分佣:绑定 user
parent
e9019e9d39
commit
15b7e3d94c
5
App.vue
5
App.vue
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -57,11 +57,12 @@
|
|||
</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";
|
||||
import * as BrokerageAPI from '@/api/trade/brokerage.js'
|
||||
export default {
|
||||
name: "Login",
|
||||
mixins: [sendVerifyCode],
|
||||
|
@ -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,8 +315,6 @@
|
|||
},
|
||||
getUserInfo(data) {
|
||||
this.$store.commit("SETUID", data.userId);
|
||||
// TODO 芋艿:换成自己的先
|
||||
if (true) {
|
||||
UserApi.getUserInfo().then(res => {
|
||||
this.$store.commit("UPDATE_USERINFO", res.data);
|
||||
// 调回登录前页面
|
||||
|
@ -328,17 +326,11 @@
|
|||
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
|
||||
});
|
||||
})
|
||||
},
|
||||
bindBrokerUser() {
|
||||
const spread = this.$Cache.get("spread");
|
||||
if (spread > 0) {
|
||||
BrokerageAPI.bindBrokerageUser(spread)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue