From 1ab653eebedc339eeb4b558802c443ede7a8a085 Mon Sep 17 00:00:00 2001 From: dqz Date: Sat, 8 Mar 2025 08:18:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8C=85=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.staging | 6 +- .eslintignore | 3 +- .husky/commit-msg | 6 - .husky/common.sh | 9 - .husky/lintstagedrc.js | 8 - .husky/pre-commit | 10 - .vscode/settings.json | 7 +- build/info.ts | 9 - src/api/shop/category.ts | 3 +- src/api/shop/goods.ts | 14 +- src/assets/iconfont/iconfont.js | 10 +- .../shop/category/category-edit-modal.vue | 115 ++++++++++ .../shop/category/category-form-modal.vue | 107 +++++++++ src/views/shop/category/index.vue | 216 ++++++++++++++++++ src/views/shop/goods/goods-edit-modal.vue | 195 ++++++++++++++++ src/views/shop/goods/index.vue | 14 +- 16 files changed, 669 insertions(+), 63 deletions(-) delete mode 100644 .husky/commit-msg delete mode 100644 .husky/common.sh delete mode 100644 .husky/lintstagedrc.js delete mode 100644 .husky/pre-commit create mode 100644 src/views/shop/category/category-edit-modal.vue create mode 100644 src/views/shop/category/category-form-modal.vue create mode 100644 src/views/shop/category/index.vue create mode 100644 src/views/shop/goods/goods-edit-modal.vue diff --git a/.env.staging b/.env.staging index 1aed2ef..6d4f944 100644 --- a/.env.staging +++ b/.env.staging @@ -2,13 +2,13 @@ # https://cn.vitejs.dev/guide/env-and-mode.html#modes # NODE_ENV = development -VITE_PUBLIC_PATH = ./ +VITE_PUBLIC_PATH = /shop-admin/ # 预发布环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数") VITE_ROUTER_HISTORY = "hash" # 是否在打包时使用cdn替换本地库 替换 true 不替换 false -VITE_CDN = true +VITE_CDN = false # 是否启用gzip压缩或brotli压缩(分两种情况,删除原始文件和不删除原始文件) # 压缩时不删除原始文件的配置:gzip、brotli、both(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认) @@ -16,4 +16,4 @@ VITE_CDN = true VITE_COMPRESSION = "none" # 后端地址 -VITE_APP_BASE_API = '/stage-api' \ No newline at end of file +VITE_APP_BASE_API = '/shop-back-end' \ No newline at end of file diff --git a/.eslintignore b/.eslintignore index 3406365..601266a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -8,4 +8,5 @@ package.json commitlint.config.js postcss.config.js tailwind.config.js -stylelint.config.js \ No newline at end of file +stylelint.config.js +build \ No newline at end of file diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100644 index 567ff71..0000000 --- a/.husky/commit-msg +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# shellcheck source=./_/husky.sh -. "$(dirname "$0")/_/husky.sh" - -npx --no-install commitlint --edit "$1" diff --git a/.husky/common.sh b/.husky/common.sh deleted file mode 100644 index 5f0540b..0000000 --- a/.husky/common.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -command_exists () { - command -v "$1" >/dev/null 2>&1 -} - -# Workaround for Windows 10, Git Bash and Pnpm -if command_exists winpty && test -t 1; then - exec < /dev/tty -fi diff --git a/.husky/lintstagedrc.js b/.husky/lintstagedrc.js deleted file mode 100644 index a9b439c..0000000 --- a/.husky/lintstagedrc.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - "*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"], - "{!(package)*.json}": ["prettier --write--parser json"], - "package.json": ["prettier --write"], - "*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"], - "*.{vue,css,scss,postcss,less}": ["stylelint --fix", "prettier --write"], - "*.md": ["prettier --write"] -}; diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index c7d15f2..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" -. "$(dirname "$0")/common.sh" - -[ -n "$CI" ] && exit 0 - -# Format and submit code according to lintstagedrc.js configuration -npm run lint:lint-staged - -npm run lint:pretty diff --git a/.vscode/settings.json b/.vscode/settings.json index fb08c71..c444ba7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -33,5 +33,10 @@ "cSpell.words": [ "iconify", "Qrcode" - ] + ], + "marscode.codeCompletionPro": { + "enableCodeCompletionPro": true + }, + "marscode.enableInlineCommand": true, + "marscode.chatLanguage": "cn" } \ No newline at end of file diff --git a/build/info.ts b/build/info.ts index 5d23440..8d2cb3d 100644 --- a/build/info.ts +++ b/build/info.ts @@ -17,15 +17,6 @@ export function viteBuildInfo(): Plugin { outDir = resolvedConfig.build?.outDir ?? "dist"; }, buildStart() { - console.log( - bold( - green( - `👏欢迎使用${blue( - "[Agileboot全栈项目]" - )},如果您感觉不错,记得点击后面链接给个star哦💖 https://github.com/valarchie/agileboot-back-end` - ) - ) - ); if (config.command === "build") { startTime = dayjs(new Date()); } diff --git a/src/api/shop/category.ts b/src/api/shop/category.ts index 4add2d1..25c7de9 100644 --- a/src/api/shop/category.ts +++ b/src/api/shop/category.ts @@ -15,7 +15,6 @@ export interface CategoryDTO { createTime?: Date; updaterId?: number; updateTime?: Date; - deleted?: number; } /** 分类请求参数 */ @@ -54,7 +53,7 @@ export const updateCategoryApi = (categoryId: number, data: CategoryRequest) => }; /** 删除分类 */ -export const deleteCategoryApi = (categoryId: number) => { +export const deleteCategoryApi = (categoryId: number | string) => { return http.request>("delete", `/shop/category/${categoryId}`); }; diff --git a/src/api/shop/goods.ts b/src/api/shop/goods.ts index d5501ad..ddfc2ed 100644 --- a/src/api/shop/goods.ts +++ b/src/api/shop/goods.ts @@ -10,13 +10,13 @@ export interface GoodsQuery extends BasePageQuery { /** 商品DTO */ export interface GoodsDTO { goodsId?: number; - goodsName?: string; - categoryId?: number; - price?: number; - stock?: number; - status?: number; - coverImg?: string; - goodsDetail?: string; + goodsName: string; + categoryId: number; + price: number; + stock: number; + status: number; + coverImg: string; + goodsDetail: string; creatorId?: number; createTime?: Date; updaterId?: number; diff --git a/src/assets/iconfont/iconfont.js b/src/assets/iconfont/iconfont.js index 64d8bd8..fdd8052 100644 --- a/src/assets/iconfont/iconfont.js +++ b/src/assets/iconfont/iconfont.js @@ -20,7 +20,7 @@ "" ); } catch (t) { - console && console.log(t); + // console && console.log(t); } } (n = function () { @@ -28,7 +28,7 @@ c = document.createElement("div"); (c.innerHTML = e._iconfont_svg_string_2208059), (c = c.getElementsByTagName("svg")[0]) && - (c.setAttribute("aria-hidden", "true"), + (c.setAttribute("aria-hidden", "true"), (c.style.position = "absolute"), (c.style.width = 0), (c.style.height = 0), @@ -42,11 +42,11 @@ ? ~["complete", "loaded", "interactive"].indexOf(document.readyState) ? setTimeout(n, 0) : ((l = function () { - document.removeEventListener("DOMContentLoaded", l, !1), n(); - }), + document.removeEventListener("DOMContentLoaded", l, !1), n(); + }), document.addEventListener("DOMContentLoaded", l, !1)) : document.attachEvent && - ((i = n), + ((i = n), (o = e.document), (a = !1), v(), diff --git a/src/views/shop/category/category-edit-modal.vue b/src/views/shop/category/category-edit-modal.vue new file mode 100644 index 0000000..2922ff9 --- /dev/null +++ b/src/views/shop/category/category-edit-modal.vue @@ -0,0 +1,115 @@ + + + \ No newline at end of file diff --git a/src/views/shop/category/category-form-modal.vue b/src/views/shop/category/category-form-modal.vue new file mode 100644 index 0000000..1a8e622 --- /dev/null +++ b/src/views/shop/category/category-form-modal.vue @@ -0,0 +1,107 @@ + + + \ No newline at end of file diff --git a/src/views/shop/category/index.vue b/src/views/shop/category/index.vue new file mode 100644 index 0000000..db59d5c --- /dev/null +++ b/src/views/shop/category/index.vue @@ -0,0 +1,216 @@ + + + \ No newline at end of file diff --git a/src/views/shop/goods/goods-edit-modal.vue b/src/views/shop/goods/goods-edit-modal.vue new file mode 100644 index 0000000..145ffaf --- /dev/null +++ b/src/views/shop/goods/goods-edit-modal.vue @@ -0,0 +1,195 @@ + + + + + \ No newline at end of file diff --git a/src/views/shop/goods/index.vue b/src/views/shop/goods/index.vue index 668c975..cdc5f02 100644 --- a/src/views/shop/goods/index.vue +++ b/src/views/shop/goods/index.vue @@ -2,13 +2,14 @@ import { ref } from "vue"; import { PureTableBar } from "@/components/RePureTableBar"; import { useRenderIcon } from "@/components/ReIcon/src/hooks"; -import { getGoodsListApi } from "@/api/shop/goods"; +import { getGoodsListApi, GoodsDTO } from "@/api/shop/goods"; import EditPen from "@iconify-icons/ep/edit-pen"; import Delete from "@iconify-icons/ep/delete"; import AddFill from "@iconify-icons/ri/add-circle-line"; import Search from "@iconify-icons/ep/search"; import Refresh from "@iconify-icons/ep/refresh"; import GoodsFormModal from "./goods-form-modal.vue"; +import GoodsEditModal from "./goods-edit-modal.vue"; import { ElMessage, ElMessageBox } from "element-plus"; import { deleteGoodsApi } from "@/api/shop/goods"; @@ -37,6 +38,8 @@ const pagination = ref({ const loading = ref(false); const dataList = ref([]); const multipleSelection = ref([]); +const editVisible = ref(false); +const currentRow = ref(); const getList = async () => { try { @@ -115,6 +118,12 @@ const handleBulkDelete = async () => { const handleSelectionChange = (rows: any[]) => { multipleSelection.value = rows.map(row => row.goodsId); }; + +const handleEdit = (row: GoodsDTO) => { + currentRow.value = row; + editVisible.value = true; +}; +