From 4c9e1ba3c7f5c95a1789e88823ff262c26a53bce Mon Sep 17 00:00:00 2001 From: zhang_12370 <z2864490065@outlook.com> Date: 星期二, 08 七月 2025 20:34:32 +0800 Subject: [PATCH] 解决 生产加工煤种字段匹配 --- src/store/modules/user.js | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 2c6398f..1ef23e6 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -2,6 +2,7 @@ import { getToken, setToken, removeToken } from '@/utils/auth' import { isHttp, isEmpty } from "@/utils/validate" import defAva from '@/assets/images/profile.jpg' +import {userListAll} from '@/api/publicApi/index.js' const useUserStore = defineStore( 'user', @@ -13,7 +14,8 @@ nickName: '', avatar: '', roles: [], - permissions: [] + permissions: [], + userList: [] }), actions: { // 鐧诲綍 @@ -70,6 +72,20 @@ reject(error) }) }) + }, + + // 鑾峰彇鐢ㄦ埛鍒楄〃锛堝鏋滃凡缂撳瓨鍒欑洿鎺ヨ繑鍥烇紝鍚﹀垯閲嶆柊鑾峰彇锛� + async getUserList () { + if (Array.isArray(this.userList) && this.userList.length > 0) { + return this.userList; + } + // 涓虹┖鏃堕噸鏂拌幏鍙� + return userListAll().then(res => { + this.userList = res.data; + return this.userList; + }).catch(error => { + throw error; + }); } } }) -- Gitblit v1.9.3