diff --git a/common/http.js b/common/http.js index 87822b4..489088c 100644 --- a/common/http.js +++ b/common/http.js @@ -1,4 +1,5 @@ const baseUrl = 'http://219.146.91.110:30801/mz-api'; + const token = uni.getStorageSync('token') || store.state.user.token; export const request = (options) => { return new Promise((resolve, reject) => { uni.request({ @@ -7,7 +8,7 @@ export const request = (options) => { data: options.data || {}, // 请求参数 header: { 'Content-Type': 'application/json', - Authorization: uni.getStorageSync('token') || '', // 携带 Token + Authorization: token ? `Bearer ${token}` : "", // 携带 Token }, success: (res) => { if (res.statusCode === 200) { diff --git a/pagesA/xjPage/xj.vue b/pagesA/xjPage/xj.vue index 871fb92..95f13ca 100644 --- a/pagesA/xjPage/xj.vue +++ b/pagesA/xjPage/xj.vue @@ -287,7 +287,7 @@ export default { 2 ); console.log(this.deptOptions, "this.deptOptions"); - const deptInfo = this.deptOptions[0].children[0]; + // const deptInfo = this.deptOptions[0].children[0]; const newArr = this.deptOptions.map((item) => ({ name: item.deptName, }));