login.vue 6.3 KB

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