Browse Source

Merge branch 'release/V1.2.0/test' into release/V2.0.0/test

木星 2 weeks ago
parent
commit
39e399279b

+ 1 - 1
.env.base

@@ -22,7 +22,7 @@ VITE_APP_TITLE='灵客管理后台'
22 22
 VITE_USE_ALL_ELEMENT_PLUS_STYLE=true
23 23
 
24 24
 # 是否开启mock
25
-VITE_USE_MOCK=true
25
+VITE_USE_MOCK=false
26 26
 
27 27
 # 是否使用在线图标
28 28
 VITE_USE_ONLINE_ICON=true

+ 1 - 1
.env.gitee

@@ -29,7 +29,7 @@ VITE_USE_BUNDLE_ANALYZER=false
29 29
 VITE_USE_ALL_ELEMENT_PLUS_STYLE=false
30 30
 
31 31
 # 是否开启mock
32
-VITE_USE_MOCK=true
32
+VITE_USE_MOCK=false
33 33
 
34 34
 # 是否切割css
35 35
 VITE_USE_CSS_SPLIT=true

+ 1 - 1
.env.pro

@@ -36,7 +36,7 @@ VITE_USE_BUNDLE_ANALYZER=true
36 36
 VITE_USE_ALL_ELEMENT_PLUS_STYLE=false
37 37
 
38 38
 # 是否开启mock
39
-VITE_USE_MOCK=true
39
+VITE_USE_MOCK=false
40 40
 
41 41
 # 是否切割css
42 42
 VITE_USE_CSS_SPLIT=true

+ 0 - 18
mock/_createProductionServer.ts

@@ -1,18 +0,0 @@
1
-import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'
2
-
3
-const modules = import.meta.glob('./**/*.mock.ts', {
4
-  import: 'default',
5
-  eager: true
6
-})
7
-
8
-const mockModules: any[] = []
9
-Object.keys(modules).forEach(async (key) => {
10
-  if (key.includes('_')) {
11
-    return
12
-  }
13
-  mockModules.push(...(modules[key] as any))
14
-})
15
-
16
-export function setupProdMockServer() {
17
-  createProdMockServer(mockModules)
18
-}

+ 0 - 150
mock/role/index.mock.ts

@@ -1,150 +0,0 @@
1
-/*
2
- * @Author: 半生瓜 1515706227@qq.com
3
- * @Date: 2024-04-21 17:20:21
4
- * @LastEditors: 半生瓜 1515706227@qq.com
5
- * @LastEditTime: 2024-05-07 15:55:12
6
- * @FilePath: \vue-element-plus-admin-mini\mock\role\index.mock.ts
7
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
- */
9
-import { MockMethod } from 'vite-plugin-mock'
10
-import { SUCCESS_CODE } from '@/constants'
11
-
12
-const timeout = 1000
13
-
14
-const adminList = [
15
-  {
16
-    path: '/Template',
17
-    component: '#',
18
-    redirect: '/Template/TemplateManage',
19
-    name: 'Template',
20
-    meta: {
21
-      title: 'router.level',
22
-    },
23
-    children: [
24
-      {
25
-        path: 'TemplateManage',
26
-        name: 'TemplateManage',
27
-        component: 'views/Template/TemplateManage',
28
-        meta: {
29
-          title: '模板管理',
30
-          icon: 'ant-design:dashboard-filled',
31
-        }
32
-      }
33
-    ]
34
-  },
35
-  {
36
-    path: '/Resource',
37
-    component: '#',
38
-    redirect: '/Resource/ResourceManage',
39
-    name: 'Resource',
40
-    meta: {
41
-      title: 'router.level'
42
-    },
43
-    children: [
44
-      {
45
-        path: 'ResourceManage',
46
-        name: 'ResourceManage',
47
-        component: 'views/Resource/ResourceManage',
48
-        meta: {
49
-          title: '资源管理',
50
-          icon: 'carbon:skill-level-advanced'   
51
-        }
52
-      }
53
-    ]
54
-  },
55
-  {
56
-    path: '/Audit',
57
-    component: '#',
58
-    redirect: '/Audit/AuditManage',
59
-    name: 'Audit',
60
-    meta: {
61
-      title: '审核管理',
62
-    },
63
-    children: [
64
-      {
65
-        path: 'AuditManage',
66
-        name: 'AuditManage',
67
-        component: 'views/Audit/AuditManage',
68
-        meta: {
69
-          icon: 'ri:function-fill',
70
-          title: '审核管理'
71
-        }
72
-      }
73
-    ]
74
-  },
75
-  {
76
-    path: '/Authority',
77
-    component: '#',
78
-    redirect: '/Authority/AuditManage',
79
-    name: 'Authority',
80
-    meta: {
81
-      title: '权限管理',
82
-      icon: 'eos-icons:role-binding',
83
-    },
84
-    children: [
85
-      {
86
-        path: 'User',
87
-        name: 'User',
88
-        component: 'views/Authority/User',
89
-        meta: {
90
-          title: '用户管理'
91
-        }
92
-      },
93
-      {
94
-        path: 'Role',
95
-        name: 'Role',
96
-        component: 'views/Authority/Role',
97
-        meta: {
98
-          title: '角色管理'
99
-        }
100
-      },
101
-    ]
102
-  },
103
-  {
104
-    path: '/System',
105
-    component: '#',
106
-    redirect: '/System/SystemSetting',
107
-    name: 'System',
108
-    meta: {
109
-      title: '系统设置',
110
-    },
111
-    children: [
112
-      {
113
-        path: 'SystemSetting',
114
-        name: 'SystemSetting',
115
-        component: 'views/System/SystemSetting',
116
-        meta: {
117
-          icon: 'ic:outline-webhook',
118
-          title: '系统设置'
119
-        }
120
-      }
121
-    ]
122
-  }
123
-]
124
-
125
-const testList: string[] = [
126
-  '/level',
127
-  '/zy',
128
-  '/zy/Menu12',
129
-  '/level/menu1',
130
-  '/level/menu1/menu1-1',
131
-  '/level/menu1/menu1-1/menu1-1-1',
132
-  '/level/menu1/menu1-2',
133
-  '/level/menu2'
134
-]
135
-
136
-export default [
137
-  // 列表接口
138
-  {
139
-    url: '/mock/role/list',
140
-    method: 'get',
141
-    timeout,
142
-    response: ({ query }) => {
143
-      const { roleName } = query
144
-      return {
145
-        code: SUCCESS_CODE,
146
-        data: roleName === 'admin' ? adminList : testList
147
-      }
148
-    }
149
-  }
150
-] as MockMethod[]

