From a9707c6d94512484749de59ca13bb19a54a498c3 Mon Sep 17 00:00:00 2001 From: YuanHuakk <1751826683@qq.com> Date: Wed, 6 Sep 2023 03:48:46 +0800 Subject: [PATCH] feat(custom): i --- .env | 10 +- .env.development | 6 +- .env.production | 8 +- build/constant.js | 24 +- settings/theme.json | 2 +- src/components/Upload.vue | 67 +++ src/components/page/AppPage.vue | 2 +- src/hooks/useScript.js | 43 ++ src/layout/components/header/index.vue | 8 +- src/router/guard/permission-guard.js | 4 +- src/router/index.js | 2 +- src/router/routes/index.js | 74 +-- src/store/modules/user/index.js | 18 +- src/utils/http/index.js | 4 +- src/utils/http/interceptors.js | 7 +- src/views/business/mer_list/api.js | 7 + src/views/business/mer_list/index.vue | 434 ++++++++++++++++++ src/views/business/mer_type/api.js | 6 + src/views/business/mer_type/index.vue | 182 ++++++++ src/views/business/mer_verify/api.js | 0 src/views/business/mer_verify/index.vue | 7 + src/views/business/route.js | 40 ++ src/views/commodity/commodity_class/api.js | 6 + src/views/commodity/commodity_class/index.vue | 182 ++++++++ src/views/commodity/hot_list/api.js | 6 + src/views/commodity/hot_list/index.vue | 155 +++++++ src/views/commodity/point/api.js | 6 + src/views/commodity/point/index.vue | 155 +++++++ src/views/commodity/route.js | 40 ++ src/views/demo/base/route.js | 1 + src/views/error-page/route.js | 1 + src/views/game/api.js | 8 + src/views/game/data/index.vue | 124 +++++ src/views/game/route.js | 19 + src/views/game/sys/index.vue | 0 src/views/login/api.js | 2 +- src/views/login/index.vue | 7 +- src/views/order/index/api.js | 5 + src/views/order/index/index.vue | 103 +++++ src/views/order/point/api.js | 5 + src/views/order/point/index.vue | 103 +++++ src/views/order/route.js | 30 ++ src/views/system/index/api.js | 6 + src/views/system/index/index.vue | 206 +++++++++ src/views/system/route.js | 30 ++ src/views/system/sys/api.js | 6 + src/views/system/sys/index.vue | 66 +++ src/views/user/index/api.js | 5 + src/views/user/index/index.vue | 101 ++++ src/views/user/route.js | 19 + src/views/workbench/index.vue | 8 +- 51 files changed, 2273 insertions(+), 87 deletions(-) create mode 100644 src/components/Upload.vue create mode 100644 src/hooks/useScript.js create mode 100644 src/views/business/mer_list/api.js create mode 100644 src/views/business/mer_list/index.vue create mode 100644 src/views/business/mer_type/api.js create mode 100644 src/views/business/mer_type/index.vue create mode 100644 src/views/business/mer_verify/api.js create mode 100644 src/views/business/mer_verify/index.vue create mode 100644 src/views/business/route.js create mode 100644 src/views/commodity/commodity_class/api.js create mode 100644 src/views/commodity/commodity_class/index.vue create mode 100644 src/views/commodity/hot_list/api.js create mode 100644 src/views/commodity/hot_list/index.vue create mode 100644 src/views/commodity/point/api.js create mode 100644 src/views/commodity/point/index.vue create mode 100644 src/views/commodity/route.js create mode 100644 src/views/game/api.js create mode 100644 src/views/game/data/index.vue create mode 100644 src/views/game/route.js create mode 100644 src/views/game/sys/index.vue create mode 100644 src/views/order/index/api.js create mode 100644 src/views/order/index/index.vue create mode 100644 src/views/order/point/api.js create mode 100644 src/views/order/point/index.vue create mode 100644 src/views/order/route.js create mode 100644 src/views/system/index/api.js create mode 100644 src/views/system/index/index.vue create mode 100644 src/views/system/route.js create mode 100644 src/views/system/sys/api.js create mode 100644 src/views/system/sys/index.vue create mode 100644 src/views/user/index/api.js create mode 100644 src/views/user/index/index.vue create mode 100644 src/views/user/route.js diff --git a/.env b/.env index d407df6..f5d8333 100644 --- a/.env +++ b/.env @@ -1,3 +1,9 @@ -VITE_TITLE = 'Vue Naive Admin' +VITE_TITLE = '捷兑通 - 平台端' -VITE_PORT = 3100 +VITE_PORT = 4000 + +VITE_WS_URL = 'www.wanzhuanyongcheng.cn/admin/data' + +VITE_WS1_URL = 'www.jdt168.com/dice/home' + +VITE_GAME_API = 'https://www.jdt168.com' \ No newline at end of file diff --git a/.env.development b/.env.development index 9feaca6..39ce38e 100644 --- a/.env.development +++ b/.env.development @@ -2,10 +2,10 @@ VITE_PUBLIC_PATH = '/' # 是否启用MOCK -VITE_USE_MOCK = true +VITE_USE_MOCK = false -# 是否启用MOCK +# 是否启用代理 VITE_USE_PROXY = true # base api -VITE_BASE_API = '/api' +VITE_BASE_API = '/admin' diff --git a/.env.production b/.env.production index 67c17e2..ce6a786 100644 --- a/.env.production +++ b/.env.production @@ -1,11 +1,13 @@ # 资源公共路径,需要以 /开头和结尾 -VITE_PUBLIC_PATH = '/' +VITE_PUBLIC_PATH = '/static/admin' # 是否启用MOCK -VITE_USE_MOCK = true +VITE_USE_MOCK = false # base api -VITE_BASE_API = '/api' +VITE_BASE_API = 'https://www.wanzhuanyongcheng.cn/admin' + +# VITE_GAME_API = 'http://www.wanzhuanyongcheng.cn/admin' # 是否启用压缩 VITE_USE_COMPRESS = true diff --git a/build/constant.js b/build/constant.js index e63072c..29ef842 100644 --- a/build/constant.js +++ b/build/constant.js @@ -6,28 +6,28 @@ export const PROXY_CONFIG = { * @请求路径 http://localhost:3100/api/user * @转发路径 http://localhost:8080/user */ - '/api': { - target: 'http://localhost:8080', + '/admin': { + target: 'https://www.wanzhuanyongcheng.cn', changeOrigin: true, - rewrite: (path) => path.replace(new RegExp('^/api'), ''), + // rewrite: (path) => path.replace(new RegExp('^/api'), ''), }, /** * @desc 不替换匹配值 * @请求路径 http://localhost:3100/api/v2/user * @转发路径 http://localhost:8080/api/v2/user */ - '/api/v2': { - target: 'http://localhost:8080', - changeOrigin: true, - }, + // '/api/v2': { + // target: 'http://localhost:8080', + // changeOrigin: true, + // }, /** * @desc 替换部分匹配值 * @请求路径 http://localhost:3100/api/v3/user * @转发路径 http://localhost:8080/user */ - '/api/v3': { - target: 'http://localhost:8080', - changeOrigin: true, - rewrite: (path) => path.replace(new RegExp('^/api'), ''), - }, + // '/api/v3': { + // target: 'http://localhost:8080', + // changeOrigin: true, + // rewrite: (path) => path.replace(new RegExp('^/api'), ''), + // }, } diff --git a/settings/theme.json b/settings/theme.json index add0a7e..d611894 100644 --- a/settings/theme.json +++ b/settings/theme.json @@ -8,7 +8,7 @@ }, "naiveThemeOverrides": { "common": { - "primaryColor": "#316C72FF", + "primaryColor": "#409EFFE3", "primaryColorHover": "#316C72E3", "primaryColorPressed": "#2B4C59FF", "primaryColorSuppl": "#316C72E3", diff --git a/src/components/Upload.vue b/src/components/Upload.vue new file mode 100644 index 0000000..12c935e --- /dev/null +++ b/src/components/Upload.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/src/components/page/AppPage.vue b/src/components/page/AppPage.vue index 9e30448..56df81a 100644 --- a/src/components/page/AppPage.vue +++ b/src/components/page/AppPage.vue @@ -2,7 +2,7 @@
- +
diff --git a/src/hooks/useScript.js b/src/hooks/useScript.js new file mode 100644 index 0000000..73d5ec6 --- /dev/null +++ b/src/hooks/useScript.js @@ -0,0 +1,43 @@ +import { onMounted, onUnmounted, ref } from 'vue' + +export function useScript(opts) { + const isLoading = ref(false) + const error = ref(false) + const success = ref(false) + let script + + const promise = new Promise((resolve, reject) => { + onMounted(() => { + script = document.createElement('script') + script.type = 'text/javascript' + script.charset = 'utf-8' + script.onload = function () { + isLoading.value = false + success.value = true + error.value = false + resolve('') + } + + script.onerror = function (err) { + isLoading.value = false + success.value = false + error.value = true + reject(err) + } + + script.src = opts.src + document.head.appendChild(script) + }) + }) + + onUnmounted(() => { + script && script.remove() + }) + + return { + isLoading, + error, + success, + toPromise: () => promise, + } +} diff --git a/src/layout/components/header/index.vue b/src/layout/components/header/index.vue index 571ab26..4f8c0c0 100644 --- a/src/layout/components/header/index.vue +++ b/src/layout/components/header/index.vue @@ -4,9 +4,9 @@