mirror of
https://gitee.com/zongzhige/shopxo-uniapp.git
synced 2026-06-07 02:12:21 +08:00
提示里面未登录处理
This commit is contained in:
@ -66,8 +66,9 @@
|
||||
<view v-else-if="propStatus == 2" class="no-data-box tc flex-col align-c">
|
||||
<image class="image" :src="static_dir + 'error.png'" mode="widthFix"></image>
|
||||
<text class="no-data-tips">{{propMsg || $t('form.form.bniyyt')}}</text>
|
||||
<view v-if="propBackBtn" class="margin-top-xxxl tc">
|
||||
<button type="default" size="mini" class="bg-grey-e br-grey cr-base round" @tap="back_event">{{$t('common.return')}}</button>
|
||||
<view v-if="propBackBtn || is_login_required == 1" class="margin-top-xxxl tc flex-row jc-c align-c">
|
||||
<button v-if="propBackBtn" type="default" size="mini" class="bg-grey-e br-grey cr-base round" @tap="back_event">{{$t('common.return')}}</button>
|
||||
<button v-if="is_login_required == 1" type="default" size="mini" :class="login_btn_class" @tap="login_event">{{$t('member-code.member-code.yj6g3a')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -75,6 +76,9 @@
|
||||
<view v-else-if="propStatus == 0" class="no-data-box tc flex-col align-c">
|
||||
<image class="image" :src="propUrl ? propUrl : static_dir + 'empty.png'" mode="widthFix"></image>
|
||||
<text class="no-data-tips">{{propMsg || $t('common.no_relevant_data_tips')}}</text>
|
||||
<view v-if="is_login_required == 1" class="margin-top-xxxl tc">
|
||||
<button type="default" size="mini" class="bg-main br-main cr-white round" @tap="login_event">{{$t('member-code.member-code.yj6g3a')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -99,6 +103,8 @@
|
||||
title: app.globalData.get_application_title(),
|
||||
network_type_value: '',
|
||||
not_network_await_status: 0,
|
||||
is_login_required: 0,
|
||||
login_btn_class: 'bg-main br-main cr-white round',
|
||||
|
||||
// 骨架屏配置
|
||||
// 商品分类内容-左侧
|
||||
@ -154,9 +160,19 @@
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
// 属性值改变监听
|
||||
watch: {
|
||||
propMsg() {
|
||||
this.login_required_handle();
|
||||
},
|
||||
propBackBtn() {
|
||||
this.login_required_handle();
|
||||
},
|
||||
},
|
||||
// 页面被展示
|
||||
created: function () {
|
||||
self = this;
|
||||
this.login_required_handle();
|
||||
uni.getNetworkType({
|
||||
success: function (res) {
|
||||
// 当前网络
|
||||
@ -182,6 +198,39 @@
|
||||
},
|
||||
// #endif
|
||||
methods: {
|
||||
// 根据提示文案更新是否展示登录按钮(登录失效、请重新登录、请先登录等)
|
||||
login_required_handle() {
|
||||
var msg = this.propMsg;
|
||||
var flag = 0;
|
||||
if ((msg || null) != null && msg !== '') {
|
||||
var text = String(msg);
|
||||
var keywords = ['登录失效', '请重新登录', '重新登录', '请先登录', '未登录', '请登录'];
|
||||
for (var i = 0; i < keywords.length; i++) {
|
||||
if (text.indexOf(keywords[i]) !== -1) {
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag == 0) {
|
||||
var lower = text.toLowerCase();
|
||||
var en_keywords = ['please log in', 'log in first', 'login expired', 'please login', 'log in again', 'not logged in'];
|
||||
for (var j = 0; j < en_keywords.length; j++) {
|
||||
if (lower.indexOf(en_keywords[j]) !== -1) {
|
||||
flag = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.is_login_required = flag;
|
||||
this.login_btn_class = 'bg-main br-main cr-white round' + (this.propBackBtn ? ' margin-left-lg' : '');
|
||||
},
|
||||
|
||||
// 跳转登录页
|
||||
login_event() {
|
||||
app.globalData.url_open('/pages/login/login');
|
||||
},
|
||||
|
||||
// 定时任务
|
||||
countdown(self) {
|
||||
// 销毁之前的任务
|
||||
|
||||
@ -30,9 +30,6 @@
|
||||
|
||||
<!-- 错误提示 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
<view v-if="is_to_login == 1" class="margin-top-lg tc">
|
||||
<button type="default" class="bg-main br-main cr-white" size="mini" data-value="/pages/login/login" @tap="url_event">{{$t('member-code.member-code.yj6g3a')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 公共 -->
|
||||
@ -51,7 +48,6 @@
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
bottom_fixed_style: '',
|
||||
is_to_login: 0,
|
||||
screen_brightness_value: 0,
|
||||
plugins_wallet: null,
|
||||
user: null,
|
||||
@ -137,7 +133,6 @@
|
||||
qrcode["code"] = user.number_code;
|
||||
this.setData({
|
||||
data_list_loding_status: 3,
|
||||
is_to_login: 0,
|
||||
user: user,
|
||||
barcode: barcode,
|
||||
qrcode: qrcode,
|
||||
@ -154,14 +149,12 @@
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: this.$t('member-code.member-code.kx4yk8'),
|
||||
is_to_login: 0,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: this.$t('setup.setup.nwt4o1'),
|
||||
is_to_login: 1,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -33,9 +33,6 @@
|
||||
|
||||
<!-- 错误提示 -->
|
||||
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
|
||||
<view v-if="is_to_login == 1" class="margin-top-lg tc">
|
||||
<button type="default" class="bg-main br-main cr-white" size="mini" data-value="/pages/login/login" @tap="url_event">{{$t('member-code.member-code.yj6g3a')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 公共 -->
|
||||
@ -54,7 +51,6 @@
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
bottom_fixed_style: '',
|
||||
is_to_login: 0,
|
||||
screen_brightness_value: 0,
|
||||
plugins_vip: null,
|
||||
scheduled_timer: null,
|
||||
@ -146,7 +142,6 @@
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: this.$t('setup.setup.nwt4o1'),
|
||||
is_to_login: 1,
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -179,7 +174,6 @@
|
||||
qrcode['code'] = res.data.data.code;
|
||||
this.setData({
|
||||
data_list_loding_status: 3,
|
||||
is_to_login: 0,
|
||||
barcode: barcode,
|
||||
qrcode: qrcode,
|
||||
payment_code: res.data.data.code,
|
||||
@ -190,7 +184,6 @@
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
is_to_login: 0,
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -198,7 +191,6 @@
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: this.$t('common.internet_error_tips'),
|
||||
is_to_login: 0,
|
||||
});
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user