提交 91e03960 编写于 作者: 刘英杰's avatar 刘英杰

20250310

1.权限管理》新增,修改权限〉追加管辖房间
2.支持用户权限切换,显隐菜单
3.房间列表接口》通过请求他携带权限
上级 23ecc610
流水线 #33573 已通过 ,包含阶段
in 1 minute 和 38 second
[data-v-60dd01ec] .ivu-modal-mask{position:fixed;top:0;bottom:0;left:0;right:0;background-color:rgba(55,55,55,.6);height:100%;z-index:1050!important}[data-v-60dd01ec] .ivu-modal-wrap{position:fixed;overflow:auto;top:0;right:0;bottom:0;left:0;z-index:1050!important;-webkit-overflow-scrolling:touch;outline:0}[data-v-60dd01ec] .ivu-drawer-mask{position:fixed;top:0;bottom:0;left:0;right:0;background-color:rgba(55,55,55,.6);height:100%;z-index:1100!important}[data-v-60dd01ec] .ivu-drawer-wrap{position:fixed;overflow:auto;top:0;right:0;bottom:0;left:0;z-index:1100!important;-webkit-overflow-scrolling:touch;outline:0}.ivu-form-item[data-v-60dd01ec]{padding-right:15px}.fileRow[data-v-60dd01ec]{display:flex;justify-content:space-between;align-items:center}.fileRow .delIcon[data-v-60dd01ec]{color:#ed4014}.fileRow .delIcon[data-v-60dd01ec]:hover{color:#f16643;cursor:pointer}.class-drawer[data-v-60dd01ec]{height:"calc(100% - 55px)";overflow:"auto";padding-bottom:"53px";position:"static";z-index:1100!important}.class-drawer .subTitle[data-v-60dd01ec]{margin-top:20px;font-size:14px;color:#191f25;font-weight:700}.class-drawer .drawer-footer[data-v-60dd01ec]{width:100%;position:absolute;bottom:0;left:0;border-top:1px solid #e8e8e8;padding:10px 16px;text-align:right;background:#fff}.class-drawer[data-v-60dd01ec] .ivu-drawer-header-inner{font-size:20px;font-weight:600}
\ No newline at end of file
[data-v-28d8568a] .ivu-modal-mask{position:fixed;top:0;bottom:0;left:0;right:0;background-color:rgba(55,55,55,.6);height:100%;z-index:1050!important}[data-v-28d8568a] .ivu-modal-wrap{position:fixed;overflow:auto;top:0;right:0;bottom:0;left:0;z-index:1050!important;-webkit-overflow-scrolling:touch;outline:0}[data-v-28d8568a] .ivu-drawer-mask{position:fixed;top:0;bottom:0;left:0;right:0;background-color:rgba(55,55,55,.6);height:100%;z-index:1100!important}[data-v-28d8568a] .ivu-drawer-wrap{position:fixed;overflow:auto;top:0;right:0;bottom:0;left:0;z-index:1100!important;-webkit-overflow-scrolling:touch;outline:0}.ivu-form-item[data-v-28d8568a]{padding-right:15px}.fileRow[data-v-28d8568a]{display:flex;justify-content:space-between;align-items:center}.fileRow .delIcon[data-v-28d8568a]{color:#ed4014}.fileRow .delIcon[data-v-28d8568a]:hover{color:#f16643;cursor:pointer}.class-drawer[data-v-28d8568a]{height:"calc(100% - 55px)";overflow:"auto";padding-bottom:"53px";position:"static";z-index:1100!important}.class-drawer .subTitle[data-v-28d8568a]{margin-top:20px;font-size:14px;color:#191f25;font-weight:700}.class-drawer .drawer-footer[data-v-28d8568a]{width:100%;position:absolute;bottom:0;left:0;border-top:1px solid #e8e8e8;padding:10px 16px;text-align:right;background:#fff}.class-drawer[data-v-28d8568a] .ivu-drawer-header-inner{font-size:20px;font-weight:600}
\ No newline at end of file
.mainDiv[data-v-d0563dd8]{width:100%;height:100%;display:flex;flex-wrap:wrap;justify-content:space-between}.mainDiv .bigCard[data-v-d0563dd8],.mainDiv .smallCard[data-v-d0563dd8]{margin-bottom:16px}.mainDiv .bigCard[data-v-d0563dd8] .ivu-card-body,.mainDiv .smallCard[data-v-d0563dd8] .ivu-card-body{height:calc(100% - 51px)}.mainDiv .bigCard[data-v-d0563dd8] .ivu-card-body .ivu-form-item,.mainDiv .smallCard[data-v-d0563dd8] .ivu-card-body .ivu-form-item{margin-bottom:12px}.mainDiv .bigCard[data-v-d0563dd8]{width:calc(50% - 8px)}.mainDiv .smallCard[data-v-d0563dd8]{width:calc(33.33333% - 10.66667px)}.mainDiv[data-v-d0563dd8] .kjyyCard .ivu-card-body{overflow:auto}.mainDiv[data-v-d0563dd8] .kjyyCard .ivu-card-body p[name=fastCP]{display:flex;justify-content:space-between}.mainDiv[data-v-d0563dd8] .kjyyCard .ivu-card-body p[name=fastCP] a[name=del]{color:#ed4014}.mainDiv[data-v-d0563dd8] .kjyyCard .ivu-card-body p[name=fastCP] a[name=del]:hover{color:#f16643}.mainDiv[data-v-d0563dd8] .kjyyCard .ivu-card-body p[name=fastCP] a[name=del]:active{color:#e13d13}.mainDiv[data-v-d0563dd8] .cplhsCard .ivu-card-body{display:flex;flex-direction:column;justify-content:space-evenly}.mainDiv[data-v-d0563dd8] .save-bt{text-align:right;position:absolute;bottom:16px;right:16px}.mainDiv .roomOpeningHours[data-v-d0563dd8]{display:flex;justify-content:space-between;flex-wrap:wrap}.mainDiv .flexBetWeen[data-v-d0563dd8]{width:100%;height:100%;display:flex;justify-content:space-between}.class-drawer[data-v-d0563dd8]{height:"calc(100% - 55px)";overflow:"auto";padding-bottom:"53px";position:"static"}.class-drawer .subTitle[data-v-d0563dd8]{margin-top:20px;font-size:14px;color:#191f25;font-weight:700}.class-drawer .drawer-footer[data-v-d0563dd8]{width:100%;position:absolute;bottom:0;left:0;border-top:1px solid #e8e8e8;padding:10px 16px;text-align:right;background:#fff}.class-drawer[data-v-d0563dd8] .ivu-drawer-header-inner{font-size:20px;font-weight:600}
\ No newline at end of file
.mainDiv[data-v-e2a35234]{width:100%;height:100%;display:flex;flex-wrap:wrap;justify-content:space-between}.mainDiv .bigCard[data-v-e2a35234],.mainDiv .smallCard[data-v-e2a35234]{margin-bottom:16px}.mainDiv .bigCard[data-v-e2a35234] .ivu-card-body,.mainDiv .smallCard[data-v-e2a35234] .ivu-card-body{height:calc(100% - 51px)}.mainDiv .bigCard[data-v-e2a35234] .ivu-card-body .ivu-form-item,.mainDiv .smallCard[data-v-e2a35234] .ivu-card-body .ivu-form-item{margin-bottom:12px}.mainDiv .bigCard[data-v-e2a35234]{width:calc(50% - 8px)}.mainDiv .smallCard[data-v-e2a35234]{width:calc(33.33333% - 10.66667px)}.mainDiv[data-v-e2a35234] .kjyyCard .ivu-card-body{overflow:auto}.mainDiv[data-v-e2a35234] .kjyyCard .ivu-card-body p[name=fastCP]{display:flex;justify-content:space-between}.mainDiv[data-v-e2a35234] .kjyyCard .ivu-card-body p[name=fastCP] a[name=del]{color:#ed4014}.mainDiv[data-v-e2a35234] .kjyyCard .ivu-card-body p[name=fastCP] a[name=del]:hover{color:#f16643}.mainDiv[data-v-e2a35234] .kjyyCard .ivu-card-body p[name=fastCP] a[name=del]:active{color:#e13d13}.mainDiv[data-v-e2a35234] .cplhsCard .ivu-card-body{display:flex;flex-direction:column;justify-content:space-evenly}.mainDiv[data-v-e2a35234] .save-bt{text-align:right;position:absolute;bottom:16px;right:16px}.mainDiv .roomOpeningHours[data-v-e2a35234]{display:flex;justify-content:space-between;flex-wrap:wrap}.mainDiv .flexBetWeen[data-v-e2a35234]{width:100%;height:100%;display:flex;justify-content:space-between}.class-drawer[data-v-e2a35234]{height:"calc(100% - 55px)";overflow:"auto";padding-bottom:"53px";position:"static"}.class-drawer .subTitle[data-v-e2a35234]{margin-top:20px;font-size:14px;color:#191f25;font-weight:700}.class-drawer .drawer-footer[data-v-e2a35234]{width:100%;position:absolute;bottom:0;left:0;border-top:1px solid #e8e8e8;padding:10px 16px;text-align:right;background:#fff}.class-drawer[data-v-e2a35234] .ivu-drawer-header-inner{font-size:20px;font-weight:600}
\ No newline at end of file
.searchDiv .ivu-form-item[data-v-28ca940a]{margin-bottom:12px}.searchDiv .buttonCol[data-v-28ca940a]{margin-left:auto;text-align:right}.searchDiv .buttonCol .ivu-btn[data-v-28ca940a]{margin-left:8px}.ivu-modal-close .ivu-icon-ios-close[data-v-5acf2128]{color:red;font-weight:700}
\ No newline at end of file
.searchDiv .ivu-form-item[data-v-28ca940a]{margin-bottom:12px}.searchDiv .buttonCol[data-v-28ca940a]{margin-left:auto;text-align:right}.searchDiv .buttonCol .ivu-btn[data-v-28ca940a]{margin-left:8px}.ivu-modal-close .ivu-icon-ios-close[data-v-597b7d2a]{color:red;font-weight:700}
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><link rel="shortcut icon" href=favicon.ico><title>自习室占座预约系统</title><link href=css/chunk-vendors.cc1990b1.css rel=stylesheet><link href=css/app.de53c9b8.css rel=stylesheet></head><body><script src=https://mapapi.qq.com/web/mapComponents/geoLocation/v/geolocation.min.js></script><script src="https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=IZXBZ-OTAWV-XU7PV-5FAAL-F6VXH-7XBQP"></script><script charset=utf-8 src="https://map.qq.com/api/js?v=2.exp&key=ZNMBZ-NYOEO-WNMWL-SJF4C-MWKQT-KJB7W&libraries=drawing,geometry,place,convertor,visualization"></script><script src=/a/manager/identify/identify.js></script><noscript><strong>请开启 JavaScript 功能来使用 自习室占座预约系统。</strong></noscript><div id=app></div><script src=js/chunk-vendors.0e2a893c.js></script><script src=js/app.7c4f5b35.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><link rel="shortcut icon" href=favicon.ico><title>自习室占座预约系统</title><link href=css/chunk-vendors.cc1990b1.css rel=stylesheet><link href=css/app.de53c9b8.css rel=stylesheet></head><body><script src=https://mapapi.qq.com/web/mapComponents/geoLocation/v/geolocation.min.js></script><script src="https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=IZXBZ-OTAWV-XU7PV-5FAAL-F6VXH-7XBQP"></script><script charset=utf-8 src="https://map.qq.com/api/js?v=2.exp&key=ZNMBZ-NYOEO-WNMWL-SJF4C-MWKQT-KJB7W&libraries=drawing,geometry,place,convertor,visualization"></script><script src=/a/manager/identify/identify.js></script><noscript><strong>请开启 JavaScript 功能来使用 自习室占座预约系统。</strong></noscript><div id=app></div><script src=js/chunk-vendors.0e2a893c.js></script><script src=js/app.ef03c55b.js></script></body></html>
\ No newline at end of file
因为 它太大了无法显示 源差异 。您可以改为 查看blob。
因为 它太大了无法显示 源差异 。您可以改为 查看blob。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
import { type AxiosRequestConfig } from "axios";
/**
* 获取所有房间集合
* /api/Common/GetRoomSelect
*/
export declare function getApiCommonGetRoomSelect(config?: AxiosRequestConfig): import("axios").AxiosPromise<{
code: number;
status: string;
msg: string;
msg_detail: string;
response: {
name: string;
id: string;
}[];
}>;
import request from "@/plugins/request";
/**
* 获取所有房间集合
* /api/Common/GetRoomSelect
*/
export function getApiCommonGetRoomSelect(config) {
return request.get(`/api/Common/GetRoomSelect`, config);
}
......@@ -5,3 +5,4 @@ export * from "./getApiCommonGetTypeAndRoomList";
export * from "./postApiCommonImageUpLoad";
export * from "./getApiCommonGetMaxAndMinOccupyseat";
export * from "./getApiCommonGetDomainName";
export * from "./getApiCommonGetRoomSelect";
......@@ -5,3 +5,4 @@ export * from "./getApiCommonGetTypeAndRoomList";
export * from "./postApiCommonImageUpLoad";
export * from "./getApiCommonGetMaxAndMinOccupyseat";
export * from "./getApiCommonGetDomainName";
export * from "./getApiCommonGetRoomSelect";
......@@ -12,7 +12,7 @@ export declare function getApiGetTokenInfo(config?: AxiosRequestConfig): import(
userid: string;
cardNumber: string;
name: string;
type: any;
type: number;
role_list: string[];
};
}>;
......@@ -21,5 +21,7 @@ export declare function getApiRoleGetRolePowerList(config?: AxiosRequestConfig):
userid: string;
is_tea: number;
is_tea_name: string;
room_id: string;
room_name: string;
}[];
}>;
......@@ -9,4 +9,6 @@ export interface PlaceOccupyseatRolePower {
createby?: string;
createtime?: string;
is_tea?: number;
room_id?: string;
room_id_list?: string[];
}
......@@ -11,4 +11,6 @@ export interface RolePowerViewModel {
userid?: string;
is_tea?: number;
is_tea_name?: string;
room_id?: string;
room_name?: string;
}
......@@ -392,8 +392,10 @@
if (!event) {
// 关闭浮层时触发
let deleteEventArray = this.formDataTimeTable.time.map(cur => {
if (cur.timeRange !== void 0) return cur.timeRange.join('~');
}).filter(cur=>{return cur !== void 0})
if (cur.timeRange !== void 0) return cur.timeRange.join('~');
}).filter(cur => {
return cur !== void 0
})
if (deleteEventArray.indexOf(item.timeRange.join('~')) !== -1) deleteEventArray.splice(deleteEventArray.indexOf(item.timeRange.join('~')), 1);
if (!(this.checkTimes(deleteEventArray, item.timeRange))) {
......@@ -425,8 +427,10 @@
function getFormatData(data) {
//获取开放时间段,格式化
return data.map(cur => {
if (cur.timeRange !== void 0) return cur.timeRange.join('~');
}).filter(cur=>{return cur !==void 0})
if (cur.timeRange !== void 0) return cur.timeRange.join('~');
}).filter(cur => {
return cur !== void 0
})
}
let info = {
......@@ -616,7 +620,6 @@
background-color: rgba(55, 55, 55, 0.6);
height: 100%;
z-index: 1050 !important;
}
/deep/ .ivu-modal-wrap {
......
import {Message, Modal, Spin} from "view-design";
import Cookies from "js-cookie";
import dayjs from "dayjs";
export function getRoleArray() {
//获取角色数组
return JSON.parse(Cookies.get('admin-occupancy-admin-userInfo')).role_list
}
export function setCurrentRoleInfo(value) {
//设置角色信息
Cookies.set('admin-occupancy-roleId', value)
}
export function getCurrentRoleInfo() {
//获取角色信息
return Cookies.get('admin-occupancy-roleId')
}
export function publicConfirm(publicFunction,text = '是否继续执行此操作?') {
// 公共弹窗删除
Modal.confirm({
......
......@@ -3,7 +3,9 @@
<Dropdown :trigger="isMobile ? 'click' : 'hover'" class="i-layout-header-user"
:class="{ 'i-layout-header-user-mobile': isMobile }" @on-click="handleClick">
<Avatar size="default" icon="ios-person" style="background-color: #2D8CF0;"/>
<span class="i-layout-header-user-name" v-if="!isMobile">{{ userName }}</span>
<span class="i-layout-header-user-name" v-if="!isMobile">
{{ `${userName}(${roleValueStrategy[this.hooks.getCurrentRoleInfo()]})` }}
</span>
<!-- <DropdownMenu slot="list">
<i-link to="/setting/user">
<DropdownItem>
......@@ -22,6 +24,18 @@
<span>{{ $t('basicLayout.user.logOut') }}</span>
</DropdownItem>
</DropdownMenu>-->
<DropdownMenu slot="list">
<DropdownItem v-for="(item,index) in getRoleArray()" :key="index"
@click.native="setCurrentRoleInfo(item.value)"
>
<Icon type="ios-settings-outline"/>
<span>{{ item.label }} </span>
</DropdownItem>
<DropdownItem divided name="logout">
<Icon type="ios-log-out"/>
<span>{{ $t('basicLayout.user.logOut') }}</span>
</DropdownItem>
</DropdownMenu>
</Dropdown>
<!-- <Dropdown
......@@ -54,15 +68,23 @@
<script>
import { mapState, mapActions } from 'vuex';
import util from '@/libs/util';
import Cookies from "js-cookie";
import * as config from "@/config";
export default {
name: 'iHeaderUser',
data() {
return {
userName: '',
userName: JSON.parse(util.cookies.get(config.occupancy.userInfo)).name,
roleValueStrategy:{
'1':'超管',
'2':'一般管理员',
'3':'普通用户',
}
}
},
computed: {
...mapState('admin/user', [
'info',
]),
......@@ -72,6 +94,41 @@ export default {
])
},
methods: {
// 处理权限信息
getRoleArray() {
//获取权限信息
return this.hooks.getRoleArray().map(cur=>{
return{
...cur,
label:this.roleValueStrategy[cur],
value:cur,
}
})
},
// 设置权限信息
async setCurrentRoleInfo(key) {
if (key =='3'){
this.$Message.warning('普通用户权限无法切换')
return
}
//同步当前权限
this.hooks.setCurrentRoleInfo(key)
//刷新权限信息
let info = {
name: 'asc666',
avatar: 'https://dev-file.iviewui.com/userinfoPDvn9gKWYihR24SpgC319vXY8qniCqj4/avatar',
access: [this.hooks.getCurrentRoleInfo()]
}
await this.$store.dispatch('admin/user/set', info, {root: true});
//刷新
window.location.reload()
},
...mapActions('admin/account', [
'logout'
]),
......
......@@ -32,7 +32,15 @@
</Menu>
<div style="position: absolute ;bottom: 10px;width: 100%;">
<div style="display: flex;width:100%;height: 50px; justify-content: center;align-items: center;">
<span style="font-size: 12px;">build v241227 1.0.1</span>
<span
style="text-align: center;
color: #b1b1b1;
font-size: 12px;
width: 100%;
"
>
V1.0.1.241215-250310
</span>
</div>
</div>
</div>
......
......@@ -2,5 +2,5 @@ export default {
path: '/activityManagement',
title: '使用记录',
header: 'home',
auth:['1','2','4',]
auth:['1','2']
}
......@@ -22,6 +22,7 @@ export default [
path: '/welcome',
title: '首页',
header: 'home',
auth:['1','2'],
// icon: 'md-home',
// custom: 'i-icon-demo i-icon-demo-i18n',
},
......
......@@ -569,6 +569,7 @@
},
// 查询列表
getData() {
this.tableLoading = true
this.asc.postApiRoomGetRoomList(this.params).then(res => {
// console.log('查询数据', res)
......@@ -665,9 +666,6 @@
this.$forceUpdate();
this.defaultOpeningHours(row.service_interval_time);
//
// console.log('行详情', row, this.$refs.ceditmodal)
this.editModalshow = true
this.editModalLoading = true
......
......@@ -31,9 +31,12 @@
@rowDelete="rowDelete"
@onPageChange="onPageChange"
@onPageSizeChange="onPageSizeChange">
<template #place_name="{row}">
<Ellipsis :transfer="true" :text="row.place_name" :height="80" tooltip/>
</template>
<template #room_name_list="{row}">
<Tag color="blue" v-for="(item,index) in row.room_name_list" :key="index">{{item}}</Tag>
</template>
<template #place_name="{row}">
<Ellipsis :transfer="true" :text="row.place_name" :height="80" tooltip/>
</template>
</CTable>
<!-- 新增修改Modal-分配教师用户权限 -->
......@@ -87,7 +90,7 @@
{key: 'name', title: '名称', align: 'center', minWidth: 150, show: true},
{key: 'is_tea_name', title: '用户类型', align: 'center', minWidth: 150, show: true},
{key: 'role_name', title: '角色', align: 'center', minWidth: 150, show: true},
{key: 'place_id', title: '场地id', align: 'center', minWidth: 150, show: false},
{slot: 'room_name_list', title: '管辖房间', align: 'center', minWidth: 350, show: true},
// { key: 'is_enable', title: '启用', align: 'center', minWidth: 150, show: true },
{slot: 'generalSwitch', title: '启用', align: 'center', minWidth: 80, show: true},
{slot: 'action', title: '操作', align: 'center', minWidth: 150, show: true, fixed: 'right'},
......@@ -107,7 +110,7 @@
formItem: [
{id: 'cardName', name: '用戶', type: 'select', disabled: false, require: false, optList: []},
{id: 'role_id', name: '角色', type: 'select', disabled: false, require: false, optList: []},
// { id: 'place_id', name: '场地', type: 'multipleselect', disabled: false, require: false, optList: [] },
{ id: 'room_id_list', name: '管辖房间', type: 'multipleselect', disabled: false, require: false, optList: [] },
{id: 'is_enable', name: '启用', type: 'switch', disabled: false, require: false, optList: []},
],
defaultFormData: {
......@@ -151,9 +154,25 @@
})
this.formItem[this.formItem.findIndex(a => a.id == 'role_id')].optList = arr
})
this.getRoomSelect()
this.getData()
},
methods: {
// 获取房间
getRoomSelect() {
api.getApiCommonGetRoomSelect().then(res => {
console.log('场地', res)
this.formItem[this.formItem.findIndex(a => a.id === 'room_id_list')].optList = res.response.map(a => {
return {
...a,
label: a.name,
value: a.id,
}
})
})
},
getPeopleList(keyword = '') {
console.log("🚀🚀🚀,", keyword)
// 获取用戶信息
......@@ -195,7 +214,14 @@
this.tableLoading = true
this.asc.getApiRoleGetRolePowerList().then(res => {
// console.log('查询数据', res)
this.tableData = res.response
this.tableData = res.response.map((cur)=>{
return {
...cur,
room_name_list: cur.room_name ? cur.room_name.split(',') : [],
}
})
console.log(this.tableData);
this.dataCount = res.response.length
this.tableLoading = false
})
......@@ -237,6 +263,7 @@
this.editModalLoading = true
this.addTeacherOrStudentFlag = row.is_tea
// 获取用戶信息
await new Promise((resolve, reject) => {
this.asc.getApiCommonGetPersonByCondiction({user_type: row.is_tea, keyword: row.card}).then(res => {
// console.log('场地', res)
......@@ -245,20 +272,24 @@
...a,
label: a.name + '-' + a.card,
value: a.name + '-' + a.card,
// value:a.name+','+a.card,
}
})
this.formItem[this.formItem.findIndex(a => a.id === 'cardName')].optList = arr
resolve()
})
})
// 禁用选择用戶
this.formItem.find(a => a.id === 'cardName').disabled = true
let obj = cloneDeep(row)
// 场地
if (obj.place_id) {
obj.place_id = obj.place_id.split(',')
}
// 管辖房间
if (obj.room_id) {
obj.room_id_list = obj.room_id.split(',')
}
obj.cardName = obj.name + '-' + obj.card
......@@ -272,6 +303,7 @@
console.log('modal提交', val)
if (val.place_id) {
val.place_id = val.place_id.join(',')
......
......@@ -6,6 +6,7 @@ import dayjs from "dayjs";
import * as Config from '@/config/index'
import {Message, Notice} from 'view-design';
import router from "@/router";
import * as hooks from "@/hook";
// 创建一个错误
function errorCreate(msg) {
......@@ -78,6 +79,13 @@ service.interceptors.request.use(
// 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
config.headers['Authorization'] = 'Bearer ' + token;
config.headers['X-Token'] = token;
if (config.url === '/api/Room/GetRoomList'){
config.headers['RoleId'] = hooks.getCurrentRoleInfo();
}
if(config.url === '/api/Common/FileUpload'){
config.headers['content-type'] = 'multipart/form-data';
}else {
......
......@@ -39,16 +39,20 @@ export default {
} else if (res.response.access_token.token_content) {
util.cookies.set(config.occupancy.token, res.response.access_token.token_content); // 这个util的cookie会自带admin前缀
util.cookies.set(config.occupancy.time, res.response.access_token.expires);
await api.getApiGetTokenInfo().then(async res => {
await api.getApiGetTokenInfo().then(async userInfo => {
// 这个接口是解析单点返回的token(admin_token) 获取到用户信息 且每次请求都会带上此token(admin_token) 在请求拦截中配置
util.cookies.set(config.occupancy.userInfo, res.response);
let userObj = res.response;
util.cookies.set(config.occupancy.userInfo, userInfo.response);
hooks.setCurrentRoleInfo(userInfo.response.role_list[0])
console.log("🚀userInfo.response.role_list🚀🚀,",userInfo.response.role_list[0])
var info = {
name: idt.GetTokenParams(idt.GetToken()).name ,
// name: userObj.name ,
avatar: 'https://dev-file.iviewui.com/userinfoPDvn9gKWYihR24SpgC319vXY8qniCqj4/avatar',
access: res.response.role_list,
access: [hooks.getCurrentRoleInfo()],
}
api.getApiCommonGetDomainName().then(doMain=>{
hooks.setStorage(doMain.response,'doMain')
})
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或