login.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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','isWxAuthorize','isLoginType'])
  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. console.log(this.isLoginType)
  102. }else{
  103. this.$api.navigateTo('/pages/authorization/authorization?type=0')
  104. }
  105. })
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. .login{
  111. width: 100%;
  112. height: auto;
  113. .model-warp.none{
  114. display: none;
  115. }
  116. .model-warp.show{
  117. display: block;
  118. }
  119. .login-main{
  120. width: 100%;
  121. display: flex;
  122. flex-direction: column;
  123. align-items: center;
  124. height: 198rpx;
  125. padding: 140rpx 0 60rpx 0;
  126. .logo{
  127. width: 138rpx;
  128. height: 118rpx;
  129. display: block;
  130. }
  131. .logo-text{
  132. font-size: 30rpx;
  133. line-height: 44rpx;
  134. color: $color-system;
  135. font-weight: 600;
  136. margin-top: 20rpx;
  137. }
  138. }
  139. .login-input{
  140. width: 654rpx;
  141. height: 40rpx;
  142. padding: 24rpx;
  143. margin: 0 auto;
  144. margin-bottom: 20rpx;
  145. background: #F7F7F7;
  146. border-radius: 14rpx;
  147. position: relative;
  148. .input{
  149. width: 100%;
  150. height: 100%;
  151. background: #F7F7F7;
  152. font-size: $font-size-28;
  153. line-height: 40rpx;
  154. color: #333333;
  155. border-radius: 14rpx;
  156. }
  157. .iconfont{
  158. position: absolute;
  159. right: 0;
  160. top: 0;
  161. font-size: 44rpx;
  162. color: #999999;
  163. font-weight: bold;
  164. z-index: 99;
  165. width: 96rpx;
  166. height: 96rpx;
  167. line-height: 96rpx;
  168. text-align: center;
  169. }
  170. &.link{
  171. background: #FFFFFF;
  172. margin-bottom: 40rpx;
  173. padding: 0 24rpx;
  174. line-height: 40rpx;
  175. font-size: $font-size-28;
  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: 702rpx;
  188. height: 88rpx;
  189. border-radius: 14rpx;
  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: 702rpx;
  199. height: 86rpx;
  200. border-radius: 14rpx;
  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>