+ 0 - 249
mock/table/index.mock.ts

@@ -1,249 +0,0 @@
1
-import Mock from 'mockjs'
2
-import { SUCCESS_CODE } from '@/constants'
3
-import { toAnyString } from '@/utils'
4
-
5
-const timeout = 1000
6
-const count = 100
7
-
8
-const baseContent =
9
-  '<p>I am testing data, I am testing data.</p><p><img src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943"></p>'
10
-
11
-interface ListProps {
12
-  id: string
13
-  author: string
14
-  title: string
15
-  content: string
16
-  importance: number
17
-  display_time: any
18
-  pageviews: number
19
-  image_uri: string
20
-  video_uri?: string
21
-}
22
-
23
-interface TreeListProps {
24
-  id: string
25
-  author: string
26
-  title: string
27
-  content: string
28
-  importance: number
29
-  display_time: any
30
-  image_uri: string
31
-  pageviews: number
32
-  video_uri?: string
33
-  children?: TreeListProps[]
34
-}
35
-
36
-let List: ListProps[] = []
37
-
38
-for (let i = 0; i < count; i++) {
39
-  List.push(
40
-    Mock.mock({
41
-      id: toAnyString(),
42
-      // timestamp: +Mock.Random.date('T'),
43
-      author: '@first',
44
-      title: '@title(5, 10)',
45
-      content: baseContent,
46
-      importance: '@integer(1, 3)',
47
-      display_time: '@datetime',
48
-      pageviews: '@integer(100, 500)',
49
-      image_uri: Mock.Random.image('@integer(100, 500)x@integer(100, 500)'),
50
-      video_uri:
51
-        '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-720p.mp4'
52
-    })
53
-  )
54
-}
55
-
56
-const treeList: TreeListProps[] = []
57
-
58
-for (let i = 0; i < count; i++) {
59
-  treeList.push(
60
-    Mock.mock({
61
-      id: toAnyString(),
62
-      // timestamp: +Mock.Random.date('T'),
63
-      author: '@first',
64
-      title: '@title(5, 10)',
65
-      content: baseContent,
66
-      importance: '@integer(1, 3)',
67
-      display_time: '@datetime',
68
-      pageviews: '@integer(300, 5000)',
69
-      image_uri: Mock.Random.image('@integer(100, 500)x@integer(100, 500)'),
70
-      // image_uri
71
-    })
72
-  )
73
-}
74
-
75
-const cardList = [
76
-  {
77
-    logo: 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
78
-    name: 'Alipay',
79
-    desc: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
80
-  },
81
-  {
82
-    logo: 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
83
-    name: 'Angular',
84
-    desc: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
85
-  },
86
-  {
87
-    logo: 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png',
88
-    name: 'Bootstrap',
89
-    desc: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
90
-  },
91
-  {
92
-    logo: 'https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png',
93
-    name: 'React',
94
-    desc: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
95
-  },
96
-  {
97
-    logo: 'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png',
98
-    name: 'Vue',
99
-    desc: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
100
-  },
101
-  {
102
-    logo: 'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png',
103
-    name: 'Webpack',
104
-    desc: '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
105
-  }
106
-]
107
-
108
-export default [
109
-  // 树形列表接口
110
-  {
111
-    url: '/mock/example/treeList',
112
-    method: 'get',
113
-    timeout,
114
-    response: ({ query }) => {
115
-      const { title, pageIndex, pageSize } = query
116
-      const mockList = treeList.filter((item) => {
117
-        if (title && item.title.indexOf(title) < 0) return false
118
-        return true
119
-      })
120
-      const pageList = mockList.filter(
121
-        (_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1)
122
-      )
123
-      return {
124
-        code: SUCCESS_CODE,
125
-        data: {
126
-          total: mockList.length,
127
-          list: pageList
128
-        }
129
-      }
130
-    }
131
-  },
132
-  // 列表接口
133
-  {
134
-    url: '/mock/example/list',
135
-    method: 'get',
136
-    timeout,
137
-    response: ({ query }) => {
138
-      const { title, pageIndex, pageSize } = query
139
-      const mockList = List.filter((item) => {
140
-        if (title && item.title.indexOf(title) < 0) return false
141
-        return true
142
-      })
143
-      const pageList = mockList.filter(
144
-        (_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1)
145
-      )
146
-      return {
147
-        code: SUCCESS_CODE,
148
-        data: {
149
-          total: mockList.length,
150
-          list: pageList
151
-        }
152
-      }
153
-    }
154
-  },
155
-  // 保存接口
156
-  {
157
-    url: '/mock/example/save',
158
-    method: 'post',
159
-    timeout,
160
-    response: ({ body }) => {
161
-      if (!body.id) {
162
-        List = [
163
-          Object.assign(body, {
164
-            id: toAnyString()
165
-          })
166
-        ].concat(List)
167
-        return {
168
-          code: SUCCESS_CODE,
169
-          data: 'success'
170
-        }
171
-      } else {
172
-        List.map((item) => {
173
-          if (item.id === body.id) {
174
-            for (const key in item) {
175
-              item[key] = body[key]
176
-            }
177
-          }
178
-        })
179
-        return {
180
-          code: SUCCESS_CODE,
181
-          data: 'success'
182
-        }
183
-      }
184
-    }
185
-  },
186
-  // 详情接口
187
-  {
188
-    url: '/mock/example/detail',
189
-    method: 'get',
190
-    response: ({ query }) => {
191
-      const { id } = query
192
-      for (const example of List) {
193
-        if (example.id === id) {
194
-          return {
195
-            code: SUCCESS_CODE,
196
-            data: example
197
-          }
198
-        }
199
-      }
200
-    }
201
-  },
202
-  // 删除接口
203
-  {
204
-    url: '/mock/example/delete',
205
-    method: 'post',
206
-    response: ({ body }) => {
207
-      const ids = body.ids
208
-      if (!ids) {
209
-        return {
210
-          code: 500,
211
-          message: '请选择需要删除的数据'
212
-        }
213
-      } else {
214
-        let i = List.length
215
-        while (i--) {
216
-          if (ids.indexOf(List[i].id) !== -1) {
217
-            List.splice(i, 1)
218
-          }
219
-        }
220
-        return {
221
-          code: SUCCESS_CODE,
222
-          data: 'success'
223
-        }
224
-      }
225
-    }
226
-  },
227
-  {
228
-    url: '/mock/card/list',
229
-    method: 'get',
230
-    timeout,
231
-    response: ({ query }) => {
232
-      const { name, pageIndex, pageSize } = query
233
-      const mockList = cardList.filter((item) => {
234
-        if (name && item.name.indexOf(name) < 0) return false
235
-        return true
236
-      })
237
-      const pageList = mockList.filter(
238
-        (_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1)
239
-      )
240
-      return {
241
-        code: SUCCESS_CODE,
242
-        data: {
243
-          total: mockList.length,
244
-          list: pageList
245
-        }
246
-      }
247
-    }
248
-  }
249
-]

