提交 a06b18a4 authored 作者: 王鹏飞's avatar 王鹏飞

feat: 移除学校环境配置,优化 AI 处理逻辑与请求拦截

上级 40ac72f7
# 学校部署:登录与问卷地址从浏览器主机名读取,端口分别为 1001、1011。
# 本地接口返回的文件地址使用学校部署的 saas-lab-api 域名。
VITE_STATIC_URL=https://saas-lab-api
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --mode dev", "dev": "vite --mode dev",
"dev:school": "vite --mode school",
"build": "npm run typecheck && vite build --mode prod && npm run deploy", "build": "npm run typecheck && vite build --mode prod && npm run deploy",
"build:prod": "npm run typecheck && vite build --mode prod", "build:prod": "npm run typecheck && vite build --mode prod",
"build:school": "npm run typecheck && vite build --mode school", "build:school": "npm run typecheck && vite build --mode school",
......
...@@ -22,7 +22,7 @@ export function useAI(config) { ...@@ -22,7 +22,7 @@ export function useAI(config) {
try { try {
switch (ai.value) { switch (ai.value) {
case 'yiyan': case 'yiyan':
await yiyan(data) await qwen(data)
break break
case 'deepseek': case 'deepseek':
await qwen(data) await qwen(data)
......
...@@ -26,6 +26,7 @@ const platformList: PlatformItem[] = [ ...@@ -26,6 +26,7 @@ const platformList: PlatformItem[] = [
async onBeforeNext(stepActive) { async onBeforeNext(stepActive) {
if (stepActive === 2) { if (stepActive === 2) {
const res = await handleSubmit() const res = await handleSubmit()
if (import.meta.env.MODE === 'school') return true
const { data } = await getWechatAuth({ connection_id: res.id, redirect_uri: location.href, auth_type: 1 }) const { data } = await getWechatAuth({ connection_id: res.id, redirect_uri: location.href, auth_type: 1 })
location.href = 'https://webapp-pub.ezijing.com/auth.html?redirect_uri=' + encodeURIComponent(data.url) location.href = 'https://webapp-pub.ezijing.com/auth.html?redirect_uri=' + encodeURIComponent(data.url)
return false return false
...@@ -144,6 +145,7 @@ const platformList: PlatformItem[] = [ ...@@ -144,6 +145,7 @@ const platformList: PlatformItem[] = [
async onBeforeNext(stepActive) { async onBeforeNext(stepActive) {
if (stepActive === 2) { if (stepActive === 2) {
const res = await handleSubmit() const res = await handleSubmit()
if (import.meta.env.MODE === 'school') return true
const { data } = await getWechatAuth({ connection_id: res.id, redirect_uri: location.href, auth_type: 2 }) const { data } = await getWechatAuth({ connection_id: res.id, redirect_uri: location.href, auth_type: 2 })
location.href = data.url location.href = data.url
return false return false
......
...@@ -51,10 +51,6 @@ httpRequest.interceptors.response.use( ...@@ -51,10 +51,6 @@ httpRequest.interceptors.response.use(
ElMessage.error(data.message || data.msg) ElMessage.error(data.message || data.msg)
return Promise.reject(data) return Promise.reject(data)
} }
if (import.meta.env.MODE === 'school' && import.meta.env.VITE_STATIC_URL) {
const json = JSON.stringify(data)
return JSON.parse(json.replace(/https?:\/\/[^/\s"\\]*saas-lab-api[^/\s"\\]*/gi, import.meta.env.VITE_STATIC_URL))
}
return data return data
}, },
function (error) { function (error) {
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论