refactor: migrate from Vue CLI to Vite, update WebSocket handling, and clean up configuration

- Replaced vue.config.js with vite.config.js for Vite setup.
- Updated WebSocket implementation in webSocket.js for improved readability and performance.
- Removed unnecessary comments and cleaned up code formatting.
- Configured Vite plugins for auto-imports, SVG icons, and component resolution.
- Set up proxy configurations for API endpoints in Vite.
This commit is contained in:
bighuixiang
2025-06-18 14:31:35 +08:00
parent 9191678708
commit 3a52cc1e53
19 changed files with 20706 additions and 26139 deletions

4
.env
View File

@@ -1,4 +1,4 @@
# NODE_ENV = 'production' # NODE_ENV = 'production'
NODE_ENV = 'development' NODE_ENV = 'development'
# VUE_APP_BASE_URL = 'http://18.167.251.121:10086' # VITE_APP_BASE_URL = 'http://18.167.251.121:10086'
VUE_APP_BASE_URL = 'https://www.api.aida.com.hk' VITE_APP_BASE_URL = 'https://www.api.aida.com.hk'

View File

@@ -1,11 +1,11 @@
NODE_ENV = 'development' NODE_ENV = 'development'
# VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk' # VITE_APP_BASE_URL = 'https://develop.api.aida.com.hk'
# VUE_APP_BASE_URL = 'https://api.aida.com.hk' # VITE_APP_BASE_URL = 'https://api.aida.com.hk'
# VUE_APP_BASE_URL = 'http://18.167.251.121:10086' # VITE_APP_BASE_URL = 'http://18.167.251.121:10086'
VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk' VITE_APP_BASE_URL = 'https://develop.api.aida.com.hk'
# VUE_APP_BASE_URL = 'https://www.api.aida.com.hk' # VITE_APP_BASE_URL = 'https://www.api.aida.com.hk'
# 徐佩 # 徐佩
# VUE_APP_BASE_URL = 'http://192.168.31.118:5567' # VITE_APP_BASE_URL = 'http://192.168.31.118:5567'
# 海波 # 海波
# VUE_APP_BASE_URL = 'http://192.168.31.34:5567' # VITE_APP_BASE_URL = 'http://192.168.31.34:5567'

View File

@@ -1,7 +1,7 @@
NODE_ENV = 'production' NODE_ENV = 'production'
# VUE_APP_BASE_URL = 'https://aida.com.hk/test' # VITE_APP_BASE_URL = 'https://aida.com.hk/test'
# VUE_APP_BASE_URL = 'http://18.167.251.121:10088' # VITE_APP_BASE_URL = 'http://18.167.251.121:10088'
# VUE_APP_BASE_URL = 'https://api.aida.com.hk' # VITE_APP_BASE_URL = 'https://api.aida.com.hk'
VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk' VITE_APP_BASE_URL = 'https://develop.api.aida.com.hk'

View File

@@ -1,4 +1,4 @@
NODE_ENV = 'production' NODE_ENV = 'production'
# VUE_APP_BASE_URL = 'http://18.167.251.121:10086' # VITE_APP_BASE_URL = 'http://18.167.251.121:10086'
# VUE_APP_BASE_URL = 'https://polyu.api.aida.com.hk' # VITE_APP_BASE_URL = 'https://polyu.api.aida.com.hk'
VUE_APP_BASE_URL = 'https://www.api.aida.com.hk' VITE_APP_BASE_URL = 'https://www.api.aida.com.hk'

View File

@@ -1,7 +1,7 @@
NODE_ENV = 'development' NODE_ENV = 'development'
VUE_APP_BASE_URL = 'https://test.api.aida.com.hk' VITE_APP_BASE_URL = 'https://test.api.aida.com.hk'
# VUE_APP_BASE_URL = 'https://api.aida.com.hk' # VITE_APP_BASE_URL = 'https://api.aida.com.hk'
# VUE_APP_BASE_URL = 'http://18.167.251.121:10086' # VITE_APP_BASE_URL = 'http://18.167.251.121:10086'
# VUE_APP_BASE_URL = 'http://192.168.1.9:5567' # VITE_APP_BASE_URL = 'http://192.168.1.9:5567'
# VUE_APP_BASE_URL = 'http://192.168.1.6:7766' # VITE_APP_BASE_URL = 'http://192.168.1.6:7766'

View File

@@ -1,7 +1,7 @@
NODE_ENV = 'production' NODE_ENV = 'production'
# VUE_APP_BASE_URL = 'https://aida.com.hk/test' # VITE_APP_BASE_URL = 'https://aida.com.hk/test'
# VUE_APP_BASE_URL = 'http://18.167.251.121:10088' # VITE_APP_BASE_URL = 'http://18.167.251.121:10088'
# VUE_APP_BASE_URL = 'https://api.aida.com.hk' # VITE_APP_BASE_URL = 'https://api.aida.com.hk'
# VUE_APP_BASE_URL = 'https://test.api.aida.com.hk' # VITE_APP_BASE_URL = 'https://test.api.aida.com.hk'
VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk' VITE_APP_BASE_URL = 'https://develop.api.aida.com.hk'

14
components.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
// biome-ignore lint: disable
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}

41670
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,87 +1,94 @@
{ {
"name": "aida", "name": "aida",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "dev": "vite",
"build": "vue-cli-service build", "serve": "vite",
"serve:test": "vue-cli-service serve --mode test", "build": "vite build",
"build:test": "vue-cli-service build --mode test_build", "preview": "vite preview",
"serve:dev": "vue-cli-service serve --mode dev", "serve:test": "vite --mode test",
"build:dev": "vue-cli-service build --mode dev_build", "build:test": "vite build --mode test_build",
"lint": "vue-cli-service lint" "serve:dev": "vite --mode dev",
}, "build:dev": "vite build --mode dev_build",
"dependencies": { "lint": "eslint src --ext .js,.ts,.vue --fix"
"@ans1998/vue3-color": "^3.0.7", },
"@flaticon/flaticon-uicons": "^2.4.0", "dependencies": {
"@types/fingerprintjs2": "^2.0.0", "@ans1998/vue3-color": "^3.0.7",
"ant-design-vue": "^3.2.12", "@flaticon/flaticon-uicons": "^2.4.0",
"axios": "^1.4.0", "@types/fingerprintjs2": "^2.0.0",
"core-js": "^3.8.3", "ant-design-vue": "^3.2.12",
"driver.js": "^1.3.1", "axios": "^1.4.0",
"echarts": "^5.5.1", "core-js": "^3.8.3",
"fabric-with-all": "^5.3.1", "driver.js": "^1.3.1",
"element-plus": "^2.4.2", "echarts": "^5.5.1",
"file-saver": "^2.0.5", "element-plus": "^2.4.2",
"fingerprintjs2": "^2.1.4", "fabric-with-all": "^5.3.1",
"gsap": "^3.12.5", "file-saver": "^2.0.5",
"html2canvas": "^1.4.1", "fingerprintjs2": "^2.1.4",
"jszip": "^3.10.1", "gsap": "^3.12.5",
"md5": "^2.3.0", "html2canvas": "^1.4.1",
"quantize": "^1.0.2", "jszip": "^3.10.1",
"sortablejs": "^1.15.0", "md5": "^2.3.0",
"swiper": "^11.1.4", "quantize": "^1.0.2",
"three": "^0.148.0", "sortablejs": "^1.15.0",
"vue": "^3.2.13", "swiper": "^11.1.4",
"vue-class-component": "^8.0.0-0", "three": "^0.148.0",
"vue-cropper": "^1.0.5", "vue": "^3.2.13",
"vue-draggable-plus": "^0.6.0", "vue-class-component": "^8.0.0-0",
"vue-i18n": "^9.6.1", "vue-cropper": "^1.0.5",
"vue-router": "^4.0.3", "vue-draggable-plus": "^0.6.0",
"vuedraggable": "^4.1.0", "vue-i18n": "^9.6.1",
"vuex": "^4.0.0" "vue-router": "^4.0.3",
}, "vuedraggable": "^4.1.0",
"devDependencies": { "vuex": "^4.0.0"
"@types/three": "^0.174.0", },
"@typescript-eslint/eslint-plugin": "^5.4.0", "devDependencies": {
"@typescript-eslint/parser": "^5.4.0", "@types/three": "^0.174.0",
"@vue/cli-plugin-babel": "~5.0.0", "@typescript-eslint/eslint-plugin": "^5.4.0",
"@vue/cli-plugin-eslint": "~5.0.0", "@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-router": "~5.0.0", "@vitejs/plugin-vue": "^5.2.4",
"@vue/cli-plugin-typescript": "~5.0.0", "@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0", "@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0", "@vue/cli-plugin-router": "~5.0.0",
"@vue/eslint-config-typescript": "^9.1.0", "@vue/cli-plugin-typescript": "~5.0.0",
"babel-eslint": "^10.1.0", "@vue/cli-plugin-vuex": "~5.0.0",
"eslint": "^7.32.0", "@vue/cli-service": "~5.0.0",
"eslint-plugin-vue": "^8.0.3", "@vue/eslint-config-typescript": "^9.1.0",
"less": "^4.1.3", "babel-eslint": "^10.1.0",
"less-loader": "^11.0.0", "eslint": "^7.32.0",
"style-resources-loader": "^1.5.0", "eslint-plugin-vue": "^8.0.3",
"typescript": "~4.5.5", "less": "^4.1.3",
"unplugin-element-plus": "^0.8.0", "less-loader": "^11.0.0",
"vue-cli-plugin-style-resources-loader": "^0.1.5", "style-resources-loader": "^1.5.0",
"vue-lazyload": "^3.0.0-rc.2" "typescript": "~4.5.5",
}, "unplugin-auto-import": "^19.3.0",
"eslintConfig": { "unplugin-element-plus": "^0.8.0",
"root": true, "unplugin-vue-components": "^28.7.0",
"env": { "vite": "^6.3.5",
"node": true "vite-plugin-svg-icons": "^2.0.1",
}, "vue-cli-plugin-style-resources-loader": "^0.1.5",
"extends": [ "vue-lazyload": "^3.0.0-rc.2"
"plugin:vue/vue3-essential", },
"eslint:recommended", "eslintConfig": {
"@vue/typescript/recommended" "root": true,
], "env": {
"parserOptions": { "node": true
"ecmaVersion": 2020 },
}, "extends": [
"rules": {} "plugin:vue/vue3-essential",
}, "eslint:recommended",
"browserslist": [ "@vue/typescript/recommended"
"> 1%", ],
"last 2 versions", "parserOptions": {
"not dead", "ecmaVersion": 2020
"not ie 11" },
] "rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
} }

View File

@@ -1,27 +1,31 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang=""> <html lang="">
<head>
<meta charset="utf-8"> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta charset="utf-8">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> --> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <!-- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> -->
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>AiDA</title> <link rel="icon" href="/favicon.ico">
<!-- <link href="https://fonts.font.im/css?family=Roboto:400,500,700,700i" rel="stylesheet"> <title>AiDA</title>
<!-- <link href="https://fonts.font.im/css?family=Roboto:400,500,700,700i" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap" rel="stylesheet"> --> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap" rel="stylesheet"> -->
<!-- 字体css --> <!-- 字体css -->
<link rel="stylesheet" href="/css/googleapis.css"> <link rel="stylesheet" href="/css/googleapis.css">
<link rel="stylesheet" href="/css/roboto.css"> <link rel="stylesheet" href="/css/roboto.css">
<link rel="stylesheet" href="/css/sloganFamily.css"> <link rel="stylesheet" href="/css/sloganFamily.css">
</head> </head>
<body>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.3.0/color-thief.umd.js"></script> --> <body>
<script src="/js/color-thief.js"></script> <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.3.0/color-thief.umd.js"></script> -->
<script src="/js/aligning_guidelines.js"></script> <script src="/js/color-thief.js"></script>
<noscript> <script src="/js/aligning_guidelines.js"></script>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <noscript>
</noscript> <strong>We're sorry but AiDA doesn't work properly without JavaScript enabled. Please enable it to
<div id="app"></div> continue.</strong>
<!-- built files will be auto injected --> </noscript>
</body> <div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html> </html>

