diff --git a/.env.development b/.env.development index 233ded6..882e7b5 100644 --- a/.env.development +++ b/.env.development @@ -2,6 +2,6 @@ VITE_MODE = dev # 请求域名 -# VITE_APP_BASE_URL='http://192.168.1.249:8084/ai-agent-server/' -VITE_APP_BASE_URL='https://info.xglpa.com/ai-agent-server' +VITE_APP_BASE_URL='http://192.168.1.249:8084/ai-agent-server' +# VITE_APP_BASE_URL='https://info.xglpa.com/ai-agent-server' diff --git a/package.json b/package.json index aee66fc..353e6d8 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,11 @@ "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei", "dev:quickapp-webview-union": "uni -p quickapp-webview-union", "build": "node scripts/publish.js", + "build:h5-test": "vite build --mode test", + "build:h5-prod": "vite build --mode production", "build:app": "uni build -p app", "build:custom": "uni build -p", - "build:h5": "uni build && node scripts/release.mjs -t h5 -o mobile", + "build:h5": "uni build && node scripts/release.mjs -t h5 -o h5", "build:h5:ssr": "uni build --ssr", "build:mp-alipay": "uni build -p mp-alipay", "build:mp-baidu": "uni build -p mp-baidu", @@ -33,7 +35,6 @@ "build:quickapp-webview": "uni build -p quickapp-webview", "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei", "build:quickapp-webview-union": "uni build -p quickapp-webview-union", - "build:prod": "uni build h5 mobile --mode production", "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" }, "dependencies": { @@ -54,6 +55,7 @@ "@iktakahiro/markdown-it-katex": "4.0.1", "@vueuse/core": "9.8.2", "css-color-function": "1.3.3", + "echarts": "^5.6.0", "github-markdown-css": "5.2.0", "highlight.js": "11.0.0", "howler": "2.2.4", @@ -107,4 +109,4 @@ "vite": "4.1.4", "weapp-tailwindcss-webpack-plugin": "1.12.8" } -} \ No newline at end of file +} diff --git a/scripts/release.mjs b/scripts/release.mjs index cab0f19..220977c 100644 --- a/scripts/release.mjs +++ b/scripts/release.mjs @@ -1,46 +1,47 @@ -import path from 'path' -import fsExtra from 'fs-extra' -import minimist from 'minimist' -const { existsSync, remove, copy } = fsExtra -const cwd = process.cwd() +import path from "path"; +import fsExtra from "fs-extra"; +import minimist from "minimist"; +const { existsSync, remove, copy } = fsExtra; +const cwd = process.cwd(); const argv = minimist(process.argv.slice(2), { - alias: { - target: 't', - output: 'o' - } -}) + alias: { + target: "t", + output: "o", + }, +}); //打包发布路径,谨慎改动 -const releaseRelativePath = `../public/${argv.output}` -const distPath = path.resolve(cwd, `dist/build/${argv.target}`) -const releasePath = path.resolve(cwd, releaseRelativePath) +const releaseRelativePath = `./output/${argv.output}`; +const distPath = path.resolve(cwd, `dist/build/${argv.target}`); +const releasePath = path.resolve(cwd, releaseRelativePath); async function build() { - if (existsSync(releasePath)) { - await remove(releasePath) - } - console.log( - `文件正在复制:dist/build/${argv.target} ==> ${releaseRelativePath}` - ) - try { - await copyFile(distPath, releasePath) - } catch (error) { - console.log(`\n ${error}`) - } - console.log( - `文件已复制:dist/build/${argv.target} ==> ${releaseRelativePath}` - ) + existsSync(releasePath); + // if (existsSync(releasePath)) { + // await remove(releasePath); + // } + // console.log( + // `文件正在复制:dist/build/${argv.target} ==> ${releaseRelativePath}` + // ); + // try { + // await copyFile(distPath, releasePath); + // } catch (error) { + // console.log(`\n ${error}`); + // } + // console.log( + // `文件已复制:dist/build/${argv.target} ==> ${releaseRelativePath}` + // ); } function copyFile(sourceDir, targetDir) { - return new Promise((resolve, reject) => { - copy(sourceDir, targetDir, (err) => { - if (err) { - reject(err) - } else { - resolve() - } - }) - }) + return new Promise((resolve, reject) => { + copy(sourceDir, targetDir, (err) => { + if (err) { + reject(err); + } else { + resolve(); + } + }); + }); } -build() +build(); diff --git a/src/api/user.ts b/src/api/user.ts index 73c9809..796c631 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -64,3 +64,8 @@ export function feedbackPost(data: any) { export function cancelled(data?: any) { return request.post({ url: "/login/cancelled", data }); } + +//获取插件数据 +export function getCharts(data?: any) { + return request.post({ url: "/charts/getCharts", data }); +} diff --git a/src/manifest.json b/src/manifest.json index c9688a0..f569d9e 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -153,8 +153,12 @@ "setting": { "urlCheck": false, "es6": true, - "minified": true + "minified": true, + "use2dCanvas": true }, + "requiredBackgroundModes": [ + "canvas" + ], "__usePrivacyCheck__": true, "usingComponents": true }, diff --git a/src/pages.json b/src/pages.json index 3b1b95a..922a323 100644 --- a/src/pages.json +++ b/src/pages.json @@ -10,6 +10,16 @@ "share": true } }, + { + "path": "pages/overview/overview", + "style": { + "navigationBarTitleText": "数据", + "enablePullDownRefresh": false + }, + "meta": { + "share": true + } + }, { "path": "pages/skills/skills", "style": { diff --git a/src/pages/overview/_components/chart.vue b/src/pages/overview/_components/chart.vue new file mode 100644 index 0000000..7d6f41a --- /dev/null +++ b/src/pages/overview/_components/chart.vue @@ -0,0 +1,172 @@ + + + + + \ No newline at end of file diff --git a/src/pages/overview/_components/pie-chart.vue b/src/pages/overview/_components/pie-chart.vue new file mode 100644 index 0000000..15ecd8f --- /dev/null +++ b/src/pages/overview/_components/pie-chart.vue @@ -0,0 +1,120 @@ + + + \ No newline at end of file diff --git a/src/pages/overview/overview.vue b/src/pages/overview/overview.vue new file mode 100644 index 0000000..042ae76 --- /dev/null +++ b/src/pages/overview/overview.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/vite.config.ts b/vite.config.ts index c410b69..e72d026 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from "vite"; +import { defineConfig, loadEnv } from "vite"; import uni from "@dcloudio/vite-plugin-uni"; import tailwindcss from "tailwindcss"; import autoprefixer from "autoprefixer"; @@ -24,22 +24,33 @@ if (!weappTailwindcssDisabled) { } // https://vitejs.dev/config/ -export default defineConfig({ - base: "https://cdn.xglpa.com/ai-agent-m/", - plugins: [ - uni(), - uniRouter({ - includes: ["style"], - }), - weappTailwindcssDisabled ? undefined : vwt(), - ], - css: { - postcss: { - plugins: postcssPlugin, +export default defineConfig(({ mode }) => { + // 加载环境变量 + const env = loadEnv(mode, process.cwd()); + console.log("env", env.VITE_MODE); + + return { + // base: "https://cdn.xglpa.com/ai-agent-m/", + plugins: [ + uni(), + uniRouter({ + includes: ["style"], + }), + weappTailwindcssDisabled ? undefined : vwt(), + ], + css: { + postcss: { + plugins: postcssPlugin, + }, }, - }, - server: { - port: 8991, - }, - // base: "./", + server: { + port: 8991, + }, + // 根据环境变量动态配置 + build: { + outDir: `dist/${mode}`, // 输出到不同目录(如 dist/development、dist/test) + assetsDir: "static", + minify: mode === "production" ? "terser" : false, // 生产环境压缩代码 + }, + }; }); diff --git a/yarn.lock b/yarn.lock index 33b8b00..abe4d40 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3506,6 +3506,14 @@ dom-walk@^0.1.0: resolved "https://registry.npmmirror.com/dom-walk/-/dom-walk-0.1.2.tgz" integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== +echarts@^5.6.0: + version "5.6.0" + resolved "https://registry.npmmirror.com/echarts/-/echarts-5.6.0.tgz#2377874dca9fb50f104051c3553544752da3c9d6" + integrity sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA== + dependencies: + tslib "2.3.0" + zrender "5.6.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz" @@ -5664,6 +5672,11 @@ ts-interface-checker@^0.1.9: resolved "https://registry.npmmirror.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz" integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== +tslib@2.3.0: + version "2.3.0" + resolved "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e" + integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg== + tslib@^1.8.1: version "1.14.1" resolved "https://registry.npmmirror.com/tslib/-/tslib-1.14.1.tgz" @@ -6006,3 +6019,10 @@ z-paging@2.7.6: version "2.7.6" resolved "https://registry.npmjs.org/z-paging/-/z-paging-2.7.6.tgz" integrity sha512-zwY7Y2DczBTq61XT69sreCqtwagZaAuGmYb0GjGEx7AgiV7yhxS8VtkaZMf7cI60Cf+8j2zENjV9yrbBwTPvLQ== + +zrender@5.6.1: + version "5.6.1" + resolved "https://registry.npmmirror.com/zrender/-/zrender-5.6.1.tgz#e08d57ecf4acac708c4fcb7481eb201df7f10a6b" + integrity sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag== + dependencies: + tslib "2.3.0"