login.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="container login">
  3. <view class="login-main">
  4. <image class="logo" src="../../../static/login-logo@3x.png" mode=""></image>
  5. <text class="logo-text">生美/医美采购服务平台</text>
  6. </view>
  7. <view class="login-form">
  8. <view class="login-input">
  9. <input type="text"
  10. v-model="accountNumber"
  11. maxlength="30"
  12. class="input"
  13. placeholder="请输入邮箱/手机号"
  14. />
  15. </view>
  16. <view class="login-input">
  17. <input v-show="isShowEye" type="text" v-model="password" maxlength="18" class="input" placeholder="请输入密码" autocomplete="new-password"/>
  18. <input v-show="!isShowEye" type="password" v-model="password" :password="true" maxlength="18" class="input" placeholder="请输入密码" autocomplete="new-password"/>
  19. <view class="iconfont" :class="isShowEye ? iconEyen : iconEyes" @click="passwordClick"></view>
  20. </view>
  21. <view class="login-input link">
  22. <view class="login-pwd" @click.stop="this.$api.navigateTo('/market/pages/login/password')">忘记密码?</view>
  23. </view>
  24. </view>
  25. <view class="login-btn" @click="confirmLogin">登录</view>
  26. <view class="login-tel">客服热线:0755-22907771</view>
  27. </view>
  28. </template>
  29. <script>
  30. import { mapMutations } from 'vuex';
  31. import authorize from '@/common/config/authorize.js'
  32. import { organizationLogin } from '@/api/use.js'
  33. var self;
  34. export default{
  35. data() {
  36. return{
  37. isShowEye:false,
  38. iconEyes:'icon-yanjing_yincang_o',
  39. iconEyen:'icon-yanjing_xianshi_o',
  40. accountNumber:'', //用户登录账号
  41. password:'', //用户登录密码
  42. toestText:'',
  43. telPhone:'',
  44. loginType:'', //跳转类型
  45. alertText:'',
  46. listType: '',
  47. listVal: '',
  48. detilType:'',
  49. id:'', //商品ID
  50. getOption:'' //页面传递参数
  51. }
  52. },
  53. onLoad(option) {
  54. console.log(option)
  55. this.getOption = JSON.stringify(option)
  56. },
  57. methods:{
  58. ...mapMutations(['login']),
  59. confirmLogin(){
  60. let params ={
  61. mobileOrEmail:this.accountNumber,
  62. password:this.password,
  63. source:'www',
  64. }
  65. organizationLogin(params).then(response =>{
  66. if(response.code == '0' ){
  67. this.storeUpdataeStatus(response.data)
  68. this.$api.navigateTo(`/pages/login/bindwechat?data=${JSON.stringify(this.getOption)}&codeType=${response.code}`)
  69. }else if(response.code == '4'){
  70. this.storeUpdataeStatus(response.data)
  71. this.$api.navigateTo(`/pages/login/bindemail?data=${JSON.stringify(this.getOption)}&codeType=${response.code}`)
  72. }else if(response.code == '-3'){
  73. this.storeUpdataeStatus(response.data)
  74. this.$util.modal('',response.msg,'前往修改','',false,() =>{
  75. this.$api.navigateTo('/pages/login/apply')
  76. })
  77. }else{
  78. this.$util.msg(response.msg,2000);
  79. }
  80. })
  81. },
  82. storeUpdataeStatus(data){
  83. let user_key = {
  84. clubID:data.clubID,
  85. shopID:data.shopID,
  86. userID:data.userID,
  87. bindMobile:data.bindMobile,
  88. }
  89. uni.setStorageSync('token',data.token)
  90. this.$store.commit('updateStatus',user_key)
  91. this.login(data);
  92. },
  93. passwordClick() { //密码显隐操作
  94. this.isShowEye = !this.isShowEye;
  95. },
  96. },
  97. onShow() {
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .login{
  103. width: 100%;
  104. height: auto;
  105. .model-warp.none{
  106. display: none;
  107. }
  108. .model-warp.show{
  109. display: block;
  110. }
  111. .login-main{
  112. width: 100%;
  113. display: flex;
  114. flex-direction: column;
  115. align-items: center;
  116. height: 198rpx;
  117. padding: 170rpx 0 60rpx 0;
  118. .logo{
  119. width: 138rpx;
  120. height: 118rpx;
  121. display: block;
  122. }
  123. .logo-text{
  124. font-size: 30rpx;
  125. line-height: 44rpx;
  126. color: $color-system;
  127. font-weight: 600;
  128. margin-top: 20rpx;
  129. }
  130. }
  131. .login-input{
  132. width: 654rpx;
  133. height: 40rpx;
  134. padding: 24rpx;
  135. margin: 0 auto;
  136. margin-bottom: 20rpx;
  137. background: #F7F7F7;
  138. border-radius: 14rpx;
  139. position: relative;
  140. .input{
  141. width: 100%;
  142. height: 100%;
  143. background: #F7F7F7;
  144. font-size: $font-size-28;
  145. line-height: 40rpx;
  146. color: #333333;
  147. border-radius: 14rpx;
  148. }
  149. .iconfont{
  150. position: absolute;
  151. right: 0;
  152. top: 0;
  153. font-size: 44rpx;
  154. color: #999999;
  155. font-weight: bold;
  156. z-index: 99;
  157. width: 96rpx;
  158. height: 96rpx;
  159. line-height: 96rpx;
  160. text-align: center;
  161. }
  162. &.link{
  163. background: #FFFFFF;
  164. margin-bottom: 40rpx;
  165. padding: 0 24rpx;
  166. line-height: 40rpx;
  167. font-size: $font-size-28;
  168. .login-reg{
  169. float: left;
  170. color: $color-system;
  171. }
  172. .login-pwd{
  173. float: right;
  174. color: $text-color;
  175. }
  176. }
  177. }
  178. .login-btn{
  179. width: 702rpx;
  180. height: 88rpx;
  181. border-radius: 14rpx;
  182. font-size: $font-size-28;
  183. line-height: 88rpx;
  184. color: #FFFFFF;
  185. margin: 0 auto;
  186. text-align: center;
  187. background: $btn-confirm;
  188. }
  189. .login-tel{
  190. width: 702rpx;
  191. font-size: $font-size-28;
  192. line-height: 240rpx;
  193. margin: 0 auto;
  194. color: $text-color;
  195. text-align: center;
  196. margin-top: 100rpx;
  197. }
  198. .model-authorization{
  199. width: 100%;
  200. height: 100%;
  201. position: fixed;
  202. top: 0;
  203. left: 0;
  204. z-index: 999;
  205. .authorization{
  206. width: 518rpx;
  207. height: 320rpx;
  208. position: absolute;
  209. background: rgba(255,255,255,.7);
  210. left: 0;
  211. right: 0;
  212. bottom: 0;
  213. top: 0;
  214. margin: auto;
  215. .to-btn{
  216. position: absolute;
  217. top: 0;
  218. left: 0;
  219. right: 0;
  220. bottom: 0;
  221. margin: auto;
  222. width: 70%;
  223. height: 88rpx;
  224. font-size: $font-size-28;
  225. line-height: 88rpx;
  226. color: #FFFFFF;
  227. text-align: center;
  228. border-radius: 44rpx;
  229. }
  230. }
  231. }
  232. }
  233. </style>