diff --git a/pages.json b/pages.json
index 14fa043..6850c42 100644
--- a/pages.json
+++ b/pages.json
@@ -137,7 +137,6 @@
{
"path": "pages/goods/goods-list/goods-list",
"style": {
- "navigationBarTitleText": "",
"navigationBarBackgroundColor": "#0083f5",
"backgroundColorTop": "#0083f5",
"navigationBarTextStyle": "white",
diff --git a/pages/goods/goods-list/goods-list.vue b/pages/goods/goods-list/goods-list.vue
index 6b824cd..2dcffff 100644
--- a/pages/goods/goods-list/goods-list.vue
+++ b/pages/goods/goods-list/goods-list.vue
@@ -1,28 +1,6 @@
-
-
-
-
-
-
-
-
-
- {{goods.name}}
-
- {{goods.price}}
- {{goods.slogan}}
-
-
-
- {{loadingText}}
-
+
@@ -30,128 +8,158 @@
export default {
data() {
return {
- goodsList:[
- { goods_id: 0, img: '/static/img/goods/p1.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 1, img: '/static/img/goods/p2.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 2, img: '/static/img/goods/p3.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 3, img: '/static/img/goods/p4.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 4, img: '/static/img/goods/p5.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 5, img: '/static/img/goods/p6.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 6, img: '/static/img/goods/p7.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 7, img: '/static/img/goods/p8.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 8, img: '/static/img/goods/p9.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' },
- { goods_id: 9, img: '/static/img/goods/p10.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' }
- ],
- loadingText:"正在加载...",
- headerTop:"0px",
- headerPosition:"fixed",
- orderbyList:[
- {text:"销量",selected:true,orderbyicon:false,orderby:0},
- {text:"价格",selected:false,orderbyicon:['sheng','jiang'],orderby:0},
- {text:"好评",selected:false,orderbyicon:false,orderby:0}
+ goodsList: [],
+ loadingText: "正在加载...",
+ headerTop: "0px",
+ headerPosition: "fixed",
+ orderbyList: [{
+ text: "销量",
+ selected: true,
+ orderbyicon: false,
+ orderby: 0
+ },
+ {
+ text: "价格",
+ selected: false,
+ orderbyicon: ['sheng', 'jiang'],
+ orderby: 0
+ },
+ {
+ text: "好评",
+ selected: false,
+ orderbyicon: false,
+ orderby: 0
+ }
],
- orderby:"sheng"
+ orderby: "sheng"
};
},
- onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
+ onLoad: function(option) { //option为object类型,会序列化上个页面传递的参数
console.log(option.cid); //打印出上个页面传递的参数。
- uni.setNavigationBarTitle({
- title: option.name
- });
-
+ if (option.id == 1) {
+ uni.setNavigationBarTitle({
+ title: '商品列表'
+ });
+ }
+ if (option.id == 2) {
+ uni.setNavigationBarTitle({
+ title: '金币列表'
+ });
+ }
//兼容H5下排序栏位置
// #ifdef H5
- //定时器方式循环获取高度为止,这么写的原因是onLoad中head未必已经渲染出来。
- let Timer = setInterval(()=>{
- let uniHead = document.getElementsByTagName('uni-page-head');
- if(uniHead.length>0){
- this.headerTop = uniHead[0].offsetHeight+'px';
- clearInterval(Timer);//清除定时器
- }
- },1);
+ //定时器方式循环获取高度为止,这么写的原因是onLoad中head未必已经渲染出来。
+ let Timer = setInterval(() => {
+ let uniHead = document.getElementsByTagName('uni-page-head');
+ if (uniHead.length > 0) {
+ this.headerTop = uniHead[0].offsetHeight + 'px';
+ clearInterval(Timer); //清除定时器
+ }
+ }, 1);
// #endif
},
- onPageScroll(e){
+ onPageScroll(e) {
//兼容iOS端下拉时顶部漂移
- if(e.scrollTop>=0){
+ if (e.scrollTop >= 0) {
this.headerPosition = "fixed";
- }else{
+ } else {
this.headerPosition = "absolute";
}
},
//下拉刷新,需要自己在page.json文件中配置开启页面下拉刷新 "enablePullDownRefresh": true
onPullDownRefresh() {
- setTimeout(()=>{
+ setTimeout(() => {
this.reload();
- uni.stopPullDownRefresh();
- }, 1000);
+ uni.stopPullDownRefresh();
+ }, 1000);
},
//上拉加载,需要自己在page.json文件中配置"onReachBottomDistance"
- onReachBottom(){
- uni.showToast({title: '触发上拉加载'});
+ onReachBottom() {
+ uni.showToast({
+ title: '触发上拉加载'
+ });
let len = this.goodsList.length;
- if(len>=40){
- this.loadingText="到底了";
+ if (len >= 40) {
+ this.loadingText = "到底了";
return false;
- }else{
- this.loadingText="正在加载...";
+ } else {
+ this.loadingText = "正在加载...";
}
- let end_goods_id = this.goodsList[len-1].goods_id;
- for(let i=1;i<=10;i++){
- let goods_id = end_goods_id+i;
- let p = { goods_id: goods_id, img: '/static/img/goods/p'+(goods_id%10==0?10:goods_id%10)+'.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' };
+ let end_goods_id = this.goodsList[len - 1].goods_id;
+ for (let i = 1; i <= 10; i++) {
+ let goods_id = end_goods_id + i;
+ let p = {
+ goods_id: goods_id,
+ img: '/static/img/goods/p' + (goods_id % 10 == 0 ? 10 : goods_id % 10) + '.jpg',
+ name: '商品名称商品名称商品名称商品名称商品名称',
+ price: '¥168',
+ slogan: '1235人付款'
+ };
this.goodsList.push(p);
}
},
- methods:{
- reload(){
+ methods: {
+ reload() {
console.log("reload");
let tmpArr = []
this.goodsList = [];
let end_goods_id = 0;
- for(let i=1;i<=10;i++){
- let goods_id = end_goods_id+i;
- let p = { goods_id: goods_id, img: '/static/img/goods/p'+(goods_id%10==0?10:goods_id%10)+'.jpg', name: '商品名称商品名称商品名称商品名称商品名称', price: '¥168', slogan:'1235人付款' };
+ for (let i = 1; i <= 10; i++) {
+ let goods_id = end_goods_id + i;
+ let p = {
+ goods_id: goods_id,
+ img: '/static/img/goods/p' + (goods_id % 10 == 0 ? 10 : goods_id % 10) + '.jpg',
+ name: '商品名称商品名称商品名称商品名称商品名称',
+ price: '¥168',
+ slogan: '1235人付款'
+ };
this.goodsList.push(p);
}
},
//商品跳转
- toGoods(e){
- uni.showToast({title: '商品'+e.goods_id,icon:"none"});
+ toGoods(e) {
+ uni.showToast({
+ title: '商品' + e.goods_id,
+ icon: "none"
+ });
uni.navigateTo({
- url: '../goods'
+ url: '../goods'
});
},
//排序类型
- select(index){
- let tmpTis = this.orderbyList[index].text+"排序 "
- if(this.orderbyList[index].orderbyicon){
- let type = this.orderbyList[index].orderby==0?'升序':'降序';
- if(this.orderbyList[index].selected){
- type = this.orderbyList[index].orderby==0?'降序':'升序';
- this.orderbyList[index].orderby = this.orderbyList[index].orderby==0?1:0;
+ select(index) {
+ let tmpTis = this.orderbyList[index].text + "排序 "
+ if (this.orderbyList[index].orderbyicon) {
+ let type = this.orderbyList[index].orderby == 0 ? '升序' : '降序';
+ if (this.orderbyList[index].selected) {
+ type = this.orderbyList[index].orderby == 0 ? '降序' : '升序';
+ this.orderbyList[index].orderby = this.orderbyList[index].orderby == 0 ? 1 : 0;
}
- tmpTis+=type
+ tmpTis += type
}
this.orderbyList[index].selected = true;
let len = this.orderbyList.length;
- for(let i=0;i
diff --git a/pages/tabBar/home/home.vue b/pages/tabBar/home/home.vue
index 3f99833..89c3894 100644
--- a/pages/tabBar/home/home.vue
+++ b/pages/tabBar/home/home.vue
@@ -55,7 +55,7 @@
-
+
@@ -70,7 +70,7 @@
-
+
@@ -420,6 +420,12 @@
console.log(err);
});
},
+ //调整商品列表
+ goGoodsList(item){
+ uni.navigateTo({
+ url:'../../goods/goods-list/goods-list?id='+item
+ })
+ },
//搜索跳转
toSearch() {
uni.navigateTo({
diff --git a/static/img/fqhed.png b/static/img/fqhed.png
index 6eccf1c..3cf7c32 100644
Binary files a/static/img/fqhed.png and b/static/img/fqhed.png differ
diff --git a/static/img/headzq.png b/static/img/headzq.png
index f7c2ae9..e35630d 100644
Binary files a/static/img/headzq.png and b/static/img/headzq.png differ
diff --git a/static/img/jbhed.png b/static/img/jbhed.png
index b08e8da..85a0ce8 100644
Binary files a/static/img/jbhed.png and b/static/img/jbhed.png differ