bd 3 年之前
父節點
當前提交
c629b0a987
共有 4 個文件被更改,包括 36 次插入25 次删除
  1. 8 5
      src/api/htgj/http.js
  2. 9 6
      src/router/index.js
  3. 4 2
      src/store/index.js
  4. 15 12
      src/views/htgj/report.vue

+ 8 - 5
src/api/htgj/http.js

@@ -33,13 +33,16 @@ _axios.interceptors.request.use(
     let data = store.state.userData;
 
     if (config.method == "get") {
-      config.params.UserName = data.name;
-      config.params.Sign = data.sign;
+      config.params.CompanyCode = data.CompanyCode;
+      config.params.CompanyName = data.CompanyName;
+      config.params.Email = data.Email;
+      config.params.Sign = data.Sign;
     } else {
-      config.data.UserName = data.name;
-      config.data.Sign = data.sign;
+      config.data.CompanyCode = data.CompanyCode;
+      config.data.CompanyName = data.CompanyName;
+      config.data.Email = data.Email;
+      config.data.Sign = data.Sign;
     }
-
     return config;
   },
   function (error) {

+ 9 - 6
src/router/index.js

@@ -24,13 +24,16 @@ const router = createRouter({
 
 router.beforeEach((to, from, next) => {
   if (to.fullPath.includes("htgj")) {
+    console.log(to.query);
     let data = {
-        name: to.query.userName,
-        sign: to.query.sign,
-      }
-      if(!store.state.userData.name || !store.state.userData.sign){
-        store.commit("getUserData", data);
-      }
+      CompanyCode: to.query.CompanyCode, //编码
+      CompanyName: to.query.CompanyName, // 名称
+      Email: to.query.Email, //邮箱
+      Sign: to.query.Sign, //签名
+    };
+    if (!store.state.userData.CompanyCode || !store.state.userData.CompanyName || !store.state.userData.Email || !store.state.userData.Sign) {
+      store.commit("getUserData", data);
+    }
   }
   next();
 });

+ 4 - 2
src/store/index.js

@@ -3,8 +3,10 @@ import { createStore, Store } from "vuex";
 const store = createStore({
   state: {
     userData: {
-      name: "",
-      sign: null,
+      CompanyCode: "",
+      CompanyName: "",
+      Email: "",
+      Sign: null,
     },
   },
   mutations: {

+ 15 - 12
src/views/htgj/report.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="container-cygx" v-if="haveData" :class="reportInfo.IsResearch ? 'no-cv' : ''">
+  <div class="container-cygx" @copy="copyMonitor" v-if="haveData == 1" :class="reportInfo.IsResearch ? 'no-cv' : ''">
     <canvas id="tutorial" ref="tutorial"></canvas>
     <div class="search">
       <div class="search-box" @click="btnSearch">
@@ -37,13 +37,19 @@
   </div>
   <div v-else class="nodata">
     <img src="@/assets/cygx/noauth.png" mode="" class="nodata_ico" />
-    <p>您的试用权限已到期</p>
-    <p>若想继续试用,请联系销售</p>
+    <div v-if="haveData == 2">
+      <p>您暂无权限查看报告</p>
+      <p>若想查看可联系销售开通试用权限</p>
+    </div>
+    <div v-else>
+      <p>您的试用权限已到期</p>
+      <p>若想继续试用,请联系销售</p>
+    </div>
   </div>
 </template>
 
 <script setup>
-import { reactive, onMounted, toRefs, ref ,onUnmounted } from "vue";
+import { reactive, onMounted, toRefs, ref, onUnmounted } from "vue";
 import { useRouter, useRoute } from "vue-router";
 import { RaiApi } from "@/api/htgj/api.js";
 import { Icon, Dialog, Toast } from "vant";
@@ -56,7 +62,7 @@ const state = reactive({
   reportInfo: {},
 });
 const rerportId = ref(null);
-const haveData = ref(true);
+const haveData = ref(1);
 const fileLink = ref(false);
 const showTips = ref(false);
 const tutorial = ref(null);
@@ -80,7 +86,7 @@ const scrolltop = () => {
 /* 复制 */
 const copyMonitor = () => {
   RaiApi.pageHistoryCopy({
-    DetailId: rerportId.value + ""
+    DetailId: rerportId.value + "",
   }).then((res) => {});
 };
 
@@ -102,7 +108,7 @@ const waterMark = (text) => {
 
 //点击回到搜索页面
 const btnSearch = () => {
- router.push('search')
+  router.push("search");
 };
 
 const timeState = reactive({
@@ -116,7 +122,7 @@ const getReport = (id) => {
     ArticleId: id,
   }).then((res) => {
     if (res.Ret === 200) {
-      haveData.value = res.Data.HasPermission === 1 ? true : false;
+      haveData.value = res.Data.HasPermission;
       if (res.Data.HasPermission === 1) {
         //有访问权限
         state.reportInfo = res.Data.Detail;
@@ -148,14 +154,11 @@ onMounted(() => {
   if (route.query.id) {
     rerportId.value = route.query.id;
     getReport(rerportId.value);
-    document.addEventListener("copy", (e) => {
-      copyMonitor();
-    });
   }
 });
 onUnmounted(() => {
   clearInterval(timeState.setIntervalTiem);
-  if (!rerportId.value || !haveData.value) return;
+  if (!rerportId.value || haveData.value !== 1) return;
   RaiApi.addStopTime({
     ArticleId: Number(rerportId.value),
     StopTime: timeState.readTiem,