作者 wangyushan

qqqqq

... ... @@ -32,13 +32,29 @@ class Login {
* @获取URL中的code
*/
getUrlCode(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [,
''
])[1]
.replace(/\+/g, '%20')) || null
};
getParameter() {
const result = {};
const queryString = window.location.search;
const reg = /[?&][^?&]+=[^?&]+/g;
const found = queryString.match(reg);
if (found) {
found.forEach(item => {
let temp = item.substring(1).split('=');
let key = temp[0];
let value = temp[1];
result[key] = value;
})
}
console.log(result, "res回调链接");
return result
}
};
}
export default new Login();
... ...
... ... @@ -91,7 +91,7 @@
"maps" : {}
},
"devServer" : {
"https" : true
"https" : false
}
},
"appid" : "__UNI__68007DE"
... ...
... ... @@ -321,11 +321,15 @@
onShow() {
// 是否截取到code
this.$loginCustom();
let fenxiaoshanginfo = Login.getParameter()
if( fenxiaoshanginfo.uid ){
console.log( '商品详情的location,扫码分xiang', fenxiaoshanginfo);
uni.setStorageSync('fenxiaoshanginfo',JSON.stringify(fenxiaoshanginfo))
}
},
onLoad(e) {
this.getPhone();
this.getGoodDetails(e.id);
console.log(e.uid, 'uid');
uni.setStorageSync('uId', e.uid);
},
... ...
... ... @@ -175,8 +175,12 @@
// (that.Daili_status == '') && (that.Daili_status_all = false)
let parameters = {
code,
platform: 'wechat'
platform: 'wechat',
};
if( uni.getStorageSync('fenxiaoshanginfo') ){
parameters.pagent_id = JSON.parse(uni.getStorageSync('fenxiaoshanginfo').uid)
}
console.log(parameters);
that.$rqs('/api/common/third', parameters, "GET").then(res => {
if (res.data.code == 1) {
... ... @@ -191,6 +195,7 @@
uni.setStorageSync("avatar", res.data.data.userinfo.avatar); // 头像
uni.setStorageSync("is_focus", res.data.data.userinfo.is_focus); // 是否关注
uni.setStorageSync("is_members", res.data.data.userinfo.is_members); //是否入会
uni.setStorageSync("udddddd", res.data.data.userinfo.user_id); //是否入会
// 支付
uni.setStorageSync("openid", res.data.data.thirdinfo.openid); //openid
uni.setStorageSync("access_token", res.data.data.thirdinfo.access_token); //access_token
... ... @@ -207,6 +212,7 @@
}
})
this.getQianbao(); //钱包详情的接口文档,需要登录后调用,渲染用户的钱包
//登录成功,
} else {
uni.showToast({
title: res.data.msg,
... ...
const BASE_URL = 'http://www.xide.com';
// const BASE_URL = 'http://www.xide.com';
const BASE_URL = 'http://xide.shs.broing.cn';
export const rqs = (url, data, method) => {
return new Promise((resolve, reject) => {
uni.request({
... ...