@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
*.sh
|
||||||
|
node_modules
|
||||||
|
*.md
|
||||||
|
*.woff
|
||||||
|
*.ttf
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
dist
|
||||||
|
/public
|
||||||
|
/docs
|
||||||
|
.husky
|
||||||
|
.local
|
||||||
|
/bin
|
||||||
|
Dockerfile
|
@ -0,0 +1,60 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
node: true,
|
||||||
|
es6: true,
|
||||||
|
},
|
||||||
|
parser: 'vue-eslint-parser',
|
||||||
|
parserOptions: {
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
sourceType: 'module',
|
||||||
|
jsxPragma: 'React',
|
||||||
|
ecmaFeatures: {
|
||||||
|
jsx: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
|
||||||
|
rules: {
|
||||||
|
'vue/script-setup-uses-vars': 'error',
|
||||||
|
'@typescript-eslint/ban-ts-ignore': 'off',
|
||||||
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-var-requires': 'off',
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'vue/custom-event-name-casing': 'off',
|
||||||
|
'no-use-before-define': 'off',
|
||||||
|
'@typescript-eslint/no-use-before-define': 'off',
|
||||||
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
|
'@typescript-eslint/ban-types': 'off',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'space-before-function-paren': 'off',
|
||||||
|
|
||||||
|
'vue/attributes-order': 'off',
|
||||||
|
'vue/one-component-per-file': 'off',
|
||||||
|
'vue/html-closing-bracket-newline': 'off',
|
||||||
|
'vue/max-attributes-per-line': 'off',
|
||||||
|
'vue/multiline-html-element-content-newline': 'off',
|
||||||
|
'vue/singleline-html-element-content-newline': 'off',
|
||||||
|
'vue/attribute-hyphenation': 'off',
|
||||||
|
'vue/require-default-prop': 'off',
|
||||||
|
'vue/require-explicit-emits': 'off',
|
||||||
|
'vue/html-self-closing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
html: {
|
||||||
|
void: 'always',
|
||||||
|
normal: 'never',
|
||||||
|
component: 'always',
|
||||||
|
},
|
||||||
|
svg: 'always',
|
||||||
|
math: 'always',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
|
},
|
||||||
|
};
|
@ -0,0 +1,31 @@
|
|||||||
|
node_modules
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
.local
|
||||||
|
.history
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
.eslintcache
|
||||||
|
.github
|
||||||
|
.husky
|
||||||
|
.vscode
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
pnpm-lock.yaml*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
# .vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
./packages
|
||||||
|
./history
|
@ -0,0 +1,3 @@
|
|||||||
|
/dist/*
|
||||||
|
/public/*
|
||||||
|
public/*
|
@ -0,0 +1,29 @@
|
|||||||
|
### 学习文档
|
||||||
|
|
||||||
|
|
||||||
|
#### 部署步骤
|
||||||
|
|
||||||
|
1. 修改constants.ts中的BASE_URL
|
||||||
|
2. vite build
|
||||||
|
3. 将dist部署到nginx
|
||||||
|
|
||||||
|
|
||||||
|
#### 配置解释
|
||||||
|
|
||||||
|
1. env.development 开发环境配置
|
||||||
|
2. eslintrc.js 代码规范化提示
|
||||||
|
3. vite.config.js vite 开发服务器配置
|
||||||
|
|
||||||
|
#### 常见问题
|
||||||
|
|
||||||
|
##### 变量
|
||||||
|
https://blog.csdn.net/qq_41636947/article/details/117907448
|
||||||
|
|
||||||
|
##### antd的css引入方式
|
||||||
|
在index.html里面引入的cdn
|
||||||
|
|
||||||
|
##### cdn
|
||||||
|
https://cdn.jsdelivr.net/npm/ant-design-vue@3.2.20/dist/
|
||||||
|
https://cdn.staticfile.org/ant-design-vue/3.2.20/antd.min.css
|
||||||
|
|
||||||
|
#### public文件夹内容在build后会自动打到dist中
|
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* @name Config
|
||||||
|
* @description 项目配置
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// 本地服务端口
|
||||||
|
export const VITE_PORT = 3000;
|
||||||
|
|
||||||
|
// 包依赖分析
|
||||||
|
export const ANALYSIS = true;
|
||||||
|
|
||||||
|
// 代码压缩
|
||||||
|
export const COMPRESSION = true;
|
||||||
|
|
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* @name ConfigCompressPlugin
|
||||||
|
* @description 开启.gz压缩
|
||||||
|
*/
|
||||||
|
import viteCompression from 'vite-plugin-compression';
|
||||||
|
import { COMPRESSION } from '../../constant';
|
||||||
|
|
||||||
|
export const ConfigCompressPlugin = () => {
|
||||||
|
if (COMPRESSION) {
|
||||||
|
return viteCompression({
|
||||||
|
verbose: true, // 默认即可
|
||||||
|
disable: false, //开启压缩(不禁用),默认即可
|
||||||
|
deleteOriginFile: false, //删除源文件
|
||||||
|
threshold: 10240, //压缩前最小文件大小
|
||||||
|
algorithm: 'gzip', //压缩算法
|
||||||
|
ext: '.gz', //文件类型
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
};
|
@ -0,0 +1,32 @@
|
|||||||
|
import viteImagemin from 'vite-plugin-imagemin';
|
||||||
|
|
||||||
|
export function ConfigImageminPlugin() {
|
||||||
|
const plugin = viteImagemin({
|
||||||
|
gifsicle: {
|
||||||
|
optimizationLevel: 7,
|
||||||
|
interlaced: false,
|
||||||
|
},
|
||||||
|
mozjpeg: {
|
||||||
|
quality: 20,
|
||||||
|
},
|
||||||
|
optipng: {
|
||||||
|
optimizationLevel: 7,
|
||||||
|
},
|
||||||
|
pngquant: {
|
||||||
|
quality: [0.8, 0.9],
|
||||||
|
speed: 4,
|
||||||
|
},
|
||||||
|
svgo: {
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
name: 'removeViewBox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'removeEmptyAttrs',
|
||||||
|
active: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return plugin;
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* @name createVitePlugins
|
||||||
|
* @description 封装plugins数组统一调用
|
||||||
|
*/
|
||||||
|
import {PluginOption} from 'vite';
|
||||||
|
import vue from '@vitejs/plugin-vue';
|
||||||
|
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||||||
|
import {AutoImportDeps} from './autoImport';
|
||||||
|
import {ConfigCompressPlugin} from './compress';
|
||||||
|
import {ConfigRestartPlugin} from './restart';
|
||||||
|
import {ConfigProgressPlugin} from './progress';
|
||||||
|
import {ConfigVisualizerConfig} from "./visualizer";
|
||||||
|
|
||||||
|
export function createVitePlugins(isBuild: boolean) {
|
||||||
|
const vitePlugins = [
|
||||||
|
// vue支持
|
||||||
|
vue(),
|
||||||
|
// JSX支持
|
||||||
|
vueJsx(),
|
||||||
|
// setup语法糖组件名支持
|
||||||
|
// vueSetupExtend(),
|
||||||
|
// 提供https证书
|
||||||
|
// VitePluginCertificate({
|
||||||
|
// source: 'coding',
|
||||||
|
// }) as PluginOption,
|
||||||
|
];
|
||||||
|
|
||||||
|
// 自动按需引入组件
|
||||||
|
// vitePlugins.push(AutoRegistryComponents());
|
||||||
|
|
||||||
|
// 自动按需引入依赖
|
||||||
|
vitePlugins.push(AutoImportDeps());
|
||||||
|
|
||||||
|
// 自动生成路由
|
||||||
|
// vitePlugins.push(ConfigPagesPlugin());
|
||||||
|
|
||||||
|
// 开启.gz压缩 rollup-plugin-gzip
|
||||||
|
vitePlugins.push(ConfigCompressPlugin());
|
||||||
|
|
||||||
|
// 监听配置文件改动重启
|
||||||
|
vitePlugins.push(ConfigRestartPlugin());
|
||||||
|
|
||||||
|
// 构建时显示进度条
|
||||||
|
vitePlugins.push(ConfigProgressPlugin());
|
||||||
|
|
||||||
|
// 构建时显示进度条
|
||||||
|
vitePlugins.push(ConfigVisualizerConfig());
|
||||||
|
|
||||||
|
|
||||||
|
return vitePlugins;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* @name ConfigProgressPlugin
|
||||||
|
* @description 构建显示进度条
|
||||||
|
*/
|
||||||
|
|
||||||
|
import progress from 'vite-plugin-progress';
|
||||||
|
export const ConfigProgressPlugin = () => {
|
||||||
|
return progress();
|
||||||
|
};
|
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* @name ConfigRestartPlugin
|
||||||
|
* @description 监听配置文件修改自动重启Vite
|
||||||
|
*/
|
||||||
|
import ViteRestart from 'vite-plugin-restart';
|
||||||
|
export const ConfigRestartPlugin = () => {
|
||||||
|
return ViteRestart({
|
||||||
|
restart: ['*.config.[jt]s', '**/config/*.[jt]s'],
|
||||||
|
});
|
||||||
|
};
|
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* @name ConfigUnocssPlugin
|
||||||
|
* @description 监听配置文件修改自动重启Vite
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Unocss
|
||||||
|
import Unocss from 'unocss/vite';
|
||||||
|
|
||||||
|
export const ConfigUnocssPlugin = () => {
|
||||||
|
return Unocss();
|
||||||
|
};
|
@ -0,0 +1,14 @@
|
|||||||
|
import visualizer from 'rollup-plugin-visualizer';
|
||||||
|
import { ANALYSIS } from '../../constant';
|
||||||
|
|
||||||
|
export function ConfigVisualizerConfig() {
|
||||||
|
if (ANALYSIS) {
|
||||||
|
return visualizer({
|
||||||
|
filename: 'dist/report.html',
|
||||||
|
open: true,
|
||||||
|
gzipSize: true,
|
||||||
|
emitFile: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN" id="html">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>电子商城系统</title>
|
||||||
|
<link rel="stylesheet" href="https://cdn.staticfile.org/ant-design-vue/3.2.20/antd.min.css">
|
||||||
|
<script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js" ></script>
|
||||||
|
|
||||||
|
<!--百度统计-->
|
||||||
|
<script>
|
||||||
|
var _hmt = _hmt || [];
|
||||||
|
(function() {
|
||||||
|
var hm = document.createElement("script");
|
||||||
|
hm.src = "https://hm.baidu.com/hm.js?f184d10e8e0d99efb453b7952f6b49ba";
|
||||||
|
var s = document.getElementsByTagName("script")[0];
|
||||||
|
s.parentNode.insertBefore(hm, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"name": "my-web-app",
|
||||||
|
"version": "0.1.2",
|
||||||
|
"author": "lengqin1024",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite --mode development",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@ant-design/icons-vue": "^6.1.0",
|
||||||
|
"@vueuse/components": "^9.10.0",
|
||||||
|
"@vueuse/core": "^9.10.0",
|
||||||
|
"ant-design-vue": "^3.2.20",
|
||||||
|
"axios": "^1.2.2",
|
||||||
|
"pinia": "^2.0.28",
|
||||||
|
"pinia-plugin-persistedstate": "^3.0.2",
|
||||||
|
"qs": "^6.11.0",
|
||||||
|
"vue": "^3.2.45",
|
||||||
|
"vue-router": "^4.1.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/qs": "^6.9.7",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
||||||
|
"@typescript-eslint/parser": "^5.48.0",
|
||||||
|
"@vitejs/plugin-vue": "^4.0.0",
|
||||||
|
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
||||||
|
"autoprefixer": "^10.4.13",
|
||||||
|
"eslint": "8.22.0",
|
||||||
|
"eslint-config-prettier": "^8.6.0",
|
||||||
|
"eslint-define-config": "^1.13.0",
|
||||||
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
"eslint-plugin-vue": "^9.8.0",
|
||||||
|
"less": "^4.1.3",
|
||||||
|
"less-loader": "^11.1.0",
|
||||||
|
"postcss": "^8.4.21",
|
||||||
|
"postcss-html": "^1.5.0",
|
||||||
|
"postcss-less": "^6.0.0",
|
||||||
|
"prettier": "^2.8.3",
|
||||||
|
"rollup-plugin-visualizer": "^5.9.0",
|
||||||
|
"stylelint": "^14.16.1",
|
||||||
|
"stylelint-config-standard": "^29.0.0",
|
||||||
|
"stylelint-order": "^6.0.1",
|
||||||
|
"typescript": "4.9.4",
|
||||||
|
"unplugin-auto-import": "^0.12.2",
|
||||||
|
"vite": "^4.0.3",
|
||||||
|
"vite-plugin-compression": "^0.5.1",
|
||||||
|
"vite-plugin-progress": "^0.0.6",
|
||||||
|
"vite-plugin-restart": "^0.3.1"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: {
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
};
|
@ -0,0 +1,10 @@
|
|||||||
|
module.exports = {
|
||||||
|
printWidth: 140,
|
||||||
|
semi: true,
|
||||||
|
vueIndentScriptAndStyle: true,
|
||||||
|
singleQuote: true,
|
||||||
|
trailingComma: 'all',
|
||||||
|
proseWrap: 'never',
|
||||||
|
htmlWhitespaceSensitivity: 'strict',
|
||||||
|
endOfLine: 'auto',
|
||||||
|
};
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 40 KiB |
@ -0,0 +1,18 @@
|
|||||||
|
<template>
|
||||||
|
<a-config-provider :locale="zhCN">
|
||||||
|
<router-view />
|
||||||
|
</a-config-provider>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
#app {
|
||||||
|
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,29 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/admin/ad/list',
|
||||||
|
create = '/myapp/admin/ad/create',
|
||||||
|
update = '/myapp/admin/ad/update',
|
||||||
|
delete = '/myapp/admin/ad/delete',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
const createApi = async (data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.create,
|
||||||
|
params: {},
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const updateApi = async (params: any, data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.update,
|
||||||
|
params: params,
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const deleteApi = async (params: any) =>
|
||||||
|
post<any>({url: URL.delete, params: params, headers: {}});
|
||||||
|
|
||||||
|
export {listApi, createApi, updateApi, deleteApi};
|
@ -0,0 +1,16 @@
|
|||||||
|
import { get, post } from '/@/utils/http/axios';
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/admin/classification/list',
|
||||||
|
create = '/myapp/admin/classification/create',
|
||||||
|
update = '/myapp/admin/classification/update',
|
||||||
|
delete = '/myapp/admin/classification/delete',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) => get<any>({ url: URL.list, params: params, data: {}, headers: {} });
|
||||||
|
const createApi = async (data: any) =>
|
||||||
|
post<any>({ url: URL.create, params: {}, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const updateApi = async (params: any, data: any) =>
|
||||||
|
post<any>({ url: URL.update, params: params, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const deleteApi = async (params: any) => post<any>({ url: URL.delete, params: params, headers: {} });
|
||||||
|
|
||||||
|
export { listApi, createApi, updateApi, deleteApi };
|
@ -0,0 +1,24 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/admin/comment/list',
|
||||||
|
create = '/myapp/admin/comment/create',
|
||||||
|
delete = '/myapp/admin/comment/delete',
|
||||||
|
listThingComments = '/api/comment/listThingComments',
|
||||||
|
listUserComments = '/api/comment/listUserComments',
|
||||||
|
like = '/api/comment/like'
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) => get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
const createApi = async (data: any) => post<any>({
|
||||||
|
url: URL.create,
|
||||||
|
params: {},
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const deleteApi = async (params: any) => post<any>({url: URL.delete, params: params, headers: {}});
|
||||||
|
const listThingCommentsApi = async (params: any) => get<any>({url: URL.listThingComments, params: params, data: {}, headers: {}});
|
||||||
|
const listUserCommentsApi = async (params: any) => get<any>({url: URL.listUserComments, params: params, data: {}, headers: {}});
|
||||||
|
const likeApi = async (params: any) => post<any>({url: URL.like, params: params, headers: {}});
|
||||||
|
|
||||||
|
export {listApi, createApi, deleteApi, listThingCommentsApi, listUserCommentsApi, likeApi};
|
@ -0,0 +1,16 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
loginLogList = '/myapp/admin/loginLog/list',
|
||||||
|
opLogList = '/myapp/admin/opLog/list',
|
||||||
|
errorLogList = '/myapp/admin/errorLog/list',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listLoginLogApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.loginLogList, params: params, data: {}, headers: {}});
|
||||||
|
const listOpLogListApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.opLogList, params: params, data: {}, headers: {}});
|
||||||
|
const listErrorLogListApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.errorLogList, params: params, data: {}, headers: {}});
|
||||||
|
|
||||||
|
export {listLoginLogApi, listOpLogListApi, listErrorLogListApi};
|
@ -0,0 +1,29 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/admin/notice/list',
|
||||||
|
create = '/myapp/admin/notice/create',
|
||||||
|
update = '/myapp/admin/notice/update',
|
||||||
|
delete = '/myapp/admin/notice/delete',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
const createApi = async (data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.create,
|
||||||
|
params: {},
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const updateApi = async (params: any, data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.update,
|
||||||
|
params: params,
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const deleteApi = async (params: any) =>
|
||||||
|
post<any>({url: URL.delete, params: params, headers: {}});
|
||||||
|
|
||||||
|
export {listApi, createApi, updateApi, deleteApi};
|
@ -0,0 +1,41 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/admin/order/list',
|
||||||
|
create = '/myapp/admin/order/create',
|
||||||
|
update = '/myapp/admin/order/update',
|
||||||
|
delete = '/myapp/admin/order/delete',
|
||||||
|
cancel = '/myapp/admin/order/cancel_order',
|
||||||
|
cancelUserOrder = '/api/order/cancelUserOrder',
|
||||||
|
userOrderList = '/api/order/userOrderList',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
const userOrderListApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.userOrderList, params: params, data: {}, headers: {}});
|
||||||
|
|
||||||
|
const createApi = async (data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.create,
|
||||||
|
params: {},
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const updateApi = async (params: any, data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.update,
|
||||||
|
params: params,
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const deleteApi = async (params: any) =>
|
||||||
|
post<any>({url: URL.delete, params: params, headers: {}});
|
||||||
|
|
||||||
|
const cancelApi = async (params: any) =>
|
||||||
|
post<any>({url: URL.cancel, params: params, headers: {}});
|
||||||
|
|
||||||
|
const cancelUserOrderApi = async (params: any) =>
|
||||||
|
post<any>({url: URL.cancelUserOrder, params: params, headers: {}});
|
||||||
|
|
||||||
|
export {listApi, userOrderListApi, createApi, updateApi, deleteApi, cancelApi, cancelUserOrderApi};
|
@ -0,0 +1,15 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/admin/overview/count',
|
||||||
|
sysInfo= '/myapp/admin/overview/sysInfo',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
|
||||||
|
|
||||||
|
const sysInfoApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.sysInfo, params: params, data: {}, headers: {}});
|
||||||
|
|
||||||
|
export {listApi, sysInfoApi};
|
@ -0,0 +1,29 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/admin/tag/list',
|
||||||
|
create = '/myapp/admin/tag/create',
|
||||||
|
update = '/myapp/admin/tag/update',
|
||||||
|
delete = '/myapp/admin/tag/delete',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
const createApi = async (data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.create,
|
||||||
|
params: {},
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const updateApi = async (params: any, data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.update,
|
||||||
|
params: params,
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const deleteApi = async (params: any) =>
|
||||||
|
post<any>({url: URL.delete, params: params, headers: {}});
|
||||||
|
|
||||||
|
export {listApi, createApi, updateApi, deleteApi};
|
@ -0,0 +1,21 @@
|
|||||||
|
// 权限问题后期增加
|
||||||
|
import { get, post } from '/@/utils/http/axios';
|
||||||
|
import { UserState } from '/@/store/modules/user/types';
|
||||||
|
// import axios from 'axios';
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/admin/thing/list',
|
||||||
|
create = '/myapp/admin/thing/create',
|
||||||
|
update = '/myapp/admin/thing/update',
|
||||||
|
delete = '/myapp/admin/thing/delete',
|
||||||
|
detail = '/api/thing/detail',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) => get<any>({ url: URL.list, params: params, data: {}, headers: {} });
|
||||||
|
const createApi = async (data: any) =>
|
||||||
|
post<any>({ url: URL.create, params: {}, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const updateApi = async (params:any, data: any) =>
|
||||||
|
post<any>({ url: URL.update,params: params, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const deleteApi = async (params: any) => post<any>({ url: URL.delete, params: params, headers: {} });
|
||||||
|
const detailApi = async (params: any) => get<any>({ url: URL.detail, params: params, headers: {} });
|
||||||
|
|
||||||
|
export { listApi, createApi, updateApi, deleteApi, detailApi };
|
@ -0,0 +1,37 @@
|
|||||||
|
// 权限问题后期增加
|
||||||
|
import { get, post } from '/@/utils/http/axios';
|
||||||
|
import { UserState } from '/@/store/modules/user/types';
|
||||||
|
// import axios from 'axios';
|
||||||
|
enum URL {
|
||||||
|
login = '/myapp/admin/adminLogin',
|
||||||
|
userList = '/myapp/admin/user/list',
|
||||||
|
detail = '/api/user/detail',
|
||||||
|
create = '/myapp/admin/user/create',
|
||||||
|
update = '/myapp/admin/user/update',
|
||||||
|
delete = '/myapp/admin/user/delete',
|
||||||
|
userLogin = '/api/user/userLogin',
|
||||||
|
userRegister = '/api/user/userRegister',
|
||||||
|
updateUserPwd = '/api/user/updatePwd',
|
||||||
|
updateUserInfo = '/api/user/updateUserInfo'
|
||||||
|
}
|
||||||
|
interface LoginRes {
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoginData {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const loginApi = async (data: LoginData) => post<any>({ url: URL.login, data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const listApi = async (params: any) => get<any>({ url: URL.userList, params: params, data: {}, headers: {} });
|
||||||
|
const detailApi = async (params: any) => get<any>({ url: URL.detail, params: params, data: {}, headers: {} });
|
||||||
|
const createApi = async (data: any) => post<any>({ url: URL.create, params: {}, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const updateApi = async (params: any, data: any) => post<any>({ url: URL.update,params: params, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const deleteApi = async (params: any) => post<any>({ url: URL.delete, params: params, headers: {} });
|
||||||
|
const userLoginApi = async (data: LoginData) => post<any>({ url: URL.userLogin, data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const userRegisterApi = async (data: any) => post<any>({ url: URL.userRegister, params: {}, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const updateUserPwdApi = async (params: any) => post<any>({ url: URL.updateUserPwd, params: params });
|
||||||
|
const updateUserInfoApi = async (data: any) => post<any>({ url: URL.updateUserInfo, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
|
||||||
|
export { loginApi, listApi, detailApi, createApi, updateApi, deleteApi, userLoginApi, userRegisterApi, updateUserPwdApi, updateUserInfoApi};
|
@ -0,0 +1,29 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/index/address/list',
|
||||||
|
create = '/myapp/index/address/create',
|
||||||
|
update = '/myapp/index/address/update',
|
||||||
|
delete = '/myapp/index/address/delete',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
const createApi = async (data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.create,
|
||||||
|
params: {},
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const updateApi = async (params:any, data: any) =>
|
||||||
|
post<any>({
|
||||||
|
url: URL.update,
|
||||||
|
params: params,
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const deleteApi = async (params: any) =>
|
||||||
|
post<any>({url: URL.delete, params: params, headers: {}});
|
||||||
|
|
||||||
|
export {listApi, createApi, updateApi, deleteApi};
|
@ -0,0 +1,8 @@
|
|||||||
|
import { get, post } from '/@/utils/http/axios';
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/index/classification/list',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) => get<any>({ url: URL.list, params: params, data: {}, headers: {} });
|
||||||
|
|
||||||
|
export { listApi};
|
@ -0,0 +1,20 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
create = '/myapp/index/comment/create',
|
||||||
|
listThingComments = '/myapp/index/comment/list',
|
||||||
|
listUserComments = '/myapp/index/comment/listMyComments',
|
||||||
|
like = '/myapp/index/comment/like'
|
||||||
|
}
|
||||||
|
|
||||||
|
const createApi = async (data: any) => post<any>({
|
||||||
|
url: URL.create,
|
||||||
|
params: {},
|
||||||
|
data: data,
|
||||||
|
headers: {'Content-Type': 'multipart/form-data;charset=utf-8'}
|
||||||
|
});
|
||||||
|
const listThingCommentsApi = async (params: any) => get<any>({url: URL.listThingComments, params: params, data: {}, headers: {}});
|
||||||
|
const listUserCommentsApi = async (params: any) => get<any>({url: URL.listUserComments, params: params, data: {}, headers: {}});
|
||||||
|
const likeApi = async (params: any) => post<any>({url: URL.like, params: params, headers: {}});
|
||||||
|
|
||||||
|
export {createApi, listThingCommentsApi,listUserCommentsApi, likeApi};
|
@ -0,0 +1,10 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/index/notice/list_api',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
|
||||||
|
export {listApi};
|
@ -0,0 +1,18 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
create='/myapp/index/order/create',
|
||||||
|
cancelUserOrder = '/myapp/index/order/cancel_order',
|
||||||
|
userOrderList = '/myapp/index/order/list',
|
||||||
|
}
|
||||||
|
|
||||||
|
const createApi = async (data: any) =>
|
||||||
|
post<any>({url: URL.create, data: data, headers: {}});
|
||||||
|
|
||||||
|
const userOrderListApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.userOrderList, params: params, data: {}, headers: {}});
|
||||||
|
|
||||||
|
const cancelUserOrderApi = async (params: any) =>
|
||||||
|
post<any>({url: URL.cancelUserOrder, params: params, headers: {}});
|
||||||
|
|
||||||
|
export {createApi, userOrderListApi, cancelUserOrderApi};
|
@ -0,0 +1,10 @@
|
|||||||
|
import {get, post} from '/@/utils/http/axios';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/index/tag/list',
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) =>
|
||||||
|
get<any>({url: URL.list, params: params, data: {}, headers: {}});
|
||||||
|
|
||||||
|
export {listApi};
|
@ -0,0 +1,28 @@
|
|||||||
|
// 权限问题后期增加
|
||||||
|
import { get, post } from '/@/utils/http/axios';
|
||||||
|
import { UserState } from '/@/store/modules/user/types';
|
||||||
|
// import axios from 'axios';
|
||||||
|
enum URL {
|
||||||
|
list = '/myapp/index/thing/list',
|
||||||
|
detail = '/myapp/index/thing/detail',
|
||||||
|
addWishUser = '/myapp/index/thing/addWishUser',
|
||||||
|
addCollectUser = '/myapp/index/thing/addCollectUser',
|
||||||
|
getCollectThingList = '/myapp/index/thing/getCollectThingList',
|
||||||
|
getWishThingList = '/myapp/index/thing/getWishThingList',
|
||||||
|
removeCollectUser = '/myapp/index/thing/removeCollectUser',
|
||||||
|
removeWishUser = '/myapp/index/thing/removeWishUser'
|
||||||
|
}
|
||||||
|
|
||||||
|
const listApi = async (params: any) => get<any>({ url: URL.list, params: params, data: {}, headers: {} });
|
||||||
|
const detailApi = async (params: any) => get<any>({ url: URL.detail, params: params, headers: {} });
|
||||||
|
const addWishUserApi = async (params: any) => post<any>({ url: URL.addWishUser, params: params, headers: {} });
|
||||||
|
const addCollectUserApi = async (params: any) => post<any>({ url: URL.addCollectUser, params: params, headers: {} });
|
||||||
|
const getCollectThingListApi = async (params: any) => get<any>({ url: URL.getCollectThingList, params: params, headers: {} });
|
||||||
|
const getWishThingListApi = async (params: any) => get<any>({ url: URL.getWishThingList, params: params, headers: {} });
|
||||||
|
|
||||||
|
const removeCollectUserApi = async (params: any) => post<any>({ url: URL.removeCollectUser, params: params, headers: {} });
|
||||||
|
const removeWishUserApi = async (params: any) => post<any>({ url: URL.removeWishUser, params: params, headers: {} });
|
||||||
|
|
||||||
|
|
||||||
|
export { listApi, detailApi, addWishUserApi,addCollectUserApi, getCollectThingListApi,
|
||||||
|
getWishThingListApi, removeCollectUserApi, removeWishUserApi };
|
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
import { get, post } from '/@/utils/http/axios';
|
||||||
|
import { UserState } from '/@/store/modules/user/types';
|
||||||
|
|
||||||
|
enum URL {
|
||||||
|
userCollectList = '/api/thingCollect/getUserCollectList',
|
||||||
|
collect = '/api/thingCollect/collect',
|
||||||
|
unCollect = '/api/thingCollect/unCollect',
|
||||||
|
}
|
||||||
|
|
||||||
|
const collectApi = async (data: any) => post<any>({ url: URL.collect, params: {}, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const unCollectApi = async (params: any) => post<any>({ url: URL.unCollect, params: params, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const userCollectListApi = async (params: any) => get<any>({ url: URL.userCollectList, params: params });
|
||||||
|
|
||||||
|
export { collectApi, unCollectApi, userCollectListApi };
|
@ -0,0 +1,15 @@
|
|||||||
|
// 权限问题后期增加
|
||||||
|
import { get, post } from '/@/utils/http/axios';
|
||||||
|
import { UserState } from '/@/store/modules/user/types';
|
||||||
|
// import axios from 'axios';
|
||||||
|
enum URL {
|
||||||
|
userWishList = '/api/thingWish/getUserWishList',
|
||||||
|
wish = '/api/thingWish/wish',
|
||||||
|
unWish = '/api/thingWish/unWish',
|
||||||
|
}
|
||||||
|
|
||||||
|
const wishApi = async (data: any) => post<any>({ url: URL.wish, params: {}, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const unWishApi = async (params: any) => post<any>({ url: URL.unWish, params: params, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const userWishListApi = async (params: any) => get<any>({ url: URL.userWishList, params: params });
|
||||||
|
|
||||||
|
export { wishApi, unWishApi, userWishListApi };
|
@ -0,0 +1,27 @@
|
|||||||
|
// 权限问题后期增加
|
||||||
|
import { get, post } from '/@/utils/http/axios';
|
||||||
|
import { UserState } from '/@/store/modules/user/types';
|
||||||
|
// import axios from 'axios';
|
||||||
|
enum URL {
|
||||||
|
userLogin = '/myapp/index/user/login',
|
||||||
|
userRegister = '/myapp/index/user/register',
|
||||||
|
detail = '/myapp/index/user/info',
|
||||||
|
updateUserPwd = '/myapp/index/user/updatePwd',
|
||||||
|
updateUserInfo = '/myapp/index/user/update'
|
||||||
|
}
|
||||||
|
interface LoginRes {
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoginData {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const detailApi = async (params: any) => get<any>({ url: URL.detail, params: params, data: {}, headers: {} });
|
||||||
|
const userLoginApi = async (data: LoginData) => post<any>({ url: URL.userLogin, data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
const userRegisterApi = async (data: any) => post<any>({ url: URL.userRegister, params: {}, data: data });
|
||||||
|
const updateUserPwdApi = async (params: any, data:any) => post<any>({ url: URL.updateUserPwd, params: params, data:data });
|
||||||
|
const updateUserInfoApi = async (params: any,data: any) => post<any>({ url: URL.updateUserInfo, params:params, data: data, headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' } });
|
||||||
|
|
||||||
|
export { detailApi, userLoginApi, userRegisterApi, updateUserPwdApi, updateUserInfoApi};
|
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 519 B |
After Width: | Height: | Size: 838 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 630 B |
After Width: | Height: | Size: 651 B |
After Width: | Height: | Size: 517 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 742 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 747 B |
After Width: | Height: | Size: 1018 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 662 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 716 B |
After Width: | Height: | Size: 630 B |
After Width: | Height: | Size: 630 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 670 B |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 503 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,19 @@
|
|||||||
|
// localStorage恢复到内存
|
||||||
|
|
||||||
|
import {useUserStore} from "/@/store";
|
||||||
|
import {USER_ID, USER_NAME, USER_TOKEN, ADMIN_USER_ID, ADMIN_USER_NAME, ADMIN_USER_TOKEN} from "/@/store/constants";
|
||||||
|
|
||||||
|
export default function Initializer () {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
userStore.$patch((state)=>{
|
||||||
|
state.user_id = localStorage.getItem(USER_ID)
|
||||||
|
state.user_name = localStorage.getItem(USER_NAME)
|
||||||
|
state.user_token = localStorage.getItem(USER_TOKEN)
|
||||||
|
|
||||||
|
state.admin_user_id = localStorage.getItem(ADMIN_USER_ID)
|
||||||
|
state.admin_user_name = localStorage.getItem(ADMIN_USER_NAME)
|
||||||
|
state.admin_user_token = localStorage.getItem(ADMIN_USER_TOKEN)
|
||||||
|
console.log('恢复store完毕==>', state)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
import { createApp } from 'vue';
|
||||||
|
import App from './App.vue';
|
||||||
|
import router from './router';
|
||||||
|
import piniaStore from './store';
|
||||||
|
|
||||||
|
import bootstrap from './core/bootstrap';
|
||||||
|
import '/@/styles/reset.less';
|
||||||
|
import '/@/styles/index.less';
|
||||||
|
import Antd from 'ant-design-vue';
|
||||||
|
|
||||||
|
const app = createApp(App);
|
||||||
|
|
||||||
|
|
||||||
|
app.use(Antd);
|
||||||
|
app.use(router);
|
||||||
|
app.use(piniaStore);
|
||||||
|
app.use(bootstrap)
|
||||||
|
app.mount('#app');
|
@ -0,0 +1,67 @@
|
|||||||
|
import {createRouter, createWebHistory} from 'vue-router';
|
||||||
|
import root from './root';
|
||||||
|
|
||||||
|
import { ADMIN_USER_TOKEN, USER_TOKEN } from '/@/store/constants'
|
||||||
|
|
||||||
|
// 路由权限白名单
|
||||||
|
const allowList = ['adminLogin', 'login', 'register', 'portal', 'search', 'detail', '403', '404']
|
||||||
|
// 前台登录地址
|
||||||
|
const loginRoutePath = '/index/login'
|
||||||
|
// 后台登录地址
|
||||||
|
const adminLoginRoutePath = '/adminLogin'
|
||||||
|
|
||||||
|
|
||||||
|
const router = createRouter({
|
||||||
|
history: createWebHistory(),
|
||||||
|
routes: root,
|
||||||
|
});
|
||||||
|
|
||||||
|
router.beforeEach(async (to, from, next) => {
|
||||||
|
console.log(to, from)
|
||||||
|
|
||||||
|
/** 后台路由 **/
|
||||||
|
if (to.path.startsWith('/admin')) {
|
||||||
|
if (localStorage.getItem(ADMIN_USER_TOKEN)) {
|
||||||
|
if (to.path === adminLoginRoutePath) {
|
||||||
|
next({ path: '/' })
|
||||||
|
} else {
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (allowList.includes(to.name as string)) {
|
||||||
|
// 在免登录名单,直接进入
|
||||||
|
next()
|
||||||
|
} else {
|
||||||
|
next({ path: adminLoginRoutePath, query: { redirect: to.fullPath } })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// next()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 前台路由 **/
|
||||||
|
if (to.path.startsWith('/index')) {
|
||||||
|
if (localStorage.getItem(USER_TOKEN)) {
|
||||||
|
if (to.path === loginRoutePath) {
|
||||||
|
next({ path: '/' })
|
||||||
|
} else {
|
||||||
|
next()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (allowList.includes(to.name as string)) {
|
||||||
|
// 在免登录名单,直接进入
|
||||||
|
next()
|
||||||
|
} else {
|
||||||
|
next({ path: loginRoutePath, query: { redirect: to.fullPath } })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// next()
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
router.afterEach((_to) => {
|
||||||
|
// 回到顶部
|
||||||
|
document.getElementById("html")?.scrollTo(0, 0)
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
@ -0,0 +1,152 @@
|
|||||||
|
// 路由表
|
||||||
|
const constantRouterMap = [
|
||||||
|
// ************* 前台路由 **************
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
redirect: '/index'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/index',
|
||||||
|
name: 'index',
|
||||||
|
redirect: '/index/portal',
|
||||||
|
component: () => import('/@/views/index/index.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'login',
|
||||||
|
name: 'login',
|
||||||
|
component: () => import('/@/views/index/login.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'register',
|
||||||
|
name: 'register',
|
||||||
|
component: () => import('/@/views/index/register.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'portal',
|
||||||
|
name: 'portal',
|
||||||
|
component: () => import('/@/views/index/portal.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'detail',
|
||||||
|
name: 'detail',
|
||||||
|
component: () => import('/@/views/index/detail.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'confirm',
|
||||||
|
name: 'confirm',
|
||||||
|
component: () => import('/@/views/index/confirm.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'pay',
|
||||||
|
name: 'pay',
|
||||||
|
component: () => import('/@/views/index/pay.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'search',
|
||||||
|
name: 'search',
|
||||||
|
component: () => import('/@/views/index/search.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'usercenter',
|
||||||
|
name: 'usercenter',
|
||||||
|
redirect: '/index/usercenter/addressView',
|
||||||
|
component: () => import('/@/views/index/usercenter.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'addressView',
|
||||||
|
name: 'addressView',
|
||||||
|
component: () => import('/@/views/index/user/address-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'wishThingView',
|
||||||
|
name: 'wishThingView',
|
||||||
|
component: () => import('/@/views/index/user/wish-thing-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'collectThingView',
|
||||||
|
name: 'collectThingView',
|
||||||
|
component: () => import('/@/views/index/user/collect-thing-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'orderView',
|
||||||
|
name: 'orderView',
|
||||||
|
component: () => import('/@/views/index/user/order-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'orderView',
|
||||||
|
name: 'orderView',
|
||||||
|
component: () => import('/@/views/index/user/order-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'userInfoEditView',
|
||||||
|
name: 'userInfoEditView',
|
||||||
|
component: () => import('/@/views/index/user/userinfo-edit-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'followView',
|
||||||
|
name: 'followView',
|
||||||
|
component: () => import('/@/views/index/user/follow-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'fansView',
|
||||||
|
name: 'fansView',
|
||||||
|
component: () => import('/@/views/index/user/fans-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'scoreView',
|
||||||
|
name: 'scoreView',
|
||||||
|
component: () => import('/@/views/index/user/score-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'commentView',
|
||||||
|
name: 'commentView',
|
||||||
|
component: () => import('/@/views/index/user/comment-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'securityView',
|
||||||
|
name: 'securityView',
|
||||||
|
component: () => import('/@/views/index/user/security-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'pushView',
|
||||||
|
name: 'pushView',
|
||||||
|
component: () => import('/@/views/index/user/push-view.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'messageView',
|
||||||
|
name: 'messageView',
|
||||||
|
component: () => import('/@/views/index/user/message-view.vue')
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/adminLogin',
|
||||||
|
name: 'adminLogin',
|
||||||
|
component: () => import('/@/views/admin/admin-login.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/admin',
|
||||||
|
name: 'admin',
|
||||||
|
redirect: '/admin/overview',
|
||||||
|
component: () => import('/@/views/admin/main.vue'),
|
||||||
|
children: [
|
||||||
|
{ path: 'overview', name: 'overview', component: () => import('/@/views/admin/overview.vue') },
|
||||||
|
{ path: 'order', name: 'order', component: () => import('/@/views/admin/order.vue') },
|
||||||
|
{ path: 'thing', name: 'thing', component: () => import('/@/views/admin/thing.vue') },
|
||||||
|
{ path: 'comment', name: 'comment', component: () => import('/@/views/admin/comment.vue') },
|
||||||
|
{ path: 'user', name: 'user', component: () => import('/@/views/admin/user.vue') },
|
||||||
|
{ path: 'classification', name: 'classification', component: () => import('/@/views/admin/classification.vue') },
|
||||||
|
{ path: 'tag', name: 'tag', component: () => import('/@/views/admin/tag.vue') },
|
||||||
|
{ path: 'ad', name: 'ad', component: () => import('/@/views/admin/ad.vue') },
|
||||||
|
{ path: 'notice', name: 'notice', component: () => import('/@/views/admin/notice.vue') },
|
||||||
|
{ path: 'loginLog', name: 'loginLog', component: () => import('/@/views/admin/login-log.vue') },
|
||||||
|
{ path: 'opLog', name: 'opLog', component: () => import('/@/views/admin/op-log.vue') },
|
||||||
|
{ path: 'errorLog', name: 'errorLog', component: () => import('/@/views/admin/error-log.vue') },
|
||||||
|
{ path: 'sysInfo', name: 'sysInfo', component: () => import('/@/views/admin/sys-info.vue') },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default constantRouterMap;
|