app更新管理

master
gongfuxiang 2024-06-11 23:39:53 +08:00
parent 03654bf4bd
commit cac5f25dfe
7 changed files with 53 additions and 47 deletions

11
App.vue
View File

@ -7,10 +7,10 @@
data: {
//
//
request_url: 'http://shopxo.com/',
request_url: 'https://d1.shopxo.vip/',
// publicpublichttps://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);
// appkey
uni.removeStorageSync(this.data.cache_app_update_tips_interval_time_key);
// appkey
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');
},

View File

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

View File

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

View File

@ -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: {},

View File

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

View File

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

View File

@ -238,9 +238,7 @@
//
this.init();
},
onReady() {
// app
if ((this.$refs.app_admin || null) != null) {
this.$refs.app_admin.init();