diff --git a/App.vue b/App.vue
index 78de416f..d9d40cb0 100644
--- a/App.vue
+++ b/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);
+ }
+ }
+ }
+ });
}
},
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 02a88fb4..61908e91 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -17,7 +17,9 @@
{{user.nickname}}
-
+
+
+
@@ -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
},
diff --git a/pages/user-address/user-address.vue b/pages/user-address/user-address.vue
index bdd055a4..0c716068 100644
--- a/pages/user-address/user-address.vue
+++ b/pages/user-address/user-address.vue
@@ -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');
+ }
},
// 添加地址事件