任一存 1 年間 前
コミット
fd63cace49
4 ファイル変更34 行追加16 行削除
  1. 2 1
      .env.dev
  2. 2 1
      .env.test
  3. 24 7
      src/api.js
  4. 6 7
      src/views/CommonDrawList.vue

+ 2 - 1
.env.dev

@@ -1,4 +1,5 @@
 VUE_APP_CLI_MODE=dev
 NODE_ENV=development
 PUBLIC_PATH=/
-VUE_APP_OUTER_ASSETS_PREFIX=https://culture.4dage.com/LiangZhu/
+VUE_APP_OUTER_ASSETS_PREFIX=https://culture.4dage.com/LiangZhu/
+VUE_APP_API_PREFIX=http://192.168.20.61:8056/api/show/

+ 2 - 1
.env.test

@@ -1,4 +1,5 @@
 VUE_APP_CLI_MODE=test
 NODE_ENV=production
 PUBLIC_PATH=./
-VUE_APP_OUTER_ASSETS_PREFIX=/LiangZhu/
+VUE_APP_OUTER_ASSETS_PREFIX=/LiangZhu/
+VUE_APP_API_PREFIX=http://192.168.20.61:8056/api/show/

+ 24 - 7
src/api.js

@@ -14,13 +14,30 @@ import axios from "axios"
 // })
 
 export default {
-  getViewCount(idx) {
-    return Promise.resolve(625)
-  },
-  getLikeCount(idx) {
-    return Promise.resolve(125)
+  reportVisit(idx) {
+    return axios({
+      method: 'post',
+      url: `${process.env.VUE_APP_API_PREFIX}addVisit`,
+      headers: {
+        "Content-Type": "application/json",
+      },
+      data: {
+        id: idx,
+        type: 'visit',
+      },
+    })
   },
   like(idx) {
-    return Promise.resolve(true)
-  }
+    return axios({
+      method: 'post',
+      url: `${process.env.VUE_APP_API_PREFIX}addVisit`,
+      headers: {
+        "Content-Type": "application/json",
+      },
+      data: {
+        id: idx,
+        type: 'star',
+      },
+    })
+  },
 }

+ 6 - 7
src/views/CommonDrawList.vue

@@ -159,15 +159,14 @@ function closeViewer() {
   viewer.hide()
 }
 
-const viewCount = ref(null)
-api.getViewCount(route.query.idx - 1).then((res) => {
-  viewCount.value = res
+api.reportVisit(Number(route.query.idx)).then((res) => {
+  console.log('sdfsdf', res)
 })
 
 const likeCount = ref(null)
-api.getLikeCount(route.query.idx - 1).then((res) => {
-  likeCount.value = res
-})
+// api.getLikeCount(route.query.idx - 1).then((res) => {
+//   likeCount.value = res
+// })
 const hasLiked = computed(() => {
   return likeRecord.value[route.query.idx - 1]
 })
@@ -179,7 +178,7 @@ function onClickLike(e) {
   api.like(route.query.idx - 1)
   setTimeout(() => {
     utils.animateCSS(e.target, 'heartBeat')
-  }, 0)
+  }, 100)
 }
 
 const drawUlEl = ref(null)