提交 373157e6 编写于 作者: D devil_gong

支付宝小程序优化

上级 a94e4f9c
......@@ -646,24 +646,16 @@ App({
}
},
// 登录校验
is_login_check(res) {
/**
* 登录校验
* object 回调操作对象
* method 回调操作对象的函数
*/
is_login_check(res, object, method) {
if(res.code == -400)
{
my.clearStorage();
my.confirm({
title: '温馨提示',
content: '授权用户信息',
confirmButtonText: '确认',
cancelButtonText: '暂不',
success: (result) => {
if (result.confirm) {
my.navigateTo({
url: "/pages/login/login?event_callback=init"
});
}
},
});
this.get_user_info(object, method);
return false;
}
return true;
......
......@@ -82,6 +82,8 @@ Page({
this.setData({form_submit_loading: false});
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
}
},
......
......@@ -76,7 +76,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -143,7 +143,7 @@ Page({
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'init')) {
app.showToast(res.data.msg);
}
}
......@@ -210,8 +210,10 @@ Page({
my.redirectTo({url: '/pages/user-order/user-order'});
}
} else {
app.showToast(res.data.msg);
this.setData({ buy_submit_disabled_status: false });
if (app.is_login_check(res.data, this, 'buy_submit_event')) {
app.showToast(res.data.msg);
}
}
},
fail: () => {
......
......@@ -104,7 +104,7 @@ Page({
data_bottom_line_status: false,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data')) {
app.showToast(res.data.msg);
}
}
......
......@@ -62,7 +62,7 @@ Page({
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, self, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -75,7 +75,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -125,7 +125,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -313,7 +313,7 @@ Page({
});
app.showToast(res.data.msg, 'success');
} else {
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'goods_favor_event')) {
app.showToast(res.data.msg);
}
}
......@@ -329,7 +329,7 @@ Page({
// 加入购物车事件
goods_cart_event(e, spec) {
var user = app.get_user_info(this, 'goods_cart_event');
var user = app.get_user_info(this, 'goods_buy_confirm_event');
if (user != false) {
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
......@@ -352,7 +352,7 @@ Page({
this.popup_close_event();
app.showToast(res.data.msg, 'success');
} else {
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'goods_buy_confirm_event')) {
app.showToast(res.data.msg);
}
}
......@@ -483,9 +483,7 @@ Page({
this.setData({goods_specifications_choose: temp_data});
}
} else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg);
}
app.showToast(res.data.msg);
}
},
fail: () => {
......@@ -540,9 +538,7 @@ Page({
goods_spec_base_inventory: res.data.data.inventory,
});
} else {
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg);
}
app.showToast(res.data.msg);
}
},
fail: () => {
......
......@@ -98,7 +98,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -108,7 +108,7 @@ Page({
self.init_value();
}, 500);
} else {
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, self, 'get_user_address')) {
app.showToast(res.data.msg);
}
}
......@@ -310,7 +310,11 @@ Page({
my.navigateBack();
}, 1000);
} else {
app.showToast(res.data.msg);
if (app.is_login_check(res.data)) {
app.showToast(res.data.msg);
} else {
app.showToast('提交失败,请重试!');
}
}
},
fail: () => {
......
......@@ -85,7 +85,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -98,7 +98,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -66,7 +66,7 @@ Page({
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, self, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -96,7 +96,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -95,7 +95,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -98,7 +98,7 @@ Page({
this.setData({
data_list_loding_status: 0
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -56,7 +56,7 @@ Page({
data_list_loding_status: 2,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, self, 'init')) {
app.showToast(res.data.msg);
}
}
......
......@@ -113,7 +113,7 @@ Page({
data_bottom_line_status: false,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, self, 'init')) {
app.showToast(res.data.msg);
}
}
......
......@@ -164,7 +164,7 @@ Page({
data_list_loding_status: 0,
load_status: 1,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -166,7 +166,7 @@ Page({
data_bottom_line_status: false,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, self, 'init')) {
app.showToast(res.data.msg);
}
}
......
......@@ -134,7 +134,7 @@ Page({
data_list_loding_status: 0,
data_list_loding_msg: res.data.msg,
});
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, self, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
......
......@@ -55,7 +55,7 @@
<view class="nav-item br-b" onTap="clear_storage">
<image src="/images/user-nav-cache-icon.png" class="item-icon" mode="widthFix" />
<text class="item-name">清除缓存</text>
<text class="item-name">安全退出</text>
</view>
<view a:if="{{customer_service_tel != null}}" class="nav-item" onTap="call_event">
......
......@@ -124,7 +124,7 @@ Page({
this.setData({common_app_mini_alipay_openid: app.get_user_openid()});
}
} else {
if (app.is_login_check(res.data)) {
if (app.is_login_check(res.data, this, 'get_data')) {
app.showToast(res.data.msg);
}
}
......
......@@ -293,7 +293,7 @@ Page({
// 加入购物车事件
goods_cart_event(e, spec) {
var user = app.get_user_cache_info(this, 'goods_cart_event');
var user = app.get_user_cache_info(this, 'goods_buy_confirm_event');
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
swan.navigateTo({
......
......@@ -305,7 +305,7 @@ Page({
// 加入购物车事件
goods_cart_event(e, spec) {
var user = app.get_user_cache_info(this, 'goods_cart_event');
var user = app.get_user_cache_info(this, 'goods_buy_confirm_event');
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
qq.navigateTo({
......
......@@ -300,7 +300,7 @@ Page({
// 加入购物车事件
goods_cart_event(e, spec) {
var user = app.get_user_cache_info(this, 'goods_cart_event');
var user = app.get_user_cache_info(this, 'goods_buy_confirm_event');
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
tt.navigateTo({
......
......@@ -331,7 +331,7 @@ Page({
// 加入购物车事件
goods_cart_event(e, spec) {
var user = app.get_user_cache_info(this, 'goods_cart_event');
var user = app.get_user_cache_info(this, 'goods_buy_confirm_event');
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
wx.navigateTo({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册