分佣:绑定 user

pull/1/MERGE
YunaiV 2023-09-09 21:06:25 +08:00
parent e9019e9d39
commit 15b7e3d94c
5 changed files with 31 additions and 40 deletions

View File

@ -81,7 +81,7 @@
let snsapiBase = 'snsapi_base';
let urlData = location.pathname + location.search;
if (!that.$store.getters.isLogin && Auth.isWeixin()) {
const { code, state, scope } = option.query;
const { code, } = option.query;
if (code && code != uni.getStorageSync('snsapiCode')
&& location.pathname.indexOf('/pages/users/wechat_login/index') === -1) {
// code
@ -89,8 +89,7 @@
let spread = that.globalData.spid ? that.globalData.spid : 0;
Auth.auth(code, that.$Cache.get('spread'))
.then(res => {
uni.setStorageSync('snRouter', decodeURIComponent(decodeURIComponent(option.query
.back_url)));
uni.setStorageSync('snRouter', decodeURIComponent(decodeURIComponent(option.query.back_url)));
if (res.type === 'register') {
this.$Cache.set('snsapiKey', res.key);
}

View File

@ -5,6 +5,13 @@ export function getBrokerageUser() {
return request.get('app-api/trade/brokerage-user/get');
}
// 获得个人分销信息
export function bindBrokerageUser(bindUserId) {
return request.put('app-api/trade/brokerage-user/bind', {
bindUserId
});
}
// 获得个人分销统计
export function getBrokerageUserSummary() {
return request.get('app-api/trade/brokerage-user/get-summary');

View File

@ -17,19 +17,13 @@
<script>
const app = getApp();
import sendVerifyCode from "@/mixins/SendVerifyCode";
import Routine from '@/libs/routine';
import {mapGetters} from "vuex";
import {
loginMobile,
registerVerify,
getCodeApi,
getUserInfo,
phoneSilenceAuth,
phoneWxSilenceAuth
} from "@/api/user";
import {
bindingPhone
} from '@/api/api.js'
import {
getUserPhone,
iosBinding
@ -173,7 +167,6 @@
phoneSilenceAuth({
code: code,
spid: app.globalData.spid,
spread: app.globalData.code,
phone: this.account,
captcha: this.codeNum
}).then(res => {

View File

@ -119,10 +119,10 @@
// #ifdef MP
phoneSilenceAuth(code) {
let self = this
// TODO @
phoneSilenceAuth({
code: code,
spid: app.globalData.spid,
spread: app.globalData.code,
phone: this.account,
captcha: this.codeNum
}).then(res => {

View File

@ -57,12 +57,13 @@
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
import { loginMobile, registerVerify, getUserInfo } from "@/api/user";
import { loginMobile, registerVerify } from "@/api/user";
import * as AuthApi from "@/api/member/auth";
import * as UserApi from "@/api/member/user";
import { appAuth, appleLogin } from "@/api/public";
const BACK_URL = "login_back_url";
export default {
import * as BrokerageAPI from '@/api/trade/brokerage.js'
export default {
name: "Login",
mixins: [sendVerifyCode],
data: function() {
@ -299,14 +300,13 @@
AuthApi.login({
mobile: this.account,
password: this.password,
spread: this.$Cache.get("spread") // TODO
}).then(({ data }) => {
// debugger
// TODO refreshToken
this.$store.commit("LOGIN", {
'token': data.accessToken
});
this.getUserInfo(data);
this.bindBrokerUser();
}).catch(e => {
this.$util.Tips({
title: e
@ -315,32 +315,24 @@
},
getUserInfo(data) {
this.$store.commit("SETUID", data.userId);
// TODO
if (true) {
UserApi.getUserInfo().then(res => {
this.$store.commit("UPDATE_USERINFO", res.data);
//
let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index";
if (backUrl.indexOf('/pages/users/login/index') !== -1) {
backUrl = '/pages/index/index';
}
uni.reLaunch({
url: backUrl
});
})
} else {
getUserInfo().then(res => {
this.$store.commit("UPDATE_USERINFO", res.data);
let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index";
if (backUrl.indexOf('/pages/users/login/index') !== -1) {
backUrl = '/pages/index/index';
}
uni.reLaunch({
url: backUrl
});
})
UserApi.getUserInfo().then(res => {
this.$store.commit("UPDATE_USERINFO", res.data);
//
let backUrl = this.$Cache.get(BACK_URL) || "/pages/index/index";
if (backUrl.indexOf('/pages/users/login/index') !== -1) {
backUrl = '/pages/index/index';
}
uni.reLaunch({
url: backUrl
});
})
},
bindBrokerUser() {
const spread = this.$Cache.get("spread");
if (spread > 0) {
BrokerageAPI.bindBrokerageUser(spread)
}
}
}
}
};
</script>