login.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="container login">
  3. <view class="login-main"> <image class="logo" src="/static/ws/logo.png" mode="widthFix"></image> </view>
  4. <view class="login-title"> <image src="/static/ws/invitation_code.png" mode="widthFix"></image> <text>邀请码</text> </view>
  5. <view class="login-input">
  6. <!-- 邀请码输入框 -->
  7. <vcode-input ref="VcodeInput" @vcodeInput="vcodeInput"></vcode-input>
  8. </view>
  9. <view class="logo-message"><text>邀请码错误,请联系采美客服获取最新邀请码</text> </view> <button class="login-btn">登录</button>
  10. </view>
  11. </template>
  12. <script>
  13. import VcodeInput from '@/components/vcode-input/vcode-input'
  14. export default {
  15. components: {
  16. VcodeInput
  17. },
  18. data() {
  19. return {}
  20. },
  21. onLoad() {},
  22. methods: {
  23. // 用户输入的值
  24. vcodeInput(val) {
  25. console.log(val)
  26. },
  27. // 控制组件获取焦点
  28. setFocus() {
  29. this.$refs.VcodeInput.setFocus()
  30. },
  31. // 控制组件失去焦点
  32. setBlur() {
  33. this.$refs.VcodeInput.setBlur()
  34. },
  35. // 清除已输入
  36. clearValue() {
  37. this.$refs.VcodeInput.clearValue()
  38. }
  39. }
  40. }
  41. /*
  42. import authorize from '@/common/config/authorize.js'
  43. import wxLogin from "@/common/config/wxLogin.js"
  44. import {mapState,mapMutations } from 'vuex';
  45. import { invitationCodeLogin } from '@/services/use.js'
  46. export default{
  47. data() {
  48. return{
  49. invitationCode:'', //获取用户登录的邀请码
  50. }
  51. },
  52. onLoad(option) {
  53. },
  54. computed: {
  55. ...mapState(['isWxAuthorize','isLoginType','isLoginProductId','isLoginOrderId'])
  56. },
  57. methods:{
  58. ...mapMutations(['login']),
  59. goLogin() {
  60. if( this.invitationCode == ''){
  61. this.$util.msg('请输入邀请码',2000)
  62. return
  63. }
  64. wx.getUserInfo({
  65. success: res => {
  66. this.isUserInfo = false
  67. this.userInfo = res.userInfo;
  68. let params ={
  69. invitationCode:this.invitationCode,
  70. nickName:res.userInfo.nickName,
  71. headimgurl:res.userInfo.avatarUrl,
  72. }
  73. invitationCodeLogin(params).then(response =>{
  74. this.login(response.data)
  75. wxLogin.wxLoginAuthorize()
  76. if(response.data.userIdentity === 3){
  77. setTimeout(()=>{
  78. this.$api.navigateTo('/supplier/pages/index/index')
  79. },1000)
  80. }else{
  81. setTimeout(()=>{
  82. switch(this.isLoginType){
  83. case 9:
  84. this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
  85. break;
  86. case 8:
  87. this.$api.navigateTo(`/pages/goods/product?id=${this.isLoginProductId}`)
  88. break;
  89. case 7:
  90. this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.isLoginOrderId}`)
  91. break;
  92. default:
  93. this.$api.switchTabTo('/pages/tabBar/user/user')
  94. }
  95. },1000)
  96. }
  97. }).catch(error =>{
  98. this.$util.msg(error.msg,2000)
  99. this.isUserInfo = false
  100. })
  101. }
  102. })
  103. }
  104. }
  105. }*/
  106. </script>
  107. <style lang="scss">
  108. .login {
  109. display: flex;
  110. align-items: center;
  111. flex-direction: column;
  112. .login-main,
  113. .login-title,
  114. .logo-message {
  115. width: 590rpx;
  116. }
  117. .login-main {
  118. display: flex;
  119. justify-content: center;
  120. margin: 180rpx 0 60rpx;
  121. image {
  122. width: 151rpx;
  123. height: 151rpx;
  124. border-radius: 50%;
  125. }
  126. }
  127. .login-title {
  128. display: flex;
  129. justify-content: flex-start;
  130. image {
  131. width: 40rpx;
  132. height: 40rpx;
  133. margin-right: 6rpx;
  134. }
  135. }
  136. .login-btn {
  137. width: 600rpx;
  138. height: 90rpx;
  139. text-align: center;
  140. line-height: 90rpx;
  141. background-color: #000;
  142. border-radius: 45rpx;
  143. color: #fff;
  144. }
  145. .login-input {
  146. margin: 30rpx 0;
  147. }
  148. .logo-message {
  149. margin-bottom: 64rpx;
  150. font-size: 24rpx;
  151. line-height: 33rpx;
  152. color: #ff2a2a;
  153. display: flex;
  154. justify-content: center;
  155. align-items: center;
  156. &::before {
  157. content: '!';
  158. display: block;
  159. width: 22rpx;
  160. height: 22rpx;
  161. background: #ff2a2a;
  162. border-radius: 50%;
  163. color: #fff;
  164. text-align: center;
  165. line-height: 22rpx;
  166. margin-right: 6rpx;
  167. }
  168. }
  169. }
  170. </style>