login.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="container login">
  3. <view class="login-main">
  4. <image class="logo" src="https://static.caimei365.com/app/img/icon/logo@2x.png" mode=""></image>
  5. </view>
  6. <view class="login-form">
  7. <view class="login-input">
  8. <input type="text"
  9. v-model="params.mobileOrEmail"
  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="params.password" maxlength="18" class="input" placeholder="请输入密码" autocomplete="new-password"/>
  17. <input v-show="!isShowEye" type="password" v-model="params.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. getOption:'', //页面传递参数
  41. params:{
  42. mobileOrEmail:'',//用户登录账号
  43. password:'',//用户登录密码
  44. unionId:''
  45. }
  46. }
  47. },
  48. onLoad(option) {
  49. this.getOption = JSON.stringify(option)
  50. },
  51. computed: {
  52. ...mapState(['hasLogin','isWxAuthorize','isLoginType'])
  53. },
  54. methods:{
  55. ...mapMutations(['login']),
  56. async confirmLogin(){
  57. if( this.params.mobileOrEmail == ''){
  58. this.$util.msg('请输入账户名',2000)
  59. return
  60. }
  61. if( this.params.password == ''){
  62. this.$util.msg('请输入密码',2000)
  63. return
  64. }
  65. this.AorganizationLogin()
  66. },
  67. AorganizationLogin(){
  68. this.UserService.AorganizationLogin(this.params)
  69. .then(response =>{
  70. if(response.code === 0){
  71. this.storeUpdataeStatus(response.data)
  72. this.$api.navigateTo(`/pages/login/bindwechat?data=${JSON.stringify(this.getOption)}&codeType=${response.code}`)
  73. }else if(response.code === -3){
  74. this.$util.modal('','您的企业账号审核未通过,请修改资料','前往修改','',false,() =>{
  75. this.$store.commit('updateStatus',response.data)
  76. this.$api.navigateTo('/pages/login/apply-supplier')
  77. })
  78. }else{
  79. this.$util.msg(response.msg,2000);
  80. }
  81. })
  82. },
  83. storeUpdataeStatus(data){
  84. uni.setStorageSync('token',data.token)
  85. this.$store.commit('updateStatus',data)
  86. this.login(data);
  87. },
  88. passwordClick() { //密码显隐操作
  89. this.isShowEye = !this.isShowEye;
  90. },
  91. async InitAuthorize(){ //是否已授权 0:为取消授权 1:为已授权 2:为未操作
  92. wxLogin.wxLoginQuick()
  93. }
  94. },
  95. onShow() {
  96. this.$api.getStorage().then((resolve) =>{
  97. this.params.unionId = resolve.unionId ? resolve.unionId : 0
  98. })
  99. this.InitAuthorize()
  100. }
  101. }
  102. </script>
  103. <style lang="scss">
  104. .login{
  105. width: 100%;
  106. height: auto;
  107. .model-warp.none{
  108. display: none;
  109. }
  110. .model-warp.show{
  111. display: block;
  112. }
  113. .login-main{
  114. width: 100%;
  115. display: flex;
  116. flex-direction: column;
  117. align-items: center;
  118. height: 189rpx;
  119. padding:60rpx 0 40rpx 0;
  120. margin-bottom: 70rpx;
  121. .logo{
  122. width:467rpx;
  123. height: 189rpx;
  124. display: block;
  125. }
  126. }
  127. .login-input{
  128. width: 600rpx;
  129. height: 88rpx;
  130. padding: 24rpx 0;
  131. margin: 0 auto;
  132. margin-bottom: 30rpx;
  133. background: #FFFFFF;
  134. position: relative;
  135. box-sizing: border-box;
  136. border-bottom: 1px solid #e1e1e1;
  137. .input{
  138. width: 100%;
  139. height: 100%;
  140. background: #FFFFFF;
  141. font-size: $font-size-28;
  142. line-height: 88rpx;
  143. color: #333333;
  144. }
  145. .iconfont{
  146. position: absolute;
  147. right: 0;
  148. top: 0;
  149. font-size: 44rpx;
  150. color: #999999;
  151. font-weight: bold;
  152. z-index: 99;
  153. width: 96rpx;
  154. height: 96rpx;
  155. line-height: 96rpx;
  156. text-align: center;
  157. }
  158. &.link{
  159. background: #FFFFFF;
  160. margin-bottom: 40rpx;
  161. padding: 0 0;
  162. line-height: 40rpx;
  163. font-size: $font-size-28;
  164. border-bottom: none;
  165. .login-reg{
  166. float: left;
  167. color: $color-system;
  168. }
  169. .login-pwd{
  170. float: right;
  171. color: $text-color;
  172. }
  173. }
  174. }
  175. .login-btn{
  176. width: 600rpx;
  177. height: 88rpx;
  178. border-radius: 44rpx;
  179. font-size: $font-size-28;
  180. line-height: 88rpx;
  181. color: #FFFFFF;
  182. margin: 0 auto;
  183. text-align: center;
  184. background: $btn-confirm;
  185. }
  186. .login-btn-last{
  187. width: 600rpx;
  188. height: 86rpx;
  189. border-radius: 44rpx;
  190. font-size: $font-size-28;
  191. line-height: 88rpx;
  192. color: $color-system;
  193. margin: 0 auto;
  194. text-align: center;
  195. border: 1px solid $color-system;
  196. margin-top: 20rpx;
  197. }
  198. .login-tel{
  199. width: 702rpx;
  200. font-size: $font-size-28;
  201. line-height: 80rpx;
  202. margin: 0 auto;
  203. color: $text-color;
  204. text-align: center;
  205. margin-top: 150rpx;
  206. }
  207. .model-authorization{
  208. width: 100%;
  209. height: 100%;
  210. position: fixed;
  211. top: 0;
  212. left: 0;
  213. z-index: 999;
  214. .authorization{
  215. width: 518rpx;
  216. height: 320rpx;
  217. position: absolute;
  218. background: rgba(255,255,255,.7);
  219. left: 0;
  220. right: 0;
  221. bottom: 0;
  222. top: 0;
  223. margin: auto;
  224. .to-btn{
  225. position: absolute;
  226. top: 0;
  227. left: 0;
  228. right: 0;
  229. bottom: 0;
  230. margin: auto;
  231. width: 70%;
  232. height: 88rpx;
  233. font-size: $font-size-28;
  234. line-height: 88rpx;
  235. color: #FFFFFF;
  236. text-align: center;
  237. border-radius: 44rpx;
  238. }
  239. }
  240. }
  241. }
  242. </style>