| | |
| | | import axios from 'axios'; |
| | | import { getStore, setStore } from './storage'; |
| | | import { getStore, setStore,getSessionStore,setSessionStore} from './storage'; |
| | | import { router } from '../router/index'; |
| | | import { Message } from 'view-design'; |
| | | import Cookies from 'js-cookie'; |
| | |
| | | case 401: |
| | | // 未登录 清除已登录状态 |
| | | Cookies.set('userInfo', ''); |
| | | setStore('accessToken', ''); |
| | | setSessionStore('accessToken', ''); |
| | | if (router.history.current.name != "login") { |
| | | if (data.message !== null) { |
| | | Message.error(data.message); |
| | |
| | | }); |
| | | |
| | | export const getRequest = (url, params, responseType = null) => { |
| | | let accessToken = getStore('accessToken'); |
| | | let accessToken = getSessionStore('accessToken'); |
| | | return axios({ |
| | | method: 'get', |
| | | url: `${baseApi}${url}`, |
| | |
| | | }); |
| | | }; |
| | | export const getmethod = (url, params) => { |
| | | let accessToken = getStore('accessToken'); |
| | | let accessToken = getSessionStore('accessToken'); |
| | | return axios({ |
| | | method: 'get', |
| | | url: `${baseApi}${url}`, |
| | |
| | | }; |
| | | |
| | | export const postRequest = (url, params) => { |
| | | let accessToken = getStore("accessToken"); |
| | | let accessToken = getSessionStore("accessToken"); |
| | | return axios({ |
| | | method: 'post', |
| | | url: `${baseApi}${url}`, |
| | |
| | | }; |
| | | |
| | | export const putRequest = (url, params) => { |
| | | let accessToken = getStore("accessToken"); |
| | | let accessToken = getSessionStore("accessToken"); |
| | | return axios({ |
| | | method: 'put', |
| | | url: `${baseApi}${url}`, |
| | |
| | | }; |
| | | |
| | | export const postBodyRequest = (url, params) => { |
| | | let accessToken = getStore('accessToken'); |
| | | let accessToken = getSessionStore('accessToken'); |
| | | return axios({ |
| | | method: 'post', |
| | | url: `${baseApi}${url}`, |
| | |
| | | |
| | | /** |
| | | * 无需token验证的GET请求 避免旧token过期导致请求失败 |
| | | * @param {*} url |
| | | * @param {*} params |
| | | * @param {*} url |
| | | * @param {*} params |
| | | */ |
| | | export const getNoAuthRequest = (url, params) => { |
| | | return axios({ |
| | |
| | | import { getStore } from './storage'; |
| | | import { getStore,getSessionStore } from './storage'; |
| | | |
| | | const hasRole = { |
| | | install (Vue, options) { |
| | |
| | | } |
| | | window.localStorage.setItem(name, content); |
| | | } |
| | | export const setSessionStore = (name, content) => { |
| | | if (!name) return; |
| | | if (typeof content !== 'string') { |
| | | content = JSON.stringify(content); |
| | | } |
| | | window.sessionStorage.setItem(name, content); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取localStorage |
| | |
| | | return v; |
| | | } |
| | | |
| | | export const getSessionStore = name => { |
| | | if (!name) return; |
| | | let v = window.sessionStorage.getItem(name); |
| | | if (v == null) { |
| | | return ""; |
| | | } |
| | | return v; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除localStorage |
| | | */ |
| | |
| | | if (!vm.$store.state.app.added) { |
| | | vm.$Loading.start(); |
| | | // 第一次加载 读取数据 |
| | | let accessToken = window.localStorage.getItem('accessToken'); |
| | | let accessToken = window.sessionStorage.getItem('accessToken'); |
| | | // 加载菜单 |
| | | axios.get(getMenuList, { headers: { 'accessToken': accessToken } }).then(res => { |
| | | vm.$Loading.finish(); |
| | |
| | | import store from './store' |
| | | import i18n from '@/locale' |
| | | import { getRequest, postRequest, putRequest, postBodyRequest, getNoAuthRequest, postNoAuthRequest } from '@/libs/axios' |
| | | import { setStore, getStore, removeStore } from '@/libs/storage' |
| | | import { setStore, getStore, removeStore,setSessionStore,getSessionStore } from '@/libs/storage' |
| | | import { format } from "date-fns" |
| | | import util from '@/libs/util' |
| | | import hasPermission from '@/libs/hasPermission' |
| | |
| | | Vue.prototype.postNoAuthRequest = postNoAuthRequest; |
| | | Vue.prototype.setStore = setStore; |
| | | Vue.prototype.getStore = getStore; |
| | | Vue.prototype.setSessionStore = setSessionStore; |
| | | Vue.prototype.getSessionStore = getSessionStore; |
| | | |
| | | Vue.prototype.removeStore = removeStore; |
| | | Vue.prototype.format = format; |
| | | |
| | |
| | | import circleLoading from "@/views/my-components/xboot/circle-loading.vue"; |
| | | |
| | | import util from "@/libs/util.js"; |
| | | import {getSessionStore} from "../libs/storage"; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {getSessionStore} from "../../libs/storage"; |
| | | |
| | | export default { |
| | | name: "access_index", |
| | | data() { |
| | |
| | | getHighlightImg + |
| | | this.id + |
| | | "?accessToken=" + |
| | | this.getStore("accessToken") + |
| | | this.getSessionStore("accessToken") + |
| | | "&time=" + |
| | | new Date(); |
| | | this.getDataList(); |
| | |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | } |
| | | this.modelerUrl = `${this.domain}/modeler/modeler.html?modelId=${ |
| | | v.id |
| | | }&accessToken=${this.getStore("accessToken")}&time=${new Date()}`; |
| | | }&accessToken=${this.getSessionStore("accessToken")}&time=${new Date()}`; |
| | | this.showModeler = true; |
| | | this.modelerLoading = true; |
| | | let that = this; |
| | |
| | | }, |
| | | export(v) { |
| | | window.open( |
| | | exportModel + v.id + "?accessToken=" + this.getStore("accessToken") |
| | | exportModel + v.id + "?accessToken=" + this.getSessionStore("accessToken") |
| | | ); |
| | | }, |
| | | remove(v) { |
| | |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | methods: { |
| | | init() { |
| | | this.accessToken = { |
| | | accessToken: this.getStore("accessToken"), |
| | | accessToken: this.getSessionStore("accessToken"), |
| | | }; |
| | | this.deployByFileUrl = deployByFile; |
| | | this.getDataList(); |
| | |
| | | window.open( |
| | | `${exportResource}?id=${ |
| | | v.id |
| | | }&type=${type}&accessToken=${this.getStore("accessToken")}` |
| | | }&type=${type}&accessToken=${this.getSessionStore("accessToken")}` |
| | | ); |
| | | } else if (type == 1) { |
| | | this.viewTitle = "流程图片预览(" + v.diagramName + ")"; |
| | | this.diagramUrl = `${exportResource}?id=${ |
| | | v.id |
| | | }&type=${type}&accessToken=${this.getStore("accessToken")}`; |
| | | }&type=${type}&accessToken=${this.getSessionStore("accessToken")}`; |
| | | this.viewImage = true; |
| | | } |
| | | }, |
| | |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | authorize(this.form).then((res) => { |
| | | if (res.success) { |
| | | // 存储accessToken |
| | | this.setStore("accessToken", res.result.accessToken); |
| | | this.setSessionStore("accessToken", res.result.accessToken); |
| | | let redictInfo = res.result; |
| | | // 获取用户信息 |
| | | userInfo().then((res) => { |
| | |
| | | }); |
| | | return; |
| | | } |
| | | this.demoUrl = `${this.domain}/chat/chat.html?accessToken=${this.getStore( |
| | | this.demoUrl = `${this.domain}/chat/chat.html?accessToken=${this.getSessionStore( |
| | | "accessToken" |
| | | )}&time=${new Date()}`; |
| | | if (previewPC) { |
| | |
| | | background: #fafafa; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | ] |
| | | } |
| | | ], |
| | | sessionStorage: null, |
| | | showMore: false, |
| | | code:"", |
| | | captchaId: "", |
| | |
| | | }, |
| | | afterLogin(res) { |
| | | let accessToken = res.result; |
| | | this.setStore("accessToken", accessToken); |
| | | console.log("login_afterLogin()",accessToken) |
| | | this.setSessionStore("accessToken", accessToken); |
| | | getOtherSet().then((res) => { |
| | | if (res.result) { |
| | | let domain = res.result.ssoDomain; |
| | | Cookies.set("accessToken", accessToken, { |
| | | domain: domain, |
| | | expires: 7, |
| | | }); |
| | | // Cookies.set("accessToken", accessToken, { |
| | | // domain: domain, |
| | | // expires: 7, |
| | | // }); |
| | | } |
| | | }); |
| | | // 获取用户信息 |
| | |
| | | if (res.success) { |
| | | this.socialLogining = true; |
| | | let accessToken = res.result; |
| | | this.setStore("accessToken", accessToken); |
| | | this.setSessionStore("accessToken", accessToken); |
| | | getOtherSet().then((res) => { |
| | | if (res.result) { |
| | | let domain = res.result.ssoDomain; |
| | | Cookies.set("accessToken", accessToken, { |
| | | domain: domain, |
| | | expires: 7, |
| | | }); |
| | | // Cookies.set("accessToken", accessToken, { |
| | | // domain: domain, |
| | | // expires: 7, |
| | | // }); |
| | | } |
| | | }); |
| | | // 获取用户信息 |
| | |
| | | //this.showNotice(); |
| | | this.relatedLogin(); |
| | | this.getCaptchaImg(); |
| | | |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | ] |
| | | } |
| | | ], |
| | | sessionStorage: null, |
| | | showMore: false, |
| | | captchaId: "", |
| | | captchaImg: "", |
| | |
| | | }, |
| | | afterLogin(res) { |
| | | let accessToken = res.result; |
| | | this.setStore("accessToken", accessToken); |
| | | this.setSessionStore("accessToken", accessToken); |
| | | getOtherSet().then((res) => { |
| | | if (res.result) { |
| | | let domain = res.result.ssoDomain; |
| | | Cookies.set("accessToken", accessToken, { |
| | | domain: domain, |
| | | expires: 7, |
| | | }); |
| | | // Cookies.set("accessToken", accessToken, { |
| | | // domain: domain, |
| | | // expires: 7, |
| | | // }); |
| | | |
| | | } |
| | | }); |
| | | // 获取用户信息 |
| | |
| | | this.setStore("roles", roles); |
| | | this.setStore("saveLogin", this.saveLogin); |
| | | if (this.saveLogin) { |
| | | // 保存7天 |
| | | 保存7天 |
| | | Cookies.set("userInfo", JSON.stringify(res.result), { |
| | | expires: 7, |
| | | }); |
| | |
| | | if (res.success) { |
| | | this.socialLogining = true; |
| | | let accessToken = res.result; |
| | | this.setStore("accessToken", accessToken); |
| | | this.setSessionStore("accessToken", accessToken); |
| | | getOtherSet().then((res) => { |
| | | if (res.result) { |
| | | let domain = res.result.ssoDomain; |
| | | Cookies.set("accessToken", accessToken, { |
| | | domain: domain, |
| | | expires: 7, |
| | | }); |
| | | // Cookies.set("accessToken", accessToken, { |
| | | // domain: domain, |
| | | // expires: 7, |
| | | // }); |
| | | } |
| | | }); |
| | | // 获取用户信息 |
| | |
| | | this.showNotice(); |
| | | this.relatedLogin(); |
| | | this.getCaptchaImg(); |
| | | this.sessionStorage = window.sessionStorage; |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | <script> |
| | | import axios from "axios"; |
| | | import { getMenuList } from "@/api/index"; |
| | | import {getSessionStore} from "../../libs/storage"; |
| | | export default { |
| | | name: "search", |
| | | props: { |
| | |
| | | let menuData = this.getStore("menuData"); |
| | | if (!menuData) { |
| | | // 第一次加载 读取数据 |
| | | let accessToken = this.getStore("accessToken"); |
| | | let accessToken = this.getSessionStore("accessToken"); |
| | | // 加载菜单 |
| | | axios |
| | | .get(getMenuList, { headers: { accessToken: accessToken } }) |
| | |
| | | import { getOtherSet } from "@/api/index"; |
| | | import util from "@/libs/util.js"; |
| | | import changePass from "@/views/change-pass/change-pass"; |
| | | import {getSessionStore} from "../../libs/storage"; |
| | | export default { |
| | | name: "user", |
| | | components: { |
| | |
| | | this.$store.commit("setLoading", false); |
| | | if (res.result) { |
| | | let domain = res.result.ssoDomain; |
| | | Cookies.set("accessToken", "", { |
| | | domain: domain, |
| | | expires: 7, |
| | | }); |
| | | // Cookies.set("accessToken", "", { |
| | | // domain: domain, |
| | | // expires: 7, |
| | | // }); |
| | | } |
| | | this.$store.commit("logout", this); |
| | | this.setStore("accessToken", ""); |
| | | this.setSessionStore("accessToken", "") |
| | | // 强制刷新页面 重新加载router |
| | | location.reload(); |
| | | }); |
| | |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | </style> |
| | | </style> |
| | |
| | | this.editor.config.uploadImgServer = uploadFile; |
| | | // xboot如要header中传入token鉴权 |
| | | this.editor.config.uploadImgHeaders = { |
| | | accessToken: that.getStore("accessToken"), |
| | | accessToken: that.getSessionStore("accessToken"), |
| | | }; |
| | | this.editor.config.uploadFileName = "file"; |
| | | this.editor.config.uploadImgHooks = { |
| | |
| | | if (this.uploadVideo) { |
| | | this.editor.config.uploadVideoServer = uploadFile; |
| | | this.editor.config.uploadVideoHeaders = { |
| | | accessToken: that.getStore("accessToken"), |
| | | accessToken: that.getSessionStore("accessToken"), |
| | | }; |
| | | this.editor.config.uploadVideoName = "file"; |
| | | this.editor.config.uploadVideoHooks = { |
| | |
| | | methods: { |
| | | init() { |
| | | this.accessToken = { |
| | | accessToken: this.getStore("accessToken"), |
| | | accessToken: this.getSessionStore("accessToken"), |
| | | }; |
| | | this.setCurrentValue(this.value); |
| | | }, |
| | |
| | | methods: { |
| | | initEditor() { |
| | | this.accessToken = { |
| | | accessToken: this.getStore("accessToken") |
| | | accessToken: this.getSessionStore("accessToken") |
| | | }; |
| | | this.editor = new Quill(`#${this.id}`, this.options); |
| | | let that = this; |
| | |
| | | methods: { |
| | | init() { |
| | | this.accessToken = { |
| | | accessToken: this.getStore("accessToken"), |
| | | accessToken: this.getSessionStore("accessToken"), |
| | | }; |
| | | }, |
| | | viewImage() { |
| | |
| | | init() { |
| | | this.setData(this.value); |
| | | this.accessToken = { |
| | | accessToken: this.getStore("accessToken"), |
| | | accessToken: this.getSessionStore("accessToken"), |
| | | }; |
| | | }, |
| | | handleView(v, i) { |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {getSessionStore} from "../../libs/storage"; |
| | | |
| | | export default { |
| | | components: {}, |
| | | name: "message", |
| | |
| | | import security from "./security"; |
| | | import social from "./social"; |
| | | import message from "./message"; |
| | | import {getSessionStore} from "../../libs/storage"; |
| | | export default { |
| | | components: { |
| | | user, |
| | |
| | | if (res.success) { |
| | | this.$Message.success("绑定成功"); |
| | | let accessToken = res.result; |
| | | this.setStore("accessToken", accessToken); |
| | | this.setSessionStore("accessToken", accessToken); |
| | | getOtherSet().then((res) => { |
| | | if (res.result) { |
| | | let domain = res.result.ssoDomain; |
| | | Cookies.set("accessToken", accessToken, { |
| | | domain: domain, |
| | | expires: 7, |
| | | }); |
| | | // Cookies.set("accessToken", accessToken, { |
| | | // domain: domain, |
| | | // expires: 7, |
| | | // }); |
| | | } |
| | | }); |
| | | // 获取用户信息 |
| | |
| | | }, |
| | | init() { |
| | | this.accessToken = { |
| | | accessToken: this.getStore("accessToken"), |
| | | accessToken: this.getSessionStore("accessToken"), |
| | | }; |
| | | checkOssSet().then((res) => { |
| | | if (!res.success) { |
| | |
| | | this.init(); |
| | | }, |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | import excel from "@/libs/excel"; |
| | | import addEdit from "./addEdit.vue"; |
| | | import dict from "@/views/my-components/xboot/dict"; |
| | | import {getSessionStore} from "../../../libs/storage"; |
| | | export default { |
| | | name: "user-manage", |
| | | components: { |
| | |
| | | this.init(); |
| | | }, |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | import { generateTable, getEntityData } from "@/api/index"; |
| | | import customList from "@/views/my-components/xboot/custom-list"; |
| | | import FileSaver from "file-saver"; |
| | | import {getSessionStore} from "../../libs/storage"; |
| | | export default { |
| | | name: "table-generator", |
| | | components: { |
| | |
| | | this.init(); |
| | | }, |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | import { generateTree, getEntityData } from "@/api/index"; |
| | | import customList from "@/views/my-components/xboot/custom-list"; |
| | | import FileSaver from "file-saver"; |
| | | import {getSessionStore} from "../../libs/storage"; |
| | | export default { |
| | | name: "tree-generator", |
| | | components: { |
| | |
| | | this.init(); |
| | | }, |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | import { userColumns, userData } from "@/views/sys/user-manage/importTemplate"; |
| | | // excel转换工具类 |
| | | import excel from "@/libs/excel"; |
| | | import {getSessionStore} from "../../../libs/storage"; |
| | | export default { |
| | | name: "excel", |
| | | data() { |
| | |
| | | this.init(); |
| | | }, |
| | | }; |
| | | </script> |
| | | </script> |
| | |
| | | import util from "@/libs/util.js"; |
| | | import excel from "@/libs/excel.js"; |
| | | import {exportColumn} from "./exportColumn"; |
| | | import {getSessionStore} from "../../../libs/storage"; |
| | | export default { |
| | | name: "car-manage", |
| | | data() { |