WINDOWS-7IFQK7E\EDY лет назад: 2
Родитель
Сommit
215f7130b6

+ 48 - 1
src/pages/ysgc/FallsFlow.vue

@@ -15,8 +15,20 @@
               <img v-for="star in Number(img.yz_star_num)" :key="star" src="../../assets/ysgc/star.png" alt="" />
             </div>
           </div>
+
         </div>
         <!-- </router-link> -->
+        <div class="dataShow">
+
+          <div class="baseInfoPart">
+            <img src="/kczy/fingerIcon.png" alt="">
+            <span>{{img.yz_like_num}}</span>
+          </div>
+          <div class="baseInfoPart">
+            <img src="/kczy/cellectIcon.png" alt="">
+            <span>{{img.yz_fav_num}}</span>
+          </div>
+        </div>
       </div>
     </div>
   </div>
@@ -62,7 +74,7 @@ export default {
     },
     // 瀑布流
     imgList() {
-      if (this.Plist.length !== 0) {
+      if (this.Plist?.length !== 0) {
         const res = [];
         for (let i = 0; i < this.col; i++) {
           res.push({
@@ -102,6 +114,41 @@ export default {
 </script>
   
 <style lang="scss" scoped>
+.dataShow {
+  position: absolute;
+  right: 0;
+  top: 0;
+  z-index: 13;
+  width: 164px;
+  height: 32px;
+  line-height: 32px;
+  background: rgba(0, 0, 0, 0.5);
+  border-bottom-left-radius: 12px;
+  border-top-right-radius: 12px;
+  display: flex;
+  padding-left: 5px;
+
+  .baseInfoPart {
+    width: 50%;
+    height: 32px;
+    line-height: 32px;
+    box-sizing: border-box;
+    margin-left: 4px;
+    img {
+      display: inline-block;
+      vertical-align: middle;
+      padding-bottom: 6px;
+    }
+    span {
+      font-size: 14px;
+      font-weight: 400;
+      text-align: left;
+      color: #ffffff;
+      margin-left: 5px;
+      vertical-align: top;
+    }
+  }
+}
 .flow {
   width: 1750px;
 

+ 43 - 1
src/pages/ysgc/jsDetail/api.js

@@ -32,4 +32,46 @@ export const ysgc_addEvaluate = (data = {}) => {
       }
     }
   })
-}
+}
+
+//点赞
+export const jszp_like_add = (data = {}) =>
+  request({
+    url: '/ysgc/zp_like/add',
+    data: {
+      issubmit: "1",
+      ysgc_zp_like: {
+        yzl_keyword: data.yzl_keyword,
+        yz_id: data.yz_id
+      }
+    }
+  })
+
+export const jszp_like_del = (data = {}) =>
+  request({
+    url: '/ysgc/zp_like/delete',
+    data: {
+      yzl_id: data.yzl_id,
+      yz_id: data.yz_id
+    }
+  })
+//收藏
+export const jszp_fav_add = (data = {}) =>
+  request({
+    url: '/ysgc/zp_fav/add',
+    data: {
+      issubmit: "1",
+      ysgc_zp_fav: {
+        yzf_keyword: data.yzf_keyword,
+        yz_id: data.yz_id
+      }
+    }
+  })
+export const jszp_fav_del = (data = {}) =>
+  request({
+    url: '/ysgc/zp_fav/delete',
+    data: {
+      yzf_id: data.yzf_id,
+      yz_id: data.yz_id
+    }
+  })

+ 116 - 3
src/pages/ysgc/jsDetail/index.vue

@@ -62,12 +62,12 @@
           <div class="coverC" @click="finger">
             <img class="posiA posi1" v-if="fingerSwitch == '0'" src="@/assets/kczy/zanIcon.png" />
             <img class="posiA posi1" v-else src="@/assets/kczy/zanIcon_full.png" />
-            <span class="posiA posi2">{{ detailData.yz_like_num }}1111</span>
+            <span class="posiA posi2">{{ fingerNum}}</span>
           </div>
           <div class="coverC" @click="loveIcon">
             <img class="posiA posi3" v-if="loveSwitch == '0'" src="@/assets/kczy/collectIcon.png" />
             <img class="posiA posi3" v-else src="@/assets/kczy/collectIcon_full.png" />
-            <span class="posiA posi4">{{ detailData.yz_fav_num }}11111</span>
+            <span class="posiA posi4">{{ loveNum}}</span>
           </div>
         </div>
       </div>
@@ -102,7 +102,12 @@
 </template>
 <script>
 import QrcodeVue from "qrcode.vue";
-import { ysgc_detail, ysgc_evaluate, ysgc_addEvaluate } from './api';
+import {
+  ysgc_detail, ysgc_evaluate, ysgc_addEvaluate, jszp_like_add,
+  jszp_like_del,
+  jszp_fav_add,
+  jszp_fav_del,
+} from './api';
 import CommonHeader from "@/components/CommonHeader/index.vue";
 import { getFullUrl, getAvatarUrl } from '@/utils/helper';
 export default {
@@ -126,9 +131,113 @@ export default {
       },
       https: window.GLOBAL_CONFIG.api,
       shareLink: window.location.href,
+      fingerNum: 0, //点赞数
+      fingerSwitch: 0, //0:关 1:开
+      loveNum: 0, //收藏
+      loveSwitch: 0, //0:关 1:开
     }
   },
   methods: {
+    /**增加赞或取消*/
+    finger() {
+      if (this.fingerSwitch == "1") {//去掉赞
+        let transObj = {
+          yz_id: this.yz_id,
+        };
+        jszp_like_del(transObj)
+          .then(res => {
+            if (res.code == "1") {
+              ElMessage({
+                message: res.msg,
+                type: "success",
+              });
+              this.getDetailData();
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: "waring",
+              });
+            }
+
+          })
+          .catch(error => { console.log(error) })
+        this.getDetailData();
+      } else {
+        let transObj = {
+          yz_id: this.yz_id,
+
+        };
+        jszp_like_add(transObj)
+          .then((res) => {
+            if (res.code == "1") {
+              ElMessage({
+                message: res.msg,
+                type: "success",
+              });
+              this.getDetailData();
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: "waring",
+              });
+            }
+          })
+          .catch((error) => {
+            console.log(error);
+          });
+      }
+      this.getDetailData();
+    },
+    /**增加收藏或取消*/
+    loveIcon() {
+      if (this.loveSwitch == 1) {//去掉收藏
+        let transObj = {
+          yz_id: this.yz_id,
+        };
+        jszp_fav_del(transObj)
+          .then(res => {
+            if (res.code == "1") {
+              ElMessage({
+                message: res.msg,
+                type: "success",
+              });
+              this.getDetailData();
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: "waring",
+              });
+            }
+          })
+          .catch(error => {
+            console.log(error)
+          });
+      } else {
+        let transObj = {
+          yz_id: this.yz_id,
+
+        };
+        jszp_fav_add(transObj)
+          .then((res) => {
+            if (res.code == "1") {
+              ElMessage({
+                message: res.msg,
+                type: "success",
+              });
+              this.getDetailData();
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: "waring",
+              });
+            }
+          })
+          .catch((error) => {
+            console.log(error);
+          });
+      }
+      this.getDetailData();
+    },
     //学生作品详情列表
     getDetailData() {
       let data = {
@@ -136,6 +245,10 @@ export default {
       };
       ysgc_detail(data).then((res) => {
         this.detailData = res.data.one_info;
+        this.fingerNum = res.data.one_info.yz_like_num; //点赞数
+        this.fingerSwitch = res.data.one_info.is_like; //0:关 1:开
+        this.loveNum = res.data.one_info.yz_fav_num; //收藏
+        this.loveSwitch = res.data.one_info.is_fav; //0:关 1:开
         console.log(this.detailData, 111);
       });
     },

+ 43 - 1
src/pages/ysgc/stuDetail/api.js

@@ -32,4 +32,46 @@ export const ysgc_addEvaluate = (data = {}) => {
       }
     }
   })
