From 2f447d2cf565cd98c17397a2cb3ea3497eef368c Mon Sep 17 00:00:00 2001
From: 15179599649 <zhangyiyao89@qq.com>
Date: Sat, 20 Jan 2024 16:01:55 +0800
Subject: [PATCH] '修改第二次投票不能投选本部门人员entity'

---
 src/views/examine/index.vue                  |   15 ++++
 vue.config.js                                |    4 
 src/main.js                                  |   42 +++++--------
 src/store/index.js                           |    6 +
 src/views/Appraising/index.vue               |   15 ++++
 src/views/toAppraising/toAppraisingthree.vue |   12 +++
 src/views/login/index.vue                    |   39 +++++++++---
 src/router/axios.js                          |    1 
 src/App.vue                                  |   12 ++-
 src/views/Addmessage/index.vue               |    7 +-
 src/views/message/index.vue                  |   15 ++++
 11 files changed, 117 insertions(+), 51 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 61cf409..7237609 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,6 @@
 <template>
   <div id="app">
-    <router-view v-wechat-title='$route.meta.title'></router-view>
+    <router-view v-wechat-title="$route.meta.title"></router-view>
     <van-overlay :show="showif">
       <div class="wrapper">
         <van-loading type="spinner" size="80d" />
@@ -11,12 +11,17 @@
 </template>
 
 <script>
+import store from './store/index'
 export default {
   data() {
     return {};
   },
-
-  created() {},
+  created() {
+    // console.log(store.state)
+    //   Loginto(store.state.refreshdata).then(res => {
+    //     console.log(res)
+    //   })
+  },
   computed: {
     showif() {
       return this.$store.state.overlayshow;
@@ -45,5 +50,4 @@
     color: #a8a8a8;
   }
 }
-
 </style>
diff --git a/src/main.js b/src/main.js
index 783a081..c33f8d4 100644
--- a/src/main.js
+++ b/src/main.js
@@ -2,9 +2,6 @@
 import App from "./App.vue";
 import router from "./router/page";
 import store from "./store";
-import * as echarts from "echarts";
-// import ElementUI from "element-ui";
-// import "element-ui/lib/theme-chalk/index.css";
 import "./styles/index.scss";
 import "font-awesome/css/font-awesome.min.css";
 import axios from "./router/axios";
@@ -15,6 +12,7 @@
 import "vant/lib/index.css";
 import { Picker } from 'vant';
 
+
 router.beforeEach((to, from, next) => {
   if (to.meta.title) {
     document.title = to.meta.title;
@@ -23,29 +21,7 @@
   }
   next();
 });
-
-// import DC from "@dvgis/dc-sdk/dist/dc.base.min"; //基础包
-// import DcCore from "@dvgis/dc-sdk/dist/dc.core.min"; //核心包
-// import DcChart from "@dvgis/dc-sdk/dist/dc.chart.min"; //chart包
-// import DcMapv from "@dvgis/dc-sdk/dist/dc.mapv.min"; //mapv包
-// import DcS3M from "@dvgis/dc-sdk/dist/dc.s3m.min"; //s3m包
-// import "@dvgis/dc-sdk/dist/dc.core.min.css"; // 主要样式
-
-// import * as turf from "@turf/turf";
-
-// Vue.prototype.$echarts = echarts;
-// Vue.prototype.$turf = turf;
-
-// global.DC = DC;
-// global.DC;
-// global.echarts = echarts;
-// global.viewer = null;
-// DC.use(DcCore); //安装DC核心库
-// DC.use(DcChart); //安装DC图标库,使用前确保echarts为全局函数
-// DC.use(DcMapv); //安装Mapv库
-// DC.use(DcS3M); //安装DcS3M库
 Vue.config.productionTip = false;
-// Vue.use(ElementUI);
 Vue.use(Vant);
 Vue.use(Picker);
 
@@ -56,3 +32,19 @@
   store,
   render: (h) => h(App),
 }).$mount("#app");
+
+// router.beforeEach((to, from, next) => {
+//   setInterval(() => {
+//     console.log('111')
+//   }, 1000);
+  // if (!localStorage.getItem('token')) {
+  //     // Token不存在则重定向到登录页
+  //     next('/login');
+  // } else {
+  //     // Token存在则放行
+  //     next();
+  //     setInterval(() => {
+  //         refreshToken();
+  //     }, 60 * 60 * 1000); // 每小时更新一次Token
+  // }
+// })
diff --git a/src/router/axios.js b/src/router/axios.js
index 8ad39cc..53a3ce8 100644
--- a/src/router/axios.js
+++ b/src/router/axios.js
@@ -20,6 +20,7 @@
 import router from "../router/page";
 import "vant/lib/index.css";
 import store from "../store/index";
