login-accont.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <view class="container login" v-if="isWxAuthorize">
  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-reg" @click.stop="this.$api.navigateTo('/pages/login/register')">免费注册</view>
  23. <view class="login-pwd" @click.stop="this.$api.navigateTo('/pages/login/password')">忘记密码?</view>
  24. </view>
  25. </view>
  26. <view class="login-btn" @click="confirmLogin">登录</view>
  27. <view class="login-btn-last" @click.stop="this.$api.navigateTo(`/pages/login/login?data=${getOption}`)">邀请码登录</view>
  28. <view class="login-tel">客服热线:0755-22907771</view>
  29. </view>
  30. </template>
  31. <script>
  32. import { mapState,mapMutations } from 'vuex';
  33. import authorize from '@/common/config/authorize.js'
  34. import wxLogin from "@/common/config/wxLogin.js"
  35. import { organizationLogin } from '@/api/use.js'
  36. export default{
  37. data() {
  38. return{
  39. isShowEye:false,
  40. iconEyes:'icon-yanjing_yincang_o',
  41. iconEyen:'icon-yanjing_xianshi_o',
  42. accountNumber:'', //用户登录账号
  43. password:'', //用户登录密码
  44. toestText:'',
  45. telPhone:'',
  46. loginType:'', //跳转类型
  47. alertText:'',
  48. listType: '',
  49. listVal: '',
  50. detilType:'',
  51. id:'', //商品ID
  52. getOption:'' //页面传递参数
  53. }
  54. },
  55. onLoad(option) {
  56. this.getOption = JSON.stringify(option)
  57. },
  58. computed: {
  59. ...mapState(['hasLogin','userInfo','isWxAuthorize'])
  60. },
  61. methods:{
  62. ...mapMutations(['login']),
  63. confirmLogin(){
  64. if( this.accountNumber == ''){
  65. this.$util.msg('请输入账户名',2000)
  66. return
  67. }
  68. if( this.password == ''){
  69. this.$util.msg('请输入密码',2000)
  70. return
  71. }
  72. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  73. if(wxResponse == 1){
  74. this.OrganizationLogin()
  75. }else{
  76. this.$api.navigateTo('/pages/authorization/authorization?type=0')
  77. }
  78. })
  79. },
  80. OrganizationLogin(){
  81. organizationLogin({mobileOrEmail:this.accountNumber,password:this.password,source:'www'}).then(response =>{
  82. if(response.code == '0' ){
  83. this.storeUpdataeStatus(response.data)
  84. this.$api.navigateTo(`/pages/login/bindwechat?data=${JSON.stringify(this.getOption)}&codeType=${response.code}`)
  85. }else if(response.code == '4'){
  86. this.storeUpdataeStatus(response.data)
  87. this.$api.navigateTo(`/pages/login/bindemail?data=${JSON.stringify(this.getOption)}&codeType=${response.code}`)
  88. }else if(response.code == '-3'){
  89. this.storeUpdataeStatus(response.data)
  90. this.$util.modal('',response.msg,'前往修改','',false,() =>{
  91. this.$api.navigateTo('/pages/login/apply')
  92. })
  93. }else{
  94. this.$util.msg(response.msg,2000);
  95. }
  96. })
  97. },
  98. storeUpdataeStatus(data){
  99. let user_key = {
  100. clubID:data.clubID,
  101. shopID:data.shopID,
  102. userID:data.userID,
  103. bindMobile:data.bindMobile,
  104. }
  105. uni.setStorageSync('token',data.token)
  106. this.$store.commit('updateStatus',user_key)
  107. this.login(data);
  108. },
  109. passwordClick() { //密码显隐操作
  110. this.isShowEye = !this.isShowEye;
  111. },
  112. },
  113. onShow() {
  114. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  115. if(wxResponse == 1){
  116. wxLogin.wxLoginAuthorize()
  117. }else{
  118. this.$api.navigateTo('/pages/authorization/authorization?type=0')
  119. }
  120. })
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. .login{
  126. width: 100%;
  127. height: auto;
  128. .model-warp.none{
  129. display: none;
  130. }
  131. .model-warp.show{
  132. display: block;
  133. }
  134. .login-main{
  135. width: 100%;
  136. display: flex;
  137. flex-direction: column;
  138. align-items: center;
  139. height: 198rpx;
  140. padding: 140rpx 0 60rpx 0;
  141. .logo{
  142. width: 138rpx;
  143. height: 118rpx;
  144. display: block;
  145. }
  146. .logo-text{
  147. font-size: 30rpx;
  148. line-height: 44rpx;
  149. color: $color-system;
  150. font-weight: 600;
  151. margin-top: 20rpx;
  152. }
  153. }
  154. .login-input{
  155. width: 654rpx;
  156. height: 40rpx;
  157. padding: 24rpx;
  158. margin: 0 auto;
  159. margin-bottom: 20rpx;
  160. background: #F7F7F7;
  161. border-radius: 14rpx;
  162. position: relative;
  163. .input{
  164. width: 100%;
  165. height: 100%;
  166. background: #F7F7F7;
  167. font-size: $font-size-28;
  168. line-height: 40rpx;
  169. color: #333333;
  170. border-radius: 14rpx;
  171. }
  172. .iconfont{
  173. position: absolute;
  174. right: 0;
  175. top: 0;
  176. font-size: 44rpx;
  177. color: #999999;
  178. font-weight: bold;
  179. z-index: 99;
  180. width: 96rpx;
  181. height: 96rpx;
  182. line-height: 96rpx;
  183. text-align: center;
  184. }
  185. &.link{
  186. background: #FFFFFF;
  187. margin-bottom: 40rpx;
  188. padding: 0 24rpx;
  189. line-height: 40rpx;
  190. font-size: $font-size-28;
  191. .login-reg{
  192. float: left;
  193. color: $color-system;
  194. }
  195. .login-pwd{
  196. float: right;
  197. color: $text-color;
  198. }
  199. }
  200. }
  201. .login-btn{
  202. width: 702rpx;
  203. height: 88rpx;
  204. border-radius: 14rpx;
  205. font-size: $font-size-28;
  206. line-height: 88rpx;
  207. color: #FFFFFF;
  208. margin: 0 auto;
  209. text-align: center;
  210. background: $btn-confirm;
  211. }
  212. .login-btn-last{
  213. width: 702rpx;
  214. height: 86rpx;
  215. border-radius: 14rpx;
  216. font-size: $font-size-28;
  217. line-height: 88rpx;
  218. color: $color-system;
  219. margin: 0 auto;
  220. text-align: center;
  221. border: 1px solid $color-system;
  222. margin-top: 20rpx;
  223. }
  224. .login-tel{
  225. width: 702rpx;
  226. font-size: $font-size-28;
  227. line-height: 80rpx;
  228. margin: 0 auto;
  229. color: $text-color;
  230. text-align: center;
  231. margin-top: 150rpx;
  232. }
  233. .model-authorization{
  234. width: 100%;
  235. height: 100%;
  236. position: fixed;
  237. top: 0;
  238. left: 0;
  239. z-index: 999;
  240. .authorization{
  241. width: 518rpx;
  242. height: 320rpx;
  243. position: absolute;
  244. background: rgba(255,255,255,.7);
  245. left: 0;
  246. right: 0;
  247. bottom: 0;
  248. top: 0;
  249. margin: auto;
  250. .to-btn{
  251. position: absolute;
  252. top: 0;
  253. left: 0;
  254. right: 0;
  255. bottom: 0;
  256. margin: auto;
  257. width: 70%;
  258. height: 88rpx;
  259. font-size: $font-size-28;
  260. line-height: 88rpx;
  261. color: #FFFFFF;
  262. text-align: center;
  263. border-radius: 44rpx;
  264. }
  265. }
  266. }
  267. }
  268. </style>