From 552ca7995834fc7b16b90db62f4ec247b486a330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E6=99=8F=E5=BD=AD?= <995457985@qq.com> Date: Tue, 7 Mar 2023 16:16:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=AD=97=E5=85=B8=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/config/servicePort.ts | 4 +- src/api/index.ts | 5 +- src/api/interface/index.ts | 24 +- src/api/modules/jxjview.ts | 49 ++++ src/api/modules/login.ts | 10 +- src/assets/json/dynamicRouter.json | 18 +- src/components/DialogForm/index.vue | 24 +- src/config/config.ts | 2 +- src/routers/modules/staticRouter.ts | 10 +- src/views/jxjview/dictionary/detail.vue | 207 +++++++++++++++ src/views/jxjview/dictionary/index.vue | 321 ++++++++++++++++++++++++ src/views/jxjview/government/index.vue | 183 ++++++++++++++ vite.config.ts | 18 +- 13 files changed, 842 insertions(+), 33 deletions(-) create mode 100644 src/views/jxjview/dictionary/detail.vue create mode 100644 src/views/jxjview/dictionary/index.vue create mode 100644 src/views/jxjview/government/index.vue diff --git a/src/api/config/servicePort.ts b/src/api/config/servicePort.ts index 23524d4..2532e86 100644 --- a/src/api/config/servicePort.ts +++ b/src/api/config/servicePort.ts @@ -1,3 +1,3 @@ // * 后端微服务端口名 -export const PORT1 = "http://10.0.1.49:6688"; -export const PORT2 = "http://10.0.1.49:6688"; +export const PORT1 = "http://192.168.34.122:6688"; +export const PORT2 = "http://192.168.34.122:6688"; diff --git a/src/api/index.ts b/src/api/index.ts index e27926a..52bac8a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -34,7 +34,10 @@ class RequestHttp { // * 如果当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { headers: { noLoading: true } }来控制不显示loading,参见loginApi config.headers!.noLoading || showFullScreenLoading(); const token = globalStore.token; - return { ...config, headers: { ...config.headers, "x-access-token": token } }; + if (token && config.headers) { + config.headers.Authorization = `Bearer ${token}`; + } + return { ...config, headers: { ...config.headers, token } }; }, (error: AxiosError) => { return Promise.reject(error); diff --git a/src/api/interface/index.ts b/src/api/interface/index.ts index 04608d3..892bd11 100644 --- a/src/api/interface/index.ts +++ b/src/api/interface/index.ts @@ -11,7 +11,7 @@ export interface ResultData extends Result { // * 分页响应参数 export interface ResPage { - list: T[]; + result: T[]; pageNo: number; pageSize: number; total: number; @@ -55,9 +55,30 @@ export namespace User { createTime: string[]; status: number; } + export interface ResRecords { + createTime: string; + dictCode: string; + dictLabel: string; + dictSort: number; + dictType: string; + dictValue: string; + isDefault: string; + remark: string; + status: string; + } + export interface ResResults { + current: string; + hitCount: boolean; + pages: string; + searchCount: boolean; + size: string; + total: string; + records: ResRecords[]; + } export interface ResUserList { id: string; configId: string; + dictCode: string; username: string; gender: string; user: { @@ -65,6 +86,7 @@ export namespace User { age: number; }; }; + records?: ResRecords[]; idCard: string; email: string; address: string; diff --git a/src/api/modules/jxjview.ts b/src/api/modules/jxjview.ts index 200c807..b48b980 100644 --- a/src/api/modules/jxjview.ts +++ b/src/api/modules/jxjview.ts @@ -26,3 +26,52 @@ export const editUser = (params: { id: string }) => { export const deleteUser = (params: { id: string }) => { return http.post(PORT1 + `/xmgl/systemConfig/delete`, params); }; + +// 政务管理 !!!!!!!!!!!!!!!!!!! +export const getGovermentList = (params: User.ReqUserParams) => { + return http.post>(PORT1 + `/xmgl/government/page`, params); +}; + +// * 新增用户 +export const addGovernment = (params: FormData) => { + return http.post(PORT1 + `/xmgl/government/add`, params); +}; + +// * 编辑用户 +export const editGovernment = (params: { id: string }) => { + return http.post(PORT1 + `/xmgl/government/edit`, params); +}; + +// 字典 !!!!!!!!!!!!!! +// 查询 +export const getDictionaryList = (params: User.ReqUserParams) => { + return http.post>(PORT1 + `/xmgl/systemDictType/page`, params); +}; + +// 查询detail +export const getDictionaryDetail = (params: User.ReqUserParams) => { + return http.post>(PORT1 + `/xmgl/systemDictData/page`, params); +}; +// * 新增用户 +export const addDictionary = (params: FormData) => { + return http.post(PORT1 + `/xmgl/systemDictType/add`, params); +}; + +export const addDiaDictionary = (params: FormData) => { + return http.post(PORT1 + `/xmgl/systemDictData/add`, params); +}; + +// * 编辑用户 +export const editDictionary = (params: { id: string }) => { + return http.post(PORT1 + `/xmgl/systemDictType/edit`, params); +}; + +// * 删除用户 +export const deleteDictionary = (params: { id: number }) => { + return http.post(PORT1 + `/xmgl/systemDictType/delete`, params); +}; + +//删除字典数据信息 +export const deleteDia = (params: { id: number }) => { + return http.post(PORT1 + `/xmgl/systemDictData/delete`, params); +}; diff --git a/src/api/modules/login.ts b/src/api/modules/login.ts index f4287a3..0b6a65d 100644 --- a/src/api/modules/login.ts +++ b/src/api/modules/login.ts @@ -10,11 +10,11 @@ import http from "@/api"; */ // * 用户登录 export const loginApi = (params: Login.ReqLoginForm) => { - return http.post(PORT1 + `xmgl/systemUser/login`, params, { headers: { noLoading: true } }); // 正常 post json 请求 ==> application/json - return http.post(PORT1 + `/login`, params, { headers: { noLoading: true } }); // 控制当前请求不显示 loading - return http.post(PORT1 + `/login`, {}, { params }); // post 请求携带 query 参数 ==> ?username=admin&password=123456 - return http.post(PORT1 + `/login`, qs.stringify(params)); // post 请求携带表单参数 ==> application/x-www-form-urlencoded - return http.get(PORT1 + `/login?${qs.stringify(params, { arrayFormat: "repeat" })}`); // 如果是 get 请求可以携带数组等复杂参数 + return http.post(PORT1 + `/xmgl/systemUser/login`, params, { headers: { noLoading: true } }); // 正常 post json 请求 ==> application/json + return http.post(PORT1 + `/xmgl/systemUser/login`, params, { headers: { noLoading: true } }); // 控制当前请求不显示 loading + return http.post(PORT1 + `/xmgl/systemUser/login`, {}, { params }); // post 请求携带 query 参数 ==> ?username=admin&password=123456 + return http.post(PORT1 + `/xmgl/systemUser/login`, qs.stringify(params)); // post 请求携带表单参数 ==> application/x-www-form-urlencoded + return http.get(PORT1 + `/xmgl/systemUser/login?${qs.stringify(params, { arrayFormat: "repeat" })}`); // 如果是 get 请求可以携带数组等复杂参数 }; // * 获取按钮权限 diff --git a/src/assets/json/dynamicRouter.json b/src/assets/json/dynamicRouter.json index 9096f66..0557631 100644 --- a/src/assets/json/dynamicRouter.json +++ b/src/assets/json/dynamicRouter.json @@ -2,9 +2,9 @@ "code": 200, "data": [ { - "path": "/home/index", - "name": "home", - "component": "/home/index", + "path": "/government", + "name": "government", + "component": "/jxjview/government/index", "meta": { "icon": "HomeFilled", "title": "政务管理", @@ -17,8 +17,7 @@ }, { "path": "/system", - "name": "system", - "component": "/jxjview/system/index", + "meta": { "icon": "Tools", "title": "菜单管理", @@ -31,8 +30,7 @@ }, { "path": "/system", - "name": "system", - "component": "/jxjview/system/index", + "meta": { "icon": "Tools", "title": "APP管理", @@ -58,9 +56,9 @@ } }, { - "path": "/system", - "name": "system", - "component": "/jxjview/system/index", + "path": "/dictionary", + "name": "dictionary", + "component": "/jxjview/dictionary/index", "meta": { "icon": "Tools", "title": "系统字典", diff --git a/src/components/DialogForm/index.vue b/src/components/DialogForm/index.vue index a8786b0..9e6e99a 100644 --- a/src/components/DialogForm/index.vue +++ b/src/components/DialogForm/index.vue @@ -7,6 +7,9 @@ :title="props.title" :width="props.width || '50%'" > + @@ -79,12 +94,13 @@ diff --git a/src/views/jxjview/dictionary/index.vue b/src/views/jxjview/dictionary/index.vue new file mode 100644 index 0000000..8b9485c --- /dev/null +++ b/src/views/jxjview/dictionary/index.vue @@ -0,0 +1,321 @@ + + diff --git a/src/views/jxjview/government/index.vue b/src/views/jxjview/government/index.vue new file mode 100644 index 0000000..5e177ee --- /dev/null +++ b/src/views/jxjview/government/index.vue @@ -0,0 +1,183 @@ + + + + diff --git a/vite.config.ts b/vite.config.ts index 911b5a5..c11ab35 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -39,16 +39,16 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => { host: "0.0.0.0", port: viteEnv.VITE_PORT, open: viteEnv.VITE_OPEN, - cors: true, + cors: true // 跨域代理配置 - proxy: { - "/api": { - target: "http://10.0.1.49:6688", // easymock - // target: "https://www.fastmock.site/mock/f81e8333c1a9276214bcdbc170d9e0a0", // fastmock - changeOrigin: true, - rewrite: path => path.replace(/^\/api/, "") - } - } + // proxy: { + // "/api": { + // target: "http://10.0.1.49:6688", // easymock + // // target: "https://www.fastmock.site/mock/f81e8333c1a9276214bcdbc170d9e0a0", // fastmock + // changeOrigin: true, + // rewrite: path => path.replace(/^\/api/, "") + // } + // } }, plugins: [ vue(),