|
@@ -1,29 +1,102 @@
|
|
|
<template>
|
|
|
<view class="container login">
|
|
|
- <view class="login-main"> <image class="logo" src="/static/ws/logo.png" mode="widthFix"></image> </view>
|
|
|
- <view class="login-title"> <image src="/static/ws/invitation_code.png" mode="widthFix"></image> <text>邀请码</text> </view>
|
|
|
+ <!-- logo区域 -->
|
|
|
+ <view class="login-main">
|
|
|
+ <image class="logo" src="/static/ws/logo.png" mode="widthFix"></image>
|
|
|
+ </view>
|
|
|
+ <!-- 邀请码标题 -->
|
|
|
+ <view class="login-title">
|
|
|
+ <image src="/static/ws/invitation_code.png" mode="widthFix"></image> <text>邀请码</text>
|
|
|
+ </view>
|
|
|
+ <!-- 邀请码 -->
|
|
|
<view class="login-input">
|
|
|
- <!-- 邀请码输入框 -->
|
|
|
- <vcode-input ref="VcodeInput" @vcodeInput="vcodeInput"></vcode-input>
|
|
|
+ <vcode-input ref="vcodeInputRef" @vcodeInput="vcodeInput" sum="6"></vcode-input>
|
|
|
</view>
|
|
|
- <view class="logo-message"><text>邀请码错误,请联系采美客服获取最新邀请码</text> </view> <button class="login-btn">登录</button>
|
|
|
+ <!-- 提示信息 -->
|
|
|
+ <view class="logo-message"><text>邀请码错误,请联系采美客服获取最新邀请码</text> </view>
|
|
|
+ <button class="login-btn" :disabled="!isCodeEmpty">登录</button>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import authorize from '@/common/config/authorize.js'
|
|
|
+import wxLogin from '@/common/config/wxLogin.js'
|
|
|
import VcodeInput from '@/components/vcode-input/vcode-input'
|
|
|
+import { mapState, mapMutations } from 'vuex'
|
|
|
+import { invitationCodeLogin } from '@/services/use.js'
|
|
|
export default {
|
|
|
- components: {
|
|
|
- VcodeInput
|
|
|
- },
|
|
|
+ components: { VcodeInput },
|
|
|
data() {
|
|
|
- return {}
|
|
|
+ return {
|
|
|
+ invitationCode: '' //获取用户登录的邀请码
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(option) {},
|
|
|
+ computed: {
|
|
|
+ ...mapState(['isWxAuthorize', 'isLoginType', 'isLoginProductId', 'isLoginOrderId']),
|
|
|
+ isCodeEmpty() {
|
|
|
+ return this.invitationCode.length > 0
|
|
|
+ }
|
|
|
},
|
|
|
- onLoad() {},
|
|
|
methods: {
|
|
|
+ ...mapMutations(['login']),
|
|
|
+ goLogin() {
|
|
|
+ if (this.invitationCode == '') {
|
|
|
+ this.$util.msg('请输入邀请码', 2000)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ wx.getUserInfo({
|
|
|
+ success: res => {
|
|
|
+ this.isUserInfo = false
|
|
|
+ this.userInfo = res.userInfo
|
|
|
+ let params = {
|
|
|
+ invitationCode: this.invitationCode,
|
|
|
+ nickName: res.userInfo.nickName,
|
|
|
+ headimgurl: res.userInfo.avatarUrl
|
|
|
+ }
|
|
|
+ invitationCodeLogin(params)
|
|
|
+ .then(response => {
|
|
|
+ this.login(response.data)
|
|
|
+ wxLogin.wxLoginAuthorize()
|
|
|
+ if (response.data.userIdentity === 3) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$api.navigateTo('/supplier/pages/index/index')
|
|
|
+ }, 1000)
|
|
|
+ } else {
|
|
|
+ setTimeout(() => {
|
|
|
+ switch (this.isLoginType) {
|
|
|
+ case 9:
|
|
|
+ this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
|
|
|
+ break
|
|
|
+ case 8:
|
|
|
+ this.$api.navigateTo(
|
|
|
+ `/pages/goods/product?id=${this.isLoginProductId}`
|
|
|
+ )
|
|
|
+ break
|
|
|
+ case 7:
|
|
|
+ this.$api.navigateTo(
|
|
|
+ `/pages/user/order/order-details?type=share&orderID=${
|
|
|
+ this.isLoginOrderId
|
|
|
+ }`
|
|
|
+ )
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ this.$api.switchTabTo('/pages/tabBar/user/user')
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ this.$util.msg(error.msg, 2000)
|
|
|
+ this.isUserInfo = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 用户输入的值
|
|
|
vcodeInput(val) {
|
|
|
console.log(val)
|
|
|
+ this.invitationCode = val
|
|
|
},
|
|
|
// 控制组件获取焦点
|
|
|
setFocus() {
|
|
@@ -39,72 +112,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-/*
|
|
|
-import authorize from '@/common/config/authorize.js'
|
|
|
-import wxLogin from "@/common/config/wxLogin.js"
|
|
|
-import {mapState,mapMutations } from 'vuex';
|
|
|
-import { invitationCodeLogin } from '@/services/use.js'
|
|
|
-export default{
|
|
|
- data() {
|
|
|
- return{
|
|
|
- invitationCode:'', //获取用户登录的邀请码
|
|
|
- }
|
|
|
- },
|
|
|
- onLoad(option) {
|
|
|
-
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapState(['isWxAuthorize','isLoginType','isLoginProductId','isLoginOrderId'])
|
|
|
- },
|
|
|
- methods:{
|
|
|
- ...mapMutations(['login']),
|
|
|
- goLogin() {
|
|
|
- if( this.invitationCode == ''){
|
|
|
- this.$util.msg('请输入邀请码',2000)
|
|
|
- return
|
|
|
- }
|
|
|
- wx.getUserInfo({
|
|
|
- success: res => {
|
|
|
- this.isUserInfo = false
|
|
|
- this.userInfo = res.userInfo;
|
|
|
- let params ={
|
|
|
- invitationCode:this.invitationCode,
|
|
|
- nickName:res.userInfo.nickName,
|
|
|
- headimgurl:res.userInfo.avatarUrl,
|
|
|
- }
|
|
|
- invitationCodeLogin(params).then(response =>{
|
|
|
- this.login(response.data)
|
|
|
- wxLogin.wxLoginAuthorize()
|
|
|
- if(response.data.userIdentity === 3){
|
|
|
- setTimeout(()=>{
|
|
|
- this.$api.navigateTo('/supplier/pages/index/index')
|
|
|
- },1000)
|
|
|
- }else{
|
|
|
- setTimeout(()=>{
|
|
|
- switch(this.isLoginType){
|
|
|
- case 9:
|
|
|
- this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- this.$api.navigateTo(`/pages/goods/product?id=${this.isLoginProductId}`)
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.isLoginOrderId}`)
|
|
|
- break;
|
|
|
- default:
|
|
|
- this.$api.switchTabTo('/pages/tabBar/user/user')
|
|
|
- }
|
|
|
- },1000)
|
|
|
- }
|
|
|
- }).catch(error =>{
|
|
|
- this.$util.msg(error.msg,2000)
|
|
|
- this.isUserInfo = false
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}*/
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
@@ -161,9 +168,9 @@ export default{
|
|
|
display: block;
|
|
|
width: 22rpx;
|
|
|
height: 22rpx;
|
|
|
- background: #ff2a2a;
|
|
|
+ border: 1px solid #ff2a2a;
|
|
|
border-radius: 50%;
|
|
|
- color: #fff;
|
|
|
+ color: #ff2a2a;
|
|
|
text-align: center;
|
|
|
line-height: 22rpx;
|
|
|
margin-right: 6rpx;
|