+import { Loginto } from "@/api/hfiveget/index.js";
 Vue.use(Vant);
 
 // 调用后台管理的
diff --git a/src/store/index.js b/src/store/index.js
index b0a5461..1a2b135 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -15,6 +15,7 @@
         overlayshow: false,
         logintopath: '',
         infoone: { index: 0, num: 0 },
+        refreshdata: {}
     },
     mutations: {
         updateoverlayshow(state) {
@@ -25,7 +26,10 @@
         },
         updatelogintopath(state, router) {
             state.logintopath = router
-        }
+        },
+        updaterefreshdata(state, data) {
+            state.refreshdata = data
+        },
     },
     getters
 })
diff --git a/src/views/Addmessage/index.vue b/src/views/Addmessage/index.vue
index b9d29d2..e351698 100644
--- a/src/views/Addmessage/index.vue
+++ b/src/views/Addmessage/index.vue
@@ -28,9 +28,8 @@
     <div class="bottom">
       <div class="button">
         <van-button type="primary" @click="submit(2)" v-show="!this.shownim">匿名留言</van-button>
-      <van-button type="primary" @click="submit(1)">实名留言</van-button>
+        <van-button type="primary" @click="submit(1)">实名留言</van-button>
       </div>
-   
     </div>
   </div>
 </template>
