login.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view class="content">
  3. <view class="loginbg">
  4. <view class="statues_bar"></view>
  5. <view class="logobox">
  6. <image src="/static/logo.png" mode="aspectFill"></image>
  7. </view>
  8. </view>
  9. <view class="checkbox flex1">
  10. <view class="business " @click="checked=0" :class="checked==0 ? 'bnesper' : 'actbnes' ">业务人员</view>
  11. <view class="business " @click="checked=1" :class="checked==1 ? 'applyper' : 'actapp' ">供应商</view>
  12. </view>
  13. <view class="acountbox">
  14. <view class="inacount">
  15. <text class="acoutitle">账户</text>
  16. <input type="text" v-model="form.account" class="checkword" placeholder="请输入您的账户"
  17. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  18. </view>
  19. <view class="inacount">
  20. <text class="acoutitle">密码</text>
  21. <input type="text" v-model="form.password" :password="true" class="checkword" placeholder="至少6位数的字母数字组合"
  22. placeholder-style="font-size:30rpx;color:#BEBDBB" />
  23. </view>
  24. </view>
  25. <view class="otherbt flex2">
  26. <text class="regbt" @click="registerNew">新用户注册</text>
  27. <text @click="show = true">忘记密码?</text>
  28. </view>
  29. <view class="logininbtn" @click="loginIn">
  30. <text>登录</text>
  31. </view>
  32. <view class="flex1 checkag">
  33. <u-checkbox-group @change="checkboxChange">
  34. <u-checkbox name="gou" activeColor="#D8AB5A" :size="20">
  35. </u-checkbox>
  36. </u-checkbox-group>
  37. <text>我已阅读并同意</text><text style="color: #D05C39;" @click="moveAgreement">用户协议</text><text>和</text><text
  38. style="color: #D05C39;" @click="privacyPolicy">隐私政策</text>
  39. </view>
  40. <u-popup :show="show" @close="close" @open="open" mode="center">
  41. <view class="forgetbox">
  42. <!-- <view class="ciclebg">
  43. <image src="../../static/img/forpwdbg.png" mode="aspectFill"></image>
  44. </view> -->
  45. <view class="keybox">
  46. <image src="../../static/img/foricon.png" mode="aspectFill"></image>
  47. </view>
  48. <text class="keytitle">忘记密码</text>
  49. <text class="remindtitle">请电联系管理员,进行密码确定</text>
  50. <view class="surebtn" @click="close()">好的</view>
  51. </view>
  52. </u-popup>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. form: {
  60. account: '',
  61. password: '',
  62. },
  63. checked: 0,
  64. show: false,
  65. gou:false,
  66. }
  67. },
  68. onLoad() {
  69. },
  70. onShareTimeline() {
  71. return {
  72. title: '企信易联',
  73. path: '/pages/login/login'
  74. }
  75. },
  76. onShareAppMessage(res) {
  77. return {
  78. title: '企信易联',
  79. path: '/pages/login/login'
  80. }
  81. },
  82. methods: {
  83. checkboxChange(n){
  84. if(n.length>0){
  85. this.gou=true
  86. }else{
  87. this.gou=false
  88. }
  89. },
  90. close() {
  91. this.show = false
  92. },
  93. open(){
  94. this.show = true
  95. },
  96. loginIn() {
  97. if(!this.gou){
  98. this.$toast("清先阅读用户协议和隐私协议")
  99. return
  100. }
  101. let form=this.form
  102. form.loginType=this.checked+1
  103. uni.showLoading({
  104. title:'加载中',
  105. icon:'none'
  106. })
  107. uni.$u.http.post('/api/Account/login',
  108. form
  109. , {
  110. custom: {
  111. auth: true
  112. }
  113. }).then((res) => {
  114. uni.hideLoading()
  115. uni.setStorageSync('token', res.token)
  116. uni.setStorageSync('supplierId', res.userInfo.id)
  117. uni.hideLoading()
  118. this.$toast("登录成功")
  119. this.$store.commit("getAdmin", this.checked)
  120. setTimeout(() => {
  121. uni.reLaunch({
  122. url: "/pages/index/index"
  123. })
  124. }, 500)
  125. }).catch((err) => {
  126. uni.hideLoading()
  127. this.$toast(err.msg)
  128. })
  129. },
  130. moveAgreement(){
  131. uni.navigateTo({
  132. url:"/pages/bsinessadmin/useragreement"
  133. })
  134. },
  135. privacyPolicy(){
  136. uni.navigateTo({
  137. url:"/pages/bsinessadmin/privacypolicy"
  138. })
  139. },
  140. registerNew() {
  141. if (this.checked == 0) {
  142. uni.navigateTo({
  143. url: "/pages/bsinessadmin/register?checked=" + this.checked
  144. })
  145. } else {
  146. uni.navigateTo({
  147. url: "/pages/bsinessadmin/supplierges"
  148. })
  149. }
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. /* uni.scss */
  156. @import 'uview-ui/theme.scss';
  157. .content {
  158. display: flex;
  159. flex-direction: column;
  160. align-items: center;
  161. justify-content: center;
  162. }
  163. .loginbg {
  164. background-image: url("https://t39.9026.com/web/uploads/thumbs/mall10000/20220629/e01b927c95ee1f05364f5e456f281388.png");
  165. height: 559rpx;
  166. width: 750rpx;
  167. background-size: 100% 100%;
  168. // display: flex;
  169. // align-items: center;
  170. // justify-content: center;
  171. }
  172. .logo {
  173. margin: 0 auto;
  174. height: 200rpx;
  175. width: 200rpx;
  176. margin-left: auto;
  177. margin-right: auto;
  178. margin-bottom: 50rpx;
  179. }
  180. .text-area {
  181. display: flex;
  182. justify-content: center;
  183. }
  184. .title {
  185. font-size: 36rpx;
  186. color: #8f8f94;
  187. }
  188. .logobox {
  189. margin: 0 auto;
  190. margin-top: 212rpx;
  191. width: 269rpx;
  192. height: 191rpx;
  193. // background-color: #F1F1F1;
  194. image {
  195. width: 100%;
  196. height: 100%;
  197. }
  198. }
  199. .checkbox {}
  200. .business {
  201. width: 305rpx;
  202. height: 90rpx;
  203. display: flex;
  204. align-items: center;
  205. justify-content: center;
  206. text-align: center;
  207. // background-color: #D8AB5A;
  208. border-raotherdius: 20rpx;
  209. color: #FFFFFF;
  210. margin-top: 57rpx;
  211. }
  212. .bnesper {
  213. background-size: 100%;
  214. background-image: url("@/static/img/loginbtn4.png");
  215. padding-top: 10rpx;
  216. color: #FFF1D8;
  217. line-height: 90rpx;
  218. }
  219. .applyper {
  220. background-image: url("@/static/img/loginbt1.png");
  221. background-size: 100%;
  222. padding-top: 10rpx;
  223. color: #FFF1D8;
  224. }
  225. .actapp {
  226. background-image: url("@/static/img/loginbtn3.png");
  227. background-size: 100%;
  228. color: #D05C39;
  229. }
  230. .actbnes {
  231. background-image: url("@/static/img/loginbt2.png");
  232. background-size: 100%;
  233. color: #D05C39;
  234. }
  235. .acountbox {
  236. .inacount {
  237. display: flex;
  238. padding: 35rpx 20rpx;
  239. box-sizing: border-box;
  240. width: 606rpx;
  241. margin-top: 40rpx;
  242. background-color: #F6F6F6;
  243. border-radius: 20rpx;
  244. font-size: 30rpx;
  245. color: #1F242A;
  246. input {
  247. width: 360rpx;
  248. }
  249. }
  250. .acoutitle {
  251. font-weight: 600;
  252. }
  253. .checkword {
  254. padding-left: 20rpx;
  255. color: #1F242A;
  256. font-size: 30rpx;
  257. }
  258. }
  259. .otherbt {
  260. width: 606rpx;
  261. display: flex;
  262. justify-content: space-between;
  263. font-size: 24rpx;
  264. padding-top: 30rpx;
  265. }
  266. .regbt {
  267. color: $uni-all-theme;
  268. }
  269. .logininbtn {
  270. box-sizing: border-box;
  271. margin-top: 80rpx;
  272. width: 606rpx;
  273. border-radius: 20rpx;
  274. background: linear-gradient(to right, #FFE1AD, #D07539);
  275. height: 100rpx;
  276. text-align: center;
  277. color: #fff;
  278. line-height: 100rpx;
  279. }
  280. .checkag {
  281. margin-top: 200rpx;
  282. font-size: 28rpx;
  283. padding-bottom: 130rpx;
  284. }
  285. .forgetbox {
  286. width: 600rpx;
  287. height: 600rpx;
  288. background-color: #fff;
  289. display: flex;
  290. flex-direction: column;
  291. align-items: center;
  292. position: relative;
  293. background-image: url("@/static/img/forpwdbg.png");
  294. background-repeat: no-repeat;
  295. background-position: right 0 top 0;
  296. background-size: 367rpx 225rpx;
  297. .ciclebg {
  298. position: relative;
  299. right: 0;
  300. top: 0;
  301. width: 367rpx;
  302. height: 225rpx;
  303. }
  304. .keybox {
  305. margin-top: 84rpx;
  306. width: 196rpx;
  307. height: 161rpx;
  308. image {
  309. width: 100%;
  310. height: 100%;
  311. }
  312. }
  313. .keytitle {
  314. color: #1F242A;
  315. padding-top: 50rpx;
  316. font-size: 36rpx;
  317. font-weight: 600;
  318. }
  319. .remindtitle {
  320. color: #68625B;
  321. font-size: 28rpx;
  322. padding-top: 30rpx;
  323. }
  324. .surebtn {
  325. width: 314rpx;
  326. height: 84rpx;
  327. line-height: 84rpx;
  328. border-radius: 43rpx;
  329. background: linear-gradient(to right, #FFE1AD, #D8AB5A);
  330. color: #412900;
  331. margin-top: 86rpx;
  332. text-align: center;
  333. }
  334. }
  335. </style>