89
src/auto-imports.d.ts vendored Normal file
View File

@@ -0,0 +1,89 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const cloneDeep: typeof import('lodash-es')['cloneDeep']
const cloneDeepWith: typeof import('lodash-es')['cloneDeepWith']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const debounce: typeof import('lodash-es')['debounce']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isArray: typeof import('lodash-es')['isArray']
const isBoolean: typeof import('lodash-es')['isBoolean']
const isDate: typeof import('lodash-es')['isDate']
const isFunction: typeof import('lodash-es')['isFunction']
const isNaN: typeof import('lodash-es')['isNaN']
const isNull: typeof import('lodash-es')['isNull']
const isNumber: typeof import('lodash-es')['isNumber']
const isObject: typeof import('lodash-es')['isObject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const isString: typeof import('lodash-es')['isString']
const isUndefined: typeof import('lodash-es')['isUndefined']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useId: typeof import('vue')['useId']
const useLink: typeof import('vue-router')['useLink']
const useModel: typeof import('vue')['useModel']
const useRoute: typeof import('vue-router')['useRoute']
const useRouter: typeof import('vue-router')['useRouter']
const useSlots: typeof import('vue')['useSlots']
const useTemplateRef: typeof import('vue')['useTemplateRef']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}

View File

@@ -306,7 +306,7 @@ export class BatchInitializeRedGreenModeCommand extends Command {
*/ */
async _setupBackgroundLayer(backgroundLayer, clothingImage) { async _setupBackgroundLayer(backgroundLayer, clothingImage) {
let backgroundObject = backgroundLayer.fabricObject; let backgroundObject = backgroundLayer.fabricObject;
const { object } = findObjectById(this.canvas, backgroundObject.id); let { object } = findObjectById(this.canvas, backgroundObject.id);
if (!object) { if (!object) {
// 创建白色背景矩形 // 创建白色背景矩形

File diff suppressed because it is too large Load Diff

View File

@@ -1,459 +1,530 @@
<template> <template>
<div class="newProject"> <div class="newProject">
<div class="contentBox"> <div class="contentBox">
<div class="content"> <div class="content">
<div class="title">How can I help you today?</div> <div class="title">How can I help you today?</div>
<div class="selectFlow"> <div class="selectFlow">
<div class="select"> <div class="select">
<div class="item" @click="setFlow(item)" :class="{active:item.title == selectFlow.title}" v-for="item in flowList">{{ item.title }}</div> <div
</div> class="item"
<div class="describe"> @click="setFlow(item)"
<p v-for="item in selectFlow.describe">{{ item }}</p> :class="{ active: item.title == selectFlow.title }"
</div> v-for="item in flowList"
</div> >
<div class="chatOrSetting"> {{ item.title }}
<div class="select"> </div>
<div class="item" @click="setChatOrSetting('chat')" :class="{active:chatOrSetting == 'chat'}">Chat</div> </div>
<div class="item" @click="setChatOrSetting('setting')" :class="{active:chatOrSetting == 'setting'}">Setting</div> <div class="describe">
</div> <p v-for="item in selectFlow.describe">{{ item }}</p>
</div> </div>
<div class="chatBox" v-show="chatOrSetting == 'chat'"> </div>
<textarea ref="textarea" @input="inputText($event)" @keydown.enter.prevent="sendChat" placeholder="Write your message"></textarea> <div class="chatOrSetting">
<div class="btn"> <div class="select">
<div class="uploadBox"> <div
<div class="filList"> class="item"
<div class="item" v-for="item,index in filList"> @click="setChatOrSetting('chat')"
<div>{{item.name}}</div> :class="{ active: chatOrSetting == 'chat' }"
<span class="icon iconfont icon-shanchu" @click="deleteFile(item,index)"></span> >
</div> Chat
</div> </div>
<i class="fi fi-rs-paperclip-vertical"> <div
<input type="file" @change="handleFileUpload($event)"> class="item"
</i> @click="setChatOrSetting('setting')"
<div class="enableThinking" :class="{active:enableThinking}" @click="()=>enableThinking = !enableThinking">Deep Thinking</div> :class="{ active: chatOrSetting == 'setting' }"
</div> >
<div class="sendBox"> Setting
<div class="maxNum">{{ chatContent.length }}/10000</div> </div>
<div class="send" @click="sendChat"> </div>
<i class="fi fi-ss-paper-plane-top"></i> </div>
</div> <div class="chatBox" v-show="chatOrSetting == 'chat'">
</div> <textarea
</div> ref="textarea"
</div> @input="inputText($event)"
<div v-show="chatOrSetting != 'chat'" class="workspaceBox"> @keydown.enter.prevent="sendChat"
<workspace @setProject="setProject" :httpWorkflowType="selectFlow.value"></workspace> placeholder="Write your message"
</div> ></textarea>
<div class="hint" v-show="chatOrSetting == 'chat'"> <div class="btn">
<div class="item" v-for="item in hintList" @click="addChatContent(item)">{{ item }}</div> <div class="uploadBox">
</div> <div class="filList">
</div> <div class="item" v-for="(item, index) in filList">
</div> <div>{{ item.name }}</div>
<div class="mark_loading" v-show="loadingShow"> <span
<a-spin size="large" /> class="icon iconfont icon-shanchu"
</div> @click="deleteFile(item, index)"
</div> ></span>
</div>
</div>
<i class="fi fi-rs-paperclip-vertical">
<input type="file" @change="handleFileUpload($event)" />
</i>
<div
class="enableThinking"
:class="{ active: enableThinking }"
@click="() => (enableThinking = !enableThinking)"
>
Deep Thinking
</div>
</div>
<div class="sendBox">
<div class="maxNum">{{ chatContent.length }}/10000</div>
<div class="send" @click="sendChat">
<i class="fi fi-ss-paper-plane-top"></i>
</div>
</div>
</div>
</div>
<div v-show="chatOrSetting != 'chat'" class="workspaceBox">
<workspace
@setProject="setProject"
:httpWorkflowType="selectFlow.value"
></workspace>
</div>
<div class="hint" v-show="chatOrSetting == 'chat'">
<div
class="item"
v-for="item in hintList"
@click="addChatContent(item)"
>
{{ item }}
</div>
</div>
</div>
</div>
<div class="mark_loading" v-show="loadingShow">
<a-spin size="large" />
</div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent,computed,ref,provide,nextTick,createVNode,toRefs, reactive, onMounted} from 'vue' import {
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; defineComponent,
computed,
ref,
provide,
nextTick,
createVNode,
toRefs,
reactive,
onMounted,
} from "vue";
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
import { Https } from "@/tool/https"; import { Https } from "@/tool/https";
import { useStore } from "vuex"; import { useStore } from "vuex";
import { Modal,message,Upload,CascaderProps } from 'ant-design-vue'; import { Modal, message, Upload, CascaderProps } from "ant-design-vue";
import { useI18n } from 'vue-i18n' import { useI18n } from "vue-i18n";
import {getCookie,clonAllCookie} from '@/tool/cookie' import { getCookie, clonAllCookie } from "@/tool/cookie";
import router from '@/router'; import router from "@/router";
import workspace from './workspace.vue' import workspace from "./workspace.vue";
export default defineComponent({ export default defineComponent({
components:{ components: {
workspace, workspace,
}, },
props:{ props: {},
}, emits: ["newProject"],
emits:['newProject'], setup(props, { emit }) {
setup(props,{emit}) { const store = useStore();
const store = useStore(); const data = reactive({
const data = reactive({ flowList: [
flowList:[ {
{ title: "Series Design",
title:'Series Design', value: "SERIES_DESIGN",
value:'SERIES_DESIGN', describe: [
describe:[ "Series Design focuses on the coordinated design of multi-category clothing, ideal for creating a unified fashion collection. You can use the Moodboard, Printboard, Colorboard, Sketchboard, and Mannequin sections in the Design Assests panel to organize your inspiration and design complementary clothing combinations. Finally, refine your designs in the Draft and Collection panels using tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to showcase your complete series design.",
'Series Design focuses on the coordinated design of multi-category clothing, ideal for creating a unified fashion collection. You can use the Moodboard, Printboard, Colorboard, Sketchboard, and Mannequin sections in the Design Assests panel to organize your inspiration and design complementary clothing combinations. Finally, refine your designs in the Draft and Collection panels using tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to showcase your complete series design.', ],
] },
}, {
{ title: "Single Design",
title:'Single Design', value: "SINGLE_DESIGN",
value:'SINGLE_DESIGN', describe: [
describe:[ "Single Design centers on the independent design of a single clothing category, such as a T-shirt, dress, or jacket, without considering coordination with other items. Use the Moodboard, Printboard, Colorboard, and Sketchboard in the Design Assests panel to gather inspiration and focus on crafting a unique piece. Once completed, optimize your design in the Draft and Collection panels with tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to display your individual creation.",
'Single Design centers on the independent design of a single clothing category, such as a T-shirt, dress, or jacket, without considering coordination with other items. Use the Moodboard, Printboard, Colorboard, and Sketchboard in the Design Assests panel to gather inspiration and focus on crafting a unique piece. Once completed, optimize your design in the Draft and Collection panels with tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to display your individual creation.', ],
] },
}, ],
], selectFlow: {
selectFlow:{ title: "Series Design",
title:'Series Design', value: "SERIES_DESIGN",
value:'SERIES_DESIGN', describe: [
describe:[ "Series Design focuses on the coordinated design of multi-category clothing, ideal for creating a unified fashion collection. You can use the Moodboard, Printboard, Colorboard, Sketchboard, and Mannequin sections in the Design Assests panel to organize your inspiration and design complementary clothing combinations. Finally, refine your designs in the Draft and Collection panels using tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to showcase your complete series design.",
'Series Design focuses on the coordinated design of multi-category clothing, ideal for creating a unified fashion collection. You can use the Moodboard, Printboard, Colorboard, Sketchboard, and Mannequin sections in the Design Assests panel to organize your inspiration and design complementary clothing combinations. Finally, refine your designs in the Draft and Collection panels using tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to showcase your complete series design.', ],
] },
}, chatContent: "",
chatContent:'', hintList: [
hintList:[ "设计一套田园风衣服",
'设计一套田园风衣服', "设计一套夏日风衣服",
'设计一套夏日风衣服', "设计一套未来风格的衣服",
'设计一套未来风格的衣服', ],
], enableThinking: false, //深度思考
enableThinking:false,//深度思考 uploadFile: null as any,
uploadFile:null as any, loadingShow: false,
loadingShow:false, text: "",
text:'', filList: [] as any,
filList:[] as any, textarea: null as any,
textarea:null as any, chatOrSetting: "chat",
chatOrSetting:'chat', });
}) const dataDom = reactive({});
const dataDom = reactive({ const setFlow = (item: any) => {
}) data.selectFlow = item;
const setFlow = (item:any)=>{ };
data.selectFlow = item
}
const inputText = (e:any)=>{ const inputText = (e: any) => {
if(e.target.value.length <= 1000){ if (e.target.value.length <= 1000) {
data.chatContent = e.target.value data.chatContent = e.target.value;
}else{ } else {
e.target.value = data.chatContent e.target.value = data.chatContent;
} }
e.target.style.height = `${e.target.scrollHeight}px`; e.target.style.height = `${e.target.scrollHeight}px`;
} };
const addChatContent = (item:any)=>{ const addChatContent = (item: any) => {
if((data.textarea.value?.length + item.length) > 10000)return if (data.textarea.value?.length + item.length > 10000) return;
data.chatContent += item data.chatContent += item;
data.textarea.value += item data.textarea.value += item;
} };
const sendChat = ()=>{ const sendChat = () => {
if(!data.chatContent)return if (!data.chatContent) return;
data.loadingShow = true data.loadingShow = true;
let fileList = JSON.parse(JSON.stringify(data.filList)) let fileList = JSON.parse(JSON.stringify(data.filList));
let fileUrl = (fileList.filter((item:any)=>item.type == 'file').length > 0) ? fileList.filter((item:any)=>item.type == 'file')[0].minioPath : '' let fileUrl =
let imageUrlList = (fileList.filter((item:any)=>item.type == 'image').length > 0)? fileList.filter((item:any)=>item.type == 'image').map((item:any)=>item.minioPath).join(',') : '' fileList.filter((item: any) => item.type == "file").length > 0
Https.axiosGet(Https.httpUrls.chatCreateProject, {params:{prompt:data.chatContent,process:data.selectFlow.value,fileUrl:fileUrl,imageUrlList}}).then((rv)=>{ ? fileList.filter((item: any) => item.type == "file")[0].minioPath
if(rv){ : "";
data.loadingShow = false let imageUrlList =
let value = { fileList.filter((item: any) => item.type == "image").length > 0
id:rv, ? fileList
fileList:fileList, .filter((item: any) => item.type == "image")
chatContent:data.chatContent, .map((item: any) => item.minioPath)
enableThinking:data.enableThinking, .join(",")
} : "";
emit('newProject',value) Https.axiosGet(Https.httpUrls.chatCreateProject, {
} params: {
}).catch(()=>{ prompt: data.chatContent,
data.loadingShow = false process: data.selectFlow.value,
}) fileUrl: fileUrl,
// let projectId = '' imageUrlList,
// const eventSource = new EventSource(`${process.env.VUE_APP_BASE_URL}${Https.httpUrls.llmStream}?token=${getCookie('token')}&prompt=${data.chatContent}&projectId=&fileUrl=${fileUrl}&imageUrlList=${imageUrlList}&enableThinking=${data.enableThinking}&process=${data.selectFlow.value}`); },
// eventSource.onmessage = function(event) { })
// let eventData = JSON.parse(event.data) .then((rv) => {
// if(eventData.status == "[PROJECT_CREATE_SIGNAL]"){ if (rv) {
// projectId = JSON.parse(eventData.tools_data).projectId data.loadingShow = false;
// } let value = {
// }; id: rv,
// eventSource.onerror = function(error) { fileList: fileList,
// if (eventSource.readyState === EventSource.CLOSED) { chatContent: data.chatContent,
// // data.chatList[data.chatList.length-1].content.message='服务器繁忙,请稍后再试。' enableThinking: data.enableThinking,
// } else { };
// if(projectId){ emit("newProject", value);
// emit('newProject',projectId) }
// } })
// eventSource.close() .catch(() => {
// } data.loadingShow = false;
// data.loadingShow = false });
// }; // let projectId = ''
} // const eventSource = new EventSource(`${import.meta.env.VITE_APP_BASE_URL}${Https.httpUrls.llmStream}?token=${getCookie('token')}&prompt=${data.chatContent}&projectId=&fileUrl=${fileUrl}&imageUrlList=${imageUrlList}&enableThinking=${data.enableThinking}&process=${data.selectFlow.value}`);
const handleFileUpload = (event:any)=>{ // eventSource.onmessage = function(event) {
if (event.target.files[0].size > 5 * 1024 * 1024) { // 5MB // let eventData = JSON.parse(event.data)
message.info('The file size cannot exceed 5MB.'); // if(eventData.status == "[PROJECT_CREATE_SIGNAL]"){
return // projectId = JSON.parse(eventData.tools_data).projectId
} // }
let type = event.target.files[0].type.startsWith('image/') // };
if(type){ // eventSource.onerror = function(error) {
if(data.filList.filter((item:any)=>item.type == 'image').length >= 5){ // if (eventSource.readyState === EventSource.CLOSED) {
message.info('You can only upload five pictures.'); // // data.chatList[data.chatList.length-1].content.message='服务器繁忙,请稍后再试。'
return // } else {
} // if(projectId){
}else{ // emit('newProject',projectId)
if(data.filList.filter((item:any)=>item.type == 'file').length >= 1){ // }
message.info('You can only upload one file.'); // eventSource.close()
return // }
} // data.loadingShow = false
} // };
data.loadingShow = true };
const formData = new FormData(); const handleFileUpload = (event: any) => {
formData.append('file', event.target.files[0]); if (event.target.files[0].size > 5 * 1024 * 1024) {
let config:any = { // 5MB
headers:{'Content-Type':'multipart/form-data','Accept':'*/*' }, message.info("The file size cannot exceed 5MB.");
params:formData, return;
} }
Https.axiosPost(Https.httpUrls.llmUploadFile,formData,config) let type = event.target.files[0].type.startsWith("image/");
.then((rv: any) => { if (type) {
let obj = { if (
name:event.target.files[0].name, data.filList.filter((item: any) => item.type == "image").length >= 5
type:type?'image':'file', ) {
minioPath:rv[0], message.info("You can only upload five pictures.");
url:rv[1], return;
} }
data.filList.push(obj) } else {
data.loadingShow = false if (
} data.filList.filter((item: any) => item.type == "file").length >= 1
).catch(rv=>{ ) {
data.loadingShow = false message.info("You can only upload one file.");
}) return;
} }
const deleteFile = (item:any,index:number)=>{ }
data.filList.splice(index,1) data.loadingShow = true;
} const formData = new FormData();
const setChatOrSetting = (str:any)=>{ formData.append("file", event.target.files[0]);
data.chatOrSetting = str let config: any = {
} headers: { "Content-Type": "multipart/form-data", Accept: "*/*" },
const setProject = (item:any)=>{ params: formData,
router.push(`home?history=${item.id}`) };
} Https.axiosPost(Https.httpUrls.llmUploadFile, formData, config)
onMounted(()=>{ .then((rv: any) => {
store.commit('createProbject') let obj = {
}) name: event.target.files[0].name,
return{ type: type ? "image" : "file",
...toRefs(dataDom), minioPath: rv[0],
...toRefs(data), url: rv[1],
setFlow, };
inputText, data.filList.push(obj);
addChatContent, data.loadingShow = false;
sendChat, })
handleFileUpload, .catch((rv) => {
deleteFile, data.loadingShow = false;
setChatOrSetting, });
setProject, };
} const deleteFile = (item: any, index: number) => {
}, data.filList.splice(index, 1);
provide() { };
return { const setChatOrSetting = (str: any) => {
} data.chatOrSetting = str;
}, };
}) const setProject = (item: any) => {
router.push(`home?history=${item.id}`);
};
onMounted(() => {
store.commit("createProbject");
});
return {
...toRefs(dataDom),
...toRefs(data),
setFlow,
inputText,
addChatContent,
sendChat,
handleFileUpload,
deleteFile,
setChatOrSetting,
setProject,
};
},
provide() {
return {};
},
});
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.newProject{ .newProject {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
> .contentBox{ > .contentBox {
width: 100%; width: 100%;
height: calc(100% - 3.9rem); height: calc(100% - 3.9rem);
// height: calc(100% - 7.8rem); // height: calc(100% - 7.8rem);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
> .content{ > .content {
// background: red; // background: red;
width: 88rem; width: 88rem;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
> .title{ > .title {
font-size: 2rem; font-size: 2rem;
font-weight: 600; font-weight: 600;
text-align: center; text-align: center;
} }
> .workspaceBox{ > .workspaceBox {
flex: 1; flex: 1;
border-radius: 2.4rem; border-radius: 2.4rem;
padding: 1.2rem; padding: 1.2rem;
border: 1px solid #0000001a; border: 1px solid #0000001a;
:deep(.workspace){ :deep(.workspace) {
padding: 0; padding: 0;
height: auto; height: auto;
} }
} }
> .selectFlow{ > .selectFlow {
margin-top: 4.8rem; margin-top: 4.8rem;
width: 100%; width: 100%;
border-radius: 2.4rem; border-radius: 2.4rem;
border: 1px solid #0000001a; border: 1px solid #0000001a;
padding: 1.2rem; padding: 1.2rem;
> .select{ > .select {
border: 1px solid #0000001a; border: 1px solid #0000001a;
border-radius: 2.4rem; border-radius: 2.4rem;
display: flex; display: flex;
padding: .2rem; padding: 0.2rem;
border-radius: 2rem; border-radius: 2rem;
> div{ > div {
white-space: nowrap; white-space: nowrap;
justify-content: space-between; justify-content: space-between;
border-radius: 2.2rem; border-radius: 2.2rem;
font-size: 1.6rem; font-size: 1.6rem;
padding: .6rem .8rem; padding: 0.6rem 0.8rem;
min-width: 25%; min-width: 25%;
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
color: #71717a; color: #71717a;
cursor: pointer; cursor: pointer;
&.active{ &.active {
background: #efeff1; background: #efeff1;
color: #3f3f46; color: #3f3f46;
} }
} }
} }
> .describe{ > .describe {
margin-top: 1.6rem; margin-top: 1.6rem;
margin-left: .8rem; margin-left: 0.8rem;
> p{ > p {
margin: 0; margin: 0;
color: #71717a; color: #71717a;
font-weight: 400; font-weight: 400;
font-size: 1.2rem; font-size: 1.2rem;
} }
} }
} }
> .chatOrSetting{ > .chatOrSetting {
margin-top: 2.4rem; margin-top: 2.4rem;
width: min-content; width: min-content;
margin-left: auto; margin-left: auto;
> .select{ > .select {
border: 1px solid #0000001a; border: 1px solid #0000001a;
border-radius: 2.4rem; border-radius: 2.4rem;
display: flex; display: flex;
padding: .2rem; padding: 0.2rem;
border-radius: 2rem; border-radius: 2rem;
> div{ > div {
white-space: nowrap; white-space: nowrap;
justify-content: space-between; justify-content: space-between;
border-radius: 2.2rem; border-radius: 2.2rem;
font-size: 1.6rem; font-size: 1.6rem;
padding: .6rem .8rem; padding: 0.6rem 0.8rem;
min-width: 10rem; min-width: 10rem;
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
color: #71717a; color: #71717a;
cursor: pointer; cursor: pointer;
&.active{ &.active {
background: #efeff1; background: #efeff1;
color: #3f3f46; color: #3f3f46;
} }
} }
} }
} }
> .chatBox{ > .chatBox {
margin-top: .4rem; margin-top: 0.4rem;
border-radius: 2.4rem; border-radius: 2.4rem;
position: relative; position: relative;
background: #f5f5f5; background: #f5f5f5;
> textarea{ > textarea {
padding: 1.6rem 2rem 0; padding: 1.6rem 2rem 0;
background: #f5f5f5; background: #f5f5f5;
width: 100%; width: 100%;
min-height: 7.2rem; min-height: 7.2rem;
border-radius: 2.4rem; border-radius: 2.4rem;
font-weight: 400; font-weight: 400;
line-height: 2rem; line-height: 2rem;
font-size: 1.4rem; font-size: 1.4rem;
resize: none; resize: none;
border: none; border: none;
overflow-y: hidden; overflow-y: hidden;
} }
> .btn{ > .btn {
padding: 0 1.2rem 1.2rem; padding: 0 1.2rem 1.2rem;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
> .uploadBox{ > .uploadBox {
display: flex; display: flex;
align-items: center; align-items: center;
> .filList{ > .filList {
display: flex; display: flex;
> .item{ > .item {
height: 3rem; height: 3rem;
padding: .5rem 1rem; padding: 0.5rem 1rem;
background: #efeff1; background: #efeff1;
border-radius: .5rem; border-radius: 0.5rem;
margin-right: 1rem; margin-right: 1rem;
font-size: 1.4rem; font-size: 1.4rem;
line-height: 2rem; line-height: 2rem;
display: flex; display: flex;
> div{ > div {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
max-width: 10rem; max-width: 10rem;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
> span{ > span {
cursor: pointer; cursor: pointer;
} }
} }
} }
> .enableThinking{ > .enableThinking {
width: 10rem; width: 10rem;
padding: .2rem .4rem; padding: 0.2rem 0.4rem;
margin-left: 1rem; margin-left: 1rem;
text-align: center; text-align: center;
font-size: 1.4rem; font-size: 1.4rem;
border: 1px solid #000; border: 1px solid #000;
border-radius: .4rem; border-radius: 0.4rem;
cursor: pointer; cursor: pointer;
&.active{ &.active {
background: #000; background: #000;
color: #fff; color: #fff;
}
}
}
i {
font-size: 2rem;
display: flex;
cursor: pointer;
position: relative;
> input {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
opacity: 0;
cursor: pointer;
&::-webkit-file-upload-button {
cursor: pointer;
}
}
}
> .sendBox {
display: flex;
align-items: center;
} > .maxNum {
} font-size: 1.2rem;
} margin-right: 0.8rem;
i{ font-weight: 400;
font-size: 2rem; }
display: flex; }
cursor: pointer; }
position: relative; }
> input{ > .hint {
width: 100%; display: flex;
height: 100%; margin-top: 2.4rem;
position: absolute; > div {
top: 0; background: #efeff1;
left: 0; width: 25rem;
opacity: 0; height: 4.8rem;
cursor: pointer; margin-right: 1.2rem;
&::-webkit-file-upload-button { border-radius: 1.6rem;
cursor: pointer; cursor: pointer;
} padding: 1.2rem;
} &:hover {
} background: #f5f5f5;
> .sendBox{ }
display: flex; :first-child {
align-items: center; margin-right: 0;
}
> .maxNum{ }
font-size: 1.2rem; }
margin-right: .8rem; }
font-weight: 400; }
} }
}
}
}
> .hint{
display: flex;
margin-top: 2.4rem;
> div{
background: #efeff1;
width: 25rem;
height: 4.8rem;
margin-right: 1.2rem;
border-radius: 1.6rem;
cursor: pointer;
padding: 1.2rem;
&:hover{
background: #f5f5f5;
}
:first-child{
margin-right: 0;
}
}
}
}
}
}
</style> </style>

View File

@@ -1,19 +1,18 @@
import axios from 'axios' import axios from "axios";
// import qs from 'qs' // import qs from 'qs'
// import message from '@/components/public/message/src' // import message from '@/components/public/message/src'
import router from '@/router/index' import router from "@/router/index";
import {getCookie,clonAllCookie} from '@/tool/cookie' import { getCookie, clonAllCookie } from "@/tool/cookie";
// import cookie from '@/tools/cookie.js' // import cookie from '@/tools/cookie.js'
axios.defaults.timeout = 60000; //响应时间 axios.defaults.timeout = 60000; //响应时间
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'; //配置请求头 // axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'; //配置请求头
axios.defaults.headers.post["Content-Type"] = "application/json"; axios.defaults.headers.post["Content-Type"] = "application/json";
axios.defaults.headers.post["lang"] = "en"; //配置语言请求头
axios.defaults.headers.post['lang'] = 'en'; //配置语言请求头 axios.defaults.withCredentials = true; //跨域携带cookie
axios.defaults.withCredentials = true; //跨域携带cookie import { message } from "ant-design-vue";
import { message } from 'ant-design-vue'; import store from "@/store";
import store from '@/store';
// if(process.env.NODE_ENV == "development"){ // if(process.env.NODE_ENV == "development"){
// axios.defaults.baseURL = ""; //配置接口地址 // axios.defaults.baseURL = ""; //配置接口地址
// }else{ // }else{
@@ -25,468 +24,492 @@ import store from '@/store';
// }else{ // }else{
// httpIp = '' // httpIp = ''
// } // }
let httpIp = process.env.NODE_ENV == 'development' ? "" : ""; let httpIp = process.env.NODE_ENV == "development" ? "" : "";
// let httpIp = process.env.NODE_ENV == 'development' ? "https://192.168.1.8:10086" : ""; // let httpIp = process.env.NODE_ENV == 'development' ? "https://192.168.1.8:10086" : "";
axios.defaults.baseURL = httpIp; //配置接口地址 axios.defaults.baseURL = httpIp; //配置接口地址
// console.log(axios.defaults.baseURL); // console.log(axios.defaults.baseURL);
axios.defaults.baseURL = process.env.VUE_APP_BASE_URL; //配置接口地址 axios.defaults.baseURL = import.meta.env.VITE_APP_BASE_URL; //配置接口地址
// 创建取消令牌 // 创建取消令牌
const CancelToken = axios.CancelToken; const CancelToken = axios.CancelToken;
const source = CancelToken.source(); const source = CancelToken.source();
// console.log(process.env.VUE_APP_BASE_URL); // console.log(import.meta.env.VITE_APP_BASE_URL);
const filterHttpsUrl = ['/api/portfolio/page','/api/portfolio/detail','/api/account/preLogin','/api/account/schoolLogin','/api/account/enterpriseLogin','/api/account/login'] const filterHttpsUrl = [
"/api/portfolio/page",
"/api/portfolio/detail",
"/api/account/preLogin",
"/api/account/schoolLogin",
"/api/account/enterpriseLogin",
"/api/account/login",
];
//POST传参序列化(添加请求拦截器) //POST传参序列化(添加请求拦截器)
axios.interceptors.request.use((config) => { axios.interceptors.request.use(
(config) => {
//在发送请求之前做某件事 //在发送请求之前做某件事
// config.cancelToken = source.token // config.cancelToken = source.token
if(config.method === 'post' || config.method === 'put' || config.method === 'delete'){ if (
// config.data = qs.stringify(config.data); config.method === "post" ||
// config.data = JSON.stringify(config.data); config.method === "put" ||
config.method === "delete"
) {
// config.data = qs.stringify(config.data);
// config.data = JSON.stringify(config.data);
} }
// config.headers.Authorization = 'Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA'; // config.headers.Authorization = 'Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA';
if(filterHttpsUrl.indexOf(config.url) == -1){ if (filterHttpsUrl.indexOf(config.url) == -1) {
config.headers.Authorization = getCookie('token'); config.headers.Authorization = getCookie("token");
}else{
config.headers.Authorization = '';
}
return config;
},(error) =>{
return Promise.reject(error);
});
let isLoginTime = false
const binaryToUrl = (binary,type = 'application/octet-stream',res)=>{
let blob = new Blob([binary], {'content-type':res.headers['content-type']});
let url = URL.createObjectURL(blob);
return url
}
//返回状态判断(添加响应拦截器)
axios.interceptors.response.use((res) =>{
// if(res.data.data == null){
// message.warning(res.data.errMsg)
// return Promise.reject(res.data);
// }else
if(res.config.env.binary){
let url = binaryToUrl(res.data,res.config.env.binaryType,res)
return Promise.resolve({url,data:res.data})
}
if (res.data) {
if (res.data.errCode === 0) {
// message.error(res.data.errMsg)
return Promise.resolve(res.data.data);
} else if(res.data.errCode === 1){
message.warning(res.data.errMsg)
return Promise.reject(res.data);
} else if(res.data.errCode === 2){
return Promise.reject(res.data);
}else if(res.data.errCode === -1){
message.error(res.data.errMsg)
return Promise.reject(res.data);
}
} else { } else {
if (res.data.errCode === 0) { config.headers.Authorization = "";
message.warning(res.data.errMsg)
return Promise.reject(res.data);
} else if(res.data.errCode === 1){
message.warning(res.data.errMsg)
return Promise.reject(res.data);
} else if(res.data.errCode === 2){
return Promise.reject(res.data);
}else if(res.data.errCode === -1){
message.error(res.data.errMsg)
return Promise.reject(res.data);
}
} }
}, function(error) { return config;
if(error?.response?.status === 401 && router.currentRoute._value.name != 'setIdentification'){//如果是记录浏览器页面就不跳转login },
// return (error) => {
clonAllCookie() return Promise.reject(error);
if(!isLoginTime){ }
isLoginTime = true );
let isSystemUserRouteList = ['/Square']//如果是这两个页面就无需跳转未登录页 let isLoginTime = false;
let sSystemUser = false const binaryToUrl = (binary, type = "application/octet-stream", res) => {
for (let index = 0; index < isSystemUserRouteList.length; index++) { let blob = new Blob([binary], {
if(router.currentRoute.value.path.indexOf(isSystemUserRouteList[index]) > -1){ "content-type": res.headers["content-type"],
sSystemUser = true });
break let url = URL.createObjectURL(blob);
} return url;
} };
if(!sSystemUser){ //返回状态判断(添加响应拦截器)
router.replace('/') axios.interceptors.response.use(
} (res) => {
message.warning('Please login and try again~') // if(res.data.data == null){
store.commit('createDetail') // message.warning(res.data.errMsg)
store.commit('createProbject') // return Promise.reject(res.data);
setTimeout(()=>[ // }else
isLoginTime = false if (res.config.env.binary) {
],2000) let url = binaryToUrl(res.data, res.config.env.binaryType, res);
} return Promise.resolve({ url, data: res.data });
// source.cancel('取消后续接口调用');
return Promise.reject()
} }
let data_new = error?.response?.data if (res.data) {
if (res.data.errCode === 0) {
// message.error(res.data.errMsg)
return Promise.resolve(res.data.data);
} else if (res.data.errCode === 1) {
message.warning(res.data.errMsg);
return Promise.reject(res.data);
} else if (res.data.errCode === 2) {
return Promise.reject(res.data);
} else if (res.data.errCode === -1) {
message.error(res.data.errMsg);
return Promise.reject(res.data);
}
} else {
if (res.data.errCode === 0) {
message.warning(res.data.errMsg);
return Promise.reject(res.data);
} else if (res.data.errCode === 1) {
message.warning(res.data.errMsg);
return Promise.reject(res.data);
} else if (res.data.errCode === 2) {
return Promise.reject(res.data);
} else if (res.data.errCode === -1) {
message.error(res.data.errMsg);
return Promise.reject(res.data);
}
}
},
function (error) {
if (
error?.response?.status === 401 &&
router.currentRoute._value.name != "setIdentification"
) {
//如果是记录浏览器页面就不跳转login
// return
clonAllCookie();
if (!isLoginTime) {
isLoginTime = true;
let isSystemUserRouteList = ["/Square"]; //如果是这两个页面就无需跳转未登录页
let sSystemUser = false;
for (let index = 0; index < isSystemUserRouteList.length; index++) {
if (
router.currentRoute.value.path.indexOf(
isSystemUserRouteList[index]
) > -1
) {
sSystemUser = true;
break;
}
}
if (!sSystemUser) {
router.replace("/");
}
message.warning("Please login and try again~");
store.commit("createDetail");
store.commit("createProbject");
setTimeout(() => [(isLoginTime = false)], 2000);
}
// source.cancel('取消后续接口调用');
return Promise.reject();
}
let data_new = error?.response?.data;
// message.error(data_new?.errMsg || 'Error: server exception') // message.error(data_new?.errMsg || 'Error: server exception')
return Promise.reject(data_new); return Promise.reject(data_new);
}); }
);
export const Https = { export const Https = {
httpUrls: { httpUrls: {
interfaceUrl: '', interfaceUrl: "",
parseGoogleCredential:'/api/third/party/parseGoogleCredential',//谷歌登录注册 parseGoogleCredential: "/api/third/party/parseGoogleCredential", //谷歌登录注册
parseWeChatCode:'/api/third/party/parseWeChatCode',//微信登录 parseWeChatCode: "/api/third/party/parseWeChatCode", //微信登录
accountIsLogin:'/api/account/isLogin', //判断用户是否登录 accountIsLogin: "/api/account/isLogin", //判断用户是否登录
accountLogin:`/api/account/login`, //账号密码登录接口 accountLogin: `/api/account/login`, //账号密码登录接口
organizationNameSearch:`/api/account/organizationNameSearch`, //查询学校或者企业版名字 organizationNameSearch: `/api/account/organizationNameSearch`, //查询学校或者企业版名字
getUserLanguage:`/api/account/getUserLanguage`, //获取当前用户语言 getUserLanguage: `/api/account/getUserLanguage`, //获取当前用户语言
changeUserLanguage:`/api/account/changeUserLanguage`, //切换用户当前语言 changeUserLanguage: `/api/account/changeUserLanguage`, //切换用户当前语言
uploadAvatar:`/api/account/uploadAvatar`, //修改头像 uploadAvatar: `/api/account/uploadAvatar`, //修改头像
editUserName:`/api/account/editUserName`, //修改用户名 editUserName: `/api/account/editUserName`, //修改用户名
updateUserInfo:`/api/account/updateUserInfo`, //修改国家职业 updateUserInfo: `/api/account/updateUserInfo`, //修改国家职业
accountDetail:`/api/account/getAccountDetail`, //用户详细信息 accountDetail: `/api/account/getAccountDetail`, //用户详细信息
trialUserLogout:`/api/account/trialUserLogout`, //试用用户退出登录接口 trialUserLogout: `/api/account/trialUserLogout`, //试用用户退出登录接口
completeGuidancet:`/api/account/completeGuidance`, //用户指引结束 completeGuidancet: `/api/account/completeGuidance`, //用户指引结束
getExpiredTime:`/api/account/getExpiredTime`, //获取用户到期时间 getExpiredTime: `/api/account/getExpiredTime`, //获取用户到期时间
addNoLoginRequired:`/api/third/party/addNoLoginRequired`, //机房用户注册 addNoLoginRequired: `/api/third/party/addNoLoginRequired`, //机房用户注册
deleteNoLoginRequired:`/api/third/party/deleteNoLoginRequired`, //机房用户注销 deleteNoLoginRequired: `/api/third/party/deleteNoLoginRequired`, //机房用户注销
noLoginRequired:`api/account/noLoginRequired`, //机房用户登录 noLoginRequired: `api/account/noLoginRequired`, //机房用户登录
existNoLoginRequired:`/api/third/party/existNoLoginRequired`, //获取唯一标识是否存在 existNoLoginRequired: `/api/third/party/existNoLoginRequired`, //获取唯一标识是否存在
deleteNoLoginRequiredNew:`/api/third/party/deleteNoLoginRequiredNew`, //机房用户注销 deleteNoLoginRequiredNew: `/api/third/party/deleteNoLoginRequiredNew`, //机房用户注销
addNoLoginRequiredNew:`api/third/party/addNoLoginRequiredNew`, //机房用户注册 addNoLoginRequiredNew: `api/third/party/addNoLoginRequiredNew`, //机房用户注册
updateNoLoginRequiredNew:`api/third/party/updateNoLoginRequiredNew`, //机房用户更新 updateNoLoginRequiredNew: `api/third/party/updateNoLoginRequiredNew`, //机房用户更新
endpoint:`api/third/party/your-secured-endpoint`, //获取唯一标识是否存在 endpoint: `api/third/party/your-secured-endpoint`, //获取唯一标识是否存在
designWorksRegister: "/api/account/designWorksRegister", //注册
designWorksRegisterCode: "/api/account/designWorksRegisterCode", //注册
designWorksRegister:'/api/account/designWorksRegister', //注册 preLogin: "/api/account/preLogin", //预先登入
designWorksRegisterCode:'/api/account/designWorksRegisterCode', //注册 schoolLogin: "/api/account/schoolLogin", //学校管理员登录
enterpriseLogin: "/api/account/enterpriseLogin", //企业管理员登录
accountSendEmail: `/api/account/sendEmail`, //发送邮件
accountResetPwd: "/api/account/resetPwd", //忘记密码修改
accountLogout: "/api/account/logout", //登出
accountBindEmail: "/api/account/bindEmail", //绑定邮箱
bindGoogle: "/api/account/bindGoogle", //绑定谷歌
bindWeChat: "/api/account/bindWeChat", //绑定微信
unbindGoogle: `/api/account/unbindGoogle`, //取消绑定谷歌
unbindWeChat: "/api/account/unbindWeChat", //取消绑定微信
elementGeneratePrint: "/api/element/generatePrint", //生成印花
elementSavePrint: "/api/element/savePrint", //保存印花
getRgbByTcx: "/api/element/getRgbByTcx", // 通过hsv值获取潘通信息
getRgbByHsv: "/api/element/getRgbByHsv", //通过hsv值获取潘通信息
designCollection: `/api/design/designCollection`, //设计 Conllection
reDesignCollection: `/api/design/reDesignCollection`, //重新设计 Conllection
countDesignProcess: "/api/design/countDesignProcess", //统计design进度
getDesignResult: "/api/design/getDesignResult", //查询design结果
designSort: `/api/design/sort`, //design排序
collectionLikeUpdate: `/api/history/collectionLikeUpdate`, //赋值排序
designProcess: `/api/design/designProcess`, //统计design进度
designGetModel: `/api/design/getModel`, //导出获取模特链接
preLogin:'/api/account/preLogin',//预先登入 //充值相关
schoolLogin:'/api/account/schoolLogin',//学校管理员登录 productList: `/api/product/list`, //获取商品列表
enterpriseLogin:'/api/account/enterpriseLogin',//企业管理员登录 payAlipay: `/api/ali-pay/trade/page/pay`, //支付宝确认支付
accountSendEmail:`/api/account/sendEmail`, //发送邮件 payAlipayHK: `/api/alipay-hk/createOrder`, //香港支付宝确认支付
accountResetPwd:'/api/account/resetPwd', //忘记密码修改 payStripe: `/api/stripe/createOrder`, //Stripe支付
accountLogout:'/api/account/logout',//登出 payPaypal: `/api/paypal/trade`, //paypal确认支付
accountBindEmail:'/api/account/bindEmail', //绑定邮箱 getCredits: `/api/credits/getCredits`, //查询用户积分
bindGoogle:'/api/account/bindGoogle', //绑定谷歌
bindWeChat:'/api/account/bindWeChat', //绑定微信
unbindGoogle:`/api/account/unbindGoogle`, //取消绑定谷歌
unbindWeChat:'/api/account/unbindWeChat', //取消绑定微信
elementGeneratePrint:'/api/element/generatePrint', //生成印花
elementSavePrint:'/api/element/savePrint',//保存印花
getRgbByTcx:'/api/element/getRgbByTcx', // 通过hsv值获取潘通信息
getRgbByHsv:'/api/element/getRgbByHsv', //通过hsv值获取潘通信息
designCollection:`/api/design/designCollection`, //设计 Conllection
reDesignCollection:`/api/design/reDesignCollection`,//重新设计 Conllection
countDesignProcess:'/api/design/countDesignProcess', //统计design进度
getDesignResult:'/api/design/getDesignResult', //查询design结果
designSort:`/api/design/sort`, //design排序
collectionLikeUpdate:`/api/history/collectionLikeUpdate`, //赋值排序
designProcess:`/api/design/designProcess`, //统计design进度 cancelSubscription: `/api/stripe/cancelSubscription`, //取消订阅
designGetModel:`/api/design/getModel`, //导出获取模特链接
//充值相关 orderInfoList: `/api/order-info/list`, //查询订单列表
productList:`/api/product/list`, //获取商品列表 getCreditsDetail: `/api/credits/getCreditsDetail`, //查询积分列表
payAlipay:`/api/ali-pay/trade/page/pay`, //支付宝确认支付 tradeRefundAlipay: `/api/ali-pay/trade/refund`, //支付宝退款
payAlipayHK:`/api/alipay-hk/createOrder`, //香港支付宝确认支付 tradeRefundPaypal: `/api/paypal/trade/refund`, //paypal退款
payStripe:`/api/stripe/createOrder`, //Stripe支付
payPaypal:`/api/paypal/trade`, //paypal确认支付
getCredits:`/api/credits/getCredits`, //查询用户积分
cancelSubscription:`/api/stripe/cancelSubscription`, //取消订阅 tradeQuery: `/api/ali-pay/trade/query/{orderNo}`, //查询订单状态
orderInfoList:`/api/order-info/list`, //查询订单列表 getRgbByHsvBatch: `/api/element/getRgbByHsvBatch`, //通过hsv值数组批量获取潘通信息
getCreditsDetail:`/api/credits/getCreditsDetail`, //查询积分列表 designLike: `/api/design/like`, //Design Like
tradeRefundAlipay:`/api/ali-pay/trade/refund`, //支付宝退款 designDislike: `/api/design/dislike`, //Design Dislike
tradeRefundPaypal:`/api/paypal/trade/refund`, //paypal退款 queryUserGroup: `/api/history/queryUserGroup`, //History用户分页分组列表
deleteUserGroup: `/api/history/deleteUserGroup`, //History删除用户分组
updateUserGroupName: `/api/history/updateUserGroupName`, //History修改用户分组名
projectSaveOrUpdate: `/api/project/saveOrUpdate`, //History修改用户分组名
historyChoose: `/api/history/choose`, //History choose
getDesignDetail: `/api/design/detail/getDetail`, //查询design详情
designSingleWithGradient: `/api/design/detail/designSingleWithGradient`, //查询需要更新mask列表
getNextSysElement: "/api/design/detail/getNextSysElement", //切换系统的element
detailPrintDot: "/api/design/detail/printDot", //print打点预览
designSingle: `/api/design/detail/designSingle`, //单个design
queryLibraryPage: `/api/library/queryLibraryPage`, //Library分页列表
libraryUpload: `/api/library/upload`, // Library文件上传
setSketchLibrary: `/api/library/updateLibraryLevel2Type`, // Library文件上传
tradeQuery:`/api/ali-pay/trade/query/{orderNo}`, //查询订单状态 queryClassification: `/api/classification/queryClassification`, //标签类别查询
classificationSaveOrUpdate: `/api/classification/saveOrUpdate`, //标签类别新增修改
classificationDelete: `/api/classification/delete`, //标签类别新增修改
relationLibrary: `/api/classification/relationLibrary`, //标签类别新增修改
getRelClassificationIdList: `/api/classification/getRelClassificationIdList`, //标签类别新增修改
getRelPublicClassificationIdList: `/api/classification/getRelPublicClassificationIdList`, //多选获取公共标签
editRelPublicClassificationIdList: `/api/classification/editRelPublicClassificationIdList`, //多选修改公共标签
getRgbByHsvBatch:`/api/element/getRgbByHsvBatch`, //通过hsv值数组批量获取潘通信息 //模块化
designLike:`/api/design/like`, //Design Like llmStream: `/api/llm/streamNew`, //聊天
designDislike: `/api/design/dislike`, //Design Dislike // llmStream:`/api/llm/stream`,//聊天
queryUserGroup:`/api/history/queryUserGroup`, //History用户分页分组列表 chatCreateProject: `/api/llm/chatCreateProject`, //聊天创建项目
deleteUserGroup:`/api/history/deleteUserGroup`, //History删除用户分组 getChatHistory: `/api/llm/getChatHistory`, //获取聊天历史记录
updateUserGroupName:`/api/history/updateUserGroupName`, //History修改用户分组名 llmUploadFile: `/api/llm/uploadFile`, //聊天上传文件
projectSaveOrUpdate:`/api/project/saveOrUpdate`, //History修改用户分组名
historyChoose:`/api/history/choose`, //History choose
getDesignDetail:`/api/design/detail/getDetail`,//查询design详情
designSingleWithGradient:`/api/design/detail/designSingleWithGradient`,//查询需要更新mask列表
getNextSysElement:'/api/design/detail/getNextSysElement',//切换系统的element
detailPrintDot:'/api/design/detail/printDot',//print打点预览
designSingle:`/api/design/detail/designSingle`,//单个design
queryLibraryPage:`/api/library/queryLibraryPage`,//Library分页列表
libraryUpload:`/api/library/upload`, // Library文件上传
setSketchLibrary:`/api/library/updateLibraryLevel2Type`, // Library文件上传
queryClassification:`/api/classification/queryClassification`,//标签类别查询 saveOrUpdate: `/api/project/saveOrUpdate`, //模块化新增修改
classificationSaveOrUpdate:`/api/classification/saveOrUpdate`,//标签类别新增修改 getModuleContent: `/api/project/getModuleContent`, //获取模块内容
classificationDelete:`/api/classification/delete`,//标签类别新增修改 saveModuleContent: `/api/project/saveModuleContent`, //储存模块内容
relationLibrary:`/api/classification/relationLibrary`,//标签类别新增修改 historyProject: `/api/project/page`, //项目记录
getRelClassificationIdList:`/api/classification/getRelClassificationIdList`,//标签类别新增修改 projectDetail: `/api/project/delete`, //删除项目
getRelPublicClassificationIdList:`/api/classification/getRelPublicClassificationIdList`,//多选获取公共标签 //3d
editRelPublicClassificationIdList:`/api/classification/editRelPublicClassificationIdList`,//多选修改公共标签 threeDPage: `/api/project/threeDPage`,
downloadZip: `/api/project/downloadZip`, //下载zip
getThreeDSize: `/api/project/getThreeDSize`, //下载列表
getLayoutDetail: `/api/project/getLayoutDetail`, //获取3d详情
getThreeDGlb: `/api/project/getThreeDGlb`,
selectHistoryProject: `/api/project/choose`, //选择项目
getMannequinDetail: `/api/project/getMannequinDetail`, //模块化查看模特点位
modifyProportion: `/api/generate/modifyProportion`, //模特拉伸
addSysModelToLib: `/api/library/addSysModelToLib`,
poselikeOrDisike: `/api/generate/likeOrDislike`, //postTransform like
getAllPose: `/api/generate/getAllPose`, //获取动作
//模块化 //拼贴
llmStream:`/api/llm/streamNew`,//聊天 genSketchRecon: `/api/generate/genSketchRecon`,
// llmStream:`/api/llm/stream`,//聊天 saveReconCanvas: `/api/generate/saveReconCanvas`,
chatCreateProject:`/api/llm/chatCreateProject`,//聊天创建项目
getChatHistory:`/api/llm/getChatHistory`,//获取聊天历史记录
llmUploadFile:`/api/llm/uploadFile`,//聊天上传文件
saveOrUpdate:`/api/project/saveOrUpdate`,//模块化新增修改 //动作变换
getModuleContent:`/api/project/getModuleContent`,//获取模块内容 poseTransform: `/api/generate/poseTransform`,
saveModuleContent:`/api/project/saveModuleContent`,//储存模块内容 poseTransformResult: `/api/generate/poseTransformResult`,
historyProject:`/api/project/page`,//项目记录
projectDetail:`/api/project/delete`,//删除项目
//3d
threeDPage:`/api/project/threeDPage`,
downloadZip:`/api/project/downloadZip`,//下载zip
getThreeDSize:`/api/project/getThreeDSize`,//下载列表
getLayoutDetail:`/api/project/getLayoutDetail`,//获取3d详情
getThreeDGlb:`/api/project/getThreeDGlb`,
selectHistoryProject:`/api/project/choose`,//选择项目
getMannequinDetail:`/api/project/getMannequinDetail`,//模块化查看模特点位
modifyProportion:`/api/generate/modifyProportion`,//模特拉伸
addSysModelToLib:`/api/library/addSysModelToLib`,
poselikeOrDisike:`/api/generate/likeOrDislike`,//postTransform like
getAllPose:`/api/generate/getAllPose`,//获取动作
batchUpdateLibraryName: "/api/library/batchUpdateLibraryName", //Library修改用户文件名
batchDeleteLibrary: "/api/library/batchDeleteLibrary", //删除library
queryLibraryTopAndBottomPage: "/api/library/queryLibraryTopAndBottomPage", //Library分页列表(查询top和bottom)
saveOrEditTemplatePoint: "/api/library/saveOrEditTemplatePoint", //保存或者编辑template打点
libraryModelsDot: "/api/library/modelsDot", //Models打点预览
chatStreamTest: `/api/python/chatStream`, //机器人助力
pictureLikeOrUnLike: `/api/python/pictureLikeOrUnLike`, //机器人生成图喜欢
getBloodBars: `/api/python/getBloodBars`, //机器人血条
//工作空间
workspaceDetail: `/api/workspace/detail`, //用户习惯详情
workspaceenumValues: `/api/workspace/enumValues`, //getSex
workspaceRemove: `/api/workspace/remove`, //删除用户习惯详情
workspacesaveOrUpdate: `/api/workspace/saveOrUpdate`, //修改用户习惯详情
getMannequins: `/api/workspace/getMannequins`, //模特
getStyleList: `/api/workspace/styleList`, //获取所有风格列表
//拼贴 workspaceList: `/api/workspace/list`,
genSketchRecon:`/api/generate/genSketchRecon`, sketchAndPrintGenerate: "/api/generate/sketchAndPrint", //sketchGenerate生成图片
saveReconCanvas:`/api/generate/saveReconCanvas`,
//动作变换 generatePrepare: "/api/generate/prepare", //开始生成generate图片
poseTransform:`/api/generate/poseTransform`, generateStopWaiting: "/api/generate/stopWaiting", //取消生成
poseTransformResult:`/api/generate/poseTransformResult`, generateResult: "/api/generate/result", //获取生成结果
generateLike: "/api/generate/like", //喜欢ganerate图片
generateDislike: "/api/generate/dislike", //喜欢ganerate图片
imageToSketch: "/api/generate/imageToSketch", //成品图转为线稿
modifySketch: "/api/generate/modifySketch", //修改画布内容并且储存
batchUpdateLibraryName:'/api/library/batchUpdateLibraryName',//Library修改用户文件名 elementUpload: `/api/element/upload`, //上传图片
batchDeleteLibrary:'/api/library/batchDeleteLibrary',//删除library imageSegmentation: `/api/element/imageSegmentation`, //分割衣服
queryLibraryTopAndBottomPage:'/api/library/queryLibraryTopAndBottomPage',//Library分页列表(查询top和bottom) convertRelightElement: `/api/history/convertRelightElement`, //toproduct复制到上传图片位置
saveOrEditTemplatePoint:'/api/library/saveOrEditTemplatePoint',//保存或者编辑template打点
libraryModelsDot:'/api/library/modelsDot',//Models打点预览
chatStreamTest:`/api/python/chatStream`,//机器人助力
pictureLikeOrUnLike:`/api/python/pictureLikeOrUnLike`,//机器人生成图喜欢
getBloodBars:`/api/python/getBloodBars`,//机器人血条
//工作空间
workspaceDetail:`/api/workspace/detail`,//用户习惯详情
workspaceenumValues:`/api/workspace/enumValues`,//getSex
workspaceRemove:`/api/workspace/remove`,//删除用户习惯详情 // oldHis:`/oldHis/history/queryUserGroup`,//上传图片
workspacesaveOrUpdate:`/api/workspace/saveOrUpdate`,//修改用户习惯详情 sketchBoardsBoundingBox: `/api/design/sketchBoardsBoundingBox`, //裁剪sketch图片
getMannequins:`/api/workspace/getMannequins`,//模特
getStyleList:`/api/workspace/styleList`,//获取所有风格列表
workspaceList:`/api/workspace/list`, trialOrderList: `/api/account/trialOrderList`, //获取审批列表
sketchAndPrintGenerate:'/api/generate/sketchAndPrint',//sketchGenerate生成图片 switchIsAutoApproval: `/api/account/switchIsAutoApproval`, //切换是否自动审批
getIsAutoApproval: `/api/account/getIsAutoApproval`, //获取是否自动审批
trialOrderApproval: `/api/account/trialOrderApproval`, //通过审批
trialOrderRefuse: `/api/account/trialOrderRefuse`, //拒绝审批
generatePrepare:'/api/generate/prepare',//开始生成generate图片 //管理员接口
generateStopWaiting:'/api/generate/stopWaiting',//取消生成 //查询所有试用用户
generateResult:'/api/generate/result',//获取生成结果 inquiryGetTrial: `/api/inquiry/getTrial`, //查询所有试用用户
generateLike:'/api/generate/like',//喜欢ganerate图片 getCities: `/api/inquiry/getCities`, //获取所有付款订单使用的国家
generateDislike:'/api/generate/dislike',//喜欢ganerate图片 getUserInfo: `/api/inquiry/getUserInfo`, //查询所有用户
imageToSketch:'/api/generate/imageToSketch',//成品图转为线稿 queryTransaction: `/api/inquiry/queryTransaction`, //查询交易记录
modifySketch:'/api/generate/modifySketch',//修改画布内容并且储存 queryTransactionDownload: `/api/inquiry/queryTransaction/download`, //导出交易记录
createCoupon: `/api/stripe/createCoupon`, //创建优惠码
updatePromCodeInfo: `/api/stripe/updatePromCodeInfo`, //修改优惠码
getAllCoupons: `/api/stripe/getAllCoupons`, //查询优惠码列表
checkCoupon: `/api/stripe/checkCoupon`, //根据优惠码获取结算后的金额
deletePromCode: `/api/stripe/deletePromCode`, //删除优惠券
addOrganization: `/api/inquiry/addOrganization`, //添加企业版或者教育版
queryOrganization: `/api/inquiry/queryOrganization`, //查询企业版或者教育版
elementUpload:`/api/element/upload`,//上传图片 //云生成
imageSegmentation:`/api/element/imageSegmentation`,//分割衣服 designCloud: `/api/design/designCloud`, //创建云生成
convertRelightElement:`/api/history/convertRelightElement`,//toproduct复制到上传图片位置 cloudPage: `/api/design/cloudPage`, //创建云生成
cloudTaskDelete: `/api/design/cloudTaskDelete`, //删除云生成
cloudTaskNameUpdate: `/api/design/cloudTaskNameUpdate`, //修改云生成名字
getDesignCloudResult: `/api/design/getDesignCloudResult`, //查询这条云生成记录的所有内容
// oldHis:`/oldHis/history/queryUserGroup`,//上传图片 //企业版教育版管理员页面
sketchBoardsBoundingBox:`/api/design/sketchBoardsBoundingBox`,//裁剪sketch图片 subAccountList: `/api/account/subAccountList`, //查询子账号
addOrUpdateSubAccount: `/api/account/addOrUpdateSubAccount`, //添加子账号
deleteSubAccount: `/api/account/deleteSubAccount`, //删除子账号
subAccountImportExcelDownload: `/api/account/subAccountImportExcelDownload`, //批量添加模板下载模板
subAccountImport: `/api/account/subAccountImport`, //模板导入
getGenerateFrequency: `/api/inquiry/getGenerateFrequency`, //积分使用详情
getAllGenerateFuncName: `/api/inquiry/getAllGenerateFuncName`, //获取所有generate类型
trialOrderList:`/api/account/trialOrderList`,//获取审批列表 //查询某个时间内design点击次数
switchIsAutoApproval:`/api/account/switchIsAutoApproval`,//切换是否自动审批 getDesignStatistic: `/api/inquiry/getDesignStatistic`, //拒绝审批
getIsAutoApproval:`/api/account/getIsAutoApproval`,//获取是否自动审批 getAllQuestionnaire: `/api/inquiry/getAllQuestionnaire`, //拒绝审批
trialOrderApproval:`/api/account/trialOrderApproval`,//通过审批 getActiveUserFunc: `/api/inquiry/getActiveUserFunc`, //获取各模块功能
trialOrderRefuse:`/api/account/trialOrderRefuse`,//拒绝审批 toProductImageElementDelete: `/api/history/toProductImageElementDelete`, //删除指定模块上传的内容
recentActiveUser: `/api/inquiry/recentActiveUser`, //获取近期活跃用户
recentActiveUserChart: `/api/inquiry/recentActiveUserChart`, //获取近期活跃用户图表数据
recentNewUser: `/api/inquiry/recentNewUser`, //获取近期新增用户
recentNewUserChart: `/api/inquiry/recentNewUserChart`, //获取新增用户图表
trialUserCountry: `/api/inquiry/trialUserCountry`, //试用用户国家-城市分布
conversionRate: `/api/inquiry/conversionRate`, //试用用户国家-城市分布
getAllUserId: `/api/inquiry/getAllUserId`, //获取所有用户id和Name
adminAddUser: `/api/inquiry/addUser`, //添加用户
modifyUser: `/api/inquiry/modifyUser`, //修改用户
publishSysMessage: `/api/message/publishSysMessage`, //发布系统任务
//affiliate接口
viewsIncrease: `/api/affiliate/viewsIncrease`, //增加访问量
affiliateRegistration: `/api/affiliate/registration`, //affiliate注册
personalCenter: `/api/affiliate/personalCenter`, //affiliate个人中心
affiliateList: `/api/affiliate/list`, //affiliate审批列表
getEachAffiliateGeneratedRevenue: `/api/affiliate/getEachAffiliateGeneratedRevenue`, //affiliate每个用户根据日期查询收益
affiliateApproval: `/api/affiliate/approval`, //affiliate同意 审批
getPersonalMonthlyIncome: `/api/affiliate/getPersonalMonthlyIncome`, //affiliate图表接口
//管理员接口 getTasksList: `/api/tasks/getList`, //获取w为执行完的所有任务
//查询所有试用用户 getTasksHistory: `/api/tasks/getAllTask`, //获取所有任务列表
inquiryGetTrial:`/api/inquiry/getTrial`,//查询所有试用用户 prepareForSR: `/api/python/prepareForSR`, //超分
getCities:`/api/inquiry/getCities`,//获取所有付款订单使用的国家
getUserInfo:`/api/inquiry/getUserInfo`,//查询所有用户
queryTransaction:`/api/inquiry/queryTransaction`,//查询交易记录
queryTransactionDownload:`/api/inquiry/queryTransaction/download`,//导出交易记录
createCoupon:`/api/stripe/createCoupon`,//创建优惠码
updatePromCodeInfo:`/api/stripe/updatePromCodeInfo`,//修改优惠码
getAllCoupons:`/api/stripe/getAllCoupons`,//查询优惠码列表
checkCoupon:`/api/stripe/checkCoupon`,//根据优惠码获取结算后的金额
deletePromCode:`/api/stripe/deletePromCode`,//删除优惠券
addOrganization:`/api/inquiry/addOrganization`,//添加企业版或者教育版
queryOrganization:`/api/inquiry/queryOrganization`,//查询企业版或者教育版
//作品广场
publish: `/api/portfolio/publish`, //发布作品到作品广场
getPorfolio: `/api/portfolio/page`, //查询作品广场
getPorfolioDetail: `/api/portfolio/detail`, //查询作品广场作品详情
setPorfolioChoose: `/api/portfolio/choose`, //二次创作
portfolioLike: `/api/portfolio/like`, //作品广场点赞
portfolioNoLike: `/api/portfolio/unlike`, //作品广场取消点赞
portfolioComment: `/api/portfolio/comment`, //作品广场评论
portfolioCommentPage: `/api/portfolio/commentPage`, //作品广场评论列表
commentDelete: `/api/portfolio/commentDelete`, //删除评论
porfolioDelete: `/api/portfolio/delete`, //删除作品
porfolioFollow: `/api/portfolio/follow`, //删除作品
porfolioFollow: `/api/portfolio/follow`, //关注
porfolioCancelFollow: `/api/portfolio/cancelFollow`, //取消关注
porfolioGetFolloweeList: `/api/portfolio/getFolloweeList`, //获取关注列表
porfolioGetFollowerList: `/api/portfolio/getFollowerList`, //获取粉丝列表
//云生成 //product生成
designCloud:`/api/design/designCloud`,//创建云生成 toProduct: `/api/history/toProduct`, //开始生成
cloudPage:`/api/design/cloudPage`,//创建云生成 toProductImageResult: `/api/history/toProductImageResult`, //获取结果
cloudTaskDelete:`/api/design/cloudTaskDelete`,//删除云生成 toProductImageElementUpload: `/api/history/toProductImageElementUpload`, //上传
cloudTaskNameUpdate:`/api/design/cloudTaskNameUpdate`,//修改云生成名字 productImageLike: `/api/history/productImageLike`, //like生成结果
getDesignCloudResult:`/api/design/getDesignCloudResult`,//查询这条云生成记录的所有内容 productImageUnLike: `/api/history/productImageUnLike`, //取消like生成结果
productImageLikeList: `/api/history/productImageLikeList`, //like生成结果
//企业版教育版管理员页面 //打光
subAccountList:`/api/account/subAccountList`,//查询子账号 relight: `/api/history/relight`, //开始生成
addOrUpdateSubAccount:`/api/account/addOrUpdateSubAccount`,//添加子账号 relightResult: `/api/history/relightResult`, //开始生成
deleteSubAccount:`/api/account/deleteSubAccount`,//删除子账号
subAccountImportExcelDownload:`/api/account/subAccountImportExcelDownload`,//批量添加模板下载模板
subAccountImport:`/api/account/subAccountImport`,//模板导入
getGenerateFrequency:`/api/inquiry/getGenerateFrequency`,//积分使用详情
getAllGenerateFuncName:`/api/inquiry/getAllGenerateFuncName`,//获取所有generate类型
//查询某个时间内design点击次数 //保存画布
getDesignStatistic:`/api/inquiry/getDesignStatistic`,//拒绝审批 canvasElementUpload: `/api/history/canvasElementUpload`, //画布上传临时图片
getAllQuestionnaire:`/api/inquiry/getAllQuestionnaire`,//拒绝审批 exportSave: `/api/history/exportSave`, //保存画布
getActiveUserFunc:`/api/inquiry/getActiveUserFunc`,//获取各模块功能 exportSearch: `/api/history/exportSearch`, //保存画布
toProductImageElementDelete:`/api/history/toProductImageElementDelete`,//删除指定模块上传的内容
recentActiveUser:`/api/inquiry/recentActiveUser`,//获取近期活跃用户
recentActiveUserChart:`/api/inquiry/recentActiveUserChart`,//获取近期活跃用户图表数据
recentNewUser:`/api/inquiry/recentNewUser`,//获取近期新增用户
recentNewUserChart:`/api/inquiry/recentNewUserChart`,//获取新增用户图表
trialUserCountry:`/api/inquiry/trialUserCountry`,//试用用户国家-城市分布
conversionRate:`/api/inquiry/conversionRate`,//试用用户国家-城市分布
getAllUserId:`/api/inquiry/getAllUserId`,//获取所有用户id和Name
adminAddUser:`/api/inquiry/addUser`,//添加用户
modifyUser:`/api/inquiry/modifyUser`,//修改用户
publishSysMessage:`/api/message/publishSysMessage`,//发布系统任务
//affiliate接口
viewsIncrease:`/api/affiliate/viewsIncrease`,//增加访问量
affiliateRegistration:`/api/affiliate/registration`,//affiliate注册
personalCenter:`/api/affiliate/personalCenter`,//affiliate个人中心
affiliateList:`/api/affiliate/list`,//affiliate审批列表
getEachAffiliateGeneratedRevenue:`/api/affiliate/getEachAffiliateGeneratedRevenue`,//affiliate每个用户根据日期查询收益
affiliateApproval:`/api/affiliate/approval`,//affiliate同意 审批
getPersonalMonthlyIncome:`/api/affiliate/getPersonalMonthlyIncome`,//affiliate图表接口
getTasksList:`/api/tasks/getList`,//获取w为执行完的所有任务 //活动
getTasksHistory:`/api/tasks/getAllTask`,//获取所有任务列表 activity: `/api/account/activity`,
prepareForSR:`/api/python/prepareForSR`,//超分
//bradDNA
brandLogoUpload: `/api/history/brandLogoUpload`, //上传bradDNA
brandDNAGenerate: `/api/history/brandDNAGenerate`, //上传bradDNA
brandDNAUpload: `/api/history/brandDNAUpload`, //上传DNA图片
getInitializeProgress: `/api/history/getInitializeProgress`, //获取brand进度
brandDNADelete: `/api/history/brandDNADelete`, //删除brandDna
//作品广场 brandDNAPage: `/api/history/brandDNAPage`, //brand列表
publish:`/api/portfolio/publish`,//发布作品到作品广场 brandDNASaveOrUpdate: `/api/history/brandDNASaveOrUpdate`, //提交个人信息
getPorfolio:`/api/portfolio/page`,//查询作品广场 productImageInitialize: `/api/history/productImageInitialize`, //产品识别
getPorfolioDetail:`/api/portfolio/detail`,//查询作品广场作品详情 //调查问卷
setPorfolioChoose:`/api/portfolio/choose`,//二次创作 questionnaire: `/api/account/questionnaire`, //保存画布
portfolioLike:`/api/portfolio/like`,//作品广场点赞
portfolioNoLike:`/api/portfolio/unlike`,//作品广场取消点赞
portfolioComment:`/api/portfolio/comment`,//作品广场评论
portfolioCommentPage:`/api/portfolio/commentPage`,//作品广场评论列表
commentDelete:`/api/portfolio/commentDelete`,//删除评论
porfolioDelete:`/api/portfolio/delete`,//删除作品
porfolioFollow:`/api/portfolio/follow`,//删除作品
porfolioFollow:`/api/portfolio/follow`,//关注
porfolioCancelFollow:`/api/portfolio/cancelFollow`,//取消关注
porfolioGetFolloweeList:`/api/portfolio/getFolloweeList`,//获取关注列表
porfolioGetFollowerList:`/api/portfolio/getFollowerList`,//获取粉丝列表
//product生成 //消息系统
toProduct:`/api/history/toProduct`,//开始生成 getUnreadCount: `/api/message/getUnreadCount`, //获取未读消息
toProductImageResult:`/api/history/toProductImageResult`,//获取结果 setReadStatus: `/api/message/setReadStatus`, //设置消息已读
toProductImageElementUpload:`/api/history/toProductImageElementUpload`,//上传 getHistoryNotification: `/api/message/getHistoryNotification`, //获取历史消息
productImageLike:`/api/history/productImageLike`,//like生成结果 oneClickRead: `/api/message/oneClickRead`, //全部设为已读
productImageUnLike:`/api/history/productImageUnLike`,//取消like生成结果 personalHomepage: `/api/account/personalHomepage`, //获取个人主页信息
productImageLikeList:`/api/history/productImageLikeList`,//like生成结果 },
//打光 axiosGet(url, config) {
relight:`/api/history/relight`,//开始生成 return new Promise((resolve, reject) => {
relightResult:`/api/history/relightResult`,//开始生成 if (isLoginTime && url != "/api/portfolio/page") {
resolve("");
//保存画布 return;
canvasElementUpload:`/api/history/canvasElementUpload`,//画布上传临时图片 }
exportSave:`/api/history/exportSave`,//保存画布 axios
exportSearch:`/api/history/exportSearch`,//保存画布 .get(url, config)
.then((response) => {
//活动 resolve(response);
activity:`/api/account/activity`, })
.catch((error) => {
//bradDNA reject(error);
brandLogoUpload:`/api/history/brandLogoUpload`,//上传bradDNA
brandDNAGenerate:`/api/history/brandDNAGenerate`,//上传bradDNA
brandDNAUpload:`/api/history/brandDNAUpload`,//上传DNA图片
getInitializeProgress:`/api/history/getInitializeProgress`,//获取brand进度
brandDNADelete:`/api/history/brandDNADelete`,//删除brandDna
brandDNAPage:`/api/history/brandDNAPage`,//brand列表
brandDNASaveOrUpdate:`/api/history/brandDNASaveOrUpdate`,//提交个人信息
productImageInitialize:`/api/history/productImageInitialize`,//产品识别
//调查问卷
questionnaire:`/api/account/questionnaire`,//保存画布
//消息系统
getUnreadCount:`/api/message/getUnreadCount`,//获取未读消息
setReadStatus:`/api/message/setReadStatus`,//设置消息已读
getHistoryNotification:`/api/message/getHistoryNotification`,//获取历史消息
oneClickRead:`/api/message/oneClickRead`,//全部设为已读
personalHomepage:`/api/account/personalHomepage`,//获取个人主页信息
},
axiosGet(url,config) {
return new Promise((resolve, reject) => {
if(isLoginTime && url != '/api/portfolio/page') {
resolve('')
return
}
axios.get(url,config).then(response => {
resolve(response)
}).catch((error) => {
reject(error)
})
}); });
}, });
},
axiosPut(url, data) { axiosPut(url, data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(isLoginTime && url != '/api/portfolio/page') { if (isLoginTime && url != "/api/portfolio/page") {
resolve('') resolve("");
return return;
} }
axios.put(url, data).then(response => { axios
resolve(response) .put(url, data)
}).catch((error) => { .then((response) => {
reject(error) resolve(response);
}) })
.catch((error) => {
reject(error);
}); });
}, });
},
axiosPost(url, data,config) { axiosPost(url, data, config) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(isLoginTime && url != '/api/portfolio/page') { if (isLoginTime && url != "/api/portfolio/page") {
resolve('') resolve("");
return return;
} }
axios.post(url, data,config).then(response => { axios
resolve(response) .post(url, data, config)
}).catch((error) => { .then((response) => {
reject(error) resolve(response);
}) })
.catch((error) => {
reject(error);
}); });
}, });
},
axiosDelete(url, newData) { axiosDelete(url, newData) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(isLoginTime && url != '/api/portfolio/page') { if (isLoginTime && url != "/api/portfolio/page") {
resolve('') resolve("");
return return;
} }
axios.delete(url,{data:newData}).then(response => { axios
resolve(response) .delete(url, { data: newData })
}).catch((error) => { .then((response) => {
reject(error) resolve(response);
}) })
.catch((error) => {
reject(error);
}); });
}, });
},
};
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,94 +1,100 @@
import { setCookie, getCookie, WriteCookie,clonAllCookie } from "@/tool/cookie"; import {
setCookie,
getCookie,
WriteCookie,
clonAllCookie,
} from "@/tool/cookie";
import MyEvent from "@/tool/myEvents"; import MyEvent from "@/tool/myEvents";
class MyWs { class MyWs {
constructor() { constructor() {
this.ws = null; this.ws = null;
// this.ws = new WebSocket(); // this.ws = new WebSocket();
let http = process.env.VUE_APP_BASE_URL.replace(/^https?:\/\//, '') let http = import.meta.env.VITE_APP_BASE_URL.replace(/^https?:\/\//, "");
this.messageUrl = http+'/notification' this.messageUrl = http + "/notification";
this.wsUrl = '' this.wsUrl = "";
this.reconnectionTime = null this.reconnectionTime = null;
this.times = 0 this.times = 0;
this.sendPINGTime = null this.sendPINGTime = null;
} }
linkWs(url) { linkWs(url) {
if(!(JSON.parse(getCookie("userInfo"))))return if (!JSON.parse(getCookie("userInfo"))) return;
if (this.ws && this.ws.readyState == 1) return if (this.ws && this.ws.readyState == 1) return;
if(!this.wsUrl)this.wsUrl = url +`/${JSON.parse(getCookie("userInfo")).userId}` if (!this.wsUrl)
this.ws = new WebSocket(this.wsUrl) this.wsUrl = url + `/${JSON.parse(getCookie("userInfo")).userId}`;
this.ws.onmessage = (e)=>{ this.ws = new WebSocket(this.wsUrl);
try { this.ws.onmessage = (e) => {
let rv = JSON.parse(e.data) try {
if(rv == "PONG")return let rv = JSON.parse(e.data);
this.times = 0 if (rv == "PONG") return;
MyWs.receiveText(rv) this.times = 0;
} catch (error) { MyWs.receiveText(rv);
console.error('websocket',error) } catch (error) {
} console.error("websocket", error);
} }
clearInterval(this.sendPINGTime) };
this.sendPINGTime = setInterval(()=>{ clearInterval(this.sendPINGTime);
this.send({text:'PING'}) this.sendPINGTime = setInterval(() => {
// },1000) this.send({ text: "PING" });
},1000*60*2) // },1000)
this.ws.onclose = (e)=>{ }, 1000 * 60 * 2);
this.reconnection() this.ws.onclose = (e) => {
} this.reconnection();
this.ws.onerror = (e)=>{ };
this.reconnection() this.ws.onerror = (e) => {
} this.reconnection();
} };
reconnection(){ }
this.times++ reconnection() {
clearTimeout(this.reconnectionTime) this.times++;
if(this.times>=10)return clearTimeout(this.reconnectionTime);
clearInterval(this.sendPINGTime) if (this.times >= 10) return;
this.reconnectionTime = setTimeout(()=>{ clearInterval(this.sendPINGTime);
this.linkWs(this.wsUrl) this.reconnectionTime = setTimeout(() => {
},1000) this.linkWs(this.wsUrl);
} }, 1000);
static receiveText(data,call){ }
MyEvent.emit('getMessage',data) static receiveText(data, call) {
} MyEvent.emit("getMessage", data);
sendMessage(data) { }
if (this.ws && this.ws.readyState == 1) { sendMessage(data) {
let obj = { if (this.ws && this.ws.readyState == 1) {
cmd: 1, let obj = {
data: { cmd: 1,
name: '123', data: {
} name: "123",
} },
this.send(obj) };
obj = { this.send(obj);
cmd: 4, obj = {
data: { cmd: 4,
msg: data, data: {
} msg: data,
} },
this.send(obj) };
// obj = { this.send(obj);
// cmd: 6, // obj = {
// data: { // cmd: 6,
// msg: data, // data: {
// } // msg: data,
// } // }
// this.send(obj,this.ws) // }
} // this.send(obj,this.ws)
} }
send(obj) { }
if(this.ws.readyState == 1){ send(obj) {
this.ws.send(JSON.stringify(obj)) if (this.ws.readyState == 1) {
}else{ this.ws.send(JSON.stringify(obj));
clearTimeout(this.sendPINGTime) } else {
this.reconnection() clearTimeout(this.sendPINGTime);
} this.reconnection();
} }
close(){ }
if (this.ws && this.ws.readyState == 1) { close() {
console.log("客户端 连接已关闭") if (this.ws && this.ws.readyState == 1) {
this.ws.close() console.log("客户端 连接已关闭");
} this.ws.close();
} }
}
} }
export default new MyWs() export default new MyWs();

116
vite.config.js Normal file
View File

@@ -0,0 +1,116 @@
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
import AutoImport from "unplugin-auto-import/vite";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import path from "path";
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
// 加载环境变量
const env = loadEnv(mode, process.cwd(), "");
return {
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
plugins: [
vue(),
Components({
resolvers: [AntDesignVueResolver({ importStyle: false })],
}),
AutoImport({
imports: [
"vue",
"vue-router",
{
"lodash-es": [
"debounce",
"cloneDeep",
"cloneDeepWith",
"isBoolean",
"isString",
"isNumber",
"isArray",
"isDate",
"isFunction",
"isNaN",
"isNull",
"isObject",
"isUndefined",
],
},
],
dts: "src/auto-imports.d.ts",
}),
createSvgIconsPlugin({
// 指定需要缓存的图标文件夹
iconDirs: [path.resolve(process.cwd(), "src/assets/icons")],
// 指定symbolId格式
symbolId: "icon-[dir]-[name]",
}),
],
css: {
preprocessorOptions: {
less: {
modifyVars: {
"primary-color": "#ec6800",
},
javascriptEnabled: true,
// 全局导入less变量文件
additionalData: `@import "${path.resolve(
__dirname,
"src/assets/style/style.less"
)}";`,
},
},
},
server: {
host: "0.0.0.0", // 允许局域网内的IP访问
port: mode === "production" ? 8060 : 10086, // 根据环境设置端口
open: true, // 自动打开浏览器
strictPort: false, // 如果端口已被占用,则尝试下一个可用端口
proxy: {
"/api": {
target: "http://192.168.1.7:5567",
// target: 'https://develop.api.aida.com.hk',
changeOrigin: true,
},
"/xupei": {
target: "http://192.168.1.7:5567",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/robot/, "/api"),
},
"/oldsis": {
target: "https://old.api.aida.com.hk",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/oldsis/, "/api"),
},
},
},
build: {
sourcemap: false, // 对应vue.config.js中的productionSourceMap: false
outDir: "dist",
assetsDir: "assets",
// 分包策略
rollupOptions: {
output: {
manualChunks: {
vendor: ["vue", "vue-router", "vuex"],
antd: ["ant-design-vue"],
utils: ["axios", "lodash-es"],
},
},
},
},
// 定义全局常量替换
define: {
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false,
},
};
});

