sys 1 rok pred
rodič
commit
161393c344

+ 7 - 0
api/community.js

@@ -0,0 +1,7 @@
+import { request } from '@/service/ajax'
+// 商品模块路由
+const goodsUrl = '/admin/community/'
+// 猜你喜欢
+export const setUnLike = (data) => request(goodsUrl + 'unLike/'+data, 'post', {  })
+export const setLike = (data) => request(goodsUrl + 'like/'+data, 'post', {  })
+

+ 2 - 0
api/discovery.js

@@ -7,4 +7,6 @@ export const getDiscoverList = (data) => request(goodsUrl + 'list', 'get', { ...
 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', {  })
+export const setFilter = (data) => request(goodsUrl + 'filter', 'post', { ...data })
+export const getFilter = (data) => request(goodsUrl + 'filter', 'get', { ...data })
 

+ 7 - 4
pages/common/dynamic/dynamic-items.vue

@@ -81,6 +81,7 @@ import ImgThree from "@/pages/common/img/img-three";
 import DynamicTag from "@/pages/common/tag/dynamic-tag";
 import {getMoments} from "@/api/discovery";
 import tools from "@/service/tools";
+import {setLike, setUnLike} from "@/api/community";
 export default {
   name: "dynamic-items",
   components: {DynamicTag, ImgThree, ImgTwo, ImgOne},
@@ -159,11 +160,13 @@ export default {
       })
     },
     setLike(index){
-      this.dynamicList[index].liked=!this.dynamicList[index].liked
-      if(this.dynamicListdynamicList[index].liked){
-        ++this.dynamicList[index].likeCount
+      this.list[index].liked=!this.list[index].liked
+      if(this.list[index].liked){
+        ++this.list[index].likeCount
+        setLike( this.list[index].id).then((res)=>{})
       }else {
-        --this.dynamicList[index].likeCount
+        --this.list[index].likeCount
+        setUnLike( this.list[index].id).then((res)=>{})
       }
     }
   }

+ 23 - 15
pages/index/model/screen-item.vue

@@ -86,6 +86,7 @@
 
 <script>
 	import cjSlider from '@/components/cj-slider/cj-slider.vue'
+  import {getFilter} from "@/api/discovery";
 	export default {
 		components: {
 			cjSlider,
@@ -107,21 +108,28 @@
 				sexId: 0,
 			};
 		},
-		mounted() {},
-		methods: {
-			scroll() {},
-			scrolltolower() {},
-			blockMoving(e) {
-				console.log('正在滑动中', e)
-			},
-			sliderChange(e) {
-				this.distance = e.detail.value
-			},
-			selsectSex(id) {
-				//点击没反应
-				this.sexId = id
-				console.log(id);
-			},
+		mounted() {
+      this.getFilter()
+    },
+    methods: {
+      getFilter(){
+        getFilter().then((res)=>{
+          console.log(res)
+        })
+      },
+      scroll() {},
+      scrolltolower() {},
+      blockMoving(e) {
+        console.log('正在滑动中', e)
+      },
+      sliderChange(e) {
+        this.distance = e.detail.value
+      },
+      selsectSex(id) {
+        //点击没反应
+        this.sexId = id
+        console.log(id);
+      },
 		},
 	}
 </script>