Compare commits

...

7 Commits

Author SHA1 Message Date
82a35cec24 Merge pull request 'main' (#157) from main into prod
Reviewed-on: #157
2026-08-11 17:00:39 +08:00
hrx
97d7af3680 Merge branch 'main' of git.opencomputing.cn:yumoqing/kboss 2026-08-10 16:18:46 +08:00
hrx
cff67aa2b5 8.10更新 2026-08-10 16:18:30 +08:00
ping
b8b41159f1 Merge branch 'main' of https://git.opencomputing.cn/yumoqing/kboss 2026-08-07 16:39:51 +08:00
ping
c36a4073d9 update 2026-08-07 16:39:44 +08:00
hrx
9d430f08ab 8.7更新 2026-08-07 16:38:45 +08:00
ping
3d4a146174 docs: design bilingual inquiry dictionary mapping
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 10:08:01 +08:00
12 changed files with 414 additions and 122 deletions

View File

@ -55,26 +55,44 @@ async def search_user_inquiry(ns={}):
# 分页查询
search_sql = """select * from product_inquiry where %s order by update_time desc limit %d offset %d;""" % (where_clause, page_size, offset)
result = await sor.sqlExe(search_sql, {})
dict_sql = """select dict_type, dict_key, dict_value from product_inquiry_dict where status = 1 order by dict_type asc, sort_order asc;"""
dict_sql = """
select dict_type, dict_key, dict_value_zh, dict_value_en
from product_inquiry_dict
where status = 1
order by dict_type asc, sort_order asc;
"""
dict_result = await sor.sqlExe(dict_sql, {})
dict_mapping = {}
dict_mapping_zh = {}
dict_mapping_en = {}
for dict_item in dict_result:
dict_type = dict_item.get('dict_type')
dict_mapping.setdefault(dict_type, {})[str(dict_item.get('dict_key'))] = dict_item.get('dict_value')
dict_key = str(dict_item.get('dict_key'))
dict_mapping_zh.setdefault(dict_type, {})[dict_key] = dict_item.get('dict_value_zh')
dict_mapping_en.setdefault(dict_type, {})[dict_key] = dict_item.get('dict_value_en')
value_mapping = {
value_mapping_zh = {
'custom_type': {'0': '个人', '1': '企业'},
'enterprise_type': dict_mapping.get('enterprise_type', {}),
'region': dict_mapping.get('region', {}),
'enterprise_type': dict_mapping_zh.get('enterprise_type', {}),
'region': dict_mapping_zh.get('region', {}),
'feedback': {'0': '待回复', '1': '已回复'}
}
value_mapping_en = {
'custom_type': {'0': 'Individual', '1': 'Enterprise'},
'enterprise_type': dict_mapping_en.get('enterprise_type', {}),
'region': dict_mapping_en.get('region', {}),
'feedback': {'0': 'Pending Reply', '1': 'Replied'}
}
for data_dic in result:
for key, mapping in value_mapping.items():
for key in value_mapping_zh.keys():
if key in data_dic:
data_dic['%s_name' % key] = mapping.get(str(data_dic.get(key)), data_dic.get(key))
direction_mapping = dict_mapping.get('direction', {})
value_key = str(data_dic.get(key))
data_dic['%s_name_zh' % key] = value_mapping_zh[key].get(value_key, data_dic.get(key))
data_dic['%s_name_en' % key] = value_mapping_en[key].get(value_key, data_dic.get(key))
direction_mapping_zh = dict_mapping_zh.get('direction', {})
direction_mapping_en = dict_mapping_en.get('direction', {})
direction_keys = str(data_dic.get('consult_direction')).split(',') if data_dic.get('consult_direction') else []
data_dic['consult_direction_name'] = ''.join([direction_mapping.get(direction_key.strip(), direction_key.strip()) for direction_key in direction_keys if direction_key.strip()])
data_dic['consult_direction_name_zh'] = ''.join([direction_mapping_zh.get(direction_key.strip(), direction_key.strip()) for direction_key in direction_keys if direction_key.strip()])
data_dic['consult_direction_name_en'] = ', '.join([direction_mapping_en.get(direction_key.strip(), direction_key.strip()) for direction_key in direction_keys if direction_key.strip()])
if ns.get('to_excel') == '1':
# 创建映射字段 导出execl
@ -106,11 +124,11 @@ async def search_user_inquiry(ns={}):
value = data_dic[key]
chinese_key = field_mapping[key]
if key == 'consult_direction':
direction_mapping = dict_mapping.get('direction', {})
direction_mapping = dict_mapping_zh.get('direction', {})
direction_keys = str(value).split(',') if value else []
new_data_dic[chinese_key] = ''.join([direction_mapping.get(direction_key.strip(), direction_key.strip()) for direction_key in direction_keys if direction_key.strip()])
elif key in value_mapping:
mapped_value = value_mapping[key].get(str(value), value) # 若未找到对应映射,保留原始值
elif key in value_mapping_zh:
mapped_value = value_mapping_zh[key].get(str(value), value) # 若未找到对应映射,保留原始值
new_data_dic[chinese_key] = mapped_value
else:
new_data_dic[chinese_key] = value

View File

@ -4,7 +4,12 @@ async def search_user_inquiry_dict(ns={}):
where_sql = "where status = 1"
if ns.get('dict_type'):
where_sql += " and dict_type = '%s'" % ns.get('dict_type')
search_sql = """select * from product_inquiry_dict %s order by dict_type asc, sort_order asc;""" % where_sql
search_sql = """
select id, dict_type, dict_key, dict_value_zh, dict_value_en, sort_order
from product_inquiry_dict
%s
order by dict_type asc, sort_order asc;
""" % where_sql
result = await sor.sqlExe(search_sql, {})
return {
'status': True,

View File

@ -0,0 +1,39 @@
# Bilingual Inquiry Dictionary Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Adapt inquiry search APIs to the bilingual dictionary value columns.
**Architecture:** Build independent Chinese and English dictionary maps from one query. Return separate language display fields in normal search results while reusing the Chinese map for the existing Excel export.
**Tech Stack:** DSPY Python endpoints, async DBPools/sor access, MySQL.
---
### Task 1: Update inquiry result mapping
**Files:**
- Modify: `b/product/search_user_inquiry.dspy`
- [ ] Query `dict_value_zh` and `dict_value_en`.
- [ ] Build separate Chinese and English maps.
- [ ] Return `*_name_zh` and `*_name_en` for single-choice fields.
- [ ] Return `consult_direction_name_zh` and `consult_direction_name_en`.
- [ ] Keep Excel export mapped through Chinese values.
### Task 2: Update dictionary search output
**Files:**
- Modify: `b/product/search_user_inquiry_dict.dspy`
- [ ] Replace `select *` with the explicit bilingual dictionary columns.
### Task 3: Verify
**Files:**
- Verify: `b/product/search_user_inquiry.dspy`
- Verify: `b/product/search_user_inquiry_dict.dspy`
- [ ] Confirm neither SQL query references the removed `dict_value` column.
- [ ] Compile both DSPY function bodies.
- [ ] Run IDE diagnostics and `git diff --check`.

View File

@ -0,0 +1,29 @@
# 咨询字典双语接口设计
## 目标
咨询相关接口适配 `product_inquiry_dict` 的双语字段
`dict_value_zh``dict_value_en`,不再读取旧字段 `dict_value`
## 接口调整
- `search_user_inquiry.dspy` 同时查询并构建中英文映射。
- 普通咨询列表分别返回 `*_name_zh``*_name_en`
- 单选字段包括客户类型、企业类型、区域和反馈状态。
- 多选咨询方向分别返回 `consult_direction_name_zh`
`consult_direction_name_en`,并保持原选项顺序。
- Excel 导出继续使用中文表头和中文字典值。
- `search_user_inquiry_dict.dspy` 明确返回
`id``dict_type``dict_key``dict_value_zh`
`dict_value_en``sort_order`
## 兼容边界
旧的 `*_name` 单语字段不再生成。调用方应读取对应的
`*_name_zh``*_name_en` 字段。
## 验证
- 字典查询不再引用 `dict_value`
- 普通列表中的单选和多选字段均包含中英文显示名称。
- Excel 仍只输出中文显示值。

View File

@ -2,7 +2,9 @@
position: relative;
min-height: 100vh;
overflow-x: hidden;
overflow-y: hidden;
color: #1f2937;
padding: 0 12%;
background:
radial-gradient(circle at 78% 18%, rgba(236, 72, 153, 0.07) 0%, rgba(236, 72, 153, 0) 32%),
radial-gradient(circle at 18% 16%, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0) 36%),
@ -10,10 +12,10 @@
}
.news-shell {
position: relative;
// position: relative;
z-index: 1;
max-width: 1280px;
margin: 0 auto;
// max-width: 1280px;
// margin: 0 auto;
padding: 0 24px;
}
@ -55,9 +57,9 @@
}
.news-hero {
position: relative;
// position: relative;
padding: 140px 0 72px;
overflow: hidden;
// overflow: hidden;
}
.news-hero::before {
@ -93,6 +95,8 @@
}
.hero-content {
text-align: left;
margin: 0 ;
animation: fadeInUp 0.8s ease-out forwards;
}
@ -197,6 +201,7 @@
.news-item {
position: relative;
overflow: hidden;
cursor: pointer;
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.04);

