Xiao_123 11 miesięcy temu
rodzic
commit
69b85fd3cc

+ 2 - 1
components.d.ts

@@ -21,7 +21,7 @@ declare module 'vue' {
     CtPagination: typeof import('./src/components/CtPagination/index.vue')['default']
     CtSearch: typeof import('./src/components/CtSearch/index.vue')['default']
     CtTextField: typeof import('./src/components/CtVuetify/CtTextField/index.vue')['default']
-    DatePicker: typeof import('./src/components/DatePicker/index.vue')['default']
+    DatePicker: typeof import('./src/components/FormUI/datePicker/index.vue')['default']
     Details: typeof import('./src/components/Enterprise/details.vue')['default']
     Empty: typeof import('./src/components/Empty/index.vue')['default']
     HeadSearch: typeof import('./src/components/headSearch/index.vue')['default']
@@ -40,6 +40,7 @@ declare module 'vue' {
     SimilarPositions: typeof import('./src/components/Position/similarPositions.vue')['default']
     TextArea: typeof import('./src/components/FormUI/textArea/index.vue')['default']
     TextInput: typeof import('./src/components/FormUI/TextInput/index.vue')['default']
+    Upload: typeof import('./src/components/Upload/index.vue')['default']
     VerificationCode: typeof import('./src/components/VerificationCode/index.vue')['default']
   }
 }

+ 27 - 12
src/components/VerificationCode/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <v-form @submit.prevent ref="phoneForm">
-      <v-text-field v-model="loginData.phone" placeholder="请输入手机号" color="primary" variant="outlined" density="compact" :rules="phoneRules" validate-on="input">
+      <v-text-field v-model="loginData.phone" :placeholder="$t('login.mobileNumberPlaceholder')" color="primary" variant="outlined" density="compact" :rules="phoneRules" validate-on="input">
         <template v-slot:prepend-inner>
           <span class="d-flex">
             <v-icon icon="mdi-cellphone" size="20"></v-icon>
@@ -19,10 +19,19 @@
           </span>
         </template>
       </v-text-field>
-      <v-text-field v-model="loginData.code" placeholder="请输入验证码" color="primary" variant="outlined" density="compact" prepend-inner-icon="mdi-security" :rules="[v=> !!v || '请填写验证码']">
+      <v-text-field 
+        v-model="loginData.code" 
+        :placeholder="$t('login.enterCode')" 
+        color="primary" 
+        variant="outlined" 
+        density="compact" 
+        prepend-inner-icon="mdi-security" 
+        :rules="[v=> !!v || $t('login.enterCode')]"
+        @keyup.enter="handleEnter"
+      >
         <template #append-inner>
-          <span v-if="showCode" class="login-code" @click="handleCode">获取验证码</span>
-          <span v-else class="disable">重新获取{{ count }}s</span>
+          <span v-if="showCode" class="login-code" @click="handleCode">{{ $t('login.getSmsCode') }}</span>
+          <span v-else class="disable">{{ $t('login.retrieveAgain') }}{{ count }}s</span>
         </template>
       </v-text-field>
     </v-form>
@@ -31,19 +40,22 @@
 
 <script setup>
 defineOptions({ name: 'verification-code' })
-import { ref, reactive, defineExpose } from 'vue'
+import { ref, reactive, defineExpose, defineEmits } from 'vue'
 import { setCodeTime } from '@/utils/code'
 import { sendSmsCode } from '@/api/common/index'
+import { useI18n } from '@/hooks/web/useI18n'
 import Snackbar from '@/plugins/snackbar'
 
+const emits = defineEmits(['handleEnter'])
+const { t } = useI18n()
 const phoneRules = ref([
   value => {
     if (value) return true
-    return '请输入手机号'
+    return t('login.mobileNumberPlaceholder')
   },
   value => {
     if (value?.length <= 11 && /^1[3456789]\d{9}$/.test(value)) return true
-    return '请输入正确的手机号码'
+    return t('login.correctPhoneNumber')
   }
 ])
 
@@ -62,7 +74,7 @@ const count = ref(0)
 const timer = ref(null)
 const handleCode = () => {
   if (!loginData.phone) {
-    Snackbar.warning('请输入手机号码')
+    Snackbar.warning(t('login.mobileNumberPlaceholder'))
     return
   }
   count.value = 60
@@ -76,7 +88,7 @@ const getSmsCode = async () => {
   }
   // try {
   await sendSmsCode(query)
-  Snackbar.success('发送成功,请注意查收')
+  Snackbar.success(t('login.sendCode'))
   // } catch (error) {
   //   Snackbar.error(error.msg)
   // }
@@ -108,7 +120,9 @@ const loginData = reactive({
 })
 
 const phoneForm = ref()
-
+const handleEnter = () => {
+  emits('handleEnter')
+}
 defineExpose({
   loginData, 
   phoneForm
@@ -117,8 +131,9 @@ defineExpose({
 
 <style lang="scss" scoped>
 .login-code {
-  width: 62px;
-  color: var(--v-primary-base); 
+  width: 97px;
+  color: var(--v-primary-base);
+  text-align: end; 
   font-size: 12px; 
   cursor: pointer;
 }

+ 1 - 0
src/components/headSearch/index.vue

@@ -32,6 +32,7 @@
       :hide-details="true"
       class="px-2"
       style="height: 100%; line-height: 100%;"
+      @keyup.enter="handleSearch"
     ></v-text-field>
     <div class="searchBtn" @click="handleSearch">搜索</div>
   </div>

+ 23 - 1
src/locales/en.js

@@ -57,7 +57,21 @@ export default {
     checkPassword: 'Confirm password',
     mobileNumber: 'Mobile Number',
     mobileNumberPlaceholder: 'Please Enter Mobile Number',
+    correctPhoneNumber: 'Please enter the correct phone number',
     getSmsCode: 'Get SMS Code',
+    retrieveAgain: 'Retrieve again',
+    sendCode: 'Successfully sent, please check your inbox',
+    enterCode: 'Please enter the verification code',
+    enterPassword: 'Please enter password',
+    smsLogin: 'SMS login',
+    passwordLogin: 'Password login',
+    enterpriseLogin: 'Enterprise login',
+    userAgreement: 'User Agreement',
+    privacyPolicy: 'Privacy Policy',
+    agreeLogin: 'By logging in/registering, you agree to',
+    smsOrPassword: 'SMS, password login or registration',
+    scanWeChatCode: 'Scan WeChat QR code for quick login',
+    loginSuccess: 'Login successful'
   },
   form: {},
   position: {
@@ -79,7 +93,8 @@ export default {
     recruitmentInProgress: 'Recruitment In Progress',
     newPositionsAdded: 'New positions added',
     screen: 'Screen',
-    positionName: 'Please enter the position name'
+    positionName: 'Please enter the position name',
+    popularPosition: 'Popular positions',
   },
   enterprise: {
     moreBtn: 'View More Enterprises',
@@ -109,5 +124,12 @@ export default {
     retract: 'Retract',
     deleteAttachment: 'Are you sure to delete this attachment?',
     uploadFiveCopies: 'Upload up to 5 copies'
+  },
+  setting: {
+    accountSettings: 'Account Settings',
+    accountBinding: 'Account binding',
+    realNameAuthentication: 'Real name authentication',
+    editPassword: 'Change password',
+    privacyPolicySettings: 'Privacy settings'
   }
 }

+ 23 - 1
src/locales/zh-CN.js

@@ -57,7 +57,21 @@ export default {
     checkPassword: '确认密码',
     mobileNumber: '手机号码',
     mobileNumberPlaceholder: '请输入手机号码',
+    correctPhoneNumber: '请输入正确的手机号码',
     getSmsCode: '获取验证码',
+    retrieveAgain: '重新获取',
+    sendCode: '发送成功,请注意查收',
+    enterCode: '请输入验证码',
+    enterPassword: '请输入密码',
+    smsLogin: '短信登录',
+    passwordLogin: '密码登录',
+    enterpriseLogin: '企业登录',
+    userAgreement: '用户协议',
+    privacyPolicy: '隐私政策',
+    agreeLogin: '登录/注册即代表您同意',
+    smsOrPassword: '短信、密码登录或注册',
+    scanWeChatCode: '微信扫码快速登录',
+    loginSuccess: '登录成功'
   },
   form: {},
   position: {
@@ -79,7 +93,8 @@ export default {
     recruitmentInProgress: '招聘中',
     newPositionsAdded: '新增职位',
     screen: '筛选',
-    positionName: '请输入职位名称'
+    positionName: '请输入职位名称',
+    popularPosition: '热门职位'
   },
   enterprise: {
     moreBtn: '查看更多企业',
@@ -109,5 +124,12 @@ export default {
     retract: '收起',
     deleteAttachment: '是否确认删除此附件?',
     uploadFiveCopies: '最多上传5份'
+  },
+  setting: {
+    accountSettings: '账号设置',
+    accountBinding: '账号绑定',
+    realNameAuthentication: '实名认证',
+    editPassword: '修改密码',
+    privacyPolicySettings: '隐私设置'
   }
 }

+ 1 - 1
src/views/Home/personal/account/dynamic/accountBinding.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <h3>账号绑定</h3>
+    <h3>{{ $t('setting.accountBinding') }}</h3>
     <v-divider class="mb-4"></v-divider>
     <div>
       <div class="login-user">当前登录账号: <span>{{ userInfo.phone }}</span> <span class="activeText ml-3">改绑手机号</span></div>

+ 1 - 1
src/views/Home/personal/account/dynamic/editPassword.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <h3>修改密码</h3>
+    <h3>{{ $t('setting.editPassword') }}</h3>
     <v-divider class="mb-4"></v-divider>
     <div class="login-user mb-4">当前登录账号: <span style="color: var(--v-primary-base);">{{ userInfo.phone }}</span></div>
     <v-stepper v-model="stepper" color="primary">

+ 1 - 1
src/views/Home/personal/account/dynamic/privacySettings.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <h3>隐私设置</h3>
+    <h3>{{ $t('setting.privacyPolicySettings') }}</h3>
     <v-divider class="mb-4"></v-divider>
     <v-radio-group v-model="radios">
       <v-radio v-for="k in items" :key="k.value" :label="k.label" :value="k.value" color="primary">

+ 1 - 1
src/views/Home/personal/account/dynamic/realAuthentication.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <h3>实名认证</h3>
+    <h3>{{ $t('setting.realNameAuthentication') }}</h3>
     <v-divider class="mb-4"></v-divider>
     <div class="tips mt-2 mb-1">一经实名认证后将无法修改,请填写真实的实名信息!</div>
   </div>

+ 8 - 5
src/views/Home/personal/account/index.vue

@@ -2,7 +2,7 @@
 <template>
   <div class="d-flex pa-3 default-width" style="height: 700px;">
     <v-card class="left">
-      <h3>账号设置</h3>
+      <h3>{{ $t('setting.accountSettings') }}</h3>
       
       <v-list>
         <v-list-item
@@ -24,11 +24,14 @@
 
 <script setup>
 defineOptions({ name:'personal-account-index'})
+import { useI18n } from '@/hooks/web/useI18n'
+const { t } = useI18n()
+
 const items = [
-  { title: '账号绑定', path: '/personalAccount/accountBinding', },
-  { title: '实名认证', path: '/personalAccount/realAuthentication', },
-  { title: '修改密码', path: '/personalAccount/editPassword', },
-  { title: '隐私设置', path: '/personalAccount/privacySettings' }
+  { title: t('setting.accountBinding'), path: '/personalAccount/accountBinding', },
+  { title: t('setting.realNameAuthentication'), path: '/personalAccount/realAuthentication', },
+  { title: t('setting.editPassword'), path: '/personalAccount/editPassword', },
+  { title: t('setting.privacyPolicySettings'), path: '/personalAccount/privacySettings' }
 ]
 </script>
 

+ 1 - 1
src/views/Home/personal/components/hotJobs.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="box text-center default-width">
-    <span class="mr-2">热门职位:</span>
+    <span class="mr-2">{{ $t('position.popularPosition') }}:</span>
     <v-btn v-for="(item, index) in jobs" :key="index" size="small" class="ml-2 mb-2" color="primary" variant="tonal" @click="handleClick(item)">{{ item.nameCn }}</v-btn>
   </div>
 </template>

+ 31 - 22
src/views/login/components/passwordPage.vue

@@ -1,51 +1,56 @@
 <template>
   <v-form ref="passwordForm" @submit.prevent>
-    <v-text-field v-model="loginData.phone" placeholder="请输入手机号" color="primary" variant="outlined" density="compact" :rules="phoneRules" validate-on="input">
-        <template v-slot:prepend-inner>
-          <span class="d-flex">
-            <v-icon icon="mdi-cellphone" size="20"></v-icon>
-            <span class="d-flex" id="menu-activator">
-              <span class="phone-number">{{ currentArea }}</span>
-              <v-icon size="20">mdi-chevron-down</v-icon>
-            </span>
-            <v-menu activator="#menu-activator">
-              <v-list>
-                <v-list-item v-for="(item, index) in items" :key="index" :value="index" @click="handleChangeCurrentArea(item)">
-                  <v-list-item-title>{{ item.label }}</v-list-item-title>
-                </v-list-item>
-              </v-list>
-            </v-menu>
+    <v-text-field v-model="loginData.phone" :placeholder="$t('login.mobileNumberPlaceholder')" color="primary" variant="outlined" density="compact" :rules="phoneRules" validate-on="input">
+      <template v-slot:prepend-inner>
+        <span class="d-flex">
+          <v-icon icon="mdi-cellphone" size="20"></v-icon>
+          <span class="d-flex" id="menu-activator">
+            <span class="phone-number">{{ currentArea }}</span>
+            <v-icon size="20">mdi-chevron-down</v-icon>
           </span>
-        </template>
-      </v-text-field>
+          <v-menu activator="#menu-activator">
+            <v-list>
+              <v-list-item v-for="(item, index) in items" :key="index" :value="index" @click="handleChangeCurrentArea(item)">
+                <v-list-item-title>{{ item.label }}</v-list-item-title>
+              </v-list-item>
+            </v-list>
+          </v-menu>
+        </span>
+      </template>
+    </v-text-field>
     <v-text-field
       v-model="loginData.password"
-      placeholder="请输入密码" 
+      :placeholder="$t('login.enterPassword')" 
       variant="outlined" 
       density="compact"
       color="primary"
       prepend-inner-icon="mdi-lock-outline" 
       :append-inner-icon="passwordType ? 'mdi-eye-outline' : 'mdi-eye-off-outline'"
       :type="passwordType ? 'text' : 'password'"
-      :rules="[v=> !!v || '请填写密码']"
+      :rules="[v=> !!v || $t('login.enterPassword')]"
       @click:append-inner="passwordType = !passwordType"
+      @keyup.enter="handleEnter"
     ></v-text-field>
   </v-form>
 </template>
 
 <script setup name="passwordPage">
-import { ref, reactive, defineExpose } from 'vue'
+import { ref, reactive, defineExpose, defineEmits } from 'vue'
 defineOptions({ name: 'password-form' })
+import { useI18n } from '@/hooks/web/useI18n'
+const { t } = useI18n()
+
 const passwordType = ref(false)
+const emits = defineEmits(['handleEnter'])
 
 const phoneRules = ref([
   value => {
     if (value) return true
-    return '请输入手机号'
+    return t('login.mobileNumberPlaceholder')
   },
   value => {
     if (value?.length <= 11 && /^1[3456789]\d{9}$/.test(value)) return true
-    return '请输入正确的手机号码'
+    return t('login.correctPhoneNumber')
   }
 ])
 
@@ -64,6 +69,10 @@ const loginData = reactive({
 })
 
 const passwordForm = ref()
+
+const handleEnter = () => {
+  emits('handleEnter')
+}
 defineExpose({
   loginData,
   passwordForm

+ 12 - 10
src/views/login/index.vue

@@ -5,10 +5,10 @@
         <div class="left">
           <div ref="phone" :class="['left-qrCode', {'phone-switch': isPhone}]" @click="handlePhone">
             <div class="switch-tip">
-              {{ isPhone ? '短信、密码登录/注册' : '微信扫码快速登录' }}
+              {{ isPhone ? $t('login.smsOrPassword') : $t('login.scanWeChatCode') }}
             </div>
           </div>
-          <div v-if="loginType" class="loginType">企业登录</div>
+          <div v-if="loginType" class="loginType">{{ $t('login.enterpriseLogin') }}</div>
         </div>
         <div class="right mr-2 mt-3" v-if="showClose">
           <v-icon color="grey" size="30">mdi-close</v-icon>
@@ -17,17 +17,17 @@
       <div class="login-content-box mt-5">
         <div v-if="!isPhone" class="login-tab">
           <v-tabs v-model="tab" align-tabs="center" color="primary">
-            <v-tab :value="1">短信登录</v-tab>
-            <v-tab :value="2">密码登录</v-tab>
+            <v-tab :value="1">{{ $t('login.smsLogin') }}</v-tab>
+            <v-tab :value="2">{{ $t('login.passwordLogin') }}</v-tab>
           </v-tabs>
           <v-window v-model="tab" class="mt-9">
               <!-- 验证码登录 -->
             <v-window-item :value="1">
-              <phoneFrom ref="phoneRef"></phoneFrom>
+              <phoneFrom ref="phoneRef" @handleEnter="handleLogin"></phoneFrom>
             </v-window-item>
               <!-- 账号密码登录 -->
             <v-window-item :value="2">
-              <passwordFrom ref="passRef"></passwordFrom>
+              <passwordFrom ref="passRef" @handleEnter="handleLogin"></passwordFrom>
             </v-window-item>
           </v-window>
         </div>
@@ -39,9 +39,9 @@
           {{ tab === 1 ? $t('login.register') : $t('login.login') }}
         </v-btn>
         <div class="login-tips mt-3">
-          登录/注册即代表您同意 
-          <span class="color" style="cursor: pointer;" @click="handleToUserAgreement">[用户协议]</span>
-          <span class="color" style="cursor: pointer;" @click="handlePrivacyPolicy">[隐私政策]</span>
+          {{ $t('login.agreeLogin') }}
+          <span class="color" style="cursor: pointer;" @click="handleToUserAgreement">[{{ $t('login.userAgreement') }}]</span>
+          <span class="color" style="cursor: pointer;" @click="handlePrivacyPolicy">[{{ $t('login.privacyPolicy') }}]</span>
         </div>
       </div>
     </div>
@@ -56,9 +56,11 @@ import qrCode from './components/qrCode.vue'
 
 import { useUserStore } from '@/store/user'
 import { useRoute, useRouter } from 'vue-router'
+import { useI18n } from '@/hooks/web/useI18n'
 import Snackbar from '@/plugins/snackbar'
 defineOptions({ name: 'login-index' })
 
+const { t } = useI18n()
 const router = useRouter()
 const route = useRoute()
 const loginType = ref(route.query?.loginType - 0 || null)
@@ -88,7 +90,7 @@ const handleLogin = async () => {
     } else {
       await userStore.handlePasswordLogin({ ...passRef.value.loginData, type })
     }
-    Snackbar.success('登录成功')
+    Snackbar.success(t('login.loginSuccess'))
     router.push({ path: '/home' })
   }
   finally {