Commit f84d9327f364a04a6499f1a5f44e1bdfcf5958dd
1 parent
09b6c3eb
分类列表添加风格页面 商品列表
Showing
4 changed files
with
87 additions
and
47 deletions
.idea/mshopweapp.iml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<module type="WEB_MODULE" version="4"> | ||
| 3 | + <component name="NewModuleRootManager"> | ||
| 4 | + <content url="file://$MODULE_DIR$" /> | ||
| 5 | + <orderEntry type="inheritedJdk" /> | ||
| 6 | + <orderEntry type="sourceFolder" forTests="false" /> | ||
| 7 | + </component> | ||
| 8 | +</module> | ||
| 0 | \ No newline at end of file | 9 | \ No newline at end of file |
pages/goods/categoryList/categoryList.js
| @@ -63,6 +63,8 @@ Page({ | @@ -63,6 +63,8 @@ Page({ | ||
| 63 | msgStatus:false, //页面显示暂无数据状态 | 63 | msgStatus:false, //页面显示暂无数据状态 |
| 64 | countDownNum: 3, | 64 | countDownNum: 3, |
| 65 | timer: '', //定时器 | 65 | timer: '', //定时器 |
| 66 | + lastMsg:false, | ||
| 67 | + toView:"", | ||
| 66 | }, | 68 | }, |
| 67 | onLoad: function(tt) { | 69 | onLoad: function(tt) { |
| 68 | var that = this; | 70 | var that = this; |
| @@ -543,10 +545,8 @@ Page({ | @@ -543,10 +545,8 @@ Page({ | ||
| 543 | //==2的时候 请求数据为商品,不为分类 | 545 | //==2的时候 请求数据为商品,不为分类 |
| 544 | if (this.data.is_used_share == 2) { | 546 | if (this.data.is_used_share == 2) { |
| 545 | this.style(this.data.stylePage, cid) | 547 | this.style(this.data.stylePage, cid) |
| 546 | - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid }); | 548 | + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid,lastMsg: false, }); |
| 547 | }else{ | 549 | }else{ |
| 548 | - | ||
| 549 | - | ||
| 550 | if (arr != "undefined" && arr != undefined) { | 550 | if (arr != "undefined" && arr != undefined) { |
| 551 | if (arr.length == 0) { | 551 | if (arr.length == 0) { |
| 552 | this.setData({ | 552 | this.setData({ |
| @@ -569,7 +569,7 @@ Page({ | @@ -569,7 +569,7 @@ Page({ | ||
| 569 | } | 569 | } |
| 570 | } | 570 | } |
| 571 | } | 571 | } |
| 572 | - this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage:1}); | 572 | + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid, stylePage: 1,lastMsg: false,}); |
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | }, | 575 | }, |
| @@ -665,6 +665,7 @@ Page({ | @@ -665,6 +665,7 @@ Page({ | ||
| 665 | that.setData({ | 665 | that.setData({ |
| 666 | stylePage: that.data.stylePage + 1, | 666 | stylePage: that.data.stylePage + 1, |
| 667 | countDownNum: 3, | 667 | countDownNum: 3, |
| 668 | + lastMsg: false, | ||
| 668 | }); | 669 | }); |
| 669 | that.style(that.data.stylePage, that.data.cat_id); | 670 | that.style(that.data.stylePage, that.data.cat_id); |
| 670 | }, | 671 | }, |
| @@ -680,6 +681,7 @@ Page({ | @@ -680,6 +681,7 @@ Page({ | ||
| 680 | that.setData({ | 681 | that.setData({ |
| 681 | stylePage: that.data.stylePage + 1, | 682 | stylePage: that.data.stylePage + 1, |
| 682 | countDownNum: 3, | 683 | countDownNum: 3, |
| 684 | + lastMsg: false, | ||
| 683 | }); | 685 | }); |
| 684 | that.style(that.data.stylePage, that.data.cat_id); | 686 | that.style(that.data.stylePage, that.data.cat_id); |
| 685 | }, | 687 | }, |
| @@ -698,7 +700,16 @@ Page({ | @@ -698,7 +700,16 @@ Page({ | ||
| 698 | msgStatus: false, | 700 | msgStatus: false, |
| 699 | }); | 701 | }); |
| 700 | //如果有数据 怕断分页为第一页的时候直接渲染数据 | 702 | //如果有数据 怕断分页为第一页的时候直接渲染数据 |
| 701 | - if (page = 1) { | 703 | + if (page > 1) { |
| 704 | + //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面 | ||
| 705 | + var arr = s.data.requestData | ||
| 706 | + console.log("arr:=" + JSON.stringify(arr)) | ||
| 707 | + arr.push(e.data.data.pageData); | ||
| 708 | + s.setData({ | ||
| 709 | + requestData: arr | ||
| 710 | + }); | ||
| 711 | + | ||
| 712 | + }else{ | ||
| 702 | s.setData({ | 713 | s.setData({ |
| 703 | requestData: e.data.data.pageData | 714 | requestData: e.data.data.pageData |
| 704 | }); | 715 | }); |
| @@ -707,14 +718,8 @@ Page({ | @@ -707,14 +718,8 @@ Page({ | ||
| 707 | scrollTop: 0 | 718 | scrollTop: 0 |
| 708 | }) | 719 | }) |
| 709 | } | 720 | } |
| 710 | - }else{ | ||
| 711 | - //如果分页不是在第一页 那么就把返回的数据追加到原有数据后面 | ||
| 712 | - var arr = s.data.requestData | ||
| 713 | - arr.push(e.data.data.pageData); | ||
| 714 | - s.setData({ | ||
| 715 | - requestData: arr | ||
| 716 | - }); | ||
| 717 | } | 721 | } |
| 722 | + | ||
| 718 | } else { | 723 | } else { |
| 719 | //没有数据页面显示暂无数据 | 724 | //没有数据页面显示暂无数据 |
| 720 | 725 | ||
| @@ -731,6 +736,10 @@ Page({ | @@ -731,6 +736,10 @@ Page({ | ||
| 731 | }); | 736 | }); |
| 732 | s.style(s.data.stylePage, dataArray[index + 1]['items']['id']) | 737 | s.style(s.data.stylePage, dataArray[index + 1]['items']['id']) |
| 733 | }else{ | 738 | }else{ |
| 739 | + //没有数据而且是第一页的时候 | ||
| 740 | + s.setData({ | ||
| 741 | + stylePage: 1, | ||
| 742 | + }); | ||
| 734 | let countDownNum = 3; //获取倒计时初始值 | 743 | let countDownNum = 3; //获取倒计时初始值 |
| 735 | s.setData({ | 744 | s.setData({ |
| 736 | msgStatus: true, | 745 | msgStatus: true, |
| @@ -750,16 +759,25 @@ Page({ | @@ -750,16 +759,25 @@ Page({ | ||
| 750 | //没有数据根据当前分类id去找到下一个分类id再次传递给服务端请求数据 | 759 | //没有数据根据当前分类id去找到下一个分类id再次传递给服务端请求数据 |
| 751 | var dataArray = s.data.one_level_classify | 760 | var dataArray = s.data.one_level_classify |
| 752 | var index = s.data.index | 761 | var index = s.data.index |
| 753 | - console.log(dataArray[index + 1]['items']) | ||
| 754 | - s.setData({ | ||
| 755 | - stylePage: 1, | ||
| 756 | - index: index + 1, | ||
| 757 | - select_classify_on: index + 1, | ||
| 758 | - cat_id: dataArray[index + 1]['items']['id'], | ||
| 759 | - classify_name: dataArray[index + 1]['items']['name'] | ||
| 760 | - }); | ||
| 761 | - s.style(s.data.stylePage, dataArray[index + 1]['items']['id']); | ||
| 762 | - | 762 | + console.log(dataArray[index + 1]) |
| 763 | + if (dataArray[index + 1] == undefined || dataArray[index + 1] == "undefined"){ | ||
| 764 | + console.log("dataArray[index + 1] = undefined") | ||
| 765 | + s.setData({ | ||
| 766 | + stylePage: 1, | ||
| 767 | + msgStatus: false, | ||
| 768 | + lastMsg: true | ||
| 769 | + }); | ||
| 770 | + }else{ | ||
| 771 | + s.setData({ | ||
| 772 | + stylePage: 1, | ||
| 773 | + index: index + 1, | ||
| 774 | + select_classify_on: index + 1, | ||
| 775 | + cat_id: dataArray[index + 1]['items']['id'], | ||
| 776 | + classify_name: dataArray[index + 1]['items']['name'] | ||
| 777 | + }); | ||
| 778 | + s.style(s.data.stylePage, dataArray[index + 1]['items']['id']); | ||
| 779 | + } | ||
| 780 | + | ||
| 763 | } | 781 | } |
| 764 | countDownNum--; | 782 | countDownNum--; |
| 765 | s.setData({ | 783 | s.setData({ |
pages/goods/categoryList/categoryList.wxml
| @@ -285,9 +285,9 @@ | @@ -285,9 +285,9 @@ | ||
| 285 | </view> | 285 | </view> |
| 286 | <!-- /头部 --> | 286 | <!-- /头部 --> |
| 287 | <!-- 分类项目内容 --> | 287 | <!-- 分类项目内容 --> |
| 288 | - <view class="flex project_height" style="margin-left:-10rpx;margin-top:120rpx;"> | 288 | + <view class="flex project_height" style="margin-left:-10rpx;"> |
| 289 | <!-- 分类项目的类型 --> | 289 | <!-- 分类项目的类型 --> |
| 290 | - <view class="project_type" style="position:fixed;left:0;z-index:999999"> | 290 | + <view class="project_type" style="height:88%;overflow-y:auto;position:fixed;left:0;z-index:999999;top:120rpx;"> |
| 291 | <view class="project_type-frame"> | 291 | <view class="project_type-frame"> |
| 292 | <view wx:if="{{is_show_gb}}"> | 292 | <view wx:if="{{is_show_gb}}"> |
| 293 | <view bindtap="click_classify" class="share_type fs30 flex-space-between xc-letter-spacing {{select_classify_on==223?'select_classify':''}}"data-index="223"data-name="国家" wx:if="{{is_country}}"> | 293 | <view bindtap="click_classify" class="share_type fs30 flex-space-between xc-letter-spacing {{select_classify_on==223?'select_classify':''}}"data-index="223"data-name="国家" wx:if="{{is_country}}"> |
| @@ -300,28 +300,23 @@ | @@ -300,28 +300,23 @@ | ||
| 300 | </view> | 300 | </view> |
| 301 | </view> | 301 | </view> |
| 302 | <view wx:if="{{is_show_pl}}"> | 302 | <view wx:if="{{is_show_pl}}"> |
| 303 | - <view wx:for="{{one_level_classify}}" wx:for-item="ittms" > | ||
| 304 | - <view bindtap="click_classify" data-arr="{{ittms.array}}" data-cid="{{ittms.items.id}}" data-pid="0" class="{{select_classify_on==index?'select_classify width80':''}} share_type fs30 t-c {{ittms.items.name.length==2? 'world_sn':''}} {{select_classify_on==index&&ittms.items.name.length==2?'text-indent':''}} {{select_classify_on==index&&ittms.items.name.length==3?'text3':''}}"data-index="{{index}}"data-name="{{ittms.items.name}}"> | ||
| 305 | - <view class="{{ittms.items.name.length==3?'flex-center-around':'flex-space-between'}}" wx:if="{{ittms.items.name.length<4}}"> | ||
| 306 | - <view wx:for="{{ittms.items.name}}" wx:for-item="name"wx:for-index="index"> | ||
| 307 | - <view> | ||
| 308 | - {{name}} | ||
| 309 | - </view> | ||
| 310 | - </view> | ||
| 311 | - | ||
| 312 | - </view> | ||
| 313 | - <view wx:else class="sort-name ellipsis-1">{{ittms.items.name}} | ||
| 314 | - </view> | ||
| 315 | - </view> | ||
| 316 | - | 303 | + <view wx:for="{{one_level_classify}}" wx:for-item="ittms" > |
| 304 | + <view bindtap="click_classify" data-arr="{{ittms.array}}" data-cid="{{ittms.items.id}}" data-pid="0" class="{{select_classify_on==index?'select_classify width80':''}} share_type fs30 t-c {{ittms.items.name.length==2? 'world_sn':''}} {{select_classify_on==index&&ittms.items.name.length==2?'text-indent':''}} {{select_classify_on==index&&ittms.items.name.length==3?'text3':''}}"data-index="{{index}}"data-name="{{ittms.items.name}}"> | ||
| 305 | + <view class="{{ittms.items.name.length==3?'flex-center-around':'flex-space-between'}}" wx:if="{{ittms.items.name.length<4}}"> | ||
| 306 | + <view wx:for="{{ittms.items.name}}" wx:for-item="name"wx:for-index="index"> | ||
| 307 | + <view> | ||
| 308 | + {{name}} | ||
| 309 | + </view> | ||
| 310 | + </view> | ||
| 311 | + </view> | ||
| 312 | + <view wx:else class="sort-name ellipsis-1">{{ittms.items.name}}</view> | ||
| 313 | + </view> | ||
| 314 | + </view> | ||
| 315 | + </view> | ||
| 317 | </view> | 316 | </view> |
| 318 | - | ||
| 319 | - </view> | ||
| 320 | - </view> | ||
| 321 | - | ||
| 322 | - </view> | ||
| 323 | - <!-- 分类项目的内容 --> | ||
| 324 | - <view class="classify_content" style="margin-left:26%"> | 317 | + </view> |
| 318 | + <!-- 分类项目的内容 --> | ||
| 319 | + <view class="classify_content" style="margin-left:26%;margin-top:51px"> | ||
| 325 | <!-- 国家的样式 --> | 320 | <!-- 国家的样式 --> |
| 326 | <block wx:if="{{select_classify_on==223&&is_show_gb}}"> | 321 | <block wx:if="{{select_classify_on==223&&is_show_gb}}"> |
| 327 | <view class="classify_name fs28 flex-space-between"> | 322 | <view class="classify_name fs28 flex-space-between"> |
| @@ -381,7 +376,7 @@ | @@ -381,7 +376,7 @@ | ||
| 381 | <!-- <view class="classify_content-frame flex-wrap" style="width:100%;overflow:hidden;heigth:100%;"> --> | 376 | <!-- <view class="classify_content-frame flex-wrap" style="width:100%;overflow:hidden;heigth:100%;"> --> |
| 382 | 377 | ||
| 383 | <!-- <view class="null" style="width:100%;margin-top:70rpx;"></view> --> | 378 | <!-- <view class="null" style="width:100%;margin-top:70rpx;"></view> --> |
| 384 | - <scroll-view scroll-y scroll-into-view="{{cat_id}}" bindscrolltolower='scrollLower' style="height:{{windowHeight}};position:absolute;margin-top:70rpx;top:120rpx;bottom:0;rigth:0;left:26%;width:73%;"> | 379 | + <scroll-view scroll-y bindscrolltolower='scrollLower' style="height:{{windowHeight}};position:absolute;margin-top:70rpx;top:120rpx;bottom:0;rigth:0;left:26%;width:73%;"> |
| 385 | <!-- <view class="null" style="width:100%;height:29px;"></view> --> | 380 | <!-- <view class="null" style="width:100%;height:29px;"></view> --> |
| 386 | <!-- goodslist --> | 381 | <!-- goodslist --> |
| 387 | <view class="choice_list"> | 382 | <view class="choice_list"> |
| @@ -469,6 +464,10 @@ | @@ -469,6 +464,10 @@ | ||
| 469 | <view class="no-data-title">该类别暂无推荐商品 {{countDownNum}} 秒后自动跳到下一个类别</view> | 464 | <view class="no-data-title">该类别暂无推荐商品 {{countDownNum}} 秒后自动跳到下一个类别</view> |
| 470 | <!-- <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> --> | 465 | <!-- <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> --> |
| 471 | </view> | 466 | </view> |
| 467 | + <view class="no-data" wx:if="{{lastMsg == true}}"> | ||
| 468 | + <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | ||
| 469 | + <view class="no-data-title">该类别暂无推荐商品</view> | ||
| 470 | + </view> | ||
| 472 | </scroll-view> | 471 | </scroll-view> |
| 473 | <!-- /goodslist --> | 472 | <!-- /goodslist --> |
| 474 | </view> | 473 | </view> |
project.config.json
| @@ -31,13 +31,28 @@ | @@ -31,13 +31,28 @@ | ||
| 31 | "current": -1, | 31 | "current": -1, |
| 32 | "list": [] | 32 | "list": [] |
| 33 | }, | 33 | }, |
| 34 | + "plugin": { | ||
| 35 | + "current": -1, | ||
| 36 | + "list": [] | ||
| 37 | + }, | ||
| 34 | "game": { | 38 | "game": { |
| 35 | "currentL": -1, | 39 | "currentL": -1, |
| 36 | "list": [] | 40 | "list": [] |
| 37 | }, | 41 | }, |
| 38 | - "miniprogram": { | 42 | + "gamePlugin": { |
| 39 | "current": -1, | 43 | "current": -1, |
| 40 | "list": [] | 44 | "list": [] |
| 45 | + }, | ||
| 46 | + "miniprogram": { | ||
| 47 | + "current": -1, | ||
| 48 | + "list": [ | ||
| 49 | + { | ||
| 50 | + "id": -1, | ||
| 51 | + "name": "pages/goods/categoryList/categoryList", | ||
| 52 | + "pathName": "pages/goods/categoryList/categoryList", | ||
| 53 | + "scene": null | ||
| 54 | + } | ||
| 55 | + ] | ||
| 41 | } | 56 | } |
| 42 | } | 57 | } |
| 43 | } | 58 | } |
| 44 | \ No newline at end of file | 59 | \ No newline at end of file |