This commit is contained in:
王创世 2024-05-17 16:49:23 +08:00
parent 21b949a86a
commit 3e3a19ca65
3 changed files with 23 additions and 11 deletions

View File

@ -75,7 +75,8 @@
></t-pagination> ></t-pagination>
</div> </div>
</div> </div>
<t-dialog header="报名详情" :confirmBtn="null" :visible="infoMode" :onClose="onCloseMy" width="55%" top="50px"> <t-dialog header="报名详情" :confirmBtn="null" :visible="infoMode" :onClose="onCloseMy" width="65%" top="50px">
<div style="height: 600px;overflow-y: scroll;">
<t-table <t-table
rowKey="index" rowKey="index"
:data="info_list" :data="info_list"
@ -99,6 +100,7 @@
:showPageSize="false" :showPageSize="false"
></t-pagination> ></t-pagination>
</div> </div>
</div>
</t-dialog> </t-dialog>
<t-dialog header="问卷统计" :confirmBtn="null" :visible="QuestionnaireMode" :onClose="onCloseMy" width="65%" top="50px"> <t-dialog header="问卷统计" :confirmBtn="null" :visible="QuestionnaireMode" :onClose="onCloseMy" width="65%" top="50px">
<div style="height: 600px;overflow-y: scroll;"> <div style="height: 600px;overflow-y: scroll;">

View File

@ -4,7 +4,7 @@ const InitUserInfo = {
// 定义的state初始值 // 定义的state初始值
const state = { const state = {
token: localStorage.getItem('associationToken') || 'main_token', // 默认token不走权限 token: localStorage.getItem('associationToken') || '', // 默认token不走权限
userInfo: InitUserInfo, userInfo: InitUserInfo,
association:localStorage.getItem('associationInfo') || '', association:localStorage.getItem('associationInfo') || '',
//apiUrl:'http://192.168.3.130', //apiUrl:'http://192.168.3.130',
@ -43,7 +43,7 @@ const actions = {
const mockLogin = async (userInfo) => { const mockLogin = async (userInfo) => {
// 登录请求流程 // 登录请求流程
console.log(userInfo); console.log(userInfo);
commit('setAssociation',userInfo[0]); commit('setAssociation',userInfo);
return{ return{
code: 200, code: 200,
} }
@ -51,23 +51,28 @@ const actions = {
const res = await mockLogin(userInfo); const res = await mockLogin(userInfo);
if (res.code === 200) { if (res.code === 200) {
commit('setToken', 'main_token'); console.log('token',userInfo.token);
commit('setToken',userInfo.token);
} else { } else {
return res; return res;
} }
}, },
async getUserInfo({ commit, state }) { async getUserInfo({ commit, state }) {
const mockRemoteUserInfo = async (token) => { const mockRemoteUserInfo = async (token) => {
if (token === 'main_token') {
return { return {
name: 'td_main', name: 'td_main',
roles: ['ALL_ROUTERS'], roles: ['ALL_ROUTERS'],
}; };
} // if (token === 'main_token') {
return { // return {
name: 'td_dev', // name: 'td_main',
roles: ['UserIndex', 'DashboardBase', 'login'], // roles: ['ALL_ROUTERS'],
}; // };
// }
// return {
// name: 'td_dev',
// roles: ['UserIndex', 'DashboardBase', 'login'],
// };
}; };
const res = await mockRemoteUserInfo(state.token); const res = await mockRemoteUserInfo(state.token);

View File

@ -28,7 +28,12 @@ instance.interceptors.request.use((config) => {
}else{ }else{
var association=JSON.parse(store.state.user.association); var association=JSON.parse(store.state.user.association);
} }
config.data = { ...config.data, association_id: association.id }; const token = store.state.user.token;
if (token) {
// 添加token请求头
config.headers.token = token;
}
config.data = { ...config.data, association_id: association.id};
} }
console.log(config.data); console.log(config.data);