-}
+}
+
+//点赞
+export const xszy_like_add = (data = {}) =>
+  request({
+    url: '/ysgc/zp_like/add',
+    data: {
+      issubmit: "1",
+      ysgc_zp_like: {
+        yzl_keyword: data.yzl_keyword,
+        yz_id: data.yz_id
+      }
+    }
+  })
+
+export const xszy_like_del = (data = {}) =>
+  request({
+    url: '/ysgc/zp_like/delete',
+    data: {
+      yzl_id: data.yzl_id,
+      yz_id: data.yz_id
+    }
+  })
+//收藏
+export const xszy_fav_add = (data = {}) =>
+  request({
+    url: '/ysgc/zp_fav/add',
+    data: {
+      issubmit: "1",
+      ysgc_zp_fav: {
+        yzf_keyword: data.yzf_keyword,
+        yz_id: data.yz_id
+      }
+    }
+  })
+export const xszy_fav_del = (data = {}) =>
+  request({
+    url: '/ysgc/zp_fav/delete',
+    data: {
+      yzf_id: data.yzf_id,
+      yz_id: data.yz_id
+    }
+  })

+ 116 - 3
src/pages/ysgc/stuDetail/index.vue

@@ -61,12 +61,12 @@
           <div class="coverC" @click="finger">
             <img class="posiA posi1" v-if="fingerSwitch == '0'" src="@/assets/kczy/zanIcon.png" />
             <img class="posiA posi1" v-else src="@/assets/kczy/zanIcon_full.png" />
-            <span class="posiA posi2">{{ detailData.yz_like_num }}1111</span>
+            <span class="posiA posi2">{{ fingerNum}}</span>
           </div>
           <div class="coverC" @click="loveIcon">
             <img class="posiA posi3" v-if="loveSwitch == '0'" src="@/assets/kczy/collectIcon.png" />
             <img class="posiA posi3" v-else src="@/assets/kczy/collectIcon_full.png" />