View File

@ -401,5 +401,59 @@ export default {
openedDecision: 'The Investment Strategy Agent page has been opened.<br>Anything else you would like to know?',
openedPage: 'The related page has been opened. Anything else you would like to know?'
},
loginDialog: {
welcomeLogin: 'Welcome',
createAccount: 'Create Account',
signIn: 'Sign In',
signUp: 'Sign Up',
signInWithPassword: 'Password',
signInWithCode: 'Verification Code',
enterAccount: 'Enter account',
enterPassword: 'Enter password',
enterMobile: 'Enter mobile number',
enterVerificationCode: 'Enter verification code',
enterAccountName: 'Enter account name',
forgotPassword: 'Forgot password?',
noAccountSignUp: 'No account? Sign Up',
signInNow: 'Sign In',
getVerificationCode: 'Get Verification Code',
agreePrefix: 'I have read and agree to the ',
userAgreement: 'User Agreement',
agreeAnd: ' and ',
privacyPolicy: 'Privacy Policy',
signUpNow: 'Sign Up',
hasAccountSignIn: 'Already have an account? Sign In',
signingIn: 'Signing in...',
signingUp: 'Signing up...',
resendCode: 'Resend {seconds}s',
mobileRequired: 'Enter mobile number',
mobileInvalid: 'Please enter a valid mobile number',
accountRequired: 'Enter account',
passwordRequired: 'Enter password',
codeRequired: 'Enter verification code',
accountNameRequired: 'Enter account name',
agreeRequired: 'Please read and agree to the agreements first',
codeSent: 'Verification code sent',
codeSendFail: 'Failed to get verification code',
loginFail: 'Sign in failed',
loginSuccess: 'Signed in successfully',
registerSuccess: 'Registration successful. Please sign in.',
registerFail: 'Registration failed',
registerRetry: 'Registration failed. Please try again.',
resetPassword: 'Reset Password',
resetPasswordDesc: 'Verify identity via mobile verification code to set a new password',
mobileLabel: 'Mobile Number',
newPasswordLabel: 'New Password',
verificationCodeLabel: 'Verification Code',
enterBoundMobile: 'Enter bound mobile number',
enterNewPassword: 'Enter new password',
cancel: 'Cancel',
confirmReset: 'Confirm Reset',
newPasswordRequired: 'Enter new password',
getCodeFirst: 'Please get the verification code first',
resetSuccess: 'Password reset successfully',
resetFail: 'Password reset failed',
codeSentCheck: 'Verification code sent. Please check your messages.'
},
...autoMessages
}

