Handy_Cao 1 year ago
parent
commit
dde2df9b06
1 changed files with 7 additions and 5 deletions
  1. 7 5
      src/packages/mobile/views/user/avatar/Index.vue

+ 7 - 5
src/packages/mobile/views/user/avatar/Index.vue

@@ -1,11 +1,11 @@
 <template>
     <app-view class="g-form">
         <template #header>
-            <app-navbar title="头像" />
+            <app-navbar :title="$t('user.avater.title')" />
         </template>
         <Form ref="formRef" class="g-form__container" @submit="onSubmit">
             <CellGroup inset>
-                <Field label="用户头像" :rules="formRules.headurl">
+                <Field :label="$t('user.avater.cardbackphotourl')" :rules="formRules.headurl">
                     <template #input>
                         <app-uploader @success="onUploadSuccess" />
                     </template>
@@ -14,7 +14,7 @@
         </Form>
         <template #footer>
             <div class="g-form__footer inset">
-                <Button round block type="danger" @click="formRef?.submit">确定</Button>
+                <Button round block type="danger" @click="formRef?.submit">{{ $t('operation.confirm') }}</Button>
             </div>
         </template>
     </app-view>
@@ -26,13 +26,15 @@ import { CellGroup, Button, Field, Form, FormInstance, FieldRule, showFailToast
 import { fullloading } from '@/utils/vant'
 import { useNavigation } from '@mobile/router/navigation'
 import { updateUserHeadUrl } from '@/services/api/user'
-import { useLoginStore, useUserStore } from '@/stores'
+import { useLoginStore, useUserStore, i18n } from '@/stores'
 import AppUploader from '@mobile/components/base/uploader/index.vue'
 
 const { router } = useNavigation()
 const loginStore = useLoginStore()
 const userStore = useUserStore()
 
+const { global: { t } } = i18n
+
 const formRef = shallowRef<FormInstance>()
 const formData = reactive<Model.UserHeadUrlReq>({
     userid: loginStore.userId, // 用户ID
@@ -42,7 +44,7 @@ const formData = reactive<Model.UserHeadUrlReq>({
 // 表单验证规则
 const formRules: { [key in keyof Model.UserHeadUrlReq]?: FieldRule[] } = {
     headurl: [{
-        message: '请上传头像',
+        message: t('user.avater.tips1'),
         validator: () => {
             return !!formData.headurl
         }