-            <span class="posiA posi4">{{ detailData.yz_fav_num }}11111</span>
+            <span class="posiA posi4">{{ loveNum}}</span>
           </div>
         </div>
       </div>
@@ -102,7 +102,12 @@
 </template>
 <script>
 import QrcodeVue from "qrcode.vue";
-import { ysgc_detail, ysgc_evaluate, ysgc_addEvaluate } from './api';
+import {
+  ysgc_detail, ysgc_evaluate, ysgc_addEvaluate, xszy_like_add,
+  xszy_like_del,
+  xszy_fav_add,
+  xszy_fav_del,
+} from './api';
 import CommonHeader from "@/components/CommonHeader/index.vue";
 export default {
   components: {
@@ -126,9 +131,113 @@ export default {
       },
       https: window.GLOBAL_CONFIG.api,
       shareLink: window.location.href,
+      fingerNum: 0, //点赞数
+      fingerSwitch: 0, //0:关 1:开
+      loveNum: 0, //收藏
+      loveSwitch: 0, //0:关 1:开
     }
   },
   methods: {
+    /**增加赞或取消*/
+    finger() {
+      if (this.fingerSwitch == "1") {//去掉赞
+        let transObj = {
+          yz_id: this.yz_id,
+        };
+        xszy_like_del(transObj)
+          .then(res => {
+            if (res.code == "1") {
+              ElMessage({
+                message: res.msg,
+                type: "success",
+              });
+              this.getDetailData();
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: "waring",
+              });
+            }
+
+          })
+          .catch(error => { console.log(error) })
+        this.getDetailData();
+      } else {
+        let transObj = {
+          yz_id: this.yz_id,
+
+        };
+        xszy_like_add(transObj)
+          .then((res) => {
+            if (res.code == "1") {
+              ElMessage({
+                message: res.msg,
+                type: "success",
+              });
+              this.getDetailData();
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: "waring",
+              });
+            }
+          })
+          .catch((error) => {
+            console.log(error);
+          });
+      }
+      this.getDetailData();
+    },
+    /**增加收藏或取消*/
+    loveIcon() {
+      if (this.loveSwitch == 1) {//去掉收藏
+        let transObj = {
+          yz_id: this.yz_id,
+        };
+        xszy_fav_del(transObj)
+          .then(res => {
+            if (res.code == "1") {
+              ElMessage({
+                message: res.msg,
+                type: "success",
+              });
+              this.getDetailData();
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: "waring",
+              });
+            }
+          })
+          .catch(error => {
+            console.log(error)
+          });
+      } else {
+        let transObj = {
+          yz_id: this.yz_id,
+
+        };
+        xszy_fav_add(transObj)
+          .then((res) => {
+            if (res.code == "1") {
+              ElMessage({
+                message: res.msg,
+                type: "success",
+              });
+              this.getDetailData();
+            } else {
+              ElMessage({
+                message: res.msg,
+                type: "waring",
+              });
+            }
+          })
+          .catch((error) => {
+            console.log(error);
+          });
+      }
+      this.getDetailData();
+    },
     //学生作品详情列表
     getDetailData() {
       let data = {
@@ -136,6 +245,10 @@ export default {
       };
       ysgc_detail(data).then((res) => {
         this.detailData = res.data.one_info;
+        this.fingerNum = res.data.one_info.yz_like_num; //点赞数
+        this.fingerSwitch = res.data.one_info.is_like; //0:关 1:开
+        this.loveNum = res.data.one_info.yz_fav_num; //收藏
+        this.loveSwitch = res.data.one_info.is_fav; //0:关 1:开
         console.log(this.detailData, 111);
       });
     },

+ 1 - 0
src/pages/zhjy/index.vue

@@ -230,6 +230,7 @@ export default {
       width: 700px;
       height: 381px;
       margin-left: 10px;
+      background: #fff;
       // border: 1px solid #000000;
       display: flex;
       flex-direction: column;

+ 3 - 8
yarn.lock

@@ -420,9 +420,9 @@
     "memoize-one" "^6.0.0"
     "normalize-wheel-es" "^1.2.0"
 
-"esbuild-darwin-arm64@0.14.54":
-  "integrity" "sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw=="
-  "resolved" "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz"
+"esbuild-windows-64@0.14.54":
+  "integrity" "sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ=="
+  "resolved" "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz"
   "version" "0.14.54"
 
 "esbuild@^0.14.47", "esbuild@>=0.13":
@@ -529,11 +529,6 @@
     "combined-stream" "^1.0.8"
     "mime-types" "^2.1.12"
 
-"fsevents@~2.3.2":
-  "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="
-  "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
-  "version" "2.3.2"
-
 "function-bind@^1.1.1":
   "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
   "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"