Commit 11828ef5 by pangchong

chore(config): 更新开发环境配置及代理Cookie

- 在 .env.dev 中添加了自定义代码目录与后端接口相关环境变量
- 更新 vite.config.ts 中代理请求的 Cookie 值以匹配最新会话
- 在 .gemini/.rules.md 中增加翻译接口调用的特别说明
- 移除多个组件及功能模块中无用或冗余的 import 语句,优化代码整洁度
parent cf19a0ee
# 自定义定制代码目录 (例如 'xm')
VITE_CUSTOM_CODE = xm
# 后端 API 目标服务基准地址
VITE_API_URL = https://amro-vue.anyremote.cn
# 接口前缀路径
VITE_API_PREFIX_URL = /api/v1
# 开发环境下默认启用本地开发桥接服务 (true 使用本地接口直接请求/模拟,false 降级使用父项目传递的 promise)
VITE_IF_LOCAL_BRIDGE = true
\ No newline at end of file
...@@ -295,3 +295,5 @@ export const COMPOSITE_CONTAINER_MAP: Record<string, string[]> = { ...@@ -295,3 +295,5 @@ export const COMPOSITE_CONTAINER_MAP: Record<string, string[]> = {
-`bridge.ts` 中封装网络及上传接口时,应当与 `getTemplateList` 风格保持一致,采用标准的 `try...catch` 块捕获异常并上抛。 -`bridge.ts` 中封装网络及上传接口时,应当与 `getTemplateList` 风格保持一致,采用标准的 `try...catch` 块捕获异常并上抛。
- 直接通过 `apiService` 向后端实体接口(例如 `/plugins/TD_JC_CEP_UPLOAD_IMG` 等)发起数据请求。对于上传等表单提交,**强制直接在 `apiService.postForm` 中传入含有 `file` 与参数的普通 JavaScript 对象**(底层服务已实现拦截自动转化为 `FormData` 包装),**严禁**在业务和桥接层手动进行 `new FormData()` 的实例化与 append 操作;同时,**禁止**在内部做任何针对外部宿主系统环境(例如 window、window.parent 等)的挂载检测与判断。 - 直接通过 `apiService` 向后端实体接口(例如 `/plugins/TD_JC_CEP_UPLOAD_IMG` 等)发起数据请求。对于上传等表单提交,**强制直接在 `apiService.postForm` 中传入含有 `file` 与参数的普通 JavaScript 对象**(底层服务已实现拦截自动转化为 `FormData` 包装),**严禁**在业务和桥接层手动进行 `new FormData()` 的实例化与 append 操作;同时,**禁止**在内部做任何针对外部宿主系统环境(例如 window、window.parent 等)的挂载检测与判断。
- **业务组件调用规范**:在任何 Vue 组件或 functionals 逻辑类中,**禁止**直接通过 `apiService` 或原生 ajax 方式编写特定的外部接口请求逻辑,**必须**`bridge.ts` 中导入对应的封装方法进行调用,实现视图层与接口传输层的彻底解耦。 - **业务组件调用规范**:在任何 Vue 组件或 functionals 逻辑类中,**禁止**直接通过 `apiService` 或原生 ajax 方式编写特定的外部接口请求逻辑,**必须**`bridge.ts` 中导入对应的封装方法进行调用,实现视图层与接口传输层的彻底解耦。
- **翻译相关接口例外情况**:智能翻译相关的接口(如单句翻译 `/translate`、双语库检索 `/search`、翻译词条维护 `/data/insert_single``/data/delete` 以及 XML 翻译对照提取 `/xml/extract/process`、批量翻译接口等)属于本编辑器纯业务或数据处理功能接口,**不属于外部宿主系统的桥接接口**,因此**不需要**存放在 `bridge.ts` 中,允许直接在各自模块的 `functionals` 逻辑类或业务代码中发起网络请求(应使用系统自带的 `service``serviceManage` 实例)。
...@@ -127,7 +127,6 @@ ...@@ -127,7 +127,6 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useThemeVars } from 'naive-ui'
import type { DataTableColumns } from 'naive-ui' import type { DataTableColumns } from 'naive-ui'
import { PlayBackOutline, ChevronBackOutline, ChevronForwardOutline, PlayForwardOutline, RefreshOutline } from '@vicons/ionicons5' import { PlayBackOutline, ChevronBackOutline, ChevronForwardOutline, PlayForwardOutline, RefreshOutline } from '@vicons/ionicons5'
......
import { NIcon } from 'naive-ui'
import type { DropdownOption } from 'naive-ui' import type { DropdownOption } from 'naive-ui'
import { import {
AddCircleOutline, AddCircleOutline,
......
...@@ -289,7 +289,6 @@ ...@@ -289,7 +289,6 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { inject, computed } from 'vue'
import type { Ref } from 'vue' import type { Ref } from 'vue'
import { TrashOutline } from '@vicons/ionicons5' import { TrashOutline } from '@vicons/ionicons5'
import type { XmlNode } from '@/types/xmlNode' import type { XmlNode } from '@/types/xmlNode'
......
import { useThemeVars } from 'naive-ui'
import { useEditorStore } from '@/store/editor' import { useEditorStore } from '@/store/editor'
import { import {
isMixedContentElement, isMixedContentElement,
......
...@@ -68,7 +68,7 @@ export default defineConfig(({ mode }) => { ...@@ -68,7 +68,7 @@ export default defineConfig(({ mode }) => {
changeOrigin: true, changeOrigin: true,
secure: false, secure: false,
headers: { headers: {
Cookie: '_udid=19255f9f-aa6a-4696-8227-7531620fc311; JSESSIONID=FB8FE3057D9C9E7A57761199BA345BB7; _amro_sk=985347ad-b8be-4874-b1e8-ec67ef283c3a' Cookie: '_udid=264b2935-6cad-4d00-8a65-7b54d1ecf2db; JSESSIONID=DE507139FF27D7D5BA18A673DCD3EC71; _amro_sk=d2bf7778-f4b7-497a-a8c5-b6fa9cfe3369'
} }
}, },
'/mnt': { '/mnt': {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment