login.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. if(response.code === 0){
  81. this.storeUpdataeStatus(response.data)
  82. this.$api.navigateTo(`/pages/login/bindwechat?data=${JSON.stringify(this.getOption)}&codeType=${response.code}`)
  83. }else if(response.code === -3){
  84. this.$util.modal('','您的企业账号审核未通过,请修改资料','前往修改','',false,() =>{
  85. this.$store.commit('updateStatus',response.data)
  86. this.$api.navigateTo('/pages/login/apply-supplier')
  87. })
  88. }else{
  89. this.$util.msg(response.msg,2000);
  90. }
  91. })
  92. },
  93. storeUpdataeStatus(data){
  94. uni.setStorageSync('token',data.token)
  95. this.$store.commit('updateStatus',data)
  96. this.login(data);
  97. },
  98. passwordClick() { //密码显隐操作
  99. this.isShowEye = !this.isShowEye;
  100. },
  101. },
  102. onShow() {
  103. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  104. if(wxResponse == 1){
  105. wxLogin.wxLoginQuick()
  106. console.log(this.isLoginType)
  107. }else{
  108. this.$api.navigateTo('/pages/authorization/authorization?type=0')
  109. }
  110. })
  111. }
  112. }
  113. </script>
  114. <style lang="scss">
  115. .login{
  116. width: 100%;
  117. height: auto;
  118. .model-warp.none{
  119. display: none;
  120. }
  121. .model-warp.show{
  122. display: block;
  123. }
  124. .login-main{
  125. width: 100%;
  126. display: flex;
  127. flex-direction: column;
  128. align-items: center;
  129. height: 189rpx;
  130. padding:60rpx 0 40rpx 0;
  131. margin-bottom: 70rpx;
  132. .logo{
  133. width:467rpx;
  134. height: 189rpx;
  135. display: block;
  136. }
  137. }
  138. .login-input{
  139. width: 600rpx;
  140. height: 88rpx;
  141. padding: 24rpx 0;
  142. margin: 0 auto;
  143. margin-bottom: 30rpx;
  144. background: #FFFFFF;
  145. position: relative;
  146. box-sizing: border-box;
  147. border-bottom: 1px solid #e1e1e1;
  148. .input{
  149. width: 100%;
  150. height: 100%;
  151. background: #FFFFFF;
  152. font-size: $font-size-28;
  153. line-height: 88rpx;
  154. color: #333333;
  155. }
  156. .iconfont{
  157. position: absolute;
  158. right: 0;
  159. top: 0;
  160. font-size: 44rpx;
  161. color: #999999;
  162. font-weight: bold;
  163. z-index: 99;
  164. width: 96rpx;
  165. height: 96rpx;
  166. line-height: 96rpx;
  167. text-align: center;
  168. }
  169. &.link{
  170. background: #FFFFFF;
  171. margin-bottom: 40rpx;
  172. padding: 0 0;
  173. line-height: 40rpx;
  174. font-size: $font-size-28;
  175. border-bottom: none;
  176. .login-reg{
  177. float: left;
  178. color: $color-system;
  179. }
  180. .login-pwd{
  181. float: right;
  182. color: $text-color;
  183. }
  184. }
  185. }
  186. .login-btn{
  187. width: 600rpx;
  188. height: 88rpx;
  189. border-radius: 44rpx;
  190. font-size: $font-size-28;
  191. line-height: 88rpx;
  192. color: #FFFFFF;
  193. margin: 0 auto;
  194. text-align: center;
  195. background: $btn-confirm;
  196. }
  197. .login-btn-last{
  198. width: 600rpx;
  199. height: 86rpx;
  200. border-radius: 44rpx;
  201. font-size: $font-size-28;
  202. line-height: 88rpx;
  203. color: $color-system;
  204. margin: 0 auto;
  205. text-align: center;
  206. border: 1px solid $color-system;
  207. margin-top: 20rpx;
  208. }
  209. .login-tel{
  210. width: 702rpx;
  211. font-size: $font-size-28;
  212. line-height: 80rpx;
  213. margin: 0 auto;
  214. color: $text-color;
  215. text-align: center;
  216. margin-top: 150rpx;
  217. }
  218. .model-authorization{
  219. width: 100%;
  220. height: 100%;
  221. position: fixed;
  222. top: 0;
  223. left: 0;
  224. z-index: 999;
  225. .authorization{
  226. width: 518rpx;
  227. height: 320rpx;
  228. position: absolute;
  229. background: rgba(255,255,255,.7);
  230. left: 0;
  231. right: 0;
  232. bottom: 0;
  233. top: 0;
  234. margin: auto;
  235. .to-btn{
  236. position: absolute;
  237. top: 0;
  238. left: 0;
  239. right: 0;
  240. bottom: 0;
  241. margin: auto;
  242. width: 70%;
  243. height: 88rpx;
  244. font-size: $font-size-28;
  245. line-height: 88rpx;
  246. color: #FFFFFF;
  247. text-align: center;
  248. border-radius: 44rpx;
  249. }
  250. }
  251. }
  252. }
  253. </style>