+ 0 - 90
mock/user/index.mock.ts

@@ -1,90 +0,0 @@
1
-import { SUCCESS_CODE } from '@/constants'
2
-
3
-const timeout = 1000
4
-
5
-const List: {
6
-  username: string
7
-  password: string
8
-  role: string
9
-  roleId: string
10
-  permissions: string | string[]
11
-}[] = [
12
-  {
13
-    username: 'admin',
14
-    password: 'admin',
15
-    role: 'admin',
16
-    roleId: '1',
17
-    permissions: ['*.*.*']
18
-  },
19
-  {
20
-    username: 'test',
21
-    password: 'test',
22
-    role: 'test',
23
-    roleId: '2',
24
-    permissions: ['example:dialog:create', 'example:dialog:delete']
25
-  }
26
-]
27
-
28
-export default [
29
-  // 列表接口
30
-  {
31
-    url: '/mock/user/list',
32
-    method: 'get',
33
-    response: ({ query }) => {
34
-      const { username, pageIndex, pageSize } = query
35
-
36
-      const mockList = List.filter((item) => {
37
-        if (username && item.username.indexOf(username) < 0) return false
38
-        return true
39
-      })
40
-      const pageList = mockList.filter(
41
-        (_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1)
42
-      )
43
-
44
-      return {
45
-        code: SUCCESS_CODE,
46
-        data: {
47
-          total: mockList.length,
48
-          list: pageList
49
-        }
50
-      }
51
-    }
52
-  },
53
-  // 登录接口
54
-  {
55
-    url: '/mock/user/login',
56
-    method: 'post',
57
-    timeout,
58
-    response: ({ body }) => {
59
-      const data = body
60
-      let hasUser = false
61
-      for (const user of List) {
62
-        if (user.username === data.username && user.password === data.password) {
63
-          hasUser = true
64
-          return {
65
-            code: SUCCESS_CODE,
66
-            data: user
67
-          }
68
-        }
69
-      }
70
-      if (!hasUser) {
71
-        return {
72
-          code: 500,
73
-          message: '账号或密码错误'
74
-        }
75
-      }
76
-    }
77
-  },
78
-  // 退出接口
79
-  {
80
-    url: '/mock/user/loginOut',
81
-    method: 'get',
82
-    timeout,
83
-    response: () => {
84
-      return {
85
-        code: SUCCESS_CODE,
86
-        data: null
87
-      }
88
-    }
89
-  }
90
-]

+ 0 - 24
src/api/System/index.ts

@@ -9,18 +9,6 @@
9 9
 import request from '@/axios'
10 10
 import type { TableData } from './types'
11 11
 
12
-export const getTableListApi = (params: any) => {
13
-  return request.get({ url: '/mock/example/list', params })
14
-}
15
-
16
-export const getCardTableListApi = (params: any) => {
17
-  return request.get({ url: '/mock/card/list', params })
18
-}
19
-
20
-export const getTreeTableListApi = (params: any) => {
21
-  return request.get({ url: '/mock/example/treeList', params })
22
-}
23
-
24 12
 //查询全部产品配置参数接口
