支付宝小程序优化

feat/task1-c-wallet
devil_gong 2019-11-28 14:19:07 +08:00
parent a94e4f9c76
commit 373157e6b0
28 changed files with 47 additions and 51 deletions

View File

@ -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;

View File

@ -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('提交失败,请重试!');
}
}
},

View File

@ -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);
}
}

View File

@ -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: () => {

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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: () => {

View File

@ -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);
}
}

View File

@ -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: () => {

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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">

View File

@ -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);
}
}

View File

@ -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({

View File

@ -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({

View File

@ -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({

View File

@ -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({