Bläddra i källkod

token取值方式更改

ydf 1 år sedan
förälder
incheckning
75e3f44951

+ 4 - 2
src/views/InformationAudit/enterWarehouseAudit/detail.vue

@@ -102,6 +102,8 @@ import { useRouter, useRoute } from "vue-router";
102 102
 import { useDict } from "@/hooks/dict";
103 103
 // import { closeTagAndOpenLastTag } from '@/router/Routermethods';
104 104
 import store from "@/store";
105
+import { useGetters } from "@/hooks/storeHooks";
106
+const { access_token } = useGetters(["access_token"])
105 107
 
106 108
 const { indound_type, is_available } = useDict("indound_type", "is_available");
107 109
 const router = useRouter();
@@ -111,7 +113,7 @@ const data = reactive({
111 113
   auditData: [],
112 114
   isShow: false,
113 115
   fileUrl: "/admin/sysFile/uploadVoucher",
114
-  myHeader: { Authorization: "Bearer " + sessionStorage.getItem("access_token") }
116
+  myHeader: { Authorization: "Bearer " + access_token.value }
115 117
 });
116 118
 let page = reactive({
117 119
   currentPage: 1,
@@ -240,7 +242,7 @@ const fileDownload = (filePart: any, fileName: string) => {
240 242
   var xhr = new XMLHttpRequest();
241 243
   var formData = new FormData();
242 244
   xhr.open("get", "/admin/sysFile/" + filePart);
243
-  xhr.setRequestHeader("Authorization", "Bearer " + sessionStorage.getItem("access_token"));
245
+  xhr.setRequestHeader("Authorization", "Bearer " + access_token.value);
244 246
   xhr.responseType = "blob";
245 247
   xhr.onload = function (e) {
246 248
     if (this.status == 200) {

+ 4 - 2
src/views/InformationAudit/outWarehouseAudit/detail.vue

@@ -107,6 +107,8 @@ import { useRouter, useRoute } from "vue-router";
107 107
 import { useDict } from "@/hooks/dict";
108 108
 import { closeTagAndOpenLastTag } from "@/router/Routermethods";
109 109
 import store from "@/store";
110
+import { useGetters } from "@/hooks/storeHooks";
111
+const { access_token } = useGetters(["access_token"])
110 112
 
111 113
 const { outdound_type, is_available, province_ch } = useDict("outdound_type", "is_available", "province_ch");
112 114
 
@@ -117,7 +119,7 @@ const data = reactive({
117 119
   auditData: [],
118 120
   isShow: false,
119 121
   fileUrl: "/admin/sysFile/uploadVoucher",
120
-  myHeader: { Authorization: "Bearer " + sessionStorage.getItem("access_token") }
122
+  myHeader: { Authorization: "Bearer " + access_token.value }
121 123
 });
122 124
 let page = reactive({
123 125
   currentPage: 1,
@@ -243,7 +245,7 @@ const fileDownload = (filePart: any, fileName: string) => {
243 245
   var xhr = new XMLHttpRequest();
244 246
   var formData = new FormData();
245 247
   xhr.open("get", "/admin/sysFile/" + filePart);
246
-  xhr.setRequestHeader("Authorization", "Bearer " + sessionStorage.getItem("access_token"));
248
+  xhr.setRequestHeader("Authorization", "Bearer " + access_token.value);
247 249
   xhr.responseType = "blob";
248 250
   xhr.onload = function (e) {
249 251
     if (this.status == 200) {

+ 3 - 1
src/views/InformationFilling/enterWarehouseInfo/detail.vue

@@ -140,6 +140,8 @@ import { useDict } from "@/hooks/dict";
140 140
 // import { closeTagAndOpenLastTag } from '@/router/Routermethods';
141 141
 import store from "@/store";
142 142
 import { getQuery } from "@/hooks/detailQuery/index";
143
+import { useGetters } from "@/hooks/storeHooks";
144
+const { access_token } = useGetters(["access_token"])
143 145
 const { indound_type, is_available, province_ch } = useDict("indound_type", "is_available", "province_ch");
144 146
 
145 147
 // const props = defineProps(['id','type'])
@@ -257,7 +259,7 @@ const fileUrl = "/admin/sysFile/uploadVoucher";
257 259
 let paramsData = reactive({
258 260
   bucket: "bound"
259 261
 });
260
-const myHeader = { Authorization: "Bearer " + sessionStorage.getItem("access_token") };
262
+const myHeader = { Authorization: "Bearer " + access_token.value };
261 263
 // 附件相关
262 264
 const getFileInfo = (res: any, file: any, index: number) => {
263 265
   tableData.value[index].filePart = res.data.fileName;

+ 3 - 1
src/views/InformationFilling/outIssue/detail.vue

@@ -161,6 +161,8 @@ import { useDict } from "@/hooks/dict";
161 161
 import { getQuery } from "@/hooks/detailQuery/index";
162 162
 // import { closeTagAndOpenLastTag } from '@/router/Routermethods';
163 163
 import store from "@/store";
164
+import { useGetters } from "@/hooks/storeHooks";
165
+const { access_token } = useGetters(["access_token"])
164 166
 
165 167
 const { outdound_type, is_available, province_ch } = useDict("outdound_type", "is_available", "province_ch");
166 168
 
@@ -299,7 +301,7 @@ const fileUrl = "/admin/sysFile/uploadVoucher";
299 301
 let paramsData = reactive({
300 302
   bucket: "bound"
301 303
 });
302
-const myHeader = { Authorization: "Bearer " + sessionStorage.getItem("access_token") };
304
+const myHeader = { Authorization: "Bearer " + access_token.value };
303 305
 // 附件相关
304 306
 const getFileInfo = (res: any, file: any, index: number) => {
305 307
   tableData.value[index].filePart = res.data.fileName;

+ 3 - 1
src/views/InformationFilling/outWarehouseInfo/detail.vue

@@ -155,6 +155,8 @@ import { useDict } from "@/hooks/dict";
155 155
 import { getQuery } from "@/hooks/detailQuery/index";
156 156
 // import { closeTagAndOpenLastTag } from '@/router/Routermethods';
157 157
 import store from "@/store";
158
+import { useGetters } from "@/hooks/storeHooks";
159
+const { access_token } = useGetters(["access_token"])
158 160
 
159 161
 const { outdound_type, is_available, province_ch } = useDict("outdound_type", "is_available", "province_ch");
160 162
 
@@ -277,7 +279,7 @@ const fileUrl = "/admin/sysFile/uploadVoucher";
277 279
 let paramsData = reactive({
278 280
   bucket: "bound"
279 281
 });
280
-const myHeader = { Authorization: "Bearer " + sessionStorage.getItem("access_token") };
282
+const myHeader = { Authorization: "Bearer " + access_token.value };
281 283
 // 附件相关
282 284
 const getFileInfo = (res: any, file: any, index: number) => {
283 285
   tableData.value[index].filePart = res.data.fileName;

+ 3 - 1
src/views/basic/basicIndex/index.vue

@@ -96,6 +96,8 @@ import { useDict } from "@/hooks/dict";
96 96
 const { warehouse_type } = useDict("warehouse_type");
97 97
 import { ElMessage } from "element-plus";
98 98
 import { sysFile } from "@/api/inAndOut/formationFilling/in";
99
+import { useGetters } from "@/hooks/storeHooks";
100
+const { access_token } = useGetters(["access_token"])
99 101
 
100 102
 const formSize = ref("default");
101 103
 const ruleFormRef = ref<FormInstance>();
@@ -201,7 +203,7 @@ const resetForm = (formEl: FormInstance | undefined) => {
201 203
 
202 204
 /*----------------------库区图-----------------*/
203 205
 //附件部分
204
-const myHeader = { Authorization: "Bearer " + sessionStorage.getItem("access_token") };
206
+const myHeader = { Authorization: "Bearer " + access_token.value };
205 207
 const fileUrl = "/admin/sysFile/uploadVoucher";
206 208
 let paramsData = reactive({
207 209
   bucket: "bound"