View File

@ -401,5 +401,59 @@ export default {
openedDecision: '已为您打开投策智能体页面 📊<br>还有其他想了解的吗?',
openedPage: '已为您打开相关页面。还有其他想了解的吗?'
},
loginDialog: {
welcomeLogin: '欢迎登录',
createAccount: '创建账号',
signIn: '登录',
signUp: '注册',
signInWithPassword: '密码登录',
signInWithCode: '验证码登录',
enterAccount: '请输入账户',
enterPassword: '请输入密码',
enterMobile: '请输入手机号',
enterVerificationCode: '请输入验证码',
enterAccountName: '请输入账户名',
forgotPassword: '忘记密码?',
noAccountSignUp: '没有账号?去注册',
signInNow: '立即登录',
getVerificationCode: '获取验证码',
agreePrefix: '我已阅读并同意',
userAgreement: '《用户协议》',
agreeAnd: '、',
privacyPolicy: '《隐私政策》',
signUpNow: '立即注册',
hasAccountSignIn: '已有账号?前往登录',
signingIn: '登录中...',
signingUp: '注册中...',
resendCode: '重新发送 {seconds}s',
mobileRequired: '请输入手机号',
mobileInvalid: '请输入正确的手机号',
accountRequired: '请输入账户',
passwordRequired: '请输入密码',
codeRequired: '请输入验证码',
accountNameRequired: '请输入账户名',
agreeRequired: '请先阅读并同意相关协议',
codeSent: '验证码已发送',
codeSendFail: '验证码获取失败',
loginFail: '登录失败',
loginSuccess: '登录成功',
registerSuccess: '注册成功,请登录',
registerFail: '注册失败',
registerRetry: '注册失败,请重试',
resetPassword: '重置密码',
resetPasswordDesc: '通过手机号验证码验证身份后设置新密码',
mobileLabel: '手机号',
newPasswordLabel: '新密码',
verificationCodeLabel: '验证码',
enterBoundMobile: '请输入绑定手机号',
enterNewPassword: '请输入新密码',
cancel: '取消',
confirmReset: '确认重置',
newPasswordRequired: '请输入新密码',
getCodeFirst: '请先获取验证码',
resetSuccess: '密码重置成功',
resetFail: '密码重置失败',
codeSentCheck: '验证码已发送,请注意查收。'
},
...autoMessages
}

View File

