mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-11-30 10:59:47 +08:00
百度小程序web化优化
This commit is contained in:
parent
efdd76547f
commit
80cecc0372
@ -468,6 +468,19 @@ App({
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除数组中空元素
|
||||
*/
|
||||
array_notempty(data) {
|
||||
var arr = [];
|
||||
data.map(function(val, index) {
|
||||
if (val !== "" && val != undefined) {
|
||||
arr.push(val);
|
||||
}
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
|
||||
});
|
@ -32,18 +32,21 @@ Page({
|
||||
success: res => {
|
||||
swan.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
var data_content = [];
|
||||
if (data.length > 0) {
|
||||
data[0]['active'] = 'nav-active';
|
||||
data_content = data[0]['items'];
|
||||
}
|
||||
this.setData({
|
||||
data_list: data,
|
||||
data_content: data_content,
|
||||
data_list_loding_status: data.length == 0 ? 0 : 3,
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
var data = res.data.data;
|
||||
var data_content = [];
|
||||
if (data.length > 0) {
|
||||
data[0]['active'] = 'nav-active';
|
||||
data_content = data[0]['items'];
|
||||
}
|
||||
this.setData({
|
||||
data_list: data,
|
||||
data_content: data_content,
|
||||
data_list_loding_status: data.length == 0 ? 0 : 3,
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
|
||||
// 页面信息设置
|
||||
this.set_page_info();
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
@ -86,5 +89,16 @@ Page({
|
||||
// 事件
|
||||
category_event(e) {
|
||||
swan.navigateTo({ url: '/pages/goods-search/goods-search?category_id=' + e.currentTarget.dataset.value });
|
||||
}
|
||||
},
|
||||
|
||||
// web页面信息设置
|
||||
set_page_info() {
|
||||
swan.setPageInfo({
|
||||
title: app.data.application_title+' - 商品分类',
|
||||
keywords: app.data.application_describe,
|
||||
description: app.data.application_describe,
|
||||
image: (this.data.data_list.length == 0) ? [] : app.array_notempty(this.data.data_list.map(function (v) { return v.big_images;})).slice(0,3)
|
||||
});
|
||||
},
|
||||
|
||||
});
|
@ -124,6 +124,9 @@ Page({
|
||||
// 不能选择规格处理
|
||||
this.goods_specifications_choose_handle_dont(0);
|
||||
|
||||
// 页面信息设置
|
||||
this.set_page_info();
|
||||
|
||||
if (data.goods.is_shelves != 1) {
|
||||
this.setData({
|
||||
nav_submit_text: '商品已下架',
|
||||
@ -647,6 +650,22 @@ Page({
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/goods-detail/goods-detail?share=goods-detail&goods_id=' + this.data.goods.id
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
// web页面信息设置
|
||||
set_page_info() {
|
||||
swan.setPageInfo({
|
||||
title: this.data.goods.seo_title || this.data.goods.title,
|
||||
keywords: this.data.goods.seo_keywords || this.data.goods.simple_desc || this.data.goods.title,
|
||||
articleTitle: this.data.goods.title,
|
||||
description: this.data.goods.seo_desc || app.data.application_describe,
|
||||
image: this.data.goods_photo.map(function (v) { return v.images;}).slice(0,3),
|
||||
video: ((this.data.goods.video || null) == null) ? [] : [{
|
||||
url: this.data.goods.video,
|
||||
duration: '100',
|
||||
image: this.data.goods.images
|
||||
}]
|
||||
});
|
||||
},
|
||||
|
||||
});
|
@ -87,6 +87,11 @@ Page({
|
||||
data_page: this.data.data_page + 1
|
||||
});
|
||||
|
||||
// 页面信息设置
|
||||
if(post_data['page'] == 1) {
|
||||
this.set_page_info();
|
||||
}
|
||||
|
||||
// 是否还有数据
|
||||
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
|
||||
this.setData({ data_bottom_line_status: true });
|
||||
@ -183,5 +188,16 @@ Page({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
}
|
||||
},
|
||||
|
||||
// web页面信息设置
|
||||
set_page_info() {
|
||||
swan.setPageInfo({
|
||||
title: app.data.application_title+' - 商品搜索',
|
||||
keywords: app.data.application_describe,
|
||||
description: app.data.application_describe,
|
||||
image: (this.data.data_list.length == 0) ? [] : this.data.data_list.map(function (v) { return v.images;}).slice(0,3)
|
||||
});
|
||||
},
|
||||
|
||||
});
|
@ -20,19 +20,9 @@ Page({
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.set_page_info();
|
||||
this.init();
|
||||
},
|
||||
|
||||
// web页面信息设置
|
||||
set_page_info() {
|
||||
swan.setPageInfo({
|
||||
title: app.data.application_title,
|
||||
keywords: app.data.application_describe,
|
||||
description: app.data.application_describe,
|
||||
});
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
init() {
|
||||
var self = this;
|
||||
@ -72,6 +62,9 @@ Page({
|
||||
if (this.data.common_app_is_limitedtimediscount == 1 && this.data.plugins_limitedtimediscount_data != null) {
|
||||
this.plugins_limitedtimediscount_countdown();
|
||||
}
|
||||
|
||||
// 页面信息设置
|
||||
this.set_page_info();
|
||||
} else {
|
||||
self.setData({
|
||||
data_list_loding_status: 0,
|
||||
@ -168,6 +161,16 @@ Page({
|
||||
desc: app.data.application_describe,
|
||||
path: '/pages/index/index?share=index'
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
// web页面信息设置
|
||||
set_page_info() {
|
||||
swan.setPageInfo({
|
||||
title: app.data.application_title,
|
||||
keywords: app.data.application_describe,
|
||||
description: app.data.application_describe,
|
||||
image: (this.data.banner_list.length == 0) ? [] : this.data.banner_list.map(function (v) { return v.images_url;}).slice(0,3)
|
||||
});
|
||||
},
|
||||
|
||||
});
|
@ -1 +1 @@
|
||||
{"appid":"16634987","cloudTesting":{"forcePreview":false},"editor":{"curPath":"","expands":["/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components/popup","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components/icon-nav","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components/slider","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/lib","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/lib/online-service","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/user","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components/badge","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/user-address-save","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/user-address","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/goods-detail"],"paths":[]},"host":"baiduboxapp","preview":{"packageId":222699},"setting":{"urlCheck":false},"swan":{"baiduboxapp":{"extensionJsVersion":"","swanJsVersion":"3.30.43"}}}
|
||||
{"appid":"16634987","cloudTesting":{"forcePreview":false},"editor":{"curPath":"","expands":["/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components/popup","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components/icon-nav","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components/slider","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/lib","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/lib/online-service","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/user","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/components/badge","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/user-address-save","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/user-address","/Volumes/dev/data/www/project/shopxo/public/appmini/old/baidu/pages/goods-detail"],"paths":[]},"host":"baiduboxapp","preview":{"packageId":222764},"setting":{"urlCheck":false},"swan":{"baiduboxapp":{"extensionJsVersion":"","swanJsVersion":"3.30.43"}}}
|
Loading…
Reference in New Issue
Block a user