Pārlūkot izejas kodu

Merge branch 'front-dev' of http://git.choozmo.com:3000/ai-anchor/video-maker

tomoya 2 gadi atpakaļ
vecāks
revīzija
aa7c13a9e5

+ 1 - 1
frontend/src/components/NotificationsManager.vue

@@ -48,7 +48,7 @@ watch(firstNotification, async (newNotification, oldNotification) => {
     if (newNotification) {
       mainStore.dispatchRemoveNotification({
         notification: newNotification,
-        timeout: 1000,
+        timeout: 1500,
       });
     }
   }

+ 7 - 1
frontend/src/language/en.json

@@ -42,7 +42,13 @@
     "title": "Title",
     "state": "State",
     "download": "Download",
+    "saving": "saving",
+    "sending": "sending",
     "fileInput": "File input",
+    "fileReceived": "File received",
     "profileUpdated": "Profile successfully updated",
-    "editUserProfile": "Edit User Profile"
+    "editUserProfile": "Edit User Profile",
+    "incorrectUsername": "Incorrect username",
+    "sendingEmail": "Sending password recovery email",
+    "passwordMailSent": "Password recovery email sent"
 }

+ 7 - 1
frontend/src/language/zh.json

@@ -42,7 +42,13 @@
     "title": "標題",
     "state": "狀態",
     "download": "下載",
+    "saving": "儲存中",
+    "sending": "上傳中",
     "fileInput": "檔案上傳",
+    "fileReceived": "上傳成功",
     "profileUpdated": "更新成功",
-    "editUserProfile": "編輯資料"
+    "editUserProfile": "編輯資料",
+    "incorrectUsername": "使用者名稱不正確",
+    "sendingEmail": "傳送電子郵件中",
+    "passwordMailSent": "重置密碼電子郵件已傳送"
 }

+ 47 - 47
frontend/src/stores/main.ts

@@ -4,7 +4,7 @@ import { api } from "@/api"
 import router from "@/router"
 import { getLocalToken, removeLocalToken, saveLocalToken } from "@/utils";
 import type { AppNotification } from '@/interfaces';
-import type { IUserProfile, IUserProfileCreate, IUserProfileUpdate, MainState, Video} from '@/interfaces';
+import type { IUserProfile, IUserProfileCreate, IUserProfileUpdate, MainState, Video } from '@/interfaces';
 import i18n from '@/plugins/i18n'
 
 const defaultState: MainState = {
@@ -84,7 +84,7 @@ export const useMainStore = defineStore("MainStoreId", {
     },
     async updateUserProfile(payload: IUserProfileUpdate) {
       try {
-        const loadingNotification = { content: "saving", showProgress: true };
+        const loadingNotification = { content: i18n.global.t("saving"), showProgress: true };
         await this.addNotification(loadingNotification);
         const response = (
           await Promise.all([
@@ -189,54 +189,54 @@ export const useMainStore = defineStore("MainStoreId", {
         await this.checkApiError(error);
       }
     },
-    async passwordRecovery(username: string ) {
-        const loadingNotification = {
-            content: "Sending password recovery email",
-            showProgress: true,
-        };
-        try {
-            this.addNotification(loadingNotification);
-            await Promise.all([
-              api.passwordRecovery(username),
-              await new Promise<void>((resolve, _) => setTimeout(() => resolve(), 500)),
-            ]);
-            this.removeNotification(loadingNotification);
-            this.addNotification({
-              content: "Password recovery email sent",
-              color: "success",
-            });
-            await this.logOut();
-        } catch (error) {
-            this.removeNotification(loadingNotification);
-            this.addNotification({ color: "error", content: "Incorrect username" });
-        }
+    async passwordRecovery(username: string) {
+      const loadingNotification = {
+        content: i18n.global.t("sendingEmail"),
+        showProgress: true,
+      };
+      try {
+        this.addNotification(loadingNotification);
+        await Promise.all([
+          api.passwordRecovery(username),
+          await new Promise<void>((resolve, _) => setTimeout(() => resolve(), 500)),
+        ]);
+        this.removeNotification(loadingNotification);
+        this.addNotification({
+          content: i18n.global.t("passwordMailSent"),
+          color: "success",
+        });
+        await this.logOut();
+      } catch (error) {
+        this.removeNotification(loadingNotification);
+        this.addNotification({ color: "error", content: i18n.global.t("incorrectUsername") });
+      }
     },
     async resetPassword(password: string, token: string) {
-        const loadingNotification = { content: "Resetting password", showProgress: true };
-        try {
-            this.addNotification(loadingNotification);
-            await Promise.all([
-                api.resetPassword(token, password),
-                await new Promise<void>((resolve, _) => setTimeout(() => resolve(), 500)),
-            ]);
-            this.removeNotification(loadingNotification);
-            this.addNotification( {
-                content: "Password successfully reset",
-                color: "success",
-            });
-            await this.logOut();
-        } catch (error) {
-            this.removeNotification(loadingNotification);
-            this.addNotification({
-                color: "error",
-                content: "Error resetting password",
-            });
-        }
+      const loadingNotification = { content: "Resetting password", showProgress: true };
+      try {
+        this.addNotification(loadingNotification);
+        await Promise.all([
+          api.resetPassword(token, password),
+          await new Promise<void>((resolve, _) => setTimeout(() => resolve(), 500)),
+        ]);
+        this.removeNotification(loadingNotification);
+        this.addNotification({
+          content: "Password successfully reset",
+          color: "success",
+        });
+        await this.logOut();
+      } catch (error) {
+        this.removeNotification(loadingNotification);
+        this.addNotification({
+          color: "error",
+          content: "Error resetting password",
+        });
+      }
     },
     async uploadPlot(title: string, file: File) {
       const mainStore = useMainStore();
       try {
-        const loadingNotification = { content: "sending", showProgress: true };
+        const loadingNotification = { content: i18n.global.t("sending"), showProgress: true };
         mainStore.addNotification(loadingNotification);
         const response = (
           await Promise.all([
@@ -246,8 +246,8 @@ export const useMainStore = defineStore("MainStoreId", {
         );
         mainStore.removeNotification(loadingNotification);
         mainStore.addNotification({
-          content: "File received",
-            color: "success",
+          content: i18n.global.t("fileReceived"),
+          color: "success",
         })
       } catch (error) {
         await mainStore.checkApiError(error);
@@ -264,7 +264,7 @@ export const useMainStore = defineStore("MainStoreId", {
         await mainStore.checkApiError(error);
       }
     },
-    }
+  }
 });
 
 

+ 4 - 1
frontend/src/views/main/Progress.vue

@@ -8,6 +8,8 @@ const { t } = useI18n();
 const mainStore = useMainStore();
 const mainStoreRef = storeToRefs(mainStore);
 const videos = mainStoreRef.readVideos;
+console.log('videos',videos);
+
 const headers = [
   {
     title: t("title"),
@@ -47,8 +49,9 @@ onMounted(async () => {
             name: 'main-admin-users-edit',
             params: { id: item.columns.id },
           }"
-          :disabled="item.progress_state !== 'completed'"
+          :disabled="item.raw.progress_state !== 'completed'"
         >
+         {{ item.progress_state }}
           <v-icon icon="file_download" />
         </v-btn>
       </template>

+ 0 - 1
frontend/src/views/main/profile/UserProfileEditPassword.vue

@@ -15,7 +15,6 @@ const form = ref(null);
 const mainStore = useMainStore();
 const mainStoreRef = storeToRefs(mainStore);
 const userProfile = mainStoreRef.readUserProfile;
-
 const password2Rules = usePassword2Rules(password1);
 
 function reset() {