From 6a7bb6b41bd7f5868c2d6cee59be5e597d9eeb93 Mon Sep 17 00:00:00 2001 From: lxy Date: Mon, 12 May 2025 15:16:55 +0800 Subject: [PATCH] =?UTF-8?q?user/info=E7=BB=84=E4=BB=B6=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9Amp=E4=BD=BF=E7=94=A8extrafile/commit=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=9B=E5=BD=93=E7=94=A8=E6=88=B7=E5=B7=B2=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=97=B6=E4=B8=8D=E5=85=81=E8=AE=B8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=A7=93=E5=90=8D=E3=80=81=E6=80=A7=E5=88=AB=E3=80=81?= =?UTF-8?q?=E7=94=9F=E6=97=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/components/user/info/index.js | 39 ++++++++++--- es/components/user/info/index.json | 3 +- es/components/user/info/index.xml | 41 +++++++++----- es/components/user/info/locales/zh_CN.json | 3 +- es/components/user/info/web.d.ts | 1 + es/components/user/info/web.js | 8 +-- es/components/user/info/web.pc.d.ts | 1 + es/components/user/info/web.pc.js | 10 ++-- es/data/i18n.js | 3 +- lib/data/i18n.js | 3 +- src/components/user/info/index.json | 5 +- src/components/user/info/index.ts | 62 ++++++++++++++------- src/components/user/info/index.xml | 41 +++++++++----- src/components/user/info/locales/zh_CN.json | 3 +- src/components/user/info/web.pc.tsx | 10 ++-- src/components/user/info/web.tsx | 5 ++ src/data/i18n.ts | 3 +- 17 files changed, 162 insertions(+), 79 deletions(-) diff --git a/es/components/user/info/index.js b/es/components/user/info/index.js index 972ca439e..6e3da3259 100644 --- a/es/components/user/info/index.js +++ b/es/components/user/info/index.js @@ -89,6 +89,9 @@ export default OakComponent({ const canSyncPublic = token?.wechatUser?.applicationId === app.id; const editable = user && user.$$createAt$$ === 1 || user['#oakLegalActions']?.includes('update'); const executable = this.tryExecute(); + const commitBtnProps = { + disabled: executable === true, + }; return { id: user?.id, name: user?.name, @@ -119,6 +122,7 @@ export default OakComponent({ editable, executable, isCreation: this.isCreation(), + commitBtnProps, }; }, data: { @@ -172,6 +176,16 @@ export default OakComponent({ }); } }, + checkIdState() { + if (this.state.idState === 'verified') { + this.setMessage({ + type: 'warning', + content: this.t('notAllowUpdate') + }); + return false; + } + return true; + }, async refreshWechatPublicUserInfo() { this.checkEditable('nickname'); this.setState({ @@ -248,21 +262,28 @@ export default OakComponent({ }, editName() { this.checkEditable('name'); - this.setState({ - editAttr: 'name', - }); + if (this.checkIdState()) { + this.setState({ + editAttr: 'name', + }); + } }, editGender() { this.checkEditable('gender'); - this.setState({ - editAttr: 'gender', - }); + const { idState } = this.state; + if (this.checkIdState()) { + this.setState({ + editAttr: 'gender', + }); + } }, editBirth() { this.checkEditable('birth'); - this.setState({ - editAttr: 'birth', - }); + if (this.checkIdState()) { + this.setState({ + editAttr: 'birth', + }); + } }, cancelEdit() { this.setState({ diff --git a/es/components/user/info/index.json b/es/components/user/info/index.json index 7b1beae1c..a3a67a11c 100644 --- a/es/components/user/info/index.json +++ b/es/components/user/info/index.json @@ -12,6 +12,7 @@ "l-radio-group": "@oak-frontend-base/miniprogram_npm/lin-ui/radio-group/index", "l-radio": "@oak-frontend-base/miniprogram_npm/lin-ui/radio/index", "l-form-item": "@oak-frontend-base/miniprogram_npm/lin-ui/form-item/index", - "oak-extraFile-avatar": "../../../components/extraFile/avatar/index" + "oak-extraFile-avatar": "../../../components/extraFile/avatar/index", + "oak-commit": "../../../components/extraFile/commit/index" } } diff --git a/es/components/user/info/index.xml b/es/components/user/info/index.xml index 00681d22e..23b640288 100644 --- a/es/components/user/info/index.xml +++ b/es/components/user/info/index.xml @@ -1,6 +1,6 @@ - + --> + + /> {{nickname || '未设置'}} @@ -41,7 +46,7 @@ + disabled="{{!editable || idState === 'verified'}}" + /> {{name || '未设置'}} @@ -62,19 +67,21 @@ {{genderStr || '未设置'}} - + {{ birthText || '选择日期'}} + {{birthText || '未设置'}} @@ -95,11 +102,11 @@ /> - {{hasPassword ? '******' : '未设置'}} + {{hasPassword ? '******' : '未设置'}} - - + + {{userStateStr || '未设置'}} @@ -113,19 +120,25 @@ - + + @@ -145,7 +158,7 @@ -
@@ -24,7 +24,7 @@ export default function render(props) { {name ? name : t('unset')}
) : ( update({ name: value, - })} onBlur={() => cancelEdit()} onEnterPress={() => cancelEdit()}/>)} onClick={editAttr === 'name' ? undefined : () => editName()}> + })} onBlur={() => cancelEdit()} onEnterPress={() => cancelEdit()}/>)} onClick={editAttr === 'name' ? undefined : () => editName()} clickable={editable && idState !== 'verified'}> {t('user:attr.name')} @@ -40,12 +40,12 @@ export default function render(props) { {ele.label} ))} - )} onClick={editAttr === 'gender' ? undefined : () => editGender()}> + )} onClick={editAttr === 'gender' ? undefined : () => editGender()} clickable={editable && idState !== 'verified'}> {t('user:attr.gender')} {birth ? dayjs(birth).format('YYYY-MM-DD') : t('unset')} - } onClick={editAttr === 'birth' ? undefined : () => editBirth()}> + } onClick={editAttr === 'birth' ? undefined : () => editBirth()} clickable={editable && idState !== 'verified'}> {t('user:attr.birth')} {!isCreation && { diff --git a/es/components/user/info/web.pc.d.ts b/es/components/user/info/web.pc.d.ts index 195d49747..98a15c94b 100644 --- a/es/components/user/info/web.pc.d.ts +++ b/es/components/user/info/web.pc.d.ts @@ -21,6 +21,7 @@ export default function Render(props: WebComponentProps void; sendCaptcha: () => void; diff --git a/es/components/user/info/web.pc.js b/es/components/user/info/web.pc.js index ee5510c69..f02213643 100644 --- a/es/components/user/info/web.pc.js +++ b/es/components/user/info/web.pc.js @@ -10,7 +10,7 @@ import Style from './web.module.less'; export default function Render(props) { const { data, methods } = props; const { t, updateMyInfo, editMobile, goAuthenticate, sendCaptcha, unbindingWechat, editPassword, } = methods; - const { nickname, name, birth, gender, mobile, oakExecuting, genderOptions, oakFullpath, oakDirty, wechatUser, editable, userStateColor, userStateStr, idStateColor, idStateStr, isRoot, isCreation, } = data; + const { nickname, name, birth, gender, mobile, oakExecuting, genderOptions, oakFullpath, oakDirty, wechatUser, editable, userStateColor, userStateStr, idStateColor, idStateStr, isRoot, isCreation, idState, } = data; const [open, setOpen] = useState(false); const [open2, setOpen2] = useState(false); return (
@@ -27,7 +27,7 @@ export default function Render(props) { }, ]}> <> - methods.update({ + methods.update({ name: e.target.value, })} value={name}/> @@ -45,14 +45,14 @@ export default function Render(props) { - { + { methods.update({ gender: value }); }}/> <> - { + { if (dayjs(current).valueOf() > dayjs().valueOf()) { return true; @@ -111,7 +111,7 @@ export default function Render(props) { {'********'} - {editable && + --> + + /> {{nickname || '未设置'}} @@ -41,7 +46,7 @@ + disabled="{{!editable || idState === 'verified'}}" + /> {{name || '未设置'}} @@ -62,19 +67,21 @@ {{genderStr || '未设置'}} - + {{ birthText || '选择日期'}} + {{birthText || '未设置'}} @@ -95,11 +102,11 @@ /> - {{hasPassword ? '******' : '未设置'}} + {{hasPassword ? '******' : '未设置'}} - - + + {{userStateStr || '未设置'}} @@ -113,19 +120,25 @@ - + + @@ -145,7 +158,7 @@ - void; @@ -88,6 +89,7 @@ export default function Render( idStateStr, isRoot, isCreation, + idState, } = data; const [open, setOpen] = useState(false); const [open2, setOpen2] = useState(false); @@ -118,7 +120,7 @@ export default function Render( > <> methods.update({ @@ -156,7 +158,7 @@ export default function Render( > { @@ -175,7 +177,7 @@ export default function Render( > <> {'********'} - {editable &&
} onClick={editAttr === 'birth' ? undefined : () => editBirth()} + clickable={editable && idState !== 'verified'} > {t('user:attr.birth')}
diff --git a/src/data/i18n.ts b/src/data/i18n.ts index ce40bd118..38d343fc6 100644 --- a/src/data/i18n.ts +++ b/src/data/i18n.ts @@ -304,7 +304,8 @@ const i18ns: I18n[] = [ "secuInfo": "安全信息", "wechatAccount": "微信帐号", "bindMobile": "绑定手机号", - "bindWechat": "绑定微信" + "bindWechat": "绑定微信", + "notAllowUpdate": "暂不支持更新" } }, {