!187 修正合并代码后前端不能正常启动的问题

Merge pull request !187 from puhui999/dev-to-dev
This commit is contained in:
芋道源码 2023-08-05 06:20:20 +00:00 committed by Gitee
commit 7c87f94985
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 48 additions and 40 deletions

View File

@ -125,6 +125,7 @@
"vite-plugin-purge-icons": "^0.9.2", "vite-plugin-purge-icons": "^0.9.2",
"vite-plugin-svg-icons": "^2.0.1", "vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-top-level-await": "^1.3.1", "vite-plugin-top-level-await": "^1.3.1",
"vue-eslint-parser": "^9.3.1",
"vue-tsc": "^1.8.8" "vue-tsc": "^1.8.8"
}, },
"license": "MIT", "license": "MIT",

View File

@ -1,8 +1,6 @@
import request from '@/config/axios' import request from '@/config/axios'
import { Sku, Spu } from '@/api/mall/product/spu' import { Sku, Spu } from '@/api/mall/product/spu'
// TODO @puhui999: combinationActivity.ts
export interface CombinationActivityVO { export interface CombinationActivityVO {
id?: number id?: number
name?: string name?: string

View File

@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
import { store } from '../index' import { store } from '../index'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import remainingRouter from '@/router/modules/remaining' import remainingRouter from '@/router/modules/remaining'
import { generateRoute, flatMultiLevelRoutes } from '@/utils/routerHelper' import { flatMultiLevelRoutes, generateRoute } from '@/utils/routerHelper'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache() const { wsCache } = useCache()
@ -34,11 +34,11 @@ export const usePermissionStore = defineStore('permission', {
async generateRoutes(): Promise<unknown> { async generateRoutes(): Promise<unknown> {
return new Promise<void>(async (resolve) => { return new Promise<void>(async (resolve) => {
// 获得菜单列表它在登录的时候setUserInfoAction 方法中已经进行获取 // 获得菜单列表它在登录的时候setUserInfoAction 方法中已经进行获取
let res: AppCustomRouteRecordRaw[] let res: AppCustomRouteRecordRaw[] = []
if (wsCache.get(CACHE_KEY.ROLE_ROUTERS)) { if (wsCache.get(CACHE_KEY.ROLE_ROUTERS)) {
res = wsCache.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[] res = wsCache.get(CACHE_KEY.ROLE_ROUTERS) as AppCustomRouteRecordRaw[]
} }
const routerMap: AppRouteRecordRaw[] = generateRoute(res as AppCustomRouteRecordRaw[]) const routerMap: AppRouteRecordRaw[] = generateRoute(res)
// 动态路由404一定要放到最后面 // 动态路由404一定要放到最后面
this.addRouters = routerMap.concat([ this.addRouters = routerMap.concat([
{ {

View File

@ -6,6 +6,7 @@
:is-col="true" :is-col="true"
:rules="rules" :rules="rules"
:schema="allSchemas.formSchema" :schema="allSchemas.formSchema"
class="mt-10px"
> >
<template #spuId> <template #spuId>
<el-button @click="spuSelectRef.open()">选择商品</el-button> <el-button @click="spuSelectRef.open()">选择商品</el-button>
@ -37,8 +38,8 @@
<SpuSelect ref="spuSelectRef" :isSelectSku="true" @confirm="selectSpu" /> <SpuSelect ref="spuSelectRef" :isSelectSku="true" @confirm="selectSpu" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as CombinationActivityApi from '@/api/mall/promotion/combination/combinationactivity' import * as CombinationActivityApi from '@/api/mall/promotion/combination/combinationActivity'
import { CombinationProductVO } from '@/api/mall/promotion/combination/combinationactivity' import { CombinationProductVO } from '@/api/mall/promotion/combination/combinationActivity'
import { allSchemas, rules } from './combinationActivity.data' import { allSchemas, rules } from './combinationActivity.data'
import { SpuAndSkuList, SpuProperty, SpuSelect } from '@/views/mall/promotion/components' import { SpuAndSkuList, SpuProperty, SpuSelect } from '@/views/mall/promotion/components'
import { getPropertyList, RuleConfig } from '@/views/mall/product/spu/components' import { getPropertyList, RuleConfig } from '@/views/mall/product/spu/components'

View File

@ -1,5 +1,5 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter, getNowDateTime } from '@/utils/formatTime' import { dateFormatter2 } from '@/utils/formatTime'
// 表单校验 // 表单校验
export const rules = reactive({ export const rules = reactive({
@ -9,11 +9,6 @@ export const rules = reactive({
startTime: [required], startTime: [required],
endTime: [required], endTime: [required],
userSize: [required], userSize: [required],
totalNum: [required],
successNum: [required],
orderUserCount: [required],
virtualGroup: [required],
status: [required],
limitDuration: [required] limitDuration: [required]
}) })
@ -31,34 +26,54 @@ const crudSchemas = reactive<CrudSchema[]>([
} }
}, },
{ {
label: '活动时间', label: '活动开始时间',
field: 'activityTime', field: 'startTime',
formatter: dateFormatter, formatter: dateFormatter2,
isSearch: true,
search: { search: {
show: true,
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
valueFormat: 'x', valueFormat: 'YYYY-MM-DD',
type: 'datetimerange', type: 'daterange'
rangeSeparator: '至'
} }
}, },
form: { form: {
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
valueFormat: 'x', type: 'date',
type: 'datetimerange', valueFormat: 'x'
rangeSeparator: '至'
},
value: [getNowDateTime().valueOf(), getNowDateTime().valueOf()],
colProps: {
span: 24
} }
},
table: {
width: 120
}
},
{
label: '活动结束时间',
field: 'endTime',
formatter: dateFormatter2,
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD',
type: 'daterange'
}
},
form: {
component: 'DatePicker',
componentProps: {
type: 'date',
valueFormat: 'x'
}
},
table: {
width: 120
} }
}, },
{ {
label: '参与人数', label: '参与人数',
field: 'orderUserCount', field: 'userSize',
isSearch: false, isSearch: false,
form: { form: {
component: 'InputNumber', component: 'InputNumber',
@ -117,13 +132,6 @@ const crudSchemas = reactive<CrudSchema[]>([
isSearch: false, isSearch: false,
isForm: false isForm: false
}, },
{
label: '虚拟成团',
field: 'virtualGroup',
isSearch: false,
isTable: false,
isForm: false
},
{ {
label: '活动状态', label: '活动状态',
field: 'status', field: 'status',

View File

@ -63,7 +63,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { allSchemas } from './combinationActivity.data' import { allSchemas } from './combinationActivity.data'
import * as CombinationActivityApi from '@/api/mall/promotion/combination/combinationactivity' import * as CombinationActivityApi from '@/api/mall/promotion/combination/combinationActivity'
import CombinationActivityForm from './CombinationActivityForm.vue' import CombinationActivityForm from './CombinationActivityForm.vue'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { createImageViewer } from '@/components/ImageViewer' import { createImageViewer } from '@/components/ImageViewer'
@ -102,10 +102,10 @@ const handleDelete = (id: number) => {
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
/** /**
TODO TODO
后面准备封装成一个函数来操作 tableColumns 重新排列比如说需求是表单上商品选择是在后面的而列表展示的时候需要调到位置 后面准备封装成一个函数来操作 tableColumns 重新排列比如说需求是表单上商品选择是在后面的而列表展示的时候需要调到位置
封装效果支持批量操作给出 field 和需要插入的位置[{field:'spuId',index: 1}] 效果为把 field spuId column 移动到第一个位置 封装效果支持批量操作给出 field 和需要插入的位置[{field:'spuId',index: 1}] 效果为把 field spuId column 移动到第一个位置
*/ */
// //
const index = allSchemas.tableColumns.findIndex((item) => item.field === 'spuId') const index = allSchemas.tableColumns.findIndex((item) => item.field === 'spuId')
const column = cloneDeep(allSchemas.tableColumns[index]) const column = cloneDeep(allSchemas.tableColumns[index])