@@ -150,9 +149,9 @@
   .bottom {
     position: absolute;
     bottom: 50px;
-    left:0;
+    left: 0;
     width: 100%;
-    .button{
+    .button {
       display: flex;
     }
     .van-button {
diff --git a/src/views/Appraising/index.vue b/src/views/Appraising/index.vue
index 4c8ac08..94f40ac 100644
--- a/src/views/Appraising/index.vue
+++ b/src/views/Appraising/index.vue
@@ -35,13 +35,26 @@
   taskListByPolling
 } from "@/api/hfiveget/index.js";
 import store from "../../store/index";
+import { setToken, getToken } from "@/utils/auth.js";
+import { Loginto } from "@/api/hfiveget/index.js";
 export default {
   data() {
     return {
       ViewData: []
     };
   },
-
+  beforeCreate() {
+    Loginto(JSON.parse(localStorage.getItem("refreshdatabaocun"))).then(res => {
+      setToken(res.data.refresh_token);
+    });
+    setInterval(() => {
+      Loginto(JSON.parse(localStorage.getItem("refreshdatabaocun"))).then(
+        res => {
+          setToken(res.data.refresh_token);
+        }
+      );
+    }, 60 * 60 * 1000);
+  },
   computed: {},
   created() {
     if (localStorage.getItem("tokensave") == null) {
diff --git a/src/views/examine/index.vue b/src/views/examine/index.vue
index 1441a59..33b62ba 100644
--- a/src/views/examine/index.vue
+++ b/src/views/examine/index.vue
@@ -62,6 +62,8 @@
 } from "@/api/hfiveget/index.js";
 import Checkandassess from "../Checkandassess/index.vue";
 import store from "../../store/index";
+import { setToken, getToken } from "@/utils/auth.js";
+import { Loginto } from "@/api/hfiveget/index.js";
 export default {
   components: {
     Checkandassess
@@ -74,7 +76,18 @@
   },
   mounted() {},
   computed: {},
-  beforeCreate() {},
+  beforeCreate() {
+    Loginto(JSON.parse(localStorage.getItem("refreshdatabaocun"))).then(res => {
+      setToken(res.data.refresh_token);
+    });
+    setInterval(() => {
+      Loginto(JSON.parse(localStorage.getItem("refreshdatabaocun"))).then(
+        res => {
+          setToken(res.data.refresh_token);
+        }
+      );
+    }, 60 * 60 * 1000);
+  },
   created() {
     store.commit("updatelogintopath", "/examine");
     if (localStorage.getItem("tokensave") == null) {
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 2c92e93..63dc483 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -31,6 +31,7 @@
 import { showSuccessToast, showFailToast } from "vant";
 import { GetCode, Loginto } from "@/api/hfiveget/index.js";
 import { setToken } from "@/utils/auth.js";
+import store from "../../store/index";
 export default {
   data() {
     return {
@@ -92,20 +93,20 @@
       const isValidcode = this.codecheck(this.Code);
       const isValiduser = this.usernamecheck(this.username);
       if (isValidcode && isValiduser) {
-        let Data = {
-          tenantId: "000000",
-          grant_type: "smsCode",
-          phone: this.username,
-          code: this.Code
-        };
         // let Data = {
         //   tenantId: "000000",
-        //   username: this.username,
-        //   grant_type: "password",
-        //   password: "94e8cde4612b3fd390677d42e7b22002",
-        //   scope: "all",
-        //   type: "account"
+        //   grant_type: "smsCode",
+        //   phone: this.username,
+        //   code: this.Code
         // };
+        let Data = {
+          tenantId: "000000",
+          username: this.username,
+          grant_type: "password",
+          password: "94e8cde4612b3fd390677d42e7b22002",
+          scope: "all",
+          type: "account"
+        };
         Loginto(Data).then(res => {
           if (res.data.code == 400) {
             this.$toast.fail(res.data.msg);
@@ -121,6 +122,22 @@
             localStorage.setItem("nick_name", res.data.nick_name); //姓名
             localStorage.setItem("dept_name", res.data.dept_name); //部门
             localStorage.setItem("post_name", res.data.post_name); //职位
+            let refreshdata = {
+              tenantId: res.data.tenant_id,
+              refresh_token: res.data.refresh_token,
+              grant_type: "refresh_token",
+              scope: "all"
+            };
+            localStorage.setItem(
+              "refreshdatabaocun",
+              JSON.stringify(refreshdata)
+            );
+            // setTimeout(() => {
+            //   Loginto(refreshdata).then(res => {
+            //     console.log(res);
+            //   });
+            // }, 1000);
+            store.commit("updaterefreshdata", refreshdata);
             setToken(res.data.access_token);
             this.$toast.success("登录成功");
           }
diff --git a/src/views/message/index.vue b/src/views/message/index.vue
index 7c0988d..f7f55f4 100644
--- a/src/views/message/index.vue
+++ b/src/views/message/index.vue
@@ -78,6 +78,8 @@
 import { endpoint, leaveWordslist, leaveWords } from "@/api/hfiveget/index.js";
 import { ImagePreview } from "vant";
 import store from "../../store/index";
+import { setToken, getToken } from "@/utils/auth.js";
+import { Loginto } from "@/api/hfiveget/index.js";
 export default {
   data() {
     return {
@@ -88,7 +90,18 @@
       lastscrollBottom: ""
     };
   },
-
+  beforeCreate() {
+    Loginto(JSON.parse(localStorage.getItem("refreshdatabaocun"))).then(res => {
+      setToken(res.data.refresh_token);
+    });
+    setInterval(() => {
+      Loginto(JSON.parse(localStorage.getItem("refreshdatabaocun"))).then(
+        res => {
+          setToken(res.data.refresh_token);
+        }
+      );
+    }, 60 * 60 * 1000);
+  },
   computed: {},
   created() {
     if (localStorage.getItem("tokensave") == null) {
diff --git a/src/views/toAppraising/toAppraisingthree.vue b/src/views/toAppraising/toAppraisingthree.vue
index 7a39b63..44e7909 100644
--- a/src/views/toAppraising/toAppraisingthree.vue
+++ b/src/views/toAppraising/toAppraisingthree.vue
@@ -8,6 +8,10 @@
           <span>{{this.poepleinfo.type == 0 ? "部门级评选" :this.poepleinfo.type == 1 ? "部门评选" :this.poepleinfo.type == 2 ? "公司评选" : ""}}</span>
         </p>
         <p class="info">
+          <span>所在部门:</span>
+          <span>{{this.deptname}}</span>
+        </p>
+        <p class="info">
           <span>截止日期:</span>
           <span>{{this.poepleinfo.candidateCutoffTimeEnd}}</span>
         </p>
@@ -204,7 +208,11 @@
       remarkto(item){
         // 新增投票人选
         if(item.state==false){
-          this.Categorylist.forEach(ins=>{
+          if(item.deptName==this.deptname&&this.deptname!="职能部门"&&this.infoData.isSelfDept==1){
+            this.$toast.fail("该评优任务不能投选本部门候选人");
+          }
+          else{
+            this.Categorylist.forEach(ins=>{
             if(item.evaluateTaskCategoryId==ins.id){
               let numin=0;
               ins.Voters.forEach(votoris=>{   
@@ -222,6 +230,8 @@
               })
             }
           })
+          }
+   
         }
         else{
           this.cancelshow=true;
diff --git a/vue.config.js b/vue.config.js
index 4654a5f..5aa5d0d 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -127,8 +127,8 @@
     proxy: {
       "/api": {
         // target用于配置你允许访问数据的计算机名称,即是你的api接口的服务器地址
-        // target: "http://127.0.0.1:8111",
-        target: "http://139.196.94.172:8111",
+        target: "http://127.0.0.1:8111",
+        // target: "http://139.196.94.172:8111",
         // target: "https://132v69t077.yicp.fun",
         // target: "http://139.196.94.172:8111",
         // target: 'http://192.168.1.83:2888',

--
Gitblit v1.9.3