as is
This commit is contained in:
2
env/.env.development
vendored
2
env/.env.development
vendored
@@ -1 +1 @@
|
|||||||
VITE_API_BASE=http://localhost:5162
|
VITE_API_BASE=http://localhost:5002
|
||||||
2
env/.env.production
vendored
2
env/.env.production
vendored
@@ -1 +1 @@
|
|||||||
VITE_API_BASE=https://api.stopshopping.bjbj.me
|
VITE_API_BASE=https://adminapi.stopshopping.bjbj.me
|
||||||
3
package-lock.json
generated
3
package-lock.json
generated
@@ -8,7 +8,6 @@
|
|||||||
"name": "stop-shopping-admin",
|
"name": "stop-shopping-admin",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/qs": "^6.15.0",
|
|
||||||
"axios": "^1.13.6",
|
"axios": "^1.13.6",
|
||||||
"echarts": "^6.0.0",
|
"echarts": "^6.0.0",
|
||||||
"qs": "^6.15.0",
|
"qs": "^6.15.0",
|
||||||
@@ -19,6 +18,7 @@
|
|||||||
"@tailwindcss/vite": "^4.2.1",
|
"@tailwindcss/vite": "^4.2.1",
|
||||||
"@tsconfig/node24": "^24.0.4",
|
"@tsconfig/node24": "^24.0.4",
|
||||||
"@types/node": "^24.11.0",
|
"@types/node": "^24.11.0",
|
||||||
|
"@types/qs": "^6.15.0",
|
||||||
"@vitejs/plugin-vue": "^6.0.4",
|
"@vitejs/plugin-vue": "^6.0.4",
|
||||||
"@vue/eslint-config-typescript": "^14.7.0",
|
"@vue/eslint-config-typescript": "^14.7.0",
|
||||||
"@vue/tsconfig": "^0.8.1",
|
"@vue/tsconfig": "^0.8.1",
|
||||||
@@ -2197,6 +2197,7 @@
|
|||||||
"version": "6.15.0",
|
"version": "6.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.0.tgz",
|
||||||
"integrity": "sha512-JawvT8iBVWpzTrz3EGw9BTQFg3BQNmwERdKE22vlTxawwtbyUSlMppvZYKLZzB5zgACXdXxbD3m1bXaMqP/9ow==",
|
"integrity": "sha512-JawvT8iBVWpzTrz3EGw9BTQFg3BQNmwERdKE22vlTxawwtbyUSlMppvZYKLZzB5zgACXdXxbD3m1bXaMqP/9ow==",
|
||||||
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
"format": "prettier --write --experimental-cli src/"
|
"format": "prettier --write --experimental-cli src/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/qs": "^6.15.0",
|
|
||||||
"axios": "^1.13.6",
|
"axios": "^1.13.6",
|
||||||
"echarts": "^6.0.0",
|
"echarts": "^6.0.0",
|
||||||
"qs": "^6.15.0",
|
"qs": "^6.15.0",
|
||||||
@@ -26,6 +25,7 @@
|
|||||||
"@tailwindcss/vite": "^4.2.1",
|
"@tailwindcss/vite": "^4.2.1",
|
||||||
"@tsconfig/node24": "^24.0.4",
|
"@tsconfig/node24": "^24.0.4",
|
||||||
"@types/node": "^24.11.0",
|
"@types/node": "^24.11.0",
|
||||||
|
"@types/qs": "^6.15.0",
|
||||||
"@vitejs/plugin-vue": "^6.0.4",
|
"@vitejs/plugin-vue": "^6.0.4",
|
||||||
"@vue/eslint-config-typescript": "^14.7.0",
|
"@vue/eslint-config-typescript": "^14.7.0",
|
||||||
"@vue/tsconfig": "^0.8.1",
|
"@vue/tsconfig": "^0.8.1",
|
||||||
|
|||||||
21
rollup-plugin-robots.ts
Normal file
21
rollup-plugin-robots.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { join } from "path";
|
||||||
|
import { type Plugin } from "rollup";
|
||||||
|
|
||||||
|
export default function robotsPlugin(): Plugin {
|
||||||
|
return {
|
||||||
|
name: "rollup-plugin-robots",
|
||||||
|
writeBundle(options, _) {
|
||||||
|
this.debug(options.dir || "dir undefined");
|
||||||
|
if (options.dir) {
|
||||||
|
this.fs
|
||||||
|
.writeFile(
|
||||||
|
join(options.dir, "robots.txt"),
|
||||||
|
"User-agent: *\nDisallow: /",
|
||||||
|
)
|
||||||
|
.catch((err) => {
|
||||||
|
this.error(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import { type AntiForgeryTokenResponse, type AntiForgeryToken } from './models/A
|
|||||||
import { type ProblemDetails } from './ProblemDetails'
|
import { type ProblemDetails } from './ProblemDetails'
|
||||||
|
|
||||||
class AxiosHelper {
|
class AxiosHelper {
|
||||||
private readonly REFRESH_TOKEN_URL: string = '/common/refreshtoken'
|
private readonly REFRESH_TOKEN_URL: string = '/admin/refreshtoken'
|
||||||
private constructor(config?: CreateAxiosDefaults) {
|
private constructor(config?: CreateAxiosDefaults) {
|
||||||
this.axios = Axios.create({
|
this.axios = Axios.create({
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ export const signIn = async (params: M.SignInParams): Promise<M.SignInResponse>
|
|||||||
return signInResult
|
return signInResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const refreshToken = async (): Promise<M.AccessTokenResponse> => {
|
||||||
|
return await AxiosHelper.getInstance().post('/admin/refreshtoken')
|
||||||
|
}
|
||||||
|
|
||||||
|
export const signOut = async (): Promise<M.ApiResponseMessage> => {
|
||||||
|
return await AxiosHelper.getInstance().post('/admin/signout')
|
||||||
|
}
|
||||||
|
|
||||||
//common
|
//common
|
||||||
export const upload = async (params: M.UploadParams): Promise<M.UploadResponse> => {
|
export const upload = async (params: M.UploadParams): Promise<M.UploadResponse> => {
|
||||||
return await AxiosHelper.getInstance().postFormData('/common/upload', params)
|
return await AxiosHelper.getInstance().postFormData('/common/upload', params)
|
||||||
@@ -29,14 +37,6 @@ export const csrfToken = async (): Promise<M.AntiForgeryTokenResponse> => {
|
|||||||
return csrfResult
|
return csrfResult
|
||||||
}
|
}
|
||||||
|
|
||||||
export const refreshToken = async (): Promise<M.AccessTokenResponse> => {
|
|
||||||
return await AxiosHelper.getInstance().post('/common/refreshtoken')
|
|
||||||
}
|
|
||||||
|
|
||||||
export const signOut = async (): Promise<M.ApiResponseMessage> => {
|
|
||||||
return await AxiosHelper.getInstance().post('/common/signout')
|
|
||||||
}
|
|
||||||
|
|
||||||
//category
|
//category
|
||||||
export const getCategoryTree = async (): Promise<M.CategoryListResponse> => {
|
export const getCategoryTree = async (): Promise<M.CategoryListResponse> => {
|
||||||
return await AxiosHelper.getInstance().get('/category/list')
|
return await AxiosHelper.getInstance().get('/category/list')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export const UploadScences = {
|
export const UploadScences = {
|
||||||
Avatar: 'Avatar',
|
Avatar: 0,
|
||||||
Product: 'Product',
|
Product: 1,
|
||||||
Category: 'Category',
|
Category: 2,
|
||||||
} as const
|
} as const
|
||||||
export type UploadScencesType = (typeof UploadScences)[keyof typeof UploadScences]
|
export type UploadScencesType = (typeof UploadScences)[keyof typeof UploadScences]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { store } from '../store/appdata'
|
import { store } from '../store/appdata'
|
||||||
import { getCategoryTree, editCategory, deleteCategory, upload } from '../api'
|
import { getCategoryTree, editCategory, deleteCategory, upload } from '../api'
|
||||||
import { type Category } from '../api/models'
|
import { type Category, UploadScences } from '../api/models'
|
||||||
import { TreeView, type TreeItem } from '../components'
|
import { TreeView, type TreeItem } from '../components'
|
||||||
|
|
||||||
type AddOrEdit = 'add' | 'edit'
|
type AddOrEdit = 'add' | 'edit'
|
||||||
@@ -151,7 +151,7 @@ async function logoSelected(e: Event) {
|
|||||||
states.value.loading = true
|
states.value.loading = true
|
||||||
const uploadResult = await upload({
|
const uploadResult = await upload({
|
||||||
file: el.files[0]!,
|
file: el.files[0]!,
|
||||||
scences: 'Category',
|
scences: UploadScences.Category,
|
||||||
})
|
})
|
||||||
if (uploadResult.isSucced) {
|
if (uploadResult.isSucced) {
|
||||||
states.value.current = {
|
states.value.current = {
|
||||||
|
|||||||
@@ -5,14 +5,37 @@ import tailwindcss from '@tailwindcss/vite'
|
|||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
import robots from './rollup-plugin-robots'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [tailwindcss(), vue(), vueDevTools()],
|
plugins: [tailwindcss(), vue(), vueDevTools(), robots()],
|
||||||
envDir: path.resolve('.', 'env'),
|
envDir: path.resolve('.', 'env'),
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
build: {
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
manualChunks: {
|
||||||
|
vue: ['vue'],
|
||||||
|
'vue-router': ['vue-router'],
|
||||||
|
http: ['axios', 'qs'],
|
||||||
|
echarts: ['echarts'],
|
||||||
|
},
|
||||||
|
chunkFileNames: (chunkFileInfo) => {
|
||||||
|
for (const id of chunkFileInfo.moduleIds) {
|
||||||
|
const match = id.match(/\/pages\/([^/]+)/)
|
||||||
|
if (match) {
|
||||||
|
return `js/${match[1].toLocaleLowerCase()}-[hash].js`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'js/[name]-[hash].js'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user