Commit 0ca6abec by lijiabin

【需求 17679】 perf: 优化类型

parent 9a58bcf0
import service from '@/utils/request/index' import service from '@/utils/request/index'
import type { BackendShopItemDto, AddOrUpdateShopItemDto } from './types' import type {
import type { BackendServicePageResult, PageSearchParams } from '@/utils/request/types' BackendShopItemDto,
AddOrUpdateShopItemDto,
BackendExchangeListSearchParams,
BackendShopListSearchParams,
} from './types'
import type { BackendServicePageResult } from '@/utils/request/types'
// 后台管理 积分商城相关接口 // 后台管理 积分商城相关接口
/** /**
* 商品配置列表 * 商品配置列表
*/ */
export const getShopItemList = (params: PageSearchParams) => { export const getShopItemList = (params: BackendShopListSearchParams) => {
return service.request<BackendServicePageResult<BackendShopItemDto>>({ return service.request<BackendServicePageResult<BackendShopItemDto>>({
url: '/api/culture/shop/item/productList', url: '/api/culture/shop/item/productList',
method: 'POST', method: 'POST',
...@@ -37,7 +42,7 @@ export const deleteShopItem = (id: number) => { ...@@ -37,7 +42,7 @@ export const deleteShopItem = (id: number) => {
/** /**
* 后台商品领用列表 * 后台商品领用列表
*/ */
export const getBackendExchangeList = (data: PageSearchParams) => { export const getBackendExchangeList = (data: BackendExchangeListSearchParams) => {
return service.request<BackendServicePageResult<BackendShopItemDto>>({ return service.request<BackendServicePageResult<BackendShopItemDto>>({
url: '/api/culture/shop/order/background/productList', url: '/api/culture/shop/order/background/productList',
method: 'POST', method: 'POST',
......
import type { PageSearchParams } from '@/utils/request/types'
import { BooleanFlag, ShopGoodsTypeEnum } from '@/constants'
export interface BackendShopListSearchParams extends PageSearchParams {
name?: string
itemType?: ShopGoodsTypeEnum
region?: string
enable?: 0 | 1
}
export interface BackendShopItemDto { export interface BackendShopItemDto {
id: number id?: number
sort: number
enable: BooleanFlag
imageUrl: string
itemType: ShopGoodsTypeEnum
name: string
price: number
region: string
title: string title: string
description: string description: string
imgUrl: string imgUrl: string
price: number
stock: number stock: number
status: number status: number
} }
...@@ -17,3 +31,8 @@ export interface AddOrUpdateShopItemDto { ...@@ -17,3 +31,8 @@ export interface AddOrUpdateShopItemDto {
stock: number stock: number
status: number status: number
} }
export interface BackendExchangeListSearchParams extends PageSearchParams {
source: string
status?: 0 | 1 | 2
itemName?: string
}
...@@ -106,9 +106,9 @@ const stats = computed(() => { ...@@ -106,9 +106,9 @@ const stats = computed(() => {
] ]
}) })
const handleClick = async (item: StatItem) => { const handleClick = (item: StatItem) => {
if (item.actionFn) { if (item.actionFn) {
await item.actionFn() item.actionFn()
} }
} }
</script> </script>
...@@ -151,14 +151,7 @@ ...@@ -151,14 +151,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { Search, Upload } from '@element-plus/icons-vue' import { Search, Upload } from '@element-plus/icons-vue'
import { usePageSearch, useResetData } from '@/hooks' import { usePageSearch, useResetData } from '@/hooks'
import { import { addOrUpdateColumn, getBackendExchangeList, issueProduct } from '@/api/backend'
addOrUpdateColumn,
deleteColumn,
hideColumn,
getBackendExchangeList,
issueProduct,
} from '@/api/backend'
import { updateArticleRecommend } from '@/api'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend' import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend'
import dayjs from 'dayjs' import dayjs from 'dayjs'
...@@ -178,7 +171,7 @@ const formRef = ref<FormInstance>() ...@@ -178,7 +171,7 @@ const formRef = ref<FormInstance>()
// 表单数据 // 表单数据
const [form, resetForm] = useResetData<AddOrUpdateColumnDto>({ const [form] = useResetData<AddOrUpdateColumnDto>({
title: '', title: '',
color: '#000000', color: '#000000',
id: undefined, id: undefined,
...@@ -192,32 +185,6 @@ const formRules: FormRules = { ...@@ -192,32 +185,6 @@ const formRules: FormRules = {
sort: [{ required: true, message: '请输入排序', trigger: 'blur' }], sort: [{ required: true, message: '请输入排序', trigger: 'blur' }],
} }
// 新增
const handleAdd = () => {
resetForm()
dialogVisible.value = true
}
// 编辑
const handleEdit = (row: BackendColumnListItemDto) => {
resetForm()
form.value = {
title: row.title,
color: row.color,
id: row.id,
sort: row.sort,
type: 'column',
}
dialogVisible.value = true
}
// 是否置顶改变
const handleIsRecommendChange = async (row: ArticleItemDto) => {
await updateArticleRecommend(row.id)
ElMessage.success('修改成功')
refresh()
}
// 取消发放 // 取消发放
const handleCancelIssue = async (row: BackendColumnListItemDto) => { const handleCancelIssue = async (row: BackendColumnListItemDto) => {
await ElMessageBox.confirm('确定要取消发放吗?', '提示', { await ElMessageBox.confirm('确定要取消发放吗?', '提示', {
...@@ -278,22 +245,6 @@ const selectedRows = ref<BackendColumnListItemDto[]>([]) ...@@ -278,22 +245,6 @@ const selectedRows = ref<BackendColumnListItemDto[]>([])
const handleSelectionChange = (selection: BackendColumnListItemDto[]) => { const handleSelectionChange = (selection: BackendColumnListItemDto[]) => {
selectedRows.value = selection selectedRows.value = selection
} }
// 批量发布/隐藏
const handleBatchPublish = async () => {
await hideColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('发布/隐藏成功')
}
// 批量删除
const handleBatchDelete = async () => {
await deleteColumn(selectedRows.value.map((item) => item.id))
refresh()
selectedRows.value = []
ElMessage.success('删除成功')
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -193,17 +193,9 @@ ...@@ -193,17 +193,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { Search, Plus, Upload } from '@element-plus/icons-vue' import { Search, Plus, Upload } from '@element-plus/icons-vue'
import { usePageSearch, useResetData } from '@/hooks' import { usePageSearch, useResetData } from '@/hooks'
import { import { getShopItemList, addOrUpdateShopItem, deleteShopItem } from '@/api/backend'
addOrUpdateColumn,
deleteColumn,
hideColumn,
getShopItemList,
addOrUpdateShopItem,
deleteShopItem,
} from '@/api/backend'
import { updateArticleRecommend } from '@/api'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import type { BackendColumnListItemDto, AddOrUpdateColumnDto } from '@/api/backend' import type { BackendColumnListItemDto } from '@/api/backend'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { BooleanFlag, ShopGoodsTypeEnum, regionListOptions } from '@/constants' import { BooleanFlag, ShopGoodsTypeEnum, regionListOptions } from '@/constants'
import UploadFile from '@/components/common/UploadFile/index.vue' import UploadFile from '@/components/common/UploadFile/index.vue'
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
"auto-imports.d.ts", "auto-imports.d.ts",
"components.d.ts" "components.d.ts"
], ],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": { "compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
// "types": ["element-plus/global"], // "types": ["element-plus/global"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment