首页和商品速度缓存优化

master
gongfuxiang 2024-03-24 18:27:12 +08:00
parent 0064e5282b
commit 0a5d256987
18 changed files with 337 additions and 164 deletions

140
App.vue
View File

@ -161,6 +161,12 @@
// key
cache_user_no_login_page_status_data_key: 'cache_user_no_login_page_status_data_key',
// key
cache_index_data_key: 'cache_index_data_key',
// key
cache_goods_data_key: 'cache_goods_data_key',
//
default_user_head_src: '/static/images/common/user.png',
@ -1212,8 +1218,14 @@
* default_value 默认值
*/
get_config(key, default_value) {
var value = null;
//
var config = uni.getStorageSync(this.data.cache_config_info_key) || null;
if((key || null) == null) {
return config;
}
// key
var value = null;
if (config != null) {
//
var arr = key.split('.');
@ -1253,55 +1265,71 @@
uni.getNetworkType({
success: function (res) {
if (res.networkType != 'none') {
uni.request({
url: self.get_request_url('common', 'base'),
method: 'POST',
data: {
is_key: 1,
},
dataType: 'json',
success: (res) => {
if (res.data.code == 0) {
//
self.data.common_data_init_status = 1;
//
var config = self.get_config();
if(config != null) {
//
self.init_config_result_handle(config, self);
}
//
var data = res.data.data;
uni.setStorageSync(self.data.cache_config_info_key, data);
//
if(config == null || self.data.common_data_init_status == 0) {
uni.request({
url: self.get_request_url('common', 'base'),
method: 'POST',
data: {
is_key: 1,
},
dataType: 'json',
success: (res) => {
if (res.data.code == 0) {
//
var data = res.data.data;
uni.setStorageSync(self.data.cache_config_info_key, data);
//
self.set_theme_value(data.plugins_themestyle_data);
//
self.set_tabbar(data.plugins_themestyle_data);
//
self.user_auto_login_handle();
} else {
self.showToast(res.data.msg);
//
if (res.data.code == -10000) {
self.data.common_data_init_status = 1;
//
self.init_config_result_handle(data, self);
} else {
self.showToast(res.data.msg);
//
if (res.data.code == -10000) {
self.data.common_data_init_status = 1;
}
//
if (status == 0 && self.data.common_data_init_status == 0) {
self.init_config(1);
}
}
//
if (status == 0 && self.data.common_data_init_status == 0) {
},
fail: () => {
//
if (status == 0) {
self.init_config(1);
}
}
},
fail: () => {
//
if (status == 0) {
self.init_config(1);
}
},
});
},
});
}
}
},
});
},
//
init_config_result_handle(data, self) {
//
self.data.common_data_init_status = 1;
//
self.set_theme_value(data.plugins_themestyle_data);
//
self.set_tabbar(data.plugins_themestyle_data);
//
self.user_auto_login_handle();
},
/**
* 配置是否有效(100毫秒检验一次最多检验100次)
* object 回调操作对象
@ -1996,23 +2024,20 @@
},
//
remove_user_cache_event() {
remove_user_cache_event(is_remove_user = true) {
//
var client_value = this.application_client();
//
uni.removeStorageSync(this.data.cache_user_login_key);
//
uni.removeStorageSync(this.data.cache_user_info_key);
//
if(is_remove_user) {
//
uni.removeStorageSync(this.data.cache_user_login_key);
//
uni.removeStorageSync(this.data.cache_user_info_key);
}
//
uni.removeStorageSync(this.data.cache_user_no_login_page_status_data_key);
//
this.showToast(i18n.t('shopxo-uniapp.app.'+(client_value == 'mp' ? '0gwt7z' : '87yghj')), 'success');
var url = this.data.tabbar_pages[0];
setTimeout(function () {
uni.switchTab({
url: url,
});
}, 1500);
this.showToast(i18n.t('shopxo-uniapp.app.'+((client_value == 'mp' || !is_remove_user) ? '0gwt7z' : '87yghj')), 'success');
},
//
@ -2564,6 +2589,17 @@
clearInterval(this.data.weixin_privacy_setting_timer);
},
// 访
goods_data_cache_handle(goods_id, goods_data = null) {
var key = this.data.cache_goods_data_key;
if((goods_data || null) == null) {
var res = uni.getStorageSync(key) || null;
return (res != null && res.id == goods_id) ? res : null;
} else {
uni.setStorageSync(key, goods_data);
}
},
//
set_pages_navigation_bar_title() {
//

View File

@ -61,7 +61,7 @@
</view>
<view class="items oh padding-left-main flex-1 flex-row">
<view>
<view :data-value="item.goods_url" @tap="url_event" class="cp">
<view :data-index="index" :data-value="item.goods_url" @tap="goods_event" class="cp">
<!-- 图片 -->
<image :class="'cart-goods-image fl radius ' + ((item.is_error || 0) == 1 ? 'opacity' : '')" :src="item.images" mode="aspectFill"></image>
<!-- 错误 -->
@ -74,7 +74,7 @@
<!-- 基础 -->
<view class="cart-goods-base padding-left-main flex-1">
<!-- 标题规格 -->
<view :data-value="item.goods_url" @tap="url_event" class="cp">
<view :data-index="index" :data-value="item.goods_url" @tap="goods_event" class="cp">
<view :class="'cart-goods-title multi-text margin-bottom-sm fw-b ' + ((item.is_error || 0) == 1 ? 'cr-grey' : '')">{{ item.title }}</view>
</view>
<view v-if="item.spec != null" class="margin-bottom-sm">
@ -1187,6 +1187,17 @@
goods_list: temp_goods_list,
});
}
},
//
goods_event(e) {
//
var goods = this.data_list[e.currentTarget.dataset.index];
goods['id'] = goods.goods_id;
app.globalData.goods_data_cache_handle(goods.id, goods);
// url
app.globalData.url_event(e);
},
// url
@ -1528,8 +1539,13 @@
}
.scroll-box-popup .content .item .cart-goods-image {
width: 100%;
}
.scroll-box-popup .cart-selected {
background-color: #fff;
height: 36rpx;
border-radius: 50%;
}
.alias {
.scroll-box-popup .alias {
margin-left: 20rpx;
padding: 0 12rpx;
line-height: 40rpx;

View File

@ -14,7 +14,7 @@
<view class="goods-data-list">
<view v-for="(item, index) in data.goods_list" :key="index" class="item oh padding-main border-radius-main bg-white oh pr spacing-mb">
<!-- 商品主体内容 -->
<view class="cp" :data-value="item.goods_url" @tap="url_event">
<view class="cp" :data-index="index" :data-value="item.goods_url" @tap="goods_event">
<image class="goods-img fl radius" :src="item.images" mode="aspectFit"></image>
<view class="base fr">
<view class="multi-text">{{ item.title }}</view>
@ -58,7 +58,7 @@
<view class="goods-data-grid-list flex-row flex-warp">
<view v-for="(item, index) in data.goods_list" :key="index" class="item oh border-radius-main bg-white oh pr spacing-mb">
<!-- 商品主体内容 -->
<view class="cp" :data-value="item.goods_url" @tap="url_event">
<view class="cp" :data-index="index" :data-value="item.goods_url" @tap="goods_event">
<image class="goods-img dis-block wh-auto" :src="item.images" mode="widthFix"></image>
<view class="base padding-horizontal-main margin-top-sm">
<view class="goods-title multi-text">{{ item.title }}</view>
@ -125,7 +125,7 @@
<swiper-item>
<view class="item bg-white border-radius-main margin-right-main oh pr ht-auto pr">
<!-- 商品主体内容 -->
<view class="cp" :data-value="item.goods_url" @tap="url_event">
<view class="cp" :data-index="index" :data-value="item.goods_url" @tap="goods_event">
<image class="goods-img dis-block wh-auto" :src="item.images" mode="aspectFit"></image>
<view class="padding-left-sm padding-right-sm margin-top-sm">
<view class="single-text text-size-xs">{{ item.title }}</view>
@ -331,6 +331,7 @@
);
}
},
//
goods_cart_back_event(e) {
//
@ -378,10 +379,22 @@
}
this.$emit('CartSuccessEvent', { ...e, ...{ goods_list: new_data.goods_list, goods: goods } });
},
//
goods_event(e) {
//
var goods = this.data.goods_list[e.currentTarget.dataset.index];
app.globalData.goods_data_cache_handle(goods.id, goods);
// url
app.globalData.url_event(e);
},
// url
url_event(e) {
app.globalData.url_event(e);
},
//
goods_badge_change() {
this.$emit('goods_badge_change');

View File

@ -238,6 +238,8 @@
"jw378f": "Authorized User Information",
"np9177": "Bind phone",
"tgsa4d": "Bind email",
"876tdf": "Bind account",
"87yui2": "Bind successful",
"158yg2": "Login with mobile verification code",
"r329eu": "Email verification code login",
"39hn6v": "Account password registration",

View File

@ -241,6 +241,8 @@
"jw378f": "授权用户信息",
"np9177": "绑定手机",
"tgsa4d": "绑定邮箱",
"876tdf": "绑定账户",
"87yui2": "绑定成功",
"158yg2": "手机验证码登录",
"r329eu": "邮箱验证码登录",
"39hn6v": "账号密码注册",

View File

@ -119,7 +119,7 @@
<view v-if="(data_list || null) != null && data_list.length > 0" class="oh">
<view v-for="(item, index) in data_list" :key="index" class="item oh pr spacing-mb">
<!-- 商品主体内容 -->
<view class="flex-row jc-sb" :data-value="item.goods_url + '&is_opt_back=1'" @tap="url_event">
<view class="flex-row jc-sb" data-type="type" :data-index="index" :data-value="item.goods_url + '&is_opt_back=1'" @tap="goods_event">
<image :src="item.images" mode="widthFix" class="goods-img radius dis-block"></image>
<view class="goods-base flex-col jc-sb">
<view class="goods-base-content">
@ -287,7 +287,7 @@
</view>
<scroll-view :scroll-y="true" class="cart-list goods-list" :show-scrollbar="false">
<view v-for="(goods, index) in cart.data" :key="index" class="item padding-main oh spacing-mb">
<view :data-value="goods.goods_url" @tap="url_event" class="cp flex-row jc-sb">
<view data-type="cart" :data-index="index" :data-value="goods.goods_url" @tap="goods_event" class="cp flex-row jc-sb">
<image :src="goods.images" mode="widthFix" class="goods-img radius br"></image>
<view class="goods-base flex-1 flex-width flex-col jc-sb">
<view class="goods-base-content">
@ -563,7 +563,7 @@
init(params = {}) {
//
if ((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'init');
app.globalData.network_type_handle(this, 'init', params);
return false;
}
@ -873,6 +873,22 @@
url: '/pages/goods-search/goods-search' + ((e || null) == null ? '' : '?keywords=' + e),
});
}
},
//
goods_event(e) {
//
var index = e.currentTarget.dataset.index;
if(e.currentTarget.dataset.type == 'cart') {
var goods = this.cart.data[index];
goods['id'] = goods['goods_id'];
} else {
var goods = this.data_list[index];
}
app.globalData.goods_data_cache_handle(goods.id, goods);
console.log(goods)
// url
app.globalData.url_event(e);
},
// url

View File

@ -50,7 +50,7 @@
<!-- 相册 -->
<view class="goods-photo bg-white oh pr" v-if="goods_photo.length > 0" :style="'height: ' + photo_height + ' !important;'">
<!-- 视频 -->
<block v-if="goods.video.length > 0">
<block v-if="(goods.video || null) != null">
<view v-if="goods_video_is_autoplay" class="goods-video pa tc">
<video :src="goods.video" :autoplay="goods_video_is_autoplay" :show-center-play-btn="true" :controls="false" :show-play-btn="false" :enable-progress-gesture="false" :show-fullscreen-btn="false" :style="'height: ' + photo_height + ' !important;'"></video>
</view>
@ -301,9 +301,9 @@
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
<view class="title-left">
<text class="text-wrapper title-left-border">{{$t('goods-detail.goods-detail.znz76d')}}</text>
<text class="vice-name cr-grey">({{ goods.comments_count }})</text>
<text class="vice-name cr-grey">({{ goods.comments_count || 0 }})</text>
</view>
<navigator :url="'/pages/goods-comment/goods-comment?goods_id=' + goods.id" hover-class="none" class="arrow-right padding-right cr-grey">{{$t('goods-detail.goods-detail.1rqkjt')}}{{ goods.comments_score.rate }}%</navigator>
<navigator :url="'/pages/goods-comment/goods-comment?goods_id=' + goods.id" hover-class="none" class="arrow-right padding-right cr-grey">{{$t('goods-detail.goods-detail.1rqkjt')}}{{ goods.comments_score.rate || 0 }}%</navigator>
</view>
<view class="border-radius-main padding-main bg-white">
<!-- 商品数据 -->
@ -460,7 +460,7 @@
</view>
</view>
<!-- 右侧主操作 -->
<view :class="'btn-items flex-row jc-sa align-c flex-width-half goods-buy-nav-btn-number-' + buy_button.count || 0">
<view :class="'btn-items flex-row jc-sa align-c flex-width-half goods-buy-nav-btn-number-' + (buy_button.count || 0)">
<block v-if="(buy_button.data || null) != null && buy_button.data.length > 0">
<block v-for="(item, index) in buy_button.data" :key="index">
<block v-if="(item.name || null) != null && (item.type || null) != null">
@ -469,7 +469,7 @@
</block>
</block>
<block v-else>
<button class="item bg-grey round tc text-size-md" type="default" disabled>{{ buy_button.error || $t('goods-detail.goods-detail.35f378') }}</button>
<button class="item bg-grey round tc text-size-md" type="default" :loading="data_loading_status == 0" disabled>{{ data_loading_status == 0 ? $t('realstore-cart.realstore-cart.50lf68') : (buy_button.error || $t('goods-detail.goods-detail.35f378')) }}</button>
</block>
</view>
</view>
@ -661,6 +661,7 @@
data_bottom_line_status: false,
data_list_loding_status: 1,
data_list_loding_msg: '',
data_loading_status: 0,
params: null,
system_info: system_info,
photo_height: win_width <= 0 ? '55vh' : app.globalData.window_width_handle(win_width) + 'px',
@ -900,6 +901,13 @@
//
init() {
//
var goods = app.globalData.goods_data_cache_handle(this.params.id);
if(goods != null) {
this.init_result_data_handle(goods);
}
//
uni.request({
url: app.globalData.get_request_url('detail', 'goods'),
method: 'POST',
@ -910,26 +918,17 @@
if (res.data.code == 0) {
var data = res.data.data;
var goods = data.goods;
var price_text_arr = [this.$t('goods-detail.goods-detail.bogx42'), this.$t('goods-category.goods-category.g2u3lf'), this.$t('goods-detail.goods-detail.3kdgjl')];
//
this.init_result_data_handle(goods);
//
var upd_data = {
data_bottom_line_status: true,
data_list_loding_status: 3,
goods: goods,
indicator_dots: goods.photo.length > 1,
autoplay: goods.photo.length > 1,
data_loading_status: 1,
guess_you_like: data.guess_you_like || [],
goods_photo: goods.photo,
nav_more_list: data.nav_more_list || [],
goods_content_app: goods.content_app || [],
nav_favor_button_info: {
text: (goods.is_favor == 1 ? this.$t('goods-detail.goods-detail.by7052') : '') + this.$t('goods-detail.goods-detail.dco1sc'),
status: goods.is_favor,
},
buy_button: data.buy_button || null,
top_nav_title_data: data.middle_tabs_nav || [],
goods_spec_base_price: goods.price,
goods_spec_base_original_price: goods.original_price || 0,
show_field_price_text: price_text_arr.indexOf(goods.show_field_price_text) != -1 ? null : goods.show_field_price_text.replace(/<[^>]+>/g, '') || null,
plugins_seckill_data: data.plugins_seckill_data || null,
plugins_coupon_data: data.plugins_coupon_data || null,
quick_nav_cart_count: data.cart_total.buy_number || 0,
@ -1013,6 +1012,32 @@
},
});
},
init_result_data_handle(goods) {
//
var price_text_arr = [this.$t('goods-detail.goods-detail.bogx42'), this.$t('goods-category.goods-category.g2u3lf'), this.$t('goods-detail.goods-detail.3kdgjl')];
//
var photo = goods.photo || [];
if(photo.length == 0 && (goods.images || null) != null) {
photo.push({images: goods.images});
}
this.setData({
data_bottom_line_status: true,
data_list_loding_status: 3,
goods: goods,
indicator_dots: photo.length > 1,
autoplay: photo.length > 1,
goods_photo: photo,
goods_content_app: goods.content_app || [],
nav_favor_button_info: {
text: (goods.is_favor == 1 ? this.$t('goods-detail.goods-detail.by7052') : '') + this.$t('goods-detail.goods-detail.dco1sc'),
status: goods.is_favor,
},
goods_spec_base_price: goods.price,
goods_spec_base_original_price: goods.original_price || 0,
show_field_price_text: price_text_arr.indexOf(goods.show_field_price_text) != -1 ? null : goods.show_field_price_text.replace(/<[^>]+>/g, '') || null,
});
},
//
bottom_nav_bus_number_handle() {

View File

@ -487,37 +487,44 @@
//
init(params = {}) {
//
var key = app.globalData.data.cache_index_data_key;
var upd_data = uni.getStorageSync(key) || null;
if(upd_data != null) {
// 使
this.setData(upd_data);
//
this.init_result_common_handle();
//
params['is_cache'] = 0;
}
//
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'init');
app.globalData.network_type_handle(this, 'init', params);
return false;
}
//
this.setData({
data_list_loding_status: 1,
});
//
if(upd_data == null) {
this.setData({
data_list_loding_status: 1,
});
}
//
uni.request({
url: app.globalData.get_request_url('index', 'index'),
method: 'POST',
data: {},
data: params,
dataType: 'json',
success: (res) => {
uni.stopPullDownRefresh();
//
if (this.load_status == 0) {
this.init_config(true);
}
//
var data = res.data.data;
var theme_view = app.globalData.get_theme_value_view();
var theme_color = app.globalData.get_theme_color();
var common_static_url = app.globalData.get_static_url('common');
var seckill_static_url = app.globalData.get_static_url('seckill', true) + 'app/';
var static_url = app.globalData.get_static_url('home');
if (res.data.code == 0) {
this.setData({
top_content_search_content_style: 'background-image: url("' + static_url + 'nav-top.png");',
var upd_data = {
data_bottom_line_status: true,
banner_list: data.banner_list || [],
navigation: data.navigation || [],
@ -541,7 +548,11 @@
plugins_shop_data: data.plugins_shop_data || null,
plugins_binding_data: data.plugins_binding_data || null,
plugins_magic_data: data.plugins_magic_data || null,
});
};
this.setData(upd_data);
//
uni.setStorageSync(key, upd_data);
// 广
this.plugins_popupscreen_handle();
@ -552,6 +563,11 @@
} else {
app.globalData.set_tab_bar_badge(2, 1, this.cart_total);
}
//
if(parseInt(data.is_result_data_cache || 0) == 1) {
this.init({is_cache: 0});
}
} else {
this.setData({
data_list_loding_status: 0,
@ -561,26 +577,8 @@
app.globalData.showToast(res.data.msg);
}
//
if (this.load_status == 0 || (this.top_content_search_bg_color || null) == null) {
var color = (this.banner_list && this.banner_list.length > 0 && (this.banner_list[0]['bg_color'] || null) != null) ? this.banner_list[0]['bg_color'] : theme_color;
this.change_banner(color);
}
//
this.setData({
theme_view: theme_view,
theme_color: theme_color,
common_static_url: common_static_url,
seckill_static_url: seckill_static_url,
static_url: static_url,
load_status: 1,
});
//
setTimeout(function () {
app.globalData.page_share_handle();
}, 3000);
//
this.init_result_common_handle();
},
fail: () => {
//
@ -600,6 +598,37 @@
});
},
//
init_result_common_handle() {
var theme_view = app.globalData.get_theme_value_view();
var theme_color = app.globalData.get_theme_color();
var common_static_url = app.globalData.get_static_url('common');
var seckill_static_url = app.globalData.get_static_url('seckill', true) + 'app/';
var static_url = app.globalData.get_static_url('home');
//
if (this.load_status == 0 || (this.top_content_search_bg_color || null) == null) {
var color = (this.banner_list && this.banner_list.length > 0 && (this.banner_list[0]['bg_color'] || null) != null) ? this.banner_list[0]['bg_color'] : theme_color;
this.change_banner(color);
}
//
this.setData({
top_content_search_content_style: 'background-image: url("' + static_url + 'nav-top.png");',
theme_view: theme_view,
theme_color: theme_color,
common_static_url: common_static_url,
seckill_static_url: seckill_static_url,
static_url: static_url,
load_status: 1,
});
//
setTimeout(function () {
app.globalData.page_share_handle();
}, 3000);
},
//
choose_user_location_event(e) {
app.globalData.choose_user_location_event();

View File

@ -4,8 +4,8 @@
<block v-if="(is_exist_base_data || 0) == 1">
<view class="flex-col jc-sb dom-content">
<view>
<!-- 多语言切换 -->
<view v-if="home_use_multilingual_status == 1" class="flex-row tr padding-top-sm padding-horizontal-lg padding-bottom-lg margin-bottom-xl">
<!-- 多语言切换绑定账户不展示语言切换 -->
<view v-if="home_use_multilingual_status == 1 && current_opt_form != 'bind_platform'" class="flex-row tr padding-top-sm padding-horizontal-lg padding-bottom-lg margin-bottom-xl">
<view class="flex-1 cr-base text-size" @tap="open_language_event">
<view class="pr top-sm margin-right-sm dis-inline-block">
<iconfont name="icon-login-language" size="32rpx"></iconfont>
@ -22,7 +22,7 @@
<form @submit="formBindMobile">
<view class="tc">
<image class="icon circle auto dis-block margin-bottom-xxl br" :src="(user.avatar || null) == null ? '/static/images/default-user.png' : user.avatar" mode="widthFix"></image>
<view v-if="(user.nickname || null) != null" class="cr-base">{{ user.nickname }}</view>
<view v-if="(user.user_name_view || null) != null" class="cr-base">{{ user.user_name_view }}</view>
</view>
<view class="margin-top-xxxl padding-top-xxxl">
<input type="number" :placeholder="$t('login.login.28k91h')" maxlength="11" name="mobile" @input="form_input_mobile_event" class="form-item margin-vertical-main wh-auto" />
@ -41,7 +41,7 @@
<form @submit="formBindEmail">
<view class="tc">
<image class="icon circle auto dis-block margin-bottom-xxl br" :src="(user.avatar || null) == null ? '/static/images/default-user.png' : user.avatar" mode="widthFix"></image>
<view v-if="(user.nickname || null) != null" class="cr-base">{{ user.nickname }}</view>
<view v-if="(user.user_name_view || null) != null" class="cr-base">{{ user.user_name_view }}</view>
</view>
<view class="margin-top-xxxl padding-top-xxxl">
<input type="text" :placeholder="$t('login.login.db1rf4')" maxlength="60" name="email" @input="form_input_email_event" key="login_email_1" class="form-item margin-vertical-xl wh-auto" />
@ -63,7 +63,7 @@
<view v-if="current_opt_form == 'bind' || current_opt_form == 'success'" class="form-content">
<view class="tc">
<image class="icon circle auto dis-block margin-bottom-xxl br" :src="(user.avatar || null) == null ? '/static/images/default-user.png' : user.avatar" mode="widthFix"></image>
<view v-if="(user.nickname || null) != null" class="cr-base">{{ user.nickname }}</view>
<view v-if="(user.user_name_view || null) != null" class="cr-base">{{ user.user_name_view }}</view>
</view>
<block v-if="current_opt_form == 'bind'">
<view class="margin-top-xxxl padding-top-xxxl">
@ -89,8 +89,14 @@
</view>
</block>
<!-- 站点logo -->
<image v-if="(home_site_logo_square || null) != null && current_opt_form != 'bind' && current_opt_form != 'bind_verify' && current_opt_form != 'bind_email' && current_opt_form != 'success'" class="icon circle auto dis-block br" :src="home_site_logo_square" mode="widthFix"></image>
<!-- 账户绑定展示用户头像和名称 -->
<view v-if="current_opt_form == 'bind_platform'" class="padding-top-xxxxl margin-top-xxxxl tc">
<image class="icon circle auto dis-block margin-bottom-xxl br" :src="(user.avatar || null) == null ? '/static/images/default-user.png' : user.avatar" mode="widthFix"></image>
<view v-if="(user.user_name_view || null) != null" class="cr-base">{{ user.user_name_view }}</view>
</view>
<!-- 默认站点logo -->
<image v-if="(home_site_logo_square || null) != null && current_opt_form != 'bind' && current_opt_form != 'bind_verify' && current_opt_form != 'bind_email' && current_opt_form != 'bind_platform' && current_opt_form != 'success'" class="icon circle auto dis-block br" :src="home_site_logo_square" mode="widthFix"></image>
<!-- 非登录成功则需要展示的数据 -->
<block v-if="current_opt_form != 'success'">
@ -319,7 +325,7 @@
<view class="text-size-xs cr-grey-c margin-bottom-main">{{ $t('login.login.9q27d8') }}</view>
<view class="flex-row align-c jc-c">
<block v-for="(item, key, index) in plugins_thirdpartylogin_data" v-if="index < 3">
<view class="item round flex-row align-c jc-c" :style="'background-color:' + item.bg_color + ';'" :data-type="key" :data-url="item.login_url" @tap="plugins_thirdpartylogin_event">
<view class="item round flex-row align-c jc-c" :style="'background-color:' + item.bg_color + ';'" :data-type="key" @tap="plugins_thirdpartylogin_event">
<image :src="item.icon" mode="aspectFit" class="dis-block auto"></image>
</view>
</block>
@ -375,7 +381,7 @@
<view class="popup-login padding-sm">
<view class="bg-white border-radius-main content">
<block v-for="(item, key, index) in plugins_thirdpartylogin_data" v-if="index > 2">
<view class="item padding-lg flex-col jc-c align-c" :data-type="key" :data-url="item.login_url" @tap="plugins_thirdpartylogin_event">
<view class="item padding-lg flex-col jc-c align-c" :data-type="key" @tap="plugins_thirdpartylogin_event">
<view class="flex-row align-c login-width text-size-lg"> <image :src="item.icon" mode="aspectFit" class="margin-right-main"></image>{{ item.name }} </view>
</view>
</block>
@ -456,6 +462,7 @@
//
plugins_thirdpartylogin_data: null,
plugins_thirdpartylogin_user: null,
plugins_thirdpartylogin_is_call_app: 0,
// app
app_login_provider_list: [],
//
@ -557,6 +564,7 @@
reg_email: this.$t('login.login.jc0w0o'),
forget: this.$t('login.login.8tmyuc'),
success: this.$t('login.login.5p23c6'),
bind_platform: this.$t('login.login.876tdf'),
},
});
},
@ -598,6 +606,8 @@
} else {
form = 'bind_verify';
}
} else {
form = 'success';
}
}
// #endif
@ -625,6 +635,15 @@
});
this.set_navigation_bar_title();
//
if(parseInt(this.plugins_thirdpartylogin_is_call_app || 0) == 0 && type == 'bind_platform' && form == 'bind_platform' && (this.params.platform_type || null) != null) {
this.setData({
plugins_thirdpartylogin_is_call_app: 1
})
this.plugins_thirdpartylogin_handle(this.params.platform_type);
return false;
}
//
if (this.current_opt_form == 'success') {
var page = uni.getStorageSync(app.globalData.data.cache_prev_page_key) || null;
@ -1323,7 +1342,8 @@
//
success_back_handle(res) {
var self = this;
app.globalData.showToast(res.data.msg, 'success');
var msg = (this.plugins_thirdpartylogin_is_call_app == 1) ? this.$t('login.login.87yui2') : res.data.msg;
app.globalData.showToast(msg, 'success');
var event_callback = this.params.event_callback || null;
setTimeout(function () {
var pages = getCurrentPages();
@ -1502,11 +1522,20 @@
this.setData({
popup_login_status: false,
});
var type = e.currentTarget.dataset.type || null;
//
this.plugins_thirdpartylogin_handle(e.currentTarget.dataset.type);
},
//
plugins_thirdpartylogin_handle(type) {
// #ifdef H5
//
window.location.href = e.currentTarget.dataset.url;
for(var i in this.plugins_thirdpartylogin_data) {
if(type == i) {
window.location.href = this.plugins_thirdpartylogin_data[i]['login_url'];
}
}
// #endif
// #ifdef APP
@ -1537,7 +1566,7 @@
},
});
break;
//
case 'apple':
uni.login({
@ -1561,7 +1590,7 @@
},
});
break;
default:
app.globalData.showToast(type + this.$t('login.login.li9573'));
}

View File

@ -156,10 +156,6 @@
goods_is_loading: 1,
});
//
uni.showLoading({
title: this.$t('common.loading_in_text'),
mask: true,
});
uni.request({
url: app.globalData.get_request_url('detail', 'index', 'ask'),
method: 'POST',
@ -168,7 +164,6 @@
},
dataType: 'json',
success: (res) => {
uni.hideLoading();
uni.stopPullDownRefresh();
if (res.data.code == 0) {
let data = res.data.data;
@ -208,7 +203,6 @@
},
fail: () => {
uni.stopPullDownRefresh();
uni.hideLoading();
this.setData({
data_list_loding_status: 2,
goods_is_loading: 0,

View File

@ -164,9 +164,6 @@
//
get_data() {
uni.showLoading({
title: this.$t('common.loading_in_text'),
});
uni.request({
url: app.globalData.get_request_url('detail', 'index', 'blog'),
method: 'POST',
@ -175,7 +172,6 @@
},
dataType: 'json',
success: (res) => {
uni.hideLoading();
uni.stopPullDownRefresh();
var data = res.data.data;
if (res.data.code == 0 && (data.data || null) != null) {
@ -219,7 +215,6 @@
app.globalData.page_share_handle(this.share_info);
},
fail: () => {
uni.hideLoading();
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,

View File

@ -135,16 +135,12 @@ export default {
//
get_data() {
uni.showLoading({
title: this.$t('common.loading_in_text'),
});
uni.request({
url: app.globalData.get_request_url("detailinit", "index", "label"),
method: "POST",
data: { id: this.params.id || 0 },
dataType: "json",
success: (res) => {
uni.hideLoading();
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
@ -189,7 +185,6 @@ export default {
app.globalData.page_share_handle(this.share_info);
},
fail: () => {
uni.hideLoading();
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
@ -221,11 +216,13 @@ export default {
}
this.setData({ data_is_loading: 1 });
//
uni.showLoading({
title: this.$t('common.loading_in_text'),
mask: true,
});
//
if(this.data_page > 1) {
uni.showLoading({
title: this.$t('common.loading_in_text'),
mask: true,
});
}
uni.request({
url: app.globalData.get_request_url("detailgoodslist", "index", "label"),
method: "POST",
@ -235,8 +232,10 @@ export default {
ov: this.search_nav_sort_value,
},
dataType: "json",
success: (res) => {
uni.hideLoading();
success: (res) => {
if(this.data_page > 1) {
uni.hideLoading();
}
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
@ -285,7 +284,9 @@ export default {
}
},
fail: () => {
uni.hideLoading();
if(this.data_page > 1) {
uni.hideLoading();
}
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,

View File

@ -175,7 +175,7 @@
get_data(params = {}) {
//
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'get_data');
app.globalData.network_type_handle(this, 'get_data', params);
return false;
}

View File

@ -273,7 +273,7 @@
get_data(params = {}) {
//
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'get_data');
app.globalData.network_type_handle(this, 'get_data', params);
return false;
}

View File

@ -127,7 +127,7 @@
get_data(params = {}) {
//
if((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'get_data');
app.globalData.network_type_handle(this, 'get_data', params);
return false;
}

View File

@ -22,6 +22,18 @@
<text>更换密码</text>
<text class="fr cr-grey">{{ $t('setup.setup.j6skqh') }}</text>
</view>
<view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-t" data-value="/pages/login/login?opt_type=bind_platform&opt_form=bind_platform&platform_type=weixin" @tap="url_event">
<text>绑定微信</text>
<text class="fr cr-grey">{{ $t('setup.setup.j6skqh') }}</text>
</view>
<view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-t" data-value="/pages/login/login?opt_type=bind_platform&opt_form=bind_platform&platform_type=qq" @tap="url_event">
<text>绑定QQ</text>
<text class="fr cr-grey">{{ $t('setup.setup.j6skqh') }}</text>
</view>
<view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-t" data-value="/pages/login/login?opt_type=bind_platform&opt_form=bind_platform&platform_type=apple" @tap="url_event">
<text>绑定apple</text>
<text class="fr cr-grey">{{ $t('setup.setup.j6skqh') }}</text>
</view>
<view v-if="home_use_multilingual_status == 1" class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-t" @tap="open_language_event">
<text>{{ $t('setup.setup.r7jz13') }}</text>
<text class="fr cr-grey">{{ language }}</text>
@ -200,7 +212,7 @@
//
remove_user_cache_event(e) {
app.globalData.remove_user_cache_event();
app.globalData.remove_user_cache_event(false);
},
//

View File

@ -30,6 +30,9 @@
.head-avatar {
width: 116rpx;
height: 116rpx !important;
}
.head-base .base-info {
max-width: 340rpx;
}
/**

View File

@ -9,9 +9,9 @@
<!-- 左侧头像 -->
<view class="head-left">
<image data-value="/pages/personal/personal" @tap="url_event" @error="user_avatar_error" class="head-avatar circle bg-white va-m" :src="avatar" mode="widthFix"></image>
<view class="va-m dis-inline-block margin-left-lg">
<view class="va-m dis-inline-block margin-left-lg base-info">
<view class="flex-col align-b" data-value="/pages/personal/personal" @tap="url_event">
<text class="va-m fw-b text-size">{{ nickname }}</text>
<view class="va-m fw-b text-size single-text">{{ nickname }}</view>
<view v-if="(user || null) != null && (user.number_code || null) != null" class="head-id border-radius-sm padding-horizontal-sm margin-top-sm dis-inline-block fw-b">
<text class="text-size-xs">ID </text>
<text class="text-size-xss padding-left-xs pr bottom-xs">{{ user.number_code }}</text>