@ -13,31 +13,31 @@
<div class="brand-area">
<div class="brand-text">
<h2>{{ activeTab === 'login' ? '欢迎登录' : '创建账号' }}</h2>
<h2>{{ activeTab === 'login' ? $t('loginDialog.welcomeLogin') : $t('loginDialog.createAccount') }}</h2>
</div>
</div>
<div class="tab-group">
<button type="button" :class="{ active: activeTab === 'login' }" @click="switchTab('login')">登录</button>
<button type="button" :class="{ active: activeTab === 'register' }" @click="switchTab('register')">注册</button>
<button type="button" :class="{ active: activeTab === 'login' }" @click="switchTab('login')">{{ $t('loginDialog.signIn') }}</button>
<button type="button" :class="{ active: activeTab === 'register' }" @click="switchTab('register')">{{ $t('loginDialog.signUp') }}</button>
</div>
<div v-if="activeTab === 'login'" class="form-panel">
<div class="mode-tabs">
<button type="button" :class="{ active: loginMode === 'password' }" @click="switchLoginMode('password')">密码登录</button>
<button type="button" :class="{ active: loginMode === 'mobile' }" @click="switchLoginMode('mobile')">验证码登录</button>
<button type="button" :class="{ active: loginMode === 'password' }" @click="switchLoginMode('password')">{{ $t('loginDialog.signInWithPassword') }}</button>
<button type="button" :class="{ active: loginMode === 'mobile' }" @click="switchLoginMode('mobile')">{{ $t('loginDialog.signInWithCode') }}</button>
</div>
<el-form ref="loginForm" :model="loginForm" :rules="activeLoginRules" label-position="top">
<template v-if="loginMode === 'password'">
<el-form-item prop="username">
<el-input v-model.trim="loginForm.username" placeholder="请输入账户" prefix-icon="el-icon-user" @keyup.enter.native="handleLogin" />
<el-input v-model.trim="loginForm.username" :placeholder="$t('loginDialog.enterAccount')" prefix-icon="el-icon-user" @keyup.enter.native="handleLogin" />
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
:type="loginPwdVisible ? 'text' : 'password'"
placeholder="请输入密码"
:placeholder="$t('loginDialog.enterPassword')"
prefix-icon="el-icon-lock"
@keyup.enter.native="handleLogin"
>
@ -48,11 +48,11 @@
<template v-else>
<el-form-item prop="mobile">
<el-input v-model.trim="loginForm.mobile" placeholder="请输入手机号" prefix-icon="el-icon-mobile-phone" />
<el-input v-model.trim="loginForm.mobile" :placeholder="$t('loginDialog.enterMobile')" prefix-icon="el-icon-mobile-phone" />
</el-form-item>
<el-form-item prop="vcode">
<div class="code-row">
<el-input v-model.trim="loginForm.vcode" placeholder="请输入验证码" prefix-icon="el-icon-key" @keyup.enter.native="handleLogin" />
<el-input v-model.trim="loginForm.vcode" :placeholder="$t('loginDialog.enterVerificationCode')" prefix-icon="el-icon-key" @keyup.enter.native="handleLogin" />
<button type="button" class="code-btn" :disabled="loginCodeDisabled" @click="getLoginCode">{{ loginCodeText }}</button>
</div>
</el-form-item>
@ -60,36 +60,36 @@
</el-form>
<div class="form-actions">
<button type="button" class="text-btn" @click="forgotPasswordVisible = true">忘记密码</button>
<button type="button" class="text-btn" @click="switchTab('register')">没有账号去注册</button>
<button type="button" class="text-btn" @click="forgotPasswordVisible = true">{{ $t('loginDialog.forgotPassword') }}</button>
<button type="button" class="text-btn" @click="switchTab('register')">{{ $t('loginDialog.noAccountSignUp') }}</button>
</div>
<button type="button" class="main-btn" :disabled="loginLoading" @click="handleLogin">
{{ loginLoading ? '登录中...' : '立即登录' }}
{{ loginLoading ? $t('loginDialog.signingIn') : $t('loginDialog.signInNow') }}
</button>
</div>
<div v-else class="form-panel">
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" label-position="top">
<el-form-item prop="mobile">
<el-input v-model.trim="registerForm.mobile" class="phone-input" placeholder="请输入手机号">
<el-input v-model.trim="registerForm.mobile" class="phone-input" :placeholder="$t('loginDialog.enterMobile')">
<span slot="prefix" class="country-prefix">+86</span>
</el-input>
</el-form-item>
<el-form-item prop="vcode">
<div class="code-row">
<el-input v-model.trim="registerForm.vcode" placeholder="请输入验证码" prefix-icon="el-icon-key" />
<el-input v-model.trim="registerForm.vcode" :placeholder="$t('loginDialog.enterVerificationCode')" prefix-icon="el-icon-key" />
<button type="button" class="code-btn" :disabled="regCodeDisabled" @click="getRegisterCode">{{ regCodeText }}</button>
</div>
</el-form-item>
<el-form-item prop="username">
<el-input v-model.trim="registerForm.username" placeholder="请输入账户名" prefix-icon="el-icon-user" />
<el-input v-model.trim="registerForm.username" :placeholder="$t('loginDialog.enterAccountName')" prefix-icon="el-icon-user" />
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="registerForm.password"
:type="regPwdVisible ? 'text' : 'password'"
placeholder="请输入密码"
:placeholder="$t('loginDialog.enterPassword')"
prefix-icon="el-icon-lock"
@keyup.enter.native="handleRegister"
>
@ -100,19 +100,18 @@
<div class="agreement-wrap">
<el-checkbox v-model="registerForm.agree">
我已阅读并同意
<a class="agreement-link" :href="getAgreementUrl('user')" target="_blank" rel="noopener noreferrer" @click.stop>用户协议</a>
<a class="agreement-link" :href="getAgreementUrl('privacy')" target="_blank" rel="noopener noreferrer" @click.stop>隐私政策</a>
{{ $t('loginDialog.agreePrefix') }}
<a class="agreement-link" :href="getAgreementUrl('user')" target="_blank" rel="noopener noreferrer" @click.stop>{{ $t('loginDialog.userAgreement') }}</a>
{{ $t('loginDialog.agreeAnd') }}
<a class="agreement-link" :href="getAgreementUrl('privacy')" target="_blank" rel="noopener noreferrer" @click.stop>{{ $t('loginDialog.privacyPolicy') }}</a>
</el-checkbox>
</div>
<button type="button" class="main-btn" :disabled="registerLoading" @click="handleRegister">
{{ registerLoading ? '注册中...' : '立即注册' }}
{{ registerLoading ? $t('loginDialog.signingUp') : $t('loginDialog.signUpNow') }}
</button>
<button type="button" class="bottom-link" @click="switchTab('login')">已有账号前往登录</button>
<button type="button" class="bottom-link" @click="switchTab('login')">{{ $t('loginDialog.hasAccountSignIn') }}</button>
</div>
</div>
</el-dialog>
@ -139,12 +138,6 @@ export default {
}
},
data() {
const validatePhone = (rule, value, callback) => {
if (!value) callback(new Error('请输入手机号'))
else if (!/^1[3-9]\d{9}$/.test(value)) callback(new Error('请输入正确的手机号'))
else callback()
}
return {
activeTab: 'login',
loginMode: 'password',
@ -155,8 +148,8 @@ export default {
regPwdVisible: false,
loginCodeDisabled: false,
regCodeDisabled: false,
loginCodeText: '获取验证码',
regCodeText: '获取验证码',
loginCodeText: '',
regCodeText: '',
loginTimer: null,
regTimer: null,
loginCount: 60,
@ -178,18 +171,6 @@ export default {
agree: false,
wechat_openid: localStorage.getItem('wechat_openid') || '',
domain_name: window.location.hostname
},
loginRules: {
username: [{ required: true, message: '请输入账户', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
mobile: [{ required: true, validator: validatePhone, trigger: 'blur' }],
vcode: [{ required: true, message: '请输入验证码', trigger: 'blur' }]
},
registerRules: {
mobile: [{ required: true, validator: validatePhone, trigger: 'blur' }],
vcode: [{ required: true, message: '请输入验证码', trigger: 'blur' }],
username: [{ required: true, message: '请输入账户名', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
}
}
},
@ -213,13 +194,50 @@ export default {
username: this.loginRules.username,
password: this.loginRules.password
}
},
loginRules() {
return {
username: [{ required: true, message: this.$t('loginDialog.accountRequired'), trigger: 'blur' }],
password: [{ required: true, message: this.$t('loginDialog.passwordRequired'), trigger: 'blur' }],
mobile: [{ required: true, validator: this.validatePhone, trigger: 'blur' }],
vcode: [{ required: true, message: this.$t('loginDialog.codeRequired'), trigger: 'blur' }]
}
},
registerRules() {
return {
mobile: [{ required: true, validator: this.validatePhone, trigger: 'blur' }],
vcode: [{ required: true, message: this.$t('loginDialog.codeRequired'), trigger: 'blur' }],
username: [{ required: true, message: this.$t('loginDialog.accountNameRequired'), trigger: 'blur' }],
password: [{ required: true, message: this.$t('loginDialog.passwordRequired'), trigger: 'blur' }]
}
}
},
watch: {
'$i18n.locale'() {
this.resetCodeButtonText()
}
},
created() {
this.resetCodeButtonText()
},
beforeDestroy() {
clearInterval(this.loginTimer)
clearInterval(this.regTimer)
},
methods: {
validatePhone(rule, value, callback) {
if (!value) callback(new Error(this.$t('loginDialog.mobileRequired')))
else if (!/^1[3-9]\d{9}$/.test(value)) callback(new Error(this.$t('loginDialog.mobileInvalid')))
else callback()
},
resetCodeButtonText() {
if (!this.loginCodeDisabled) {
this.loginCodeText = this.$t('loginDialog.getVerificationCode')
}
if (!this.regCodeDisabled) {
this.regCodeText = this.$t('loginDialog.getVerificationCode')
}
},
handleClose() {
this.loginLoading = false
this.registerLoading = false
@ -284,18 +302,18 @@ export default {
clearInterval(this[timerKey])
this[countKey] = 59
this[disabledKey] = true
this[textKey] = `重新发送 ${this[countKey]}s`
this[textKey] = this.$t('loginDialog.resendCode', { seconds: this[countKey] })
this[timerKey] = setInterval(() => {
if (this[countKey] > 0) {
this[countKey] -= 1
this[textKey] = `重新发送 ${this[countKey]}s`
this[textKey] = this.$t('loginDialog.resendCode', { seconds: this[countKey] })
return
}
clearInterval(this[timerKey])
this[timerKey] = null
this[countKey] = 60
this[disabledKey] = false
this[textKey] = '获取验证码'
this[textKey] = this.$t('loginDialog.getVerificationCode')
}, 1000)
},
getLoginCode() {
@ -306,12 +324,12 @@ export default {
if (res.status) {
this.loginForm.codeid = res.codeid || (res.data && res.data.codeid) || ''
this.startCountdown('login')
this.$message.success('验证码已发送')
this.$message.success(this.$t('loginDialog.codeSent'))
} else {
this.$message.error(res.msg || '验证码获取失败')
this.$message.error(res.msg || this.$t('loginDialog.codeSendFail'))
}
} catch (error) {
this.$message.error('验证码获取失败')
this.$message.error(this.$t('loginDialog.codeSendFail'))
}
})
},
@ -323,12 +341,12 @@ export default {
if (res.status) {
this.registerForm.codeid = res.codeid || (res.data && res.data.codeid) || res.data || ''
this.startCountdown('register')
this.$message.success('验证码已发送')
this.$message.success(this.$t('loginDialog.codeSent'))
} else {
this.$message.error(res.msg || '验证码获取失败')
this.$message.error(res.msg || this.$t('loginDialog.codeSendFail'))
}
} catch (error) {
this.$message.error('验证码获取失败')
this.$message.error(this.$t('loginDialog.codeSendFail'))
}
})
},
@ -340,12 +358,12 @@ export default {
try {
const check = await logintypeAPI(loginParams)
if (!check.status) {
this.$message.error(check.msg || '登录失败')
this.$message.error(check.msg || this.$t('loginDialog.loginFail'))
return
}
const res = await this.$store.dispatch('user/login', loginParams)
if (!res.status) {
this.$message.error(res.msg || '登录失败')
this.$message.error(res.msg || this.$t('loginDialog.loginFail'))
return
}
@ -377,12 +395,12 @@ export default {
})
router.addRoutes(accessRoutes)
this.$message.success(res.msg || '登录成功')
this.$message.success(res.msg || this.$t('loginDialog.loginSuccess'))
this.dialogVisible = false
this.$emit('success', res)
this.redirectAfterLogin(res)
} catch (error) {
this.$message.error((error && error.msg) || '登录失败')
this.$message.error((error && error.msg) || this.$t('loginDialog.loginFail'))
} finally {
this.loginLoading = false
}
@ -434,7 +452,7 @@ export default {
},
handleRegister() {
if (!this.registerForm.agree) {
this.$message.warning('请先阅读并同意相关协议')
this.$message.warning(this.$t('loginDialog.agreeRequired'))
return
}
this.$refs.registerForm.validate(async valid => {
@ -454,17 +472,17 @@ export default {
}
const res = await register(registerData)
if (res.status) {
this.$message.success('注册成功,请登录')
this.$message.success(this.$t('loginDialog.registerSuccess'))
this.loginForm.mobile = this.registerForm.mobile
this.switchTab('login')
this.loginMode = 'mobile'
this.$refs.registerForm.resetFields()
this.registerForm.agree = false
} else {
this.$message.error(res.message || res.msg || '注册失败')
this.$message.error(res.message || res.msg || this.$t('loginDialog.registerFail'))
}
} catch (error) {
this.$message.error('注册失败,请重试')
this.$message.error(this.$t('loginDialog.registerRetry'))
} finally {
this.registerLoading = false
}
@ -628,7 +646,7 @@ export default {
}
.form-panel ::v-deep .el-form-item {
margin-bottom: 16px;
margin-bottom: 22px;
}
.form-panel ::v-deep .el-form-item__error {

View File

@ -54,7 +54,13 @@
<button v-if="!isNcmatchDomain" type="button" class="nav-item" @click.stop="goHomeAnchor('cases-section')">
{{ $t('topbar.cases') }}
</button>
<button v-if="!isNcmatchDomain" type="button" class="nav-item" @click.stop="goHomeAnchor('news')">
<button
v-if="!isNcmatchDomain"
type="button"
class="nav-item"
:class="{ active: isActiveNews }"
@click.stop="navigateTo('/homePage/news')"
>
{{ $t('topbar.news') }}
</button>
<button
@ -329,6 +335,9 @@ export default Vue.extend({
? this.$route.path.includes('/ncmatchHome/index')
: this.$route.path.includes('/homePage/index')
},
isActiveNews() {
return this.$route.path.includes('/homePage/news')
},
langToggleText() {
return this.activeLocale === 'en-US' ? 'EN/中' : '中/EN'
},
@ -462,15 +471,24 @@ export default Vue.extend({
},
goHomeAnchor(id) {
this.closeProductPanelImmediate()
const scrollToTarget = () => {
const scrollToTarget = (attempt = 0) => {
const target = document.getElementById(id)
if (target) target.scrollIntoView({ behavior: 'smooth', block: 'start' })
if (target) {
target.scrollIntoView({ behavior: 'smooth', block: 'start' })
return true
}
if (attempt < 30) {
window.setTimeout(() => scrollToTarget(attempt + 1), 100)
}
return false
}
if (this.$route.path.includes('/homePage/index')) {
this.$nextTick(scrollToTarget)
this.$nextTick(() => {
window.setTimeout(() => scrollToTarget(), 80)
})
return
}
this.$router.push('/homePage/index').then(() => this.$nextTick(scrollToTarget)).catch(() => {})
this.$router.push({ path: '/homePage/index', query: { anchor: id } }).catch(() => {})
},
handleModelSquareClick() {
this.closeProductPanelImmediate()

View File

@ -247,15 +247,38 @@ export default Vue.extend({
},
},
mounted() {
this.scrollToRouteAnchor()
},
watch: {
'$route.fullPath'() {
this.$nextTick(() => {
if (this.scrollToRouteAnchor()) return
this.scrollHomeToTop()
window.setTimeout(this.scrollHomeToTop, 0)
})
}
},
methods: {
scrollToRouteAnchor() {
const anchor = this.$route.query.anchor
if (!anchor || !this.$route.path.includes('/homePage/index')) return false
window.setTimeout(() => {
this.scrollToElementWithRetry(anchor)
}, 120)
return true
},
scrollToElementWithRetry(id, attempt = 0) {
const element = document.getElementById(id)
if (element) {
element.scrollIntoView({ behavior: 'smooth', block: 'start' })
return true
}
if (attempt < 30) {
window.setTimeout(() => this.scrollToElementWithRetry(id, attempt + 1), 100)
}
return false
},
scrollHomeToTop() {
const container = this.$el
if (container) container.scrollTop = 0
@ -335,9 +358,11 @@ export default Vue.extend({
<style scoped lang="scss">
.homeOut {
//padding-top: 60px;
width: 100%;
min-width: 0;
height: 100%;
overflow: auto !important;
min-width: 1500px;
overflow-x: hidden;
overflow-y: auto !important;
// background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 60%, #f5f8ff 100%);
}
#topBox{
@ -350,6 +375,7 @@ export default Vue.extend({
.home-router-view {
width: 100%;
min-width: 0;
padding-top: 0;
box-sizing: border-box;
}

View File

@ -570,6 +570,8 @@ export default {
<style scoped lang="scss">
.home-main-page {
width: 100%;
min-width: 0;
min-height: 100vh;
background-color: #f0f7ff !important;
background-image: linear-gradient(180deg, #f0f7ff 0%, #ffffff 60%, #f5f8ff 100%) !important;
@ -640,7 +642,7 @@ body.dark-theme .bg-orb {
display: flex;
align-items: center;
justify-content: center;
padding: 120px 24px 96px;
padding: 120px 5% 96px;
box-sizing: border-box;
overflow: hidden;
background: transparent;
@ -754,7 +756,7 @@ body.dark-theme .bg-orb {
.ai-solution-section {
position: relative;
padding: 60px 24px 110px;
padding: 60px 5% 110px;
scroll-margin-top: 90px;
overflow: hidden;
background: transparent;
@ -1151,7 +1153,7 @@ body.dark-theme .bg-orb {
.case-section {
position: relative;
padding: 96px 24px 112px;
padding: 96px 5% 112px;
background: transparent;
}
@ -1357,7 +1359,7 @@ body.dark-theme .bg-orb {
.news-section {
position: relative;
padding: 96px 24px 112px;
padding: 96px 5% 112px;
overflow: hidden;
background: transparent;
}

View File

@ -6,24 +6,24 @@
<i class="el-icon-lock"></i>
</div>
<div>
<h3>重置密码</h3>
<p>通过手机号验证码验证身份后设置新密码</p>
<h3>{{ $t('loginDialog.resetPassword') }}</h3>
<p>{{ $t('loginDialog.resetPasswordDesc') }}</p>
</div>
</div>
<el-form ref="formRef" :model="form" :rules="rules" label-position="top" class="forgot-form" autocomplete="off">
<el-form-item label="手机号" prop="username">
<el-input v-model="form.username" clearable autocomplete="off" placeholder="请输入绑定手机号"></el-input>
<el-form-item :label="`* ${$t('loginDialog.mobileLabel')}`" prop="username">
<el-input v-model="form.username" clearable autocomplete="off" :placeholder="$t('loginDialog.enterBoundMobile')"></el-input>
</el-form-item>
<el-form-item label="新密码" prop="password">
<el-form-item :label="`* ${$t('loginDialog.newPasswordLabel')}`" prop="password">
<el-input v-model="form.password" clearable show-password autocomplete="new-password"
placeholder="请输入新密码"></el-input>
:placeholder="$t('loginDialog.enterNewPassword')"></el-input>
</el-form-item>
<el-form-item label="验证码" prop="vcode">
<el-form-item :label="`* ${$t('loginDialog.verificationCodeLabel')}`" prop="vcode">
<div class="code-row">
<el-input v-model="form.vcode" clearable autocomplete="off" placeholder="请输入验证码"></el-input>
<el-input v-model="form.vcode" clearable autocomplete="off" :placeholder="$t('loginDialog.enterVerificationCode')"></el-input>
<el-button class="code-btn" :disabled="isDisabled || isGettingCode" :loading="isGettingCode"
@click="debouncedGetCode">
{{ sendCodeText }}
@ -33,8 +33,8 @@
</el-form>
<div slot="footer" class="forgot-footer">
<el-button @click="handleClose">取消</el-button>
<el-button class="confirm-btn" type="primary" :loading="submitting" @click="handleSubmit">确认重置</el-button>
<el-button @click="handleClose">{{ $t('loginDialog.cancel') }}</el-button>
<el-button class="confirm-btn" type="primary" :loading="submitting" @click="handleSubmit">{{ $t('loginDialog.confirmReset') }}</el-button>
</div>
</el-dialog>
</template>
@ -53,15 +53,7 @@ export default {
data() {
return {
form: this.createEmptyForm(),
rules: {
username: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
],
password: [{ required: true, message: '请输入新密码', trigger: 'blur' }],
vcode: [{ required: true, message: '请输入验证码', trigger: 'blur' }]
},
sendCodeText: '获取验证码',
sendCodeText: '',
isDisabled: false,
isGettingCode: false,
submitting: false,
@ -70,11 +62,36 @@ export default {
debounceTimer: null
}
},
computed: {
rules() {
return {
username: [
{ required: true, message: this.$t('loginDialog.mobileRequired'), trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: this.$t('loginDialog.mobileInvalid'), trigger: 'blur' }
],
password: [{ required: true, message: this.$t('loginDialog.newPasswordRequired'), trigger: 'blur' }],
vcode: [{ required: true, message: this.$t('loginDialog.codeRequired'), trigger: 'blur' }]
}
}
},
watch: {
'$i18n.locale'() {
this.resetCodeButtonText()
}
},
created() {
this.resetCodeButtonText()
},
beforeDestroy() {
this.resetCodeState()
clearTimeout(this.debounceTimer)
},
methods: {
resetCodeButtonText() {
if (!this.isDisabled) {
this.sendCodeText = this.$t('loginDialog.getVerificationCode')
}
},
handleOpen() {
this.resetForm()
this.$nextTick(() => {
@ -110,7 +127,7 @@ export default {
async getCode() {
if (!this.form.username || !/^1[3-9]\d{9}$/.test(this.form.username)) {
this.isGettingCode = false
this.$message.error('请输入正确的手机号')
this.$message.error(this.$t('loginDialog.mobileInvalid'))
return
}
@ -123,13 +140,13 @@ export default {
if (res.status === true) {
this.form.codeid = res.codeid
this.startCountdown()
this.$message.success('验证码已发送,请注意查收。')
this.$message.success(this.$t('loginDialog.codeSentCheck'))
return
}
this.$message.error(res.msg || '验证码获取失败')
this.$message.error(res.msg || this.$t('loginDialog.codeSendFail'))
} catch (error) {
this.$message.error('验证码获取失败')
this.$message.error(this.$t('loginDialog.codeSendFail'))
} finally {
this.isGettingCode = false
}
@ -137,20 +154,20 @@ export default {
startCountdown() {
this.timeCount = 59
this.isDisabled = true
this.sendCodeText = `重新发送${this.timeCount}s`
this.sendCodeText = this.$t('loginDialog.resendCode', { seconds: this.timeCount })
clearInterval(this.timer)
this.timer = setInterval(() => {
if (this.timeCount > 0) {
this.timeCount--
this.sendCodeText = `重新发送${this.timeCount}s`
this.sendCodeText = this.$t('loginDialog.resendCode', { seconds: this.timeCount })
return
}
this.resetCodeState()
}, 1000)
},
resetCodeState() {
this.sendCodeText = '获取验证码'
this.sendCodeText = this.$t('loginDialog.getVerificationCode')
clearInterval(this.timer)
this.timer = null
this.isDisabled = false
@ -160,7 +177,7 @@ export default {
this.$refs.formRef.validate(async valid => {
if (!valid) return
if (!this.form.codeid) {
this.$message.error('请先获取验证码')
this.$message.error(this.$t('loginDialog.getCodeFirst'))
return
}
@ -175,14 +192,14 @@ export default {
})
if (res.status === true) {
this.$message.success('密码重置成功')
this.$message.success(this.$t('loginDialog.resetSuccess'))
this.handleClose()
return
}
this.$message.error(res.msg || '密码重置失败')
this.$message.error(res.msg || this.$t('loginDialog.resetFail'))
} catch (error) {
this.$message.error('密码重置失败')
this.$message.error(this.$t('loginDialog.resetFail'))
} finally {
this.submitting = false
}
@ -250,7 +267,14 @@ export default {
.forgot-form {
.el-form-item {
margin-bottom: 22px;
margin-bottom: 28px;
}
.el-form-item__error {
position: static;
margin-top: 6px;
padding-top: 0;
line-height: 1.4;
}
.el-form-item__label {