25 13
 export const getSystem = () => {
26 14
   return request.post({ url: '/config/manage/all' })
@@ -47,15 +35,3 @@ export const saveSystem = (params: any) => {
47 35
 export const deleteBulletin = (params: any) => {
48 36
   return request.post({ url: '/bulletin/manage/delete', params })
49 37
 }
50
-
51
-export const saveTableApi = (data: Partial<TableData>): Promise<IResponse> => {
52
-  return request.post({ url: '/mock/example/save', data })
53
-}
54
-
55
-export const getTableDetApi = (id: string): Promise<IResponse<TableData>> => {
56
-  return request.get({ url: '/mock/example/detail', params: { id } })
57
-}
58
-
59
-export const delTableListApi = (ids: string[] | number[]): Promise<IResponse> => {
60
-  return request.post({ url: '/mock/example/delete', data: { ids } })
61
-}

+ 0 - 8
src/api/login/index.ts

@@ -17,18 +17,10 @@ export const loginApi = (data): Promise<IResponse> => {
17 17
   return request.post({ url: '/jwt/token', data })
18 18
 }
19 19
 
20
-export const loginOutApi = (): Promise<IResponse> => {
21
-  return request.get({ url: '/mock/user/loginOut' })
22
-}
23
-
24 20
 export const getAdminRoleApi = (): Promise<IResponse<AppCustomRouteRecordRaw[]>> => {
25 21
   return request.post({ url: '/user/authList' })
26 22
 }
27 23
 
28
-export const getTestRoleApi = (params: RoleParams): Promise<IResponse<string[]>> => {
29
-  return request.get({ url: '/mock/role/list2', params })
30
-}
31
-
32 24
 export const getRsaKey = (): Promise<IResponse> => {
33 25
   return request.post({ url: '/encrypt/rsaKey' })
34 26
 }

+ 0 - 2
src/api/material/index.ts

@@ -11,7 +11,6 @@ import request from '@/axios'
11 11
 //资源管理分页接口
12 12
 export const getMaterial = (params: any) => {
13 13
   params.page = params.page - 1
14
-  params.materialType = 1
15 14
   return request.post({ url: '/material/pageQuery', params })
16 15
 }
17 16
 
@@ -22,7 +21,6 @@ export const upIcon = (params: any) => {
22 21
 
23 22
 //保存材质接口
24 23
 export const saveResource = (params: any) => {
25
-  params.materialType = 1
26 24
   return request.post({ url: '/material/save', data: params })
27 25
 }
28 26
 //批量保存材质接口

+ 10 - 3
src/components/Editor/src/Editor.vue

@@ -10,10 +10,17 @@ import { useLocaleStore } from '@/store/modules/locale'
10 10
 
11 11
 const userStore = useUserStore()
12 12
 const token = userStore.getToken
13
-const Authorization = `Bearer ${token}`
14
-
15 13
 const localeStore = useLocaleStore()
16
-const headers = ref({ Authorization: Authorization })
14
+
15
+const Authorization = ref(`Bearer ${userStore.getToken}`)
16
+const headers = ref({ Authorization: Authorization.value })
17
+
18
+setInterval(() => {
19
+  Authorization.value = `Bearer ${userStore.getToken}`
20
+  console.log('Authorization', Authorization.value)
21
+  headers.value = { Authorization: Authorization.value }
22
+}, 6000) //
23
+
17 24
 const currentLocale = computed(() => localeStore.getCurrentLocale)
18 25
 
19 26
 i18nChangeLanguage(unref(currentLocale).lang)

+ 10 - 2
src/views/Audit/AuditManage.vue

@@ -120,7 +120,11 @@ const deletetab = async (data: TableSlotDefault) => {
120 120
     const res = await deleteAudit(arr)
121 121
     refresh()
122 122
     if (res.code == 200) {
123
-      ElMessage.success('删除成功')
123
+      if (res.message.includes('成功')) {
124
+        ElMessage.success(res.message)
125
+      } else {
126
+        ElMessage.error(res.message)
127
+      }
124 128
     }
125 129
     refresh()
126 130
   })
@@ -145,7 +149,11 @@ const getSelections = async () => {
145 149
         const res = await deleteAudit(arr)
146 150
         console.log('kkkkkkss', res)
147 151
         if (res.code == 200) {
148
-          ElMessage.success('删除成功')
152
+          if (res.message.includes('成功')) {
153
+            ElMessage.success(res.message)
154
+          } else {
155
+            ElMessage.error(res.message)
156
+          }
149 157
         }
150 158
         refresh()
151 159
       })

+ 9 - 1
src/views/Authority/Role.vue

@@ -148,6 +148,9 @@ const editRole = async (data) => {
148 148
     morenxz.push(item)
149 149
   })
150 150
   console.log('sssssa', morenxz)
151
+    morenxz.push(item)
152
+  })
153
+  console.log('sssssa', morenxz)
151 154
 
