mirror of
				https://github.com/continew-org/continew-admin-ui.git
				synced 2025-11-04 10:57:08 +08:00 
			
		
		
		
	refactor: 适配系统参数 API 新的使用方式
This commit is contained in:
		@@ -263,6 +263,7 @@ export interface StoragePageQuery extends StorageQuery, PageQuery {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/** 系统参数类型 */
 | 
					/** 系统参数类型 */
 | 
				
			||||||
export interface OptionResp {
 | 
					export interface OptionResp {
 | 
				
			||||||
 | 
					  id: string
 | 
				
			||||||
  name: string
 | 
					  name: string
 | 
				
			||||||
  code: string
 | 
					  code: string
 | 
				
			||||||
  value: string
 | 
					  value: string
 | 
				
			||||||
@@ -270,7 +271,8 @@ export interface OptionResp {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface OptionQuery {
 | 
					export interface OptionQuery {
 | 
				
			||||||
  code: Array<string>
 | 
					  code?: Array<string>
 | 
				
			||||||
 | 
					  category?: string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 基础配置类型 */
 | 
					/** 基础配置类型 */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,7 +59,7 @@ const storeSetup = () => {
 | 
				
			|||||||
  // 初始化系统配置
 | 
					  // 初始化系统配置
 | 
				
			||||||
  const initSiteConfig = () => {
 | 
					  const initSiteConfig = () => {
 | 
				
			||||||
    listOptionDict({
 | 
					    listOptionDict({
 | 
				
			||||||
      code: ['SITE_FAVICON', 'SITE_LOGO', 'SITE_TITLE', 'SITE_COPYRIGHT']
 | 
					      category: 'SITE'
 | 
				
			||||||
    }).then((res) => {
 | 
					    }).then((res) => {
 | 
				
			||||||
      const resMap = new Map()
 | 
					      const resMap = new Map()
 | 
				
			||||||
      res.data.forEach((item) => {
 | 
					      res.data.forEach((item) => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -125,7 +125,7 @@ const handleCancel = () => {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const queryForm = {
 | 
					const queryForm = {
 | 
				
			||||||
  code: Object.keys(mailConfig.value)
 | 
					  category: 'MAIL'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// 查询列表数据
 | 
					// 查询列表数据
 | 
				
			||||||
const getDataList = async () => {
 | 
					const getDataList = async () => {
 | 
				
			||||||
@@ -143,7 +143,7 @@ const handleSave = async () => {
 | 
				
			|||||||
  if (isInvalid) return false
 | 
					  if (isInvalid) return false
 | 
				
			||||||
  await updateOption(
 | 
					  await updateOption(
 | 
				
			||||||
    Object.entries(form).map(([key, value]) => {
 | 
					    Object.entries(form).map(([key, value]) => {
 | 
				
			||||||
      return { code: key, value }
 | 
					      return { id: mailConfig.value[key].id, code: key, value }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
  await getDataList()
 | 
					  await getDataList()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,7 +160,7 @@ const handleCancel = () => {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const queryForm = {
 | 
					const queryForm = {
 | 
				
			||||||
  code: Object.keys(securityConfig.value)
 | 
					  category: 'PASSWORD'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// 查询列表数据
 | 
					// 查询列表数据
 | 
				
			||||||
const getDataList = async () => {
 | 
					const getDataList = async () => {
 | 
				
			||||||
@@ -178,7 +178,7 @@ const handleSave = async () => {
 | 
				
			|||||||
  if (isInvalid) return false
 | 
					  if (isInvalid) return false
 | 
				
			||||||
  await updateOption(
 | 
					  await updateOption(
 | 
				
			||||||
    Object.entries(form).map(([key, value]) => {
 | 
					    Object.entries(form).map(([key, value]) => {
 | 
				
			||||||
      return { code: key, value }
 | 
					      return { id: securityConfig.value[key].id, code: key, value }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
  await getDataList()
 | 
					  await getDataList()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user