用户地址授权优化、一键绑定手机优化
parent
e9377a9156
commit
2472ad6ec7
33
App.vue
33
App.vue
|
|
@ -43,7 +43,7 @@
|
|||
// 版本号
|
||||
version: "v2.2.1",
|
||||
// 货币价格符号
|
||||
currency_symbol: "¥",
|
||||
currency_symbol: "¥",
|
||||
// 主题类型 主题颜色
|
||||
// 黄色 yellow #f6c133
|
||||
// 红色 red #ff0036
|
||||
|
|
@ -597,7 +597,6 @@
|
|||
if (user == false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 是否需要绑定手机号码
|
||||
if ((user.is_mandatory_bind_mobile || 0) == 1) {
|
||||
if ((user.mobile || null) == null) {
|
||||
|
|
@ -614,7 +613,6 @@
|
|||
var json = new Object();
|
||||
if ((url_params || null) != null) {
|
||||
var arr = url_params.split('&');
|
||||
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var temp = arr[i].split('=');
|
||||
json[temp[0]] = temp[1];
|
||||
|
|
@ -983,6 +981,35 @@
|
|||
value = 'h5';
|
||||
//#endif
|
||||
return value;
|
||||
},
|
||||
|
||||
// 授权验证
|
||||
auth_check(object, method, scope, msg) {
|
||||
var self = this;
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting[scope]) {
|
||||
uni.authorize({
|
||||
scope: scope,
|
||||
success (res) {
|
||||
if (typeof object === 'object' && (method || null) != null) {
|
||||
object[method](1);
|
||||
}
|
||||
},
|
||||
fail (res) {
|
||||
self.showToast(msg || '请打开授权');
|
||||
setTimeout(function() {
|
||||
uni.openSetting();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (typeof object === 'object' && (method || null) != null) {
|
||||
object[method](1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@
|
|||
<view v-if="(user.nickname || null) != null" class="cr-base">{{user.nickname}}</view>
|
||||
<view class="margin-top-xxxl padding-top-xxxl">
|
||||
<button class="bg-main-pair br-main-pair cr-white round text-size" type="warn" hover-class="none" @tap="confirm_verify_event">验证码登录</button>
|
||||
<button v-if="common_user_is_onekey_bind_mobile == 1" class="margin-top-xxl bg-main br-main cr-white round text-size" type="default" hover-class="none" open-type="getPhoneNumber" @getphonenumber="confirm_phone_number_event">获取手机号码一键登录</button>
|
||||
<!-- #ifdef MP-WEIXIN || MP-BAIDU -->
|
||||
<button v-if="common_user_is_onekey_bind_mobile == 1" class="margin-top-xxl bg-main br-main cr-white round text-size" type="default" hover-class="none" open-type="getPhoneNumber" @getphonenumber="confirm_phone_number_event">获取手机号码一键登录</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -97,8 +99,7 @@
|
|||
this.setData({
|
||||
common_user_is_onekey_bind_mobile: app.globalData.get_config('config.common_user_is_onekey_bind_mobile'),
|
||||
home_site_logo_square: app.globalData.get_config('config.home_site_logo_square')
|
||||
});
|
||||
console.log(this.home_site_logo_square)
|
||||
});
|
||||
} else {
|
||||
app.globalData.is_config(this, 'init_config');
|
||||
}
|
||||
|
|
@ -144,30 +145,17 @@
|
|||
this.user_auth_code(userinfo);
|
||||
// #endif
|
||||
// #ifdef MP-TOUTIAO
|
||||
var self = this;
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting['scope.userInfo']) {
|
||||
uni.authorize({
|
||||
scope: 'scope.userInfo',
|
||||
success (res) {},
|
||||
fail (res) {
|
||||
app.globalData.showToast('请同意用户授权');
|
||||
setTimeout(function() {
|
||||
uni.openSetting();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.getUserInfo({
|
||||
success (res) {
|
||||
var userinfo = JSON.parse(res.rawData);
|
||||
self.user_auth_code(userinfo);
|
||||
}
|
||||
});
|
||||
if(e == 1) {
|
||||
var self = this;
|
||||
uni.getUserInfo({
|
||||
success (res) {
|
||||
var userinfo = JSON.parse(res.rawData);
|
||||
self.user_auth_code(userinfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
app.globalData.auth_check(this, 'get_user_info_event', 'scope.userInfo');
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -300,48 +300,53 @@
|
|||
},
|
||||
|
||||
// 获取系统地址事件
|
||||
choose_system_address_event(e) {
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
var data = {
|
||||
"name": res.userName || '',
|
||||
"tel": res.telNumber || '',
|
||||
"province": res.provinceName || '',
|
||||
"city": res.cityName || '',
|
||||
"county": res.countyName || '',
|
||||
"address": res.detailInfo || ''
|
||||
};
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("outsystemadd", "useraddress"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
this.get_data_list();
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
choose_system_address_event(e) {
|
||||
console.log(e);
|
||||
if(e == 1) {
|
||||
console.log(0);
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
var data = {
|
||||
"name": res.userName || '',
|
||||
"tel": res.telNumber || '',
|
||||
"province": res.provinceName || '',
|
||||
"city": res.cityName || '',
|
||||
"county": res.countyName || '',
|
||||
"address": res.detailInfo || ''
|
||||
};
|
||||
|
||||
// 加载获取数据
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("outsystemadd", "useraddress"),
|
||||
method: "POST",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
this.get_data_list();
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast('提交失败,请重试!');
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log(1);
|
||||
app.globalData.auth_check(this, 'choose_system_address_event', 'scope.address');
|
||||
}
|
||||
},
|
||||
|
||||
// 添加地址事件
|
||||
|
|
|
|||
Loading…
Reference in New Issue