152 155
   tianjia().then(async () => {
153 156
     const formData = await getFormData()
@@ -207,7 +210,8 @@ const tianjia = async () => {
207 210
       let a1 = {
208 211
         label: item.name,
209 212
         id: item.id,
210
-        value: item.id
213
+        value: item.id,
214
+        childrenid: item.children[0].id
211 215
       }
212 216
       transformedData.push(a1)
213 217
     } else {
@@ -230,6 +234,8 @@ const tianjia = async () => {
230 234
   data = transformedData
231 235
   console.log('sadas22d', data)
232 236
 
237
+  console.log('sadas22d', data)
238
+
233 239
   isshow.value = false
234 240
 }
235 241
 
@@ -334,7 +340,9 @@ const send = (a, b) => {
334 340
   query.authorityList = []
335 341
   b.checkedNodes.map((item) => {
336 342
     query.authorityList.push(item.value)
343
+    query.authorityList.push(item.childrenid)
337 344
     query2.authorityList.push(item.value)
345
+    query2.authorityList.push(item.childrenid)
338 346
   })
339 347
 }
340 348
 

+ 4 - 11
src/views/Login/components/LoginForm.vue

@@ -12,14 +12,7 @@ import { Form, FormSchema } from '@/components/Form'
12 12
 import { useI18n } from '@/hooks/web/useI18n'
13 13
 import { ElCheckbox, ElLink, ElMessage } from 'element-plus'
14 14
 import { useForm } from '@/hooks/web/useForm'
15
-import {
16
-  loginApi,
17
-  getRsaKey,
18
-  getTestRoleApi,
19
-  getAdminRoleApi,
20
-  getRefreshToken,
21
-  getuesrinfo
22
-} from '@/api/login'
15
+import { loginApi, getRsaKey, getAdminRoleApi, getRefreshToken, getuesrinfo } from '@/api/login'
23 16
 import { useAppStore } from '@/store/modules/app'
24 17
 import { usePermissionStore } from '@/store/modules/permission'
25 18
 import { useRouter } from 'vue-router'
@@ -77,7 +70,7 @@ const schema = reactive<FormSchema[]>([
77 70
       span: 24
78 71
     },
79 72
     componentProps: {
80
-      placeholder: '请输入用户名',
73
+      placeholder: '请输入账号',
81 74
       prefixIcon: <Icon icon="mdi:account" />
82 75
     }
83 76
   },
@@ -219,7 +212,7 @@ const signIn = async () => {
219 212
               if (item.configKey == 'jarVersion') {
220 213
                 a1 = item
221 214
                 a1.configValue = JSON.parse(a1.configValue)
222
-                a1.configValue.manger = 'V1.0.0.20240606'
215
+                a1.configValue.manger = 'V1.1.0.20250208'
223 216
                 a1.configValue = JSON.stringify(a1.configValue)
224 217
 
225 218
                 saveSystem([a1]).then(() => {})
@@ -271,7 +264,7 @@ const getRole = async () => {
271 264
   const res =
272 265
     appStore.getDynamicRouter && appStore.getServerDynamicRouter
273 266
       ? await getAdminRoleApi()
274
-      : await getTestRoleApi(params)
267
+      : await getAdminRoleApi()
275 268
   if (res) {
276 269
     if (res.data.length > 0) {
277 270
       console.log('kankan....', res.data)

+ 217 - 41
src/views/Material/MaterialMange.vue

@@ -7,7 +7,7 @@
7 7
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8 8
 -->
9 9
 <script setup lang="tsx">
10
-import { ElInput } from 'element-plus'
10
+import { ElInput, ElSelect, ElOption } from 'element-plus'
11 11
 import { ref } from 'vue'
12 12
 import { Dialog } from '@/components/Dialog'
13 13
 import { ContentWrap } from '@/components/ContentWrap'
@@ -25,10 +25,13 @@ import { useForm } from '@/hooks/web/useForm'
25 25
 import { BaseButton } from '@/components/Button'
26 26
 import { useUserStore } from '@/store/modules/user'
27 27
 import { log } from 'console'
28
+import { json } from 'stream/consumers'
28 29
 const PATH_URL = window.VITE_API_BASE_PATH
29
-
30
+const tietu = ref('')
30 31
 const { required } = useValidator()
31 32
 const text = ref('')
33
+const materialType = ref('')
34
+
32 35
 const userStore = useUserStore()
33 36
 defineOptions({
34 37
   name: 'TemplateManage'
@@ -40,7 +43,8 @@ const { tableRegister, tableState, tableMethods } = useTable({
40 43
     const res = await getMaterial({
41 44
       page: unref(currentPage),
42 45
       pageSize: unref(pageSize),
43
-      name: unref(text)
46
+      name: unref(text),
47
+      materialType: unref(materialType)
44 48
     })
45 49
     res.data.content.map((item) => {
46 50
       item.materialIcon = PATH_URL + item.materialIcon
@@ -72,6 +76,17 @@ const columns = reactive<TableColumn[]>([
72 76
     type: 'index'
73 77
   },
74 78
   {
79
+    field: 'materialName',
80
+    label: '材质名称'
81
+  },
82
+  {
83
+    field: 'materialType',
84
+    label: '材质类型',
85
+    formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
86
+      return cellValue === 1 ? '贴图' : cellValue === 2 ? '颜色' : ''
87
+    }
88
+  },
89
+  {
75 90
     field: 'icon',
76 91
     label: '图标'
77 92
   },
@@ -95,6 +110,7 @@ const columns = reactive<TableColumn[]>([
95 110
   }
96 111
 ])
97 112
 const imageUrl = ref('')
113
+const imageUrl2 = ref('')
98 114
 const isedit = ref('添加')
99 115
 //删除
100 116
 const deletetab = async (data: TableSlotDefault) => {
@@ -119,15 +135,62 @@ const deletetab = async (data: TableSlotDefault) => {
119 135
 const dialogVisible = ref(false)
120 136
 const dialogVisible2 = ref(false)
121 137
 
122
-const token = userStore.getToken
123
-const Authorization = `Bearer ${token}`
124
-const headers = ref({ Authorization: Authorization })
138
+const Authorization = ref(`Bearer ${userStore.getToken}`)
139
+const headers = ref({ Authorization: Authorization.value })
140
+
141
+setInterval(() => {
142
+  Authorization.value = `Bearer ${userStore.getToken}`
143
+  console.log('Authorization', Authorization.value)
144
+  headers.value = { Authorization: Authorization.value }
145
+}, 6000) //
125 146
 
126 147
 const { formRegister, formMethods } = useForm()
127 148
 const { getElFormExpose, getFormData } = formMethods
128 149
 
129 150
 const schema = reactive<FormSchema[]>([
130 151
   {
152
+    field: 'materialType',
153
+    label: '材质类型',
154
+    component: 'Select',
155
+    colProps: {
156
+      span: 24
157
+    },
158
+    componentProps: {
159
+      options: [
160
+        { label: '贴图', value: 1 },
161
+        { label: '颜色', value: 2 }
162
+      ],
163
+      placeholder: '请选择材质类型',
164
+      onChange: (value) => {
165
+        if (value === 2) {
166
+          schema.find((item) => item.field === 'TIETU').colProps.span = 0
167
+        } else {
168
+          schema.find((item) => item.field === 'TIETU').colProps.span = 24
169
+        }
170
+      }
171
+    },
172
+    formItemProps: {
173
+      rules: [required()]
174
+    }
175
+  },
176
+  {
177
+    field: 'materialName',
178
+    label: '材质名称',
179
+    component: 'Input',
180
+    colProps: {
181
+      span: 24
182
+    },
183
+    componentProps: {
184
+      style: {
185
+        width: '100%'
186
+      },
187
+      placeholder: '请输入材质名称'
188
+    },
189
+    formItemProps: {
190
+      rules: [required()]
191
+    }
192
+  },
193
+  {
131 194
     field: 'materialIcon',
132 195
     component: 'Upload',
133 196
     colProps: {
@@ -147,11 +210,17 @@ const schema = reactive<FormSchema[]>([
147 210
         formData.materialIcon = _response.data
148 211
       },
149 212
       beforeUpload: (rawFile) => {
213
+        console.log('sadghasgdaj', rawFile.name.includes('jpeg'))
150 214
         console.log('kankangeshi', rawFile)
215
+        if (rawFile.name.includes('jpeg')) {
216
+          ElMessage.error('上传格式:png、jpg!')
217
+          return false
218
+        }
151 219
         if (rawFile.type !== 'image/png' && rawFile.type !== 'image/jpeg') {
152 220
           ElMessage.error('上传格式:png、jpg!')
153 221
           return false
154 222
         }
223
+
155 224
         return true
156 225
       },
157 226
       slots: {
@@ -170,50 +239,68 @@ const schema = reactive<FormSchema[]>([
170 239
     }
171 240
   },
172 241
   {
173
-    field: 'jsonPath',
242
+    field: 'TIETU',
174 243
     component: 'Upload',
175
-    label: '材质内容',
176 244
     colProps: {
177 245
       span: 24
178 246
     },
247
+    label: '贴图图片',
248
+    formItemProps: {},
179 249
     componentProps: {
180
-      limit: 1,
181
-      action: PATH_URL + '/resource/v1/addJsonFile',
250
+      action: PATH_URL + '/resource/manage/uploadImg',
182 251
       headers: headers,
183
-      fileList: [],
184
-      multiple: true,
185
-      onPreview: (uploadFile) => {
186
-        console.log(uploadFile)
187
-      },
188
-      onRemove: async (file) => {
189
-        const formData = await getFormData()
190
-        formData.jsonPath = ''
191
-        formData.compressFileName = ''
192
-        formData.uploadCompress = false
193
-      },
252
+      showFileList: false,
194 253
       onSuccess: async (_response, uploadFile) => {
195
-        console.log('kankan_response', uploadFile)
254
+        imageUrl2.value = URL.createObjectURL(uploadFile.raw!)
196 255
         const formData = await getFormData()
197
-        formData.jsonPath = _response.data
198
-        formData.compressFileName = uploadFile.name
199
-      },
200
-      beforeRemove: (uploadFile) => {},
201
-      onExceed: (files, uploadFiles) => {
202
-        ElMessage.warning('只能上传一个资源,请移除后重新上传')
256
+        formData.TIETU = _response.data
257
+        console.log('asdhjasdkj', formData)
203 258
       },
204 259
       beforeUpload: (rawFile) => {
205
-        console.log('kokokoko', rawFile)
206
-        // if (rawFile.type !== 'application/x-zip-compressed' && rawFile.name.indexOf('.rar') == -1) {
207
-        //   ElMessage.error('只能上传RAR、ZIP文件')
208
-        //   return false
209
-        // }
210
-        // return true
260
+        console.log('sadghasgdaj', rawFile.name.includes('jpeg'))
261
+        console.log('kankangeshi', rawFile)
262
+        if (rawFile.name.includes('jpeg')) {
263
+          ElMessage.error('上传格式:png、jpg!')
264
+          return false
265
+        }
266
+        if (rawFile.type !== 'image/png' && rawFile.type !== 'image/jpeg') {
267
+          ElMessage.error('上传格式:png、jpg!')
268
+          return false
269
+        }
270
+
271
+        return true
211 272
       },
212 273
       slots: {
213
-        default: () => <BaseButton type="primary">点击上传</BaseButton>,
214
-        tip: () => <div class="el-upload__tip">文件类型:JSON</div>
274
+        default: () => (
275
+          <>
276
+            {imageUrl2.value ? <img src={imageUrl2.value} class="avatar" /> : null}
277
+            {!imageUrl2.value ? (
278
+              <ElIcon class="avatar-uploader-icon" size="large" style="font-size: 50px">
279
+                +
280
+              </ElIcon>
281
+            ) : null}
282
+          </>
283
+        ),
284
+        tip: () => <div class="el-upload__tip">上传格式:png、jpg,大小:56x56px;</div>
215 285
       }
216 286
     }
287
+  },
288
+  {
289
+    field: 'jsonValue',
290
+    label: '材质内容',
291
+    component: 'Input',
292
+    colProps: {
293
+      span: 24
294
+    },
295
+    componentProps: {
296
+      type: 'textarea',
297
+      rows: 4,
298
+      placeholder: '请输入材质内容'
299
+    },
300
+
301
+    formItemProps: {
302
+      rules: [required()]
303
+    }
217 304
   }
218 305
 ])
219 306
 const schema2 = reactive<FormSchema[]>([
@@ -272,10 +359,21 @@ const edittab = async (data: TableSlotDefault) => {
272 359
   const formData = await getFormData()
273 360
   formData.compressFileName = data.row.compressFileName
274 361
   formData.jsonPath = data.row.jsonPath
362
+  formData.TIETU = data.row.jsonValue.texture
363
+
275 364
   formData.materialName = data.row.materialName
276 365
 
366
+  let a = JSON.parse(JSON.stringify(data.row.jsonValue))
367
+  tietu.value = a.texture
368
+  imageUrl2.value = PATH_URL + data.row.jsonValue.texture
369
+  delete a.texture
370
+  formData.jsonValue = JSON.stringify(a)
371
+
372
+  formData.materialType = data.row.materialType
373
+
277 374
   formData.materialIcon = data.row.materialIcon.replace(PATH_URL, '')
278 375
   imageUrl.value = data.row.materialIcon
376
+
279 377
   formData.materialId = data.row.materialId
280 378
   schema[1].componentProps.fileList = [
281 379
     {
@@ -283,20 +381,52 @@ const edittab = async (data: TableSlotDefault) => {
283 381
       url: data.row.jsonPath
284 382
     }
285 383
   ]
384
+
385
+  // 如果材质类型是颜色,不显示贴图图标
386
+  if (formData.materialType === 2) {
387
+    schema.find((item) => item.field === 'TIETU').colProps.span = 0
388
+  } else {
389
+    schema.find((item) => item.field === 'TIETU').colProps.span = 24
390
+  }
286 391
 }
287 392
 // 添加编辑模板管理
288 393
 const signIn = async () => {
289 394
   const formRef = await getElFormExpose()
290 395
   const formData = await getFormData()
396
+  console.log('asdhajgsh', formData.jsonValue)
397
+
398
+  if (!formData.TIETU && formData.materialType == 1) {
399
+    ElMessage.warning('请上传贴图图标')
400
+    return
401
+  }
402
+
403
+  try {
404
+    formData.jsonValue = JSON.parse(formData.jsonValue)
405
+  } catch (error) {
406
+    ElMessage.error('材质内容格式错误')
407
+    return
408
+  }
291 409
 
410
+  console.log('shdjasd1', formData.TIETU)
411
+  if (formData.TIETU) {
412
+    formData.jsonValue.texture = formData.TIETU
413
+  } else {
414
+    formData.jsonValue.texture = tietu.value
415
+  }
292 416
   //如果是编辑去掉icon的拼接
293 417
   console.log('kakkkkak', formData)
294 418
   await formRef?.validate(async (isValid) => {
295 419
     if (isValid) {
296 420
       const res = await saveResource(formData)
421
+      console.log('shdjasd22', res)
297 422
       if (res) {
298 423
         dialogVisible.value = false
424
+        ElMessage.success('保存成功')
299 425
         refresh()
426
+      } else {
427
+        console.log('asdhjasd')
428
+        delete formData.jsonValue.texture
429
+        formData.jsonValue = JSON.stringify(formData.jsonValue)
300 430
       }
301 431
     }
302 432
   })
@@ -350,23 +480,69 @@ const getSelections = async () => {
350 480
     ElMessage.warning('请选择数据')
351 481
   }
352 482
 }
483
+
484
+const options = [
485
+  {
486
+    value: 1,
487
+    label: '贴图'
488
+  },
489
+  {
490
+    value: 2,
491
+    label: '颜色'
492
+  }
493
+]
494
+
495
+//搜索
496
+const handersearch = function () {
497
+  tableState.currentPage.value = 1
498
+  refresh()
499
+}
500
+
353 501
 const tianjia = async () => {
354 502
   imageUrl.value = ''
503
+  imageUrl2.value = ''
355 504
   isedit.value = '添加'
356 505
   schema[1].componentProps.fileList = []
357 506
   dialogVisible.value = true
358 507
 }
359
-const batchtianjia = async () => {
360
-  dialogVisible2.value = true
361
-}
362 508
 </script>
363 509
 
364 510
 <template>
365 511
   <ContentWrap>
366 512
     <div style="margin-bottom: 10px">
513
+      <span style="color: #606266"> 材质名称:</span>
514
+      <el-input
515
+        v-model="text"
516
+        style="width: 200px; height: 43px; margin: 7px"
517
+        placeholder="请输入材质名称"
518
+      />
519
+      <span style="color: #606266"> 材质状态:</span>
520
+      <el-select
521
+        v-model="materialType"
522
+        clearable
523
+        placeholder="全部"
524
+        size="large"
525
+        style="width: 240px"
526
+      >
527
+        <el-option
528
+          v-for="item in options"
529
+          :key="item.value"
530
+          :label="item.label"
531
+          :value="item.value"
532
+        />
533
+      </el-select>
534
+
535
+      <ElButton
536
+        style="margin-left: 20px"
537
+        type="primary"
538
+        size="large"
539
+        @click="handersearch"
540
+        :icon="Search"
541
+        >搜索</ElButton
542
+      >
543
+
367 544
       <ElButton type="success" size="large" @click="tianjia" :icon="Edit">添加</ElButton>
368 545
       <ElButton type="danger" size="large" @click="getSelections" :icon="Delete">删除</ElButton>
369
-      <ElButton type="success" size="large" @click="batchtianjia" :icon="Edit">批量上传</ElButton>
370 546
     </div>
371 547
 
372 548
     <Table
@@ -388,7 +564,7 @@ const batchtianjia = async () => {
388 564
     />
389 565
   </ContentWrap>
390 566
 
391
-  <Dialog v-model="dialogVisible" maxHeight="390px" width="35rem" :title="isedit">
567
+  <Dialog v-model="dialogVisible" maxHeight="580px" width="35rem" :title="isedit">
392 568
     <Form :schema="schema" @register="formRegister" />
393 569
     <template #footer>
394 570
       <div style="width: 100%; display: flex; justify-content: center">

+ 9 - 4
src/views/Resource/ResourceManage.vue

@@ -127,9 +127,14 @@ const deletetab = async (data: TableSlotDefault) => {
127 127
 
128 128
 const dialogVisible = ref(false)
129 129
 
130
-const token = userStore.getToken
131
-const Authorization = `Bearer ${token}`
132
-const headers = ref({ Authorization: Authorization })
130
+const Authorization = ref(`Bearer ${userStore.getToken}`)
131
+const headers = ref({ Authorization: Authorization.value })
132
+
133
+setInterval(() => {
134
+  Authorization.value = `Bearer ${userStore.getToken}`
135
+  console.log('Authorization', Authorization.value)
136
+  headers.value = { Authorization: Authorization.value }
137
+}, 6000) // 每60秒更新一次token
133 138
 
134 139
 const { formRegister, formMethods } = useForm()
135 140
 const { getElFormExpose, getFormData } = formMethods
@@ -228,7 +233,7 @@ const schema = reactive<FormSchema[]>([
228 233
       },
229 234
       beforeUpload: (rawFile) => {
230 235
         console.log('kokokoko', rawFile)
231
-        if (rawFile.type !== 'application/x-zip-compressed' && rawFile.name.indexOf('.rar') == -1) {
236
+        if (rawFile.name.indexOf('.zip') == -1 && rawFile.name.indexOf('.rar') == -1) {
232 237
           ElMessage.error('只能上传RAR、ZIP文件')
233 238
           return false
234 239
         }

+ 10 - 2
src/views/System/SystemSetting.vue

@@ -33,9 +33,17 @@ import { any } from 'vue-types'
33 33
 import { useTable } from '@/hooks/web/useTable'
34 34
 const userStore = useUserStore()
35 35
 const token = userStore.getToken
36
-const Authorization = `Bearer ${token}`
36
+
37 37
 import type { UploadProps } from 'element-plus'
38
-const headers = ref({ Authorization: Authorization })
38
+
39
+const Authorization = ref(`Bearer ${userStore.getToken}`)
40
+const headers = ref({ Authorization: Authorization.value })
41
+
42
+setInterval(() => {
43
+  Authorization.value = `Bearer ${userStore.getToken}`
44
+  console.log('Authorization', Authorization.value)
45
+  headers.value = { Authorization: Authorization.value }
46
+}, 6000) //
39 47
 const PATH_URL = window.VITE_API_BASE_PATH + '/config/manage/uploadImg'
40 48
 const IMG_URL = window.VITE_API_BASE_PATH
41 49
 const { required, lengthRange } = useValidator()

+ 47 - 17
src/views/Template/TemplateManage.vue

@@ -115,9 +115,14 @@ const deletetab = async (data: TableSlotDefault) => {
115 115
 
116 116
 const dialogVisible = ref(false)
117 117
 
118
-const token = userStore.getToken
119
-const Authorization = `Bearer ${token}`
120
-const headers = ref({ Authorization: Authorization })
118
+const Authorization = ref(`Bearer ${userStore.getToken}`)
119
+const headers = ref({ Authorization: Authorization.value })
120
+
121
+setInterval(() => {
122
+  Authorization.value = `Bearer ${userStore.getToken}`
123
+  console.log('Authorization', Authorization.value)
124
+  headers.value = { Authorization: Authorization.value }
125
+}, 6000) //
121 126
 
122 127
 const { formRegister, formMethods } = useForm()
123 128
 const { getElFormExpose, getFormData } = formMethods
@@ -140,6 +145,31 @@ const schema = reactive<FormSchema[]>([
140 145
       rules: [required()]
141 146
     }
142 147
   },
148
+
149
+  {
150
+    field: 'typeNumber',
151
+    label: '模板内容',
152
+    component: 'Select',
153
+    colProps: {
154
+      span: 24
155
+    },
156
+    componentProps: {
157
+      options: [
158
+        {
159
+          value: 1,
160
+          label: '不含pak包'
161
+        },
162
+        {
163
+          value: 2,
164
+          label: '含pak包'
165
+        }
166
+      ],
167
+      slots: {}
168
+    },
169
+    formItemProps: {
170
+      rules: [required()]
171
+    }
172
+  },
143 173
   {
144 174
     field: 'thumbnail',
145 175
     component: 'Upload',
@@ -157,15 +187,17 @@ const schema = reactive<FormSchema[]>([
157 187
         formData.thumbnail = _response.data
158 188
       },
159 189
       beforeUpload: (rawFile) => {
160
-        console.log('kokokoko', rawFile)
161
-        if (
162
-          rawFile.type !== 'image/jpeg' &&
163
-          rawFile.type !== 'image/png' &&
164
-          rawFile.type !== 'image/jpg'
165
-        ) {
166
-          ElMessage.error('只能上传png、jpg格式')
190
+        console.log('sadghasgdaj', rawFile.name.includes('jpeg'))
191
+        console.log('kankangeshi', rawFile)
192
+        if (rawFile.name.includes('jpeg')) {
193
+          ElMessage.error('上传格式:png、jpg!')
167 194
           return false
168 195
         }
196
+        if (rawFile.type !== 'image/png' && rawFile.type !== 'image/jpeg') {
197
+          ElMessage.error('上传格式:png、jpg!')
198
+          return false
199
+        }
200
+
169 201
         return true
170 202
       },
171 203
       slots: {
@@ -216,18 +248,15 @@ const schema = reactive<FormSchema[]>([
216 248
       },
217 249
       beforeUpload: (rawFile) => {
218 250
         console.log('kokokoko', rawFile)
219
-        if (rawFile.type !== 'application/x-zip-compressed' || rawFile.type !== 'application/zip') {
251
+        if (rawFile.type !== 'application/x-zip-compressed' && rawFile.type !== 'application/zip') {
220 252
           ElMessage.error('只能上传ZIP文件')
221 253
           return false
222
-        } else if (rawFile.size / 1024 / 1024 > 2048) {
223
-          ElMessage.error('文件不超过2G!')
224
-          return false
225 254
         }
226 255
         return true
227 256
       },
228 257
       slots: {
229 258
         default: () => <BaseButton type="primary">点击上传</BaseButton>,
230
-        tip: () => <div class="el-upload__tip">只能上传ZIP文件,且不超过2G</div>
259
+        tip: () => <div class="el-upload__tip">只能上传ZIP文件</div>
231 260
       }
232 261
     }
233 262
   }
@@ -246,7 +275,8 @@ const edittab = async (data: TableSlotDefault) => {
246 275
   formData.thumbnail = data.row.thumbnail
247 276
   imageUrl.value = PATH_URL + data.row.thumbnail
248 277
   formData.zoneId = data.row.zoneId
249
-  schema[2].componentProps.fileList = [
278
+  formData.typeNumber = data.row.typeNumber
279
+  schema[3].componentProps.fileList = [
250 280
     {
251 281
       name: data.row.templateFileName,
252 282
       url: data.row.templateFilePath
@@ -350,7 +380,7 @@ const tianjia = async () => {
350 380
     />
351 381
   </ContentWrap>
352 382
 
353
-  <Dialog v-model="dialogVisible" maxHeight="380px" width="35rem" :title="isedit">
383
+  <Dialog v-model="dialogVisible" maxHeight="430px" width="35rem" :title="isedit">
354 384
     <Form :schema="schema" @register="formRegister" />
355 385
 
356 386
     <template #footer>