Selaa lähdekoodia

社区 下拉 触底刷新完成

zxl 1 vuosi sitten
vanhempi
commit
698395d30e

+ 5 - 2
README.md

@@ -22,8 +22,11 @@ git push
 See [Configuration Reference](https://cli.vuejs.org/config/).
 
 ### 地址
-http://apidoc.chelvc.com/admin/
-http://apidoc.chelvc.com/
+
+http://apidoc.chelvc.com   // 接口地址
+http://apidoc.chelvc.com/admin // 后台接口地址
+http://apidoc.chelvc.com/maintain // 小程序接口地址
+https://chelvchengzentao.cpolar.top/zentao/user-login-L3plbnRhby8=.html // 禅道地址
 
 wangzhongqing 564342
 

+ 1 - 1
src/PageMine/shopCar.vue

@@ -192,7 +192,7 @@ export default {
           }).then(res => {
             if (res.code === 'OK') {
               uni.navigateTo({
-                url: `/pages/client/clientPackage/uptickOrder?ids=${a[0]}`,
+                url: `/pagesHome/marketer/settleOrder?ids=${a[0]}`,
               });
             }
           });

+ 2 - 1
src/mixin/cache.js

@@ -1,9 +1,10 @@
-import { setCache, getCache, removeCache, clearCache } from '@/utils/cache';
+import { setCache, getCache, removeCache, clearCache , uToast } from '@/utils/cache';
 export default {
   methods: {
     setCache,
     getCache,
     removeCache,
     clearCache,
+    uToast
   },
 };

+ 11 - 9
src/pages.json

@@ -2,7 +2,14 @@
 	"easycom": {
 		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
 	},
-	"pages": [{
+	"pages": [
+    {
+    	"path": "pages/tabbar/home",
+    	"style": {
+    		"navigationBarTitleText": "",
+    		"navigationStyle": "custom"
+    	}
+    },{
 			// 登录 + tabbar + webview
 			"path": "pages/login/login",
 			"style": {
@@ -22,18 +29,13 @@
 				"navigationBarTitleText": ""
 			}
 		},
-		{
-			"path": "pages/tabbar/home",
-			"style": {
-				"navigationBarTitleText": "",
-				"navigationStyle": "custom"
-			}
-		},
 		{
 			"path": "pages/tabbar/community",
 			"style": {
 				"navigationBarTitleText": "",
-				"navigationStyle": "custom"
+				"navigationStyle": "custom",
+        "enablePullDownRefresh": true,
+        "onReachBottomDistance": 50
 			}
 		},
 		{

+ 29 - 27
src/pages/tabbar/community.vue

@@ -20,29 +20,19 @@
       <view class="item-box" v-for="(item,index) of initList" :key='index'>
         <view class="item-top">
           <view class="top-left">
-            <!-- <image class="img" :src="" v-if="item.userDTO.avata"></image> -->
             <u-avatar :src="item.userDTO.avatar" size="45" />
           </view>
           <view class="top-right">
             <view class="right-title">{{ item.userDTO.nickname }}</view>
             <view class="right-address">
-              <view class="marRight-20">
-                {{ item.distanceTime }}
-              </view>
-              <view class="">
-
-                {{ item.location }}
-              </view>
+              <view class="marRight-20"> {{ item.distanceTime }} </view>
+              <view class=""> {{ item.location }} </view>
             </view>
           </view>
         </view>
-
         <!-- <u-line margin='10rpx 0'></u-line> -->
-
         <view class="item-center">
-          <view class="center-text">
-            {{ item.textContent }}
-          </view>
+          <view class="center-text"> {{ item.textContent }} </view>
           <view class="center-img-box">
             <image v-for="itm of item.resourceVos" class="center-img" :src="itm.resourceKey" @click='reviewImg(itm)'>
             </image>
@@ -84,20 +74,11 @@
 </template>
 
 <script>
-  import {
-    clientContentList,
-    addEvaulateRecords
-  } from '@/api/client/community.js';
+  import { clientContentList, addEvaulateRecords } from '@/api/client/community.js';
   import communityPop from "./components/communityPop.vue"
-  // import empty from "@/components/empty/index.vue"
-  import {
-    GetDateToNewData
-  } from "@/utils/tools.js"
+  import { GetDateToNewData } from "@/utils/tools.js"
   export default {
-    components: {
-      communityPop,
-      // empty
-    },
+    components: { communityPop },
     data() {
       return {
         communityShow: false,
@@ -126,8 +107,26 @@
         userId: '',
         dynamicId: 0,
         dynamicUserId: 0,
+        total:0
       }
     },
+    // 下拉刷新
+    onPullDownRefresh() {
+      this.params.pageNum = 1
+      this.initList = []
+      this.handlerInitList()
+    	setTimeout(function () {
+    		uni.stopPullDownRefresh();
+        this.uToast('刷新成功')
+    	}, 1000);
+    },
+    // 触底刷新
+    onReachBottom() {
+      let { pageNum , pageSize } = this.params
+      if( pageNum * pageSize > this.total ) return this.uToast('没有更多啦')
+      this.params.pageNum ++
+      this.handlerInitList()
+    },
     onShow() {
       this.handlerInitList()
     },
@@ -149,15 +148,18 @@
             let time = GetDateToNewData(rs.createTime)
             this.$set(rs, 'distanceTime', time)
           })
-          this.initList = res.data.records
+          this.total = res.data.total
+          this.initList = [...this.initList,...res.data.records]
         })
       },
       // 切换顶部tabbar
       tabChange(e) {
         this.params.type = e.type
+        this.params.pageNum = 1
+        this.initList = []
         this.handlerInitList()
       },
-      // 发布按钮
+      // 点击发布按钮
       handlerToPublish() {
         uni.navigateTo({
           url: "/pagesCustomer/communityPostReview"

+ 3 - 3
src/pages/tabbar/components/communityPop.vue

@@ -22,11 +22,11 @@
             </view>
           </view>
           <view class="top-right">
-            <u-icon
+            <!-- <u-icon
               :name="item.clickStatus == 0 ? 'heart' : 'heart-fill'"
               size="22"
               @click="handlerFocus(item)"
-            ></u-icon>
+            ></u-icon> -->
           </view>
         </view>
 
@@ -98,7 +98,7 @@ export default {
     handlerPopPublishBtn() {
       let params = {
         dynamicId: this.dynamicId,
-		targetUserId:this.dynamicUserId,
+        targetUserId:this.dynamicUserId,
         parentId: 0,
         content: this.content,
         status: 0,

+ 8 - 1
src/utils/cache.js

@@ -15,4 +15,11 @@ function clearCache() {
   uni.clearStorageSync();
 }
 
-export { setCache, getCache, removeCache, clearCache };
+function uToast(msg){
+  uni.showToast({
+    title:msg,
+    icon:'none'
+  })
+}
+
+export { setCache, getCache, removeCache, clearCache , uToast };