liyongli hace 3 años
padre
commit
6fea383787
Se han modificado 1 ficheros con 24 adiciones y 14 borrados
  1. 24 14
      src/pages/vote/Index.vue

+ 24 - 14
src/pages/vote/Index.vue

@@ -4,9 +4,13 @@
     ref="votePage"
     @scroll="scroll"
   >
-    <img :src="'https://djweb.smcic.net/static/img/vote.jpg?t='+t" alt="" srcset="" />
+    <img
+      :src="'https://djweb.smcic.net/static/img/vote.jpg?t=' + t"
+      alt=""
+      srcset=""
+    />
     <div ref="vote" class="vote">
-      <van-checkbox-group v-model="checkboxGroup">
+      <van-checkbox-group v-model="checkboxGroup" :max="config.VOTE_MAX">
         <van-cell-group>
           <van-cell
             :label="voteLabel(item)"
@@ -79,6 +83,8 @@ import "vant/lib/progress/style";
 import "vant/lib/checkbox-group/style";
 
 import { voteList, saveVote, isVote } from "@/api/vote/vote.js";
+import { sysConfig } from "@/api/user/user.js";
+
 import { isIphone, isAndroid } from "@/utils/isTerminal.js";
 import { setToken } from "@/utils/common.js";
 
@@ -96,8 +102,9 @@ export default {
       show: false,
       doc: "",
       appName: "",
+      config: {},
       disable: false,
-      t: new Date().getTime()
+      t: Date.now()
     };
   },
   methods: {
@@ -219,12 +226,12 @@ export default {
       if (this.$user) setToken(this.$user.accessToken);
       else setToken("");
       this.$user.accessToken &&
-      isVote().then(res => {
-        this.disable = (res || []).length !== 0;
-        this.checkboxGroup = (res || []).map(v => v.infoId);
-        console.log(res);
-        this.addList();
-      });
+        isVote().then(res => {
+          this.disable = (res || []).length !== 0;
+          this.checkboxGroup = (res || []).map(v => v.infoId);
+          console.log(res);
+          this.addList();
+        });
       if (!this.$user.accessToken) {
         this.addList();
       }
@@ -233,9 +240,12 @@ export default {
     let height = document.body.offsetHeight || 0;
     let width = document.body.offsetWidth || 0;
     this.$refs.vote.style.minHeight = height - (856 / 1500) * width + "px";
+
+    sysConfig().then(r => {
+      this.config = r || {};
+    });
   },
-  beforeDestroy: function() {
-  },
+  beforeDestroy: function() {},
   components: {
     vanPopup,
     vanIcon,
@@ -279,9 +289,9 @@ $themeColor: #e6837c;
     padding: 1em 0;
     bottom: 0;
     background-image: linear-gradient(
-        0deg,
-        rgba(170, 170, 170, 0.8) 5%,
-        rgba(0, 0, 0, 0)
+      0deg,
+      rgba(170, 170, 170, 0.8) 5%,
+      rgba(0, 0, 0, 0)
     );
   }