Forráskód Böngészése

Merge branch 'dev_zyh' of United_Software/k_online_ui into dev

Jack Zhou 3 hónapja
szülő
commit
516dd71042

+ 4 - 4
src/views/DestinationDelivery/src/DestinationDelivery.vue

@@ -67,12 +67,12 @@ const clickCard = (filterTagItem: string) => {
 }
 
 const DateChange = (date: any) => {
-  queryData.value.created_time_start = date[0]
-  queryData.value.created_time_end = date[1]
+  queryData.value.created_time_start = date ? date[0] : ''
+  queryData.value.created_time_end = date ? date[1] : ''
 }
 const deliveryDataChange = (date) => {
-  queryData.value.delivery_date_start = date[0]
-  queryData.value.delivery_date_end = date[1]
+  queryData.value.delivery_date_start = date ? date[0] : ''
+  queryData.value.delivery_date_end = date ? date[1] : ''
 }
 
 const handleConfigurations = () => {

+ 13 - 1
src/views/Login/src/components/ActivatedDialog.vue

@@ -1,7 +1,15 @@
 <script setup lang="ts">
+import { useRouter } from 'vue-router'
+
+const router = useRouter()
 const dialogModel = ref(false)
 const state = ref<'reset' | 'activate'>('activate')
 
+const openDialog = (stateValue: 'reset' | 'activate') => {
+  state.value = stateValue
+  dialogModel.value = true
+}
+
 const tipsData = ref({
   reset: {
     title: 'Password Reset Successfully',
@@ -16,8 +24,12 @@ const tipsData = ref({
 })
 const handleGotoLogin = () => {
   dialogModel.value = false
-  // Navigate to login page
+  router.push({ name: 'Login' })
 }
+
+defineExpose({
+  openDialog
+})
 </script>
 
 <template>

+ 13 - 6
src/views/Login/src/components/SetPasswordDialog.vue

@@ -2,6 +2,11 @@
 const dialogModel = ref(false)
 const state = ref<'reset' | 'activate'>('activate')
 
+const openDialog = (stateValue: 'reset' | 'activate') => {
+  state.value = stateValue
+  dialogModel.value = true
+}
+
 const loginForm = ref({
   username: '',
   oldPassword: '',
@@ -16,6 +21,8 @@ const loginError: any = ref({
   confirmPassword: false
 })
 
+const emit = defineEmits(['submit'])
+
 const handleChangePwd = () => {
   if (loginForm.value.newPassword !== loginForm.value.confirmPassword) {
     loginError.value.confirmPassword = true
@@ -48,6 +55,8 @@ const handleChangePwd = () => {
       password: loginForm.value.newPassword
     })
     .then((res: any) => {
+      emit('submit')
+      dialogModel.value = false
       // if (res.code === 200) {
       //   router.push({
       //     name: 'Login',
@@ -93,15 +102,13 @@ const confirmPwd = () => {
     loginError.value.confirmPassword = false
   }
 }
+defineExpose({
+  openDialog
+})
 </script>
 
 <template>
-  <el-dialog
-    v-model="dialogModel"
-    class="set-password-dialog"
-    width="480"
-    :close-on-click-modal="false"
-  >
+  <el-dialog v-model="dialogModel" class="set-password-dialog" width="480">
     <div class="content">
       <div class="top-section">
         <div class="title">Set Your Password</div>

+ 17 - 4
src/views/Login/src/loginView.vue

@@ -14,6 +14,19 @@ const router = useRouter()
 const route = useRoute()
 const themeStore = useThemeStore()
 
+const activatedDialogState = ref()
+const activatedDialogRef = ref()
+const setPasswordDialogRef = ref()
+onMounted(() => {
+  if (route.query.state) {
+    activatedDialogState.value = route.query.state
+    setPasswordDialogRef.value.openDialog(activatedDialogState.value)
+  }
+})
+const handleSetPassword = () => {
+  activatedDialogRef.value.openDialog(activatedDialogState.value)
+}
+
 // 手动获取url中的参数,直接获取route.query的参数时如果有+号会被转义成空格
 const getQueryParams = (url: string) => {
   const params = url.split('?')[1]
@@ -417,7 +430,7 @@ const firstLoginTipsRef = ref()
     </el-card>
     <el-card class="login-card" v-else-if="status === 'reset'">
       <div class="card-title" :class="{ 'is-dark': themeStore.theme === 'dark' }">
-        <span class="welcome">Password Retrieval</span>
+        <span class="welcome">Reset Password</span>
         <span class="tips">We'll send your password to your email address.</span>
       </div>
       <div class="login-form">
@@ -457,7 +470,7 @@ const firstLoginTipsRef = ref()
         <div class="error" v-if="loginError.email">Incorrect email. Please try again.</div>
 
         <el-button @click="handleVerification" class="el-button--dark login-btn"
-          >Send Password</el-button
+          >Send Reset Link</el-button
         >
         <div @click="backLogin(false)" class="back-text">
           <span class="font_family icon-icon_back_b"></span>
@@ -478,8 +491,8 @@ const firstLoginTipsRef = ref()
     ></VSliderVerification>
     <ErrorTips ref="errorTipsRef" @forget-password="status = 'reset'"></ErrorTips>
     <FirstLoginTips ref="firstLoginTipsRef" @forget-password="status = 'reset'"></FirstLoginTips>
-    <ActivatedDialog></ActivatedDialog>
-    <SetPasswordDialog></SetPasswordDialog>
+    <ActivatedDialog ref="activatedDialogRef"></ActivatedDialog>
+    <SetPasswordDialog @submit="handleSetPassword" ref="setPasswordDialogRef"></SetPasswordDialog>
   </div>
 </template>