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

C端数字史馆:点赞时先检查登录态

任一存 3 éve
szülő
commit
45d11e117a
1 módosított fájl, 13 hozzáadás és 7 törlés
  1. 13 7
      web/src/views/scene/gui/menu.vue

+ 13 - 7
web/src/views/scene/gui/menu.vue

@@ -281,7 +281,7 @@
 </template>
 
 <script>
-
+import { checkLogin } from "@/config/api";
 import { getStar,dianzan  } from "@/config/api";
 
 let menuli = [
@@ -401,12 +401,18 @@ export default {
     },
     handleLike(){
       if (this.isShowGood) return
-      this.isShowGood = true
-      dianzan(()=>{
-        setTimeout(() => {
-          this.isShowGood = false
-          this.likeNum++
-        }, 2500);
+      checkLogin(res => {
+        if (res.data) {
+          dianzan(()=>{
+            this.isShowGood = true
+            setTimeout(() => {
+              this.isShowGood = false
+              this.likeNum++
+            }, 2500);
+          })
+        } else {
+          alert('请登录后操作')
+        }
       })
     },
     getStar(){