View File

@@ -1,79 +0,0 @@
const {defineConfig} = require('@vue/cli-service')
const path = require('path');
const webpack = require('webpack')
module.exports = defineConfig({
transpileDependencies: ['vuetify'],
lintOnSave:false,//关闭语法检查
productionSourceMap: false,//打包不生成map文件减少文件大小
devServer: {
// hot: true, // 热更新
// port: '8060',
port: process.env.NODE_ENV === 'production'
? '8060'
: '10086',
proxy: {
// "/api": {
// // target: 'https://www.aida.com.hk', //后端接口地址
// target: process.env.VUE_APP_BASE_URL,
// changeOrigin: true, //是否允许跨越
// }
'/api':{
target:'http://192.168.1.7:5567',
// target:'https://develop.api.aida.com.hk',
changeOrigin:true,
},
'/xupei':{
target:'http://192.168.1.7:5567',
changeOrigin:true,
pathRewrite:{
'^/robot': 'api', // api替换成api
}
},
'/oldsis':{
target:'https://old.api.aida.com.hk',
changeOrigin:true,
pathRewrite:{
'^/oldsis': 'api', // api替换成api
}
}
},
// https:true,
},
pluginOptions: {
"style-resources-loader": {
preProcessor: "less",
patterns: [
// 存放less变量文件的路径
path.resolve(__dirname, "./src/assets/style/style.less")
]
}
},
css: {
loaderOptions: {
less: {
lessOptions: {
modifyVars: {
'primary-color': '#ec6800'
},
javascriptEnabled: true,
},
},
},
},
configureWebpack: {
plugins: [
require('unplugin-element-plus/webpack')({
// options
}),
],
},
})