Forráskód Böngészése

事项收藏查询方法修改

conghelong 1 éve
szülő
commit
b27d1ee464
2 módosított fájl, 15 hozzáadás és 18 törlés
  1. 7 6
      api/handleAffairs/matter.js
  2. 8 12
      pages/gridQuery/mattercontent.vue

+ 7 - 6
api/handleAffairs/matter.js

@@ -40,7 +40,7 @@ export function listMatters(query) {
     params: query
     params: query
   })
   })
 }
 }
-// 新增事项
+// 收藏事项
 export function scadd(data) {
 export function scadd(data) {
   return request({
   return request({
     url: '/system/collect/add',
     url: '/system/collect/add',
@@ -57,12 +57,13 @@ export function collectlist(id) {
   })
   })
 }
 }
 
 
-// 查询事项详细
-export function getsc(id) {
+export function getsc(query) {
   return request({
   return request({
-    url: '/system/collect/lists/' + id,
-    method: 'get'
-  })
+    url: '/system/collect/lists',
+    method: 'get',
+    params: query
+    
+  });
 }
 }
 
 
 
 

+ 8 - 12
pages/gridQuery/mattercontent.vue

@@ -2,19 +2,14 @@
 
 
 	<view>
 	<view>
 		<view class="rnwdList">
 		<view class="rnwdList">
-
-
 			<ul >
 			<ul >
 				<li >
 				<li >
-
 					<h3>{{matterlist.title }}</h3>
 					<h3>{{matterlist.title }}</h3>
 				    <p>{{ matterlist.content }}</p>
 				    <p>{{ matterlist.content }}</p>
 					<image class="uni-header-image" :src="'http://127.0.0.1:8080'+matterlist.picture"></image>
 					<image class="uni-header-image" :src="'http://127.0.0.1:8080'+matterlist.picture"></image>
 					   <button @click="toggleFavorite">{{ isFavorite ? '❤️' : '🤍' }}</button>
 					   <button @click="toggleFavorite">{{ isFavorite ? '❤️' : '🤍' }}</button>
 				</li>
 				</li>
 				</ul>
 				</ul>
-
-
 		</view>
 		</view>
 	</view>
 	</view>
 
 
@@ -42,6 +37,7 @@
 		      getList(){
 		      getList(){
 		        const _that = this;
 		        const _that = this;
 		        const id = uni.getStorageSync('id');
 		        const id = uni.getStorageSync('id');
+
 		        getDept(id).then(res =>{
 		        getDept(id).then(res =>{
 		          _that.matterlist = res.data
 		          _that.matterlist = res.data
 					this.checkFavorite();
 					this.checkFavorite();
@@ -62,13 +58,13 @@
 		        }
 		        }
 		      },
 		      },
 
 
-		    checkFavorite() {
-				const userId = getApp().globalData.userId
-		      getsc(userId).then(res => {
-		        this.isFavorite = res.data;
-		      });
-		    },
-
+		   checkFavorite() {
+		   	const userId = getApp().globalData.userId
+		   	const matterId = this.matterlist.id
+		     getsc({ matterId , userId }).then(res => {
+		       this.isFavorite = res.data;
+		     });
+		   },
 	},
 	},
 	}
 	}
 </script>
 </script>