Commit 1fd30d6a authored by “yiyousong”'s avatar “yiyousong”

pref:添加站点事项库事项来源

parent 9e4c6b74
......@@ -17,13 +17,13 @@ export default {
this.getInfo();
},
methods: {
...mapMutations(["SET_sysName", "SET_sysLogo"]),
...mapMutations(["SET_sysName", "SET_sysLogo", "SET_token"]),
// 获取token和站点信息
async getInfo() {
let { token, siteid, sysName, sysLogo } = this.$route.query;
if (token) {
local.setLocal("sampleToken", token);
local.setLocal("sampleSiteId", siteid);
this.SET_token(token);
this.SET_sysName(sysName);
this.SET_sysLogo(sysLogo);
calcMenu();
......
......@@ -38,6 +38,7 @@
import { login } from "@/api/login";
import local from "@/utils/local";
import { calcMenu } from "@/router";
import { mapMutations } from "vuex";
export default {
name: "login",
data() {
......@@ -53,6 +54,7 @@ export default {
},
created() {},
methods: {
...mapMutations(["SET_token"]),
async login() {
let res = await login(this.form);
let { data, code } = res.data;
......@@ -62,8 +64,8 @@ export default {
let siteIds = data.user.siteIds;
let siteid = siteIds.split(",")[0];
if (token) {
local.setLocal("sampleToken", token);
local.setLocal("sampleSiteId", siteid);
this.SET_token(token);
// 渲染菜单
calcMenu();
this.$router.push("/basicsset");
......
......@@ -61,7 +61,9 @@
:on-remove="handleRemoveSamplePath"
:file-list="samplePathFileList"
:on-success="OnsuccessSamplePath"
:headers="headers"
:headers="{
Authorization: token,
}"
>
<!-- accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document" -->
<el-button size="small" type="primary">上传文件</el-button>
......@@ -86,6 +88,7 @@
<script>
import local from "@/utils/local";
import { saveMaterials } from "@/api/materials";
import { mapGetters } from "vuex";
export default {
props: {
title: {
......@@ -140,14 +143,10 @@ export default {
// { required: true, message: "请上传模板", trigger: "change" },
// ],
},
headers: {
Authorization: local.getLocal("sampleToken")
? local.getLocal("sampleToken")
: "",
},
};
},
computed: {
...mapGetters(["token"]),
Visible: {
get() {
return this.addMaterialsVisible;
......
......@@ -240,6 +240,14 @@
label="事项名称"
>
</el-table-column>
<el-table-column width="100" align="center" label="事项来源">
<template slot-scope="scope">
<el-tag size="small" type="success" v-if="scope.row.source == 0"
>一体化添加</el-tag
>
<el-tag size="small" v-else>自建事项</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="160">
<template slot-scope="scope">
<span class="primary pointer" @click="handleJoin(scope.row.id)"
......
......@@ -2,7 +2,7 @@ import Vue from "vue";
import VueRouter from "vue-router";
import Layouts from "@/pages/layouts/Layouts.vue";
import store from "@/store";
import local from "@/utils/local";
// import local from "@/utils/local";
// 解决重复点击同一个路由报错
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location) {
......@@ -33,7 +33,7 @@ const router = new VueRouter({
// 前置路由卫士
router.beforeEach((to, from, next) => {
let islogin = local.getLocal("sampleToken") ? true : false;
let islogin = store.getters.token;
if (islogin) {
next();
} else {
......
......@@ -15,6 +15,9 @@ export default new Vuex.Store({
sysLogo: "", // 系统logo
},
getters: {
token(state) {
return state.token;
},
siteId(state) {
return state.siteId;
},
......@@ -50,7 +53,7 @@ export default new Vuex.Store({
// storage: window.sessionStorage,
// }),
createPersistedState({
key: "info",
key: "sample",
storage: {
getItem: (key) => ls.get(key),
setItem: (key, value) => ls.set(key, value),
......
......@@ -3,7 +3,8 @@
*/
import axios from "axios";
import { Message } from "element-ui";
import local from "@/utils/local";
// import local from "@/utils/local";
import store from "@/store";
// import router from "@/router"
// 请求超时时间
// axios.defaults.timeout = 10 * 1000;
......@@ -13,7 +14,7 @@ axios.defaults.baseURL = process.env.VUE_APP_API_BASE_URL;
// 请求拦截
axios.interceptors.request.use(
(config) => {
let token = local.getLocal("sampleToken");
let token = store.getters.token;
if (token) {
config.headers.Authorization = token;
config.headers.Authtoken = token;
......@@ -40,6 +41,7 @@ axios.interceptors.response.use(
message: msg,
});
setTimeout(() => {
store.commit("SET_token", "");
location.href = process.env.VUE_APP_API_portal_URL;
}, 2000);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment