sys пре 1 година
родитељ
комит
9b2a0c7dae
4 измењених фајлова са 54 додато и 17 уклоњено
  1. 1 1
      api/discovery.js
  2. 6 2
      pages/index/index.vue
  3. 39 13
      pages/index/model/attachment-list.vue
  4. 8 1
      pages/index/model/index-nav.vue

+ 1 - 1
api/discovery.js

@@ -4,7 +4,7 @@ const goodsUrl = '/admin/discovery/'
 // 猜你喜欢
 export const getMoments = (data) => request(goodsUrl + 'moments', 'get', { ...data })
 export const getDiscoverList = (data) => request(goodsUrl + 'list', 'get', { ...data })
-export const getNearbyList = (data) => request(goodsUrl + 'nearby', 'get', { ...data })
+export const getNearbyList = (data) => request(goodsUrl + 'nearby', 'post', { ...data })
 export const setLike = (data) => request(goodsUrl + 'right/'+data, 'get', {  })
 export const setDislike = (data) => request(goodsUrl + 'left/'+data, 'get', {  })
 

+ 6 - 2
pages/index/index.vue

@@ -6,7 +6,7 @@
         <slide-item></slide-item>
       </view>
       <view class="box-two" v-else-if="tabNum===1">
-        <attachment-list></attachment-list>
+        <attachment-list ref="attachmentObj"></attachment-list>
       </view>
       <view class="box-three" v-else>
         <attachment-list></attachment-list>
@@ -26,7 +26,11 @@ export default {
       tabNum:0
     }
   },
-
+  onReachBottom(){
+    if(this.tabNum===1){
+      this.$refs.attachmentObj.getAttachmentList()
+    }
+  },
   methods: {
     setTabNum(tabNum){
       this.tabNum=tabNum

+ 39 - 13
pages/index/model/attachment-list.vue

@@ -17,7 +17,7 @@
 
       </view>
     </view>
-    <view class="attachment-open">
+    <view class="attachment-open" v-show="isLock">
       <view class="open-data sys-background-yellow sys-radius-200">
         <image class="open-img" src="/static/img/common/lock.png" mode="aspectFill"></image>
         <view class="open-text sys-color-black sys-weight-500" >立即解锁</view>
@@ -34,13 +34,16 @@ import tools from "@/service/tools";
 export default {
   name: "attachment-list",
   components: {},
-  props: {},
+  props: {
+
+  },
   data() {
     return {
       page:1,
       total:undefined,
       isAjax:false,
       list:[],
+      isLock:false
     }
   },
   watch: {},
@@ -48,22 +51,45 @@ export default {
     this.getAttachmentList()
   },
   methods: {
+
     async  getAttachmentList(){
+      if(this.isLock && this.page>1 ){
+        return false
+      }
+      if(this.total<=this.list.length){
+        return false
+      }
+      if(this.isAjax){
+        return false
+      }
+      this.isAjax=true
       let locationData=await tools.getLocation()
       getNearbyList({'pageNo':this.page,'pageSize':20,'longitude':locationData.longitude,'latitude':locationData.latitude}).then((res)=>{
+        this.isAjax=false
         if(res.code===0){
-
+          this.page++
+          this.total=res.total
+          res.data.data.forEach( (item)=>{
+            let galleryUrls=item.galleryUrls
+            let age=tools.getAge(item.dateOfBirth)
+            if(galleryUrls.length>0){
+              if(galleryUrls.length>8){
+                galleryUrls=galleryUrls.slice(0,7)
+              }
+              let newdata = {
+                img: galleryUrls[0],
+                age:  age,
+                name:  item.nickname,
+                userId:  item.userId,
+                sex:  '女',
+                constellation:  '处女座',
+              }
+              this.list.push(newdata)
+            }
+          })
         }
       })
-      let list=[
-        {'name':'仰看辉煌仰看辉煌仰看辉煌仰看辉煌','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/1.png'},
-        {'name':'Maple','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/2.png'},
-        {'name':'仰看辉煌','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/3.png'},
-        {'name':'Maple','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/1.png'},
-        {'name':'仰看辉煌','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/2.png'},
-        {'name':'Maple','age':18,'sex':'女','constellation':'处女座','img':'/static/img/temporary/3.png'},
-      ];
-      this.list.push(...list)
+
     }
 
   }
@@ -128,7 +154,7 @@ export default {
   .attachment-open{
     position: fixed;
     left: 0;
-    bottom: 0;
+    bottom: 80rpx;
     width: 100vw;
     height: 190rpx;
     background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #FFFFFF 100%);

+ 8 - 1
pages/index/model/index-nav.vue

@@ -1,7 +1,7 @@
 <template>
   <view class="">
     <view class="header"  :style="[{'height': customBarH + 'px', 'padding-top': statusBarH + 'px'}]">
-      <view class="header-left">
+      <view class="header-left" @click="goToUrl(1)">
         <view class="left-text sys-color-black-0 sys-weight-600">筛选</view>
         <view class="left-img">
           <image class="down-img" src="/static/img/common/down.png" mode="aspectFill"></image>
@@ -53,6 +53,13 @@
 
     },
     methods: {
+      goToUrl(type){
+        if(type===1){
+          uni.navigateTo({
+            'url':'/pages/index/model/screen-item'
+          })
+        }
+      },
       setTabNum(tabNum){
         if(this.tabNum!==tabNum){
           this.tabNum=tabNum