app更新管理
parent
03654bf4bd
commit
cac5f25dfe
11
App.vue
11
App.vue
|
|
@ -7,10 +7,10 @@
|
|||
data: {
|
||||
// 基础配置
|
||||
// 数据接口请求地址
|
||||
request_url: 'http://shopxo.com/',
|
||||
request_url: 'https://d1.shopxo.vip/',
|
||||
|
||||
// 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/)
|
||||
static_url: 'http://shopxo.com/',
|
||||
static_url: 'https://d1.shopxo.vip/',
|
||||
|
||||
// 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立)
|
||||
system_type: 'default',
|
||||
|
|
@ -2087,6 +2087,13 @@
|
|||
}
|
||||
// 未登录提示缓存记录
|
||||
uni.removeStorageSync(this.data.cache_user_no_login_page_status_data_key);
|
||||
// 用户基础资料提示间隔key
|
||||
uni.removeStorageSync(this.data.cache_user_base_personal_interval_time_key);
|
||||
// app更新提示缓存记录key
|
||||
uni.removeStorageSync(this.data.cache_app_update_tips_interval_time_key);
|
||||
// app评分提示缓存记录key
|
||||
uni.removeStorageSync(this.data.cache_app_star_tips_interval_time_key);
|
||||
|
||||
// 非小程序则两秒后回到首页
|
||||
this.showToast(i18n.t('shopxo-uniapp.app.'+((client_value == 'mp' || !is_remove_user) ? '0gwt7z' : '87yghj')), 'success');
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,19 +13,19 @@
|
|||
</block>
|
||||
</scroll-view>
|
||||
<view class="margin-top-xl flex-row">
|
||||
<button v-if="(update_data.is_force_update || 0) == 0" type="default" class="br-main bg-white cr-main round text-size-sm" size="mini" @tap="update_close_event">{{$t('common.cancel')}}</button>
|
||||
<button type="default" class="br-main bg-main cr-white round text-size-sm" size="mini" @tap="to_update_event">{{$t('common.now_update_text')}}</button>
|
||||
<button v-if="(update_data.is_force_update || 0) == 0" type="default" class="br-main bg-white cr-main round text-size-md" size="mini" @tap="update_close_event">{{$t('common.cancel')}}</button>
|
||||
<button type="default" class="br-main bg-main cr-white round text-size-md" size="mini" @tap="to_update_event">{{$t('common.now_update_text')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 评分 -->
|
||||
<view v-if="is_star_status && (star_url || null) != null" class="star-container pf left-0 top-0 wh-auto ht-auto">
|
||||
<view class="star-content padding-xl">
|
||||
<view v-if="is_star_status && (star_url || null) != null" class="star-container pf left-0 top-0 wh-auto ht-auto tc">
|
||||
<view class="star-content">
|
||||
<image :src="star_alert_images" mode="widthFix" class="star-alert-images wh-auto" @tap="star_event"></image>
|
||||
</view>
|
||||
<view class="tc padding-sm">
|
||||
<view class="padding-sm margin-top-xl">
|
||||
<view class="dis-inline-block" data-value="close" @tap="star_event">
|
||||
<iconfont name="icon-close-o" size="30rpx" color="#ccc"></iconfont>
|
||||
</view>
|
||||
|
|
@ -47,6 +47,7 @@
|
|||
update_alert_bg_images: null,
|
||||
// 评分提示
|
||||
is_star_status: false,
|
||||
star_tips_await_time: 0,
|
||||
star_tips_interval_time: 0,
|
||||
star_alert_images: null,
|
||||
star_url: null
|
||||
|
|
@ -61,14 +62,7 @@
|
|||
|
||||
methods: {
|
||||
// 初始化、获取数据
|
||||
init(is_init = 0) {
|
||||
// 记录缓存
|
||||
var star_tips_cache_time = parseInt(uni.getStorageSync(this.star_tips_cache_key) || 0);
|
||||
if(star_tips_cache_time == 0) {
|
||||
uni.setStorageSync(this.star_tips_cache_key, Date.parse(new Date()) / 1000);
|
||||
}
|
||||
|
||||
// 获取版本数据
|
||||
init(is_init = 0) {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url('index', 'version', 'appadmin'),
|
||||
method: 'POST',
|
||||
|
|
@ -82,30 +76,40 @@
|
|||
// 更新提示
|
||||
update_alert_bg_images: data.update_alert_bg_images || null,
|
||||
is_update_status: parseInt(data.is_update_status || 0) == 1,
|
||||
update_tips_interval_time: parseInt(data.update_tips_interval_time || 10),
|
||||
update_tips_interval_time: parseInt(data.update_tips_interval_time || 600),
|
||||
// 评分提示
|
||||
is_star_status: parseInt(data.is_star_status || 0) == 1,
|
||||
star_tips_interval_time: parseInt(data.star_tips_interval_time || 10),
|
||||
star_tips_await_time: parseInt(data.star_tips_await_time || 600),
|
||||
star_tips_interval_time: parseInt(data.star_tips_interval_time || 1800),
|
||||
star_alert_images: data.star_alert_images || null,
|
||||
star_url: data.star_url || null,
|
||||
};
|
||||
|
||||
// 当前时间
|
||||
var current_time = Date.parse(new Date()) / 1000;
|
||||
|
||||
// 更新提示间隔时间
|
||||
var update_tips_cache_time = parseInt(uni.getStorageSync(this.update_tips_cache_key) || 0);
|
||||
var current_time = Date.parse(new Date()) / 1000;
|
||||
if(update_tips_cache_time > 0 && current_time < update_tips_cache_time + upd_data.update_tips_interval_time) {
|
||||
upd_data.is_update_status = false;
|
||||
}
|
||||
|
||||
// 评分提示间隔时间、如果已经展示更新弹窗则不展示评分弹窗
|
||||
// 评分是否可以展示评分
|
||||
var star_tips_cache_time = parseInt(uni.getStorageSync(this.star_tips_cache_key) || 0);
|
||||
if(star_tips_cache_time > 0) {
|
||||
upd_data.is_star_status = current_time > star_tips_cache_time;
|
||||
}
|
||||
// 首次则记录评分缓存
|
||||
if(star_tips_cache_time == 0) {
|
||||
uni.setStorageSync(this.star_tips_cache_key, (Date.parse(new Date()) / 1000)+upd_data.star_tips_await_time);
|
||||
// 如果等待时间为0则不需要等待就提示评分
|
||||
if(upd_data.star_tips_await_time == 0) {
|
||||
upd_data.is_star_status = true;
|
||||
}
|
||||
}
|
||||
// 如果已经展示更新弹窗则不展示评分弹窗
|
||||
if(upd_data.is_update_status) {
|
||||
upd_data.is_star_status = false;
|
||||
} else {
|
||||
var star_tips_cache_time = parseInt(uni.getStorageSync(this.star_tips_cache_key) || 0);
|
||||
var current_time = Date.parse(new Date()) / 1000;
|
||||
if(star_tips_cache_time > 0) {
|
||||
upd_data.is_star_status = current_time > star_tips_cache_time + upd_data.star_tips_interval_time;
|
||||
}
|
||||
}
|
||||
|
||||
this.setData(upd_data);
|
||||
|
|
@ -138,16 +142,16 @@
|
|||
this.setData({
|
||||
is_star_status: false
|
||||
});
|
||||
// 增加24小时,后才会再提示
|
||||
uni.setStorageSync(this.star_tips_cache_key, (Date.parse(new Date()) / 1000)+86400);
|
||||
// 增加间隔时间,到时间后才会再提示
|
||||
uni.setStorageSync(this.star_tips_cache_key, (Date.parse(new Date()) / 1000)+this.star_tips_interval_time);
|
||||
|
||||
// 打开地址
|
||||
var value = e.currentTarget.dataset.type || null;
|
||||
var value = e.currentTarget.dataset.value || null;
|
||||
if(value == null) {
|
||||
plus.runtime.openURL(this.star_url);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
|
|
@ -155,7 +159,7 @@
|
|||
.star-container {
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
z-index: 100;
|
||||
padding-top: 24vh;
|
||||
padding-top: 26vh;
|
||||
}
|
||||
.update-container .update-content {
|
||||
width: 75vw;
|
||||
|
|
@ -174,9 +178,12 @@
|
|||
top: 140rpx;
|
||||
}
|
||||
.update-container .update-content .content {
|
||||
max-height: 28vh;
|
||||
max-height: 26vh;
|
||||
}
|
||||
.star-container .star-content {
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
.star-container .star-content .star-alert-images {
|
||||
max-width: 460rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1373,7 +1373,7 @@
|
|||
* 空购物车
|
||||
*/
|
||||
.cart-no-data-box {
|
||||
padding: 100rpx 0 80rpx 0;
|
||||
padding: 140rpx 0 80rpx 0;
|
||||
}
|
||||
.cart-no-data-box image {
|
||||
width: 160rpx;
|
||||
|
|
|
|||
|
|
@ -39,10 +39,8 @@ export default {
|
|||
// 数据加载
|
||||
if ((this.$refs.cart || null) != null) {
|
||||
this.$refs.cart.init();
|
||||
}
|
||||
},
|
||||
|
||||
onReady() {
|
||||
}
|
||||
|
||||
// app管理
|
||||
if ((this.$refs.app_admin || null) != null) {
|
||||
this.$refs.app_admin.init();
|
||||
|
|
@ -51,7 +49,7 @@ export default {
|
|||
// 用户头像和昵称设置提示
|
||||
if ((this.$refs.user_base || null) != null) {
|
||||
this.$refs.user_base.init('cart');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {},
|
||||
|
|
|
|||
|
|
@ -497,10 +497,8 @@
|
|||
this.init_config();
|
||||
|
||||
// 清除tab参数
|
||||
app.globalData.remove_page_tabbar_switch_params();
|
||||
},
|
||||
app.globalData.remove_page_tabbar_switch_params();
|
||||
|
||||
onReady() {
|
||||
// app管理
|
||||
if ((this.$refs.app_admin || null) != null) {
|
||||
this.$refs.app_admin.init();
|
||||
|
|
@ -509,7 +507,7 @@
|
|||
// 用户头像和昵称设置提示
|
||||
if ((this.$refs.user_base || null) != null) {
|
||||
this.$refs.user_base.init('goods-category');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
|
|||
|
|
@ -455,14 +455,12 @@
|
|||
|
||||
// 初始化配置
|
||||
this.init_config();
|
||||
},
|
||||
|
||||
onReady() {
|
||||
// app管理
|
||||
if ((this.$refs.app_admin || null) != null) {
|
||||
this.$refs.app_admin.init();
|
||||
}
|
||||
|
||||
|
||||
// 用户头像和昵称设置提示
|
||||
if ((this.$refs.user_base || null) != null) {
|
||||
this.$refs.user_base.init('index');
|
||||
|
|
|
|||
|
|
@ -238,9 +238,7 @@
|
|||
|
||||
// 数据加载
|
||||
this.init();
|
||||
},
|
||||
|
||||
onReady() {
|
||||
// app管理
|
||||
if ((this.$refs.app_admin || null) != null) {
|
||||
this.$refs.app_admin.init();
|
||||
|
|
|
|||
Loading…
Reference in New Issue