diff --git a/dist.zip b/dist.zip new file mode 100644 index 00000000..ff42f1b9 Binary files /dev/null and b/dist.zip differ diff --git a/src/App.vue b/src/App.vue index 63fa31ce..f6028c22 100644 --- a/src/App.vue +++ b/src/App.vue @@ -89,6 +89,7 @@ export default defineComponent({ }); }; orgTree(); + return { routes, name: currentRouteName, diff --git a/src/api/config.js b/src/api/config.js index c045783a..3562efbb 100644 --- a/src/api/config.js +++ b/src/api/config.js @@ -2,11 +2,12 @@ * @Author: lixg lixg@dongwu-inc.com * @Date: 2022-11-21 14:32:52 * @LastEditors: lixg lixg@dongwu-inc.com - * @LastEditTime: 2022-11-23 09:59:26 + * @LastEditTime: 2022-11-25 17:33:03 * @FilePath: /fe-manage/src/api/config.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ import axios from "axios"; +// import { getCookie } from '../api/method' // const Qs = require("qs"); // axios.defaults.headers.post["Content-Type"] = @@ -24,15 +25,16 @@ const http = axios.create({ http.interceptors.request.use( (config) => { const token = localStorage.getItem("token"); + // const token = getCookie('token') + // console.log('token', token) if (token) { - // config.headers.token = token; config.headers.token = token; //测试1111 } else { console.log("当前请求页面无token,请执行操作!!!"); // 此处测试默认配置token config.headers.token = "123456"; - // config.headers.token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NjkyMTE4MzMsImV4cCI6MTY2OTIxOTAzMywiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.40067eca3be5d50857448005a673cbe1a48f560ff8e9c7aea4e7ff12f59c7962"; + // config.headers.token = "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NjkzMDA4MDksImV4cCI6MTY2OTMwODAwOSwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.bb3e0e031513761003d5c3bfeaf16e364bdf8fe7bc4cf691a05a74dc454afbfb"; } return config; }, @@ -44,12 +46,15 @@ http.interceptors.request.use( http.interceptors.response.use( (response) => { + // console.log('response', response) const { data: { code, msg }, } = response; + // console.log('code', code) if (code === 0 || code === 200) { return response; } else { + // window.open("https://u-pre.boe.com/web/", '_self'); console.log("api %o", msg); } return response; diff --git a/src/api/index1.js b/src/api/index1.js index be062ef2..43c80689 100644 --- a/src/api/index1.js +++ b/src/api/index1.js @@ -2,13 +2,13 @@ * @Author: lixg lixg@dongwu-inc.com * @Date: 2022-11-04 22:45:31 * @LastEditors: lixg lixg@dongwu-inc.com - * @LastEditTime: 2022-11-24 15:11:25 + * @LastEditTime: 2022-11-25 14:56:59 * @FilePath: /fe-manage/src/api/index1.js * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ import http from "./config"; import qs from "qs"; - +// import { getCookie } from '../api/method' /** * 接口传参数方式(get) * axios.get('/user', { @@ -104,7 +104,8 @@ export const getMemberInfo = (obj) => http.post('/admin/orgStruct/getMemberInfo' export const getAudienceInfo = (obj) => http.post('/admin/orgStruct/getAudienceInfo', obj) //获取授权(修改版) export const optionAuthPerm = (obj) => http.post('/admin/AuthPerm/optionAuthPerm', obj) - +//获取用户登录 +export const getUser = () => http.post('/admin/CheckUser/login') // 获取组织结构树 diff --git a/src/api/method.js b/src/api/method.js index ef5ccc81..cee18bff 100644 --- a/src/api/method.js +++ b/src/api/method.js @@ -162,11 +162,47 @@ function autoComma(number) { return 0; } } + +//把token存到cookie +//name 字段名 value 字段值 perpetual 有效期 +const setCookie = (name, value, perpetual) => { + console.log('存储token到cookie') + let exdate = new Date() + exdate.setDate(perpetual * 24 * 60 * 60 * 1000) //exdate.setDate(exdate.getDate() + 365) + document.cookie = name + '=' + value + ';expires=' + exdate.toGMTString() + //永久有效 + //document.cookie = name + '=' + value + ';expires=' + 'Fri, 31 Dec 9999 23:59:59 GMT' +} +//获取cookie数据 + +//先写一个方法 +function getCookie(name) { + //1.获取cookie字符串 + var cookies = document.cookie; + //通过;来分割字符串 + var cookie = cookies.split("; "); + // console.log('cookie', cookie) + //遍历,使键值对匹配上 + for (var i = 0; i < cookie.length; i++) { + var arr = cookie[i].split("token="); + // console.log('arr', arr) + console.log('name', name) + // if (arr[0] == name) { + // console.log('arr[1]', arr[1]) + // return arr[1]; + // } + // console.log('arr[1]', arr[1]) + return arr[1] + } + return ""; +} +//最后通 + + //新建延迟 const commonData = { - timeout: 50 + timeout: 50, } - // const organizationalTree = [ // { // title: "京东方", @@ -376,6 +412,8 @@ export { getWeek, autoComma, formatNumber, + setCookie, + getCookie, commonData, organizationalTree, iframeUrl, diff --git a/src/assets/images/avatar.png b/src/assets/images/avatar.png new file mode 100644 index 00000000..045535a4 Binary files /dev/null and b/src/assets/images/avatar.png differ diff --git a/src/components/NavTop.vue b/src/components/NavTop.vue index d1c19f19..fecadcd2 100644 --- a/src/components/NavTop.vue +++ b/src/components/NavTop.vue @@ -23,15 +23,15 @@
-