login.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="container login" v-if="isWxAuthorize">
  3. <view class="login-main">
  4. <image class="logo" src="https://admin-b.caimei365.com/userfiles/1/images/photo/2020/11/logo.png" mode=""></image>
  5. </view>
  6. <view class="login-form">
  7. <view class="login-input">
  8. <input type="text"
  9. v-model="accountNumber"
  10. maxlength="30"
  11. class="input"
  12. placeholder="请输入邮箱/手机号"
  13. />
  14. </view>
  15. <view class="login-input">
  16. <input v-show="isShowEye" type="text" v-model="password" maxlength="18" class="input" placeholder="请输入密码" autocomplete="new-password"/>
  17. <input v-show="!isShowEye" type="password" v-model="password" :password="true" maxlength="18" class="input" placeholder="请输入密码" autocomplete="new-password"/>
  18. <view class="iconfont" :class="isShowEye ? iconEyen : iconEyes" @click="passwordClick"></view>
  19. </view>
  20. <view class="login-input link">
  21. <view class="login-reg" @click.stop="this.$api.navigateTo('/pages/login/register-select')">免费注册</view>
  22. <view class="login-pwd" @click.stop="this.$api.navigateTo('/pages/login/password')">忘记密码?</view>
  23. </view>
  24. </view>
  25. <view class="login-btn" @click="confirmLogin">登录</view>
  26. <view class="login-btn-last" @click.stop="this.$api.navigateTo(`/pages/login/logincode?data=${getOption}`)">邀请码登录</view>
  27. <view class="login-tel">客服热线:0755-22907771</view>
  28. </view>
  29. </template>
  30. <script>
  31. import { mapState,mapMutations } from 'vuex';
  32. import authorize from '@/common/config/authorize.js'
  33. import wxLogin from "@/common/config/wxLogin.js"
  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. this.getOption = JSON.stringify(option)
  55. },
  56. computed: {
  57. ...mapState(['hasLogin','isWxAuthorize','isLoginType'])
  58. },
  59. methods:{
  60. ...mapMutations(['login']),
  61. confirmLogin(){
  62. if( this.accountNumber == ''){
  63. this.$util.msg('请输入账户名',2000)
  64. return
  65. }
  66. if( this.password == ''){
  67. this.$util.msg('请输入密码',2000)
  68. return
  69. }
  70. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  71. if(wxResponse == 1){
  72. this.AorganizationLogin()
  73. }else{
  74. this.$api.navigateTo('/pages/authorization/authorization?type=0')
  75. }
  76. })
  77. },
  78. AorganizationLogin(){
  79. this.UserService.AorganizationLogin({mobileOrEmail:this.accountNumber,password:this.password,source:'www'}).then(response =>{
  80. this.storeUpdataeStatus(response.data)
  81. this.$api.navigateTo(`/pages/login/bindwechat?data=${JSON.stringify(this.getOption)}&codeType=${response.code}`)
  82. }).catch(error =>{
  83. this.$util.msg(error.msg,2000);
  84. })
  85. },
  86. storeUpdataeStatus(data){
  87. uni.setStorageSync('token',data.token)
  88. this.$store.commit('updateStatus',data)
  89. this.login(data);
  90. },
  91. passwordClick() { //密码显隐操作
  92. this.isShowEye = !this.isShowEye;
  93. },
  94. },
  95. onShow() {
  96. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  97. if(wxResponse == 1){
  98. wxLogin.wxLoginQuick()
  99. console.log(this.isLoginType)
  100. }else{
  101. this.$api.navigateTo('/pages/authorization/authorization?type=0')
  102. }
  103. })
  104. }
  105. }
  106. </script>
  107. <style lang="scss">
  108. .login{
  109. width: 100%;
  110. height: auto;
  111. .model-warp.none{
  112. display: none;
  113. }
  114. .model-warp.show{
  115. display: block;
  116. }
  117. .login-main{
  118. width: 100%;
  119. display: flex;
  120. flex-direction: column;
  121. align-items: center;
  122. height: 189rpx;
  123. padding:60rpx 0 40rpx 0;
  124. margin-bottom: 70rpx;
  125. .logo{
  126. width:467rpx;
  127. height: 189rpx;
  128. display: block;
  129. }
  130. }
  131. .login-input{
  132. width: 600rpx;
  133. height: 88rpx;
  134. padding: 24rpx 0;
  135. margin: 0 auto;
  136. margin-bottom: 30rpx;
  137. background: #FFFFFF;
  138. position: relative;
  139. box-sizing: border-box;
  140. border-bottom: 1px solid #e1e1e1;
  141. .input{
  142. width: 100%;
  143. height: 100%;
  144. background: #FFFFFF;
  145. font-size: $font-size-28;
  146. line-height: 88rpx;
  147. color: #333333;
  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 0;
  166. line-height: 40rpx;
  167. font-size: $font-size-28;
  168. border-bottom: none;
  169. .login-reg{
  170. float: left;
  171. color: $color-system;
  172. }
  173. .login-pwd{
  174. float: right;
  175. color: $text-color;
  176. }
  177. }
  178. }
  179. .login-btn{
  180. width: 600rpx;
  181. height: 88rpx;
  182. border-radius: 44rpx;
  183. font-size: $font-size-28;
  184. line-height: 88rpx;
  185. color: #FFFFFF;
  186. margin: 0 auto;
  187. text-align: center;
  188. background: $btn-confirm;
  189. }
  190. .login-btn-last{
  191. width: 600rpx;
  192. height: 86rpx;
  193. border-radius: 44rpx;
  194. font-size: $font-size-28;
  195. line-height: 88rpx;
  196. color: $color-system;
  197. margin: 0 auto;
  198. text-align: center;
  199. border: 1px solid $color-system;
  200. margin-top: 20rpx;
  201. }
  202. .login-tel{
  203. width: 702rpx;
  204. font-size: $font-size-28;
  205. line-height: 80rpx;
  206. margin: 0 auto;
  207. color: $text-color;
  208. text-align: center;
  209. margin-top: 150rpx;
  210. }
  211. .model-authorization{
  212. width: 100%;
  213. height: 100%;
  214. position: fixed;
  215. top: 0;
  216. left: 0;
  217. z-index: 999;
  218. .authorization{
  219. width: 518rpx;
  220. height: 320rpx;
  221. position: absolute;
  222. background: rgba(255,255,255,.7);
  223. left: 0;
  224. right: 0;
  225. bottom: 0;
  226. top: 0;
  227. margin: auto;
  228. .to-btn{
  229. position: absolute;
  230. top: 0;
  231. left: 0;
  232. right: 0;
  233. bottom: 0;
  234. margin: auto;
  235. width: 70%;
  236. height: 88rpx;
  237. font-size: $font-size-28;
  238. line-height: 88rpx;
  239. color: #FFFFFF;
  240. text-align: center;
  241. border-radius: 44rpx;
  242. }
  243. }
  244. }
  245. }
  246. </style>