瀏覽代碼

add article page

SyuanYu 2 年之前
父節點
當前提交
24a59e9f49

+ 2 - 2
.env

@@ -1,4 +1,4 @@
-DOMAIN=cloud.choozmo.com:8080
+DOMAIN=cloud.choozmo.com
 SERVER_ADDRESS=http://localhost
 # DOMAIN=local.dockertoolbox.tiangolo.com
 # DOMAIN=localhost.tiangolo.com
@@ -15,7 +15,7 @@ DOCKER_IMAGE_CELERYWORKER=gpuceleryworker
 DOCKER_IMAGE_FRONTEND=frontend
 
 # Backend
-BACKEND_CORS_ORIGINS=["https://cloud.choozmo:8080", "http://cloud.choozmo.com:8080", "https://cloud.choozmo.com", "http://cloud.choozmo.com","http://172.105.219.42", "http://local.ai-anchor.com:5173", "http://local.ai-anchor.com:8080", "http://localhost", "http://localhost:4200", "http://localhost:3000", "http://localhost:5173", "http://localhost:8080", "https://localhost", "https://localhost:4200", "https://localhost:3000", "https://localhost:8080", "http://dev.ai-anchor.com:3000", "http://dev.ai-anchor.com:5173", "http://dev.ai-anchor.com:8080", "https://stag.ai-anchor.com", "https://ai-anchor.com", "http://local.dockertoolbox.tiangolo.com", "http://localhost.tiangolo.com"]
+BACKEND_CORS_ORIGINS=["https://cloud.choozmo", "http://cloud.choozmo.com", "https://cloud.choozmo.com", "http://cloud.choozmo.com","http://172.105.219.42", "http://local.ai-anchor.com:5173", "http://local.ai-anchor.com:8080", "http://localhost", "http://localhost:4200", "http://localhost:3000", "http://localhost:5173", "http://localhost:8080", "https://localhost", "https://localhost:4200", "https://localhost:3000", "https://localhost:8080", "http://dev.ai-anchor.com:3000", "http://dev.ai-anchor.com:5173", "http://dev.ai-anchor.com:8080", "https://stag.ai-anchor.com", "https://ai-anchor.com", "http://local.dockertoolbox.tiangolo.com", "http://localhost.tiangolo.com"]
 PROJECT_NAME=AI anchor
 SECRET_KEY=1df1f2180c7b2550e76a8ccf5e67a76e5321d8c2d3fee4a725f8b80baf9a0c91
 FIRST_SUPERUSER=admin@ai-anchor.com

+ 1 - 1
frontend/.env

@@ -1,4 +1,4 @@
-VITE_APP_DOMAIN_DEV=cloud.choozmo.com:8080
+VITE_APP_DOMAIN_DEV=cloud.choozmo.com
 # VUE_APP_DOMAIN_DEV=local.dockertoolbox.tiangolo.com
 # VUE_APP_DOMAIN_DEV=localhost.tiangolo.com
 # VUE_APP_DOMAIN_DEV=dev.ai-anchor.com

+ 6 - 2
frontend/src/language/en.json

@@ -24,9 +24,10 @@
     "passwordRecovery": "Password Recovery",
     "passwordRecoveryMail": "A password recovery email will be sent to the registered account",
     "describe_1": "Make your first video for promotion, creation and life today",
-    "describe_2": "Let's get started with AI Presentors",
+    "describe_2": "Let's get started with AI Presenters",
     "dashboard": "Dashboard",
     "makeVideo": "Make Video",
+    "makeArticle": "Make Article",
     "progress": "Progress",
     "userProfile": "User Profile",
     "editProfile": "Edit Profile",
@@ -39,7 +40,10 @@
     "clear": "Clear",
     "edit": "Edit",
     "send": "Send",
-    "title": "Title",
+    "videoTitle": "Title",
+    "articleTitle": "Article Title",
+    "articleContent": "Article Content",
+    "articleLink": "Article Link",
     "state": "State",
     "download": "Download",
     "preview": "Preview",

+ 6 - 2
frontend/src/language/zh.json

@@ -24,9 +24,10 @@
     "passwordRecovery": "忘記您的密碼嗎?",
     "passwordRecoveryMail": "請輸入註冊時填入的電子信箱,我們將寄出重設密碼的信件給您。",
     "describe_1": "將您的生活、創作、宣傳做成影片",
-    "describe_2": "開始使用 AI Presentors",
+    "describe_2": "開始使用 AI Presenters",
     "dashboard": "首頁",
     "makeVideo": "製作影片",
+    "makeArticle": "製作文章",
     "progress": "影片清單",
     "userProfile": "會員資料",
     "editProfile": "編輯資料",
@@ -39,7 +40,10 @@
     "clear": "清除",
     "edit": "編輯",
     "send": "送出",
-    "title": "影片標題",
+    "videoTitle": "影片標題",
+    "articleTitle": "標題",
+    "articleContent": "內容",
+    "articleLink": "連結",
     "state": "狀態",
     "download": "下載",
     "preview": "預覽",

+ 5 - 0
frontend/src/router/index.ts

@@ -48,6 +48,11 @@ const router = createRouter({
               name: 'make-video',
               component: () => import ('@/views/main/Upload.vue'),
             },
+            {
+              path: 'make-article',
+              name: 'make-article',
+              component: () => import ('@/views/main/Article.vue'),
+            },
             {
               path: 'progress',
               name: 'progress',

+ 220 - 0
frontend/src/views/main/Article.vue

@@ -0,0 +1,220 @@
+<script setup lang="ts">
+import { ref, reactive, watch } from "vue";
+import { useMainStore } from "@/stores/main";
+import { required } from "@/utils";
+import { useI18n } from "vue-i18n";
+import type { VideoCreate } from "@/interfaces";
+import router from "@/router";
+
+const { t } = useI18n();
+const valid = ref(true);
+const dialog = ref(false);
+const title = ref("");
+const zipFiles = ref();
+const Form = ref();
+let anchor = ref(0);
+const anchorList = reactive([
+  {
+    anchor_id: 0,
+    language_id: 1,
+    name: "Angela",
+  },
+  {
+    anchor_id: 1,
+    language_id: 1,
+    name: "Peggy",
+  },
+  {
+    anchor_id: 2,
+    language_id: 1,
+    name: "Jocelyn",
+  },
+  {
+    anchor_id: 3,
+    language_id: 1,
+    name: "Summer",
+  },
+]);
+
+let anchorLang = ref("中文");
+let items = reactive([
+  { lang: "中文", id: 0 },
+  { lang: "英文", id: 1 },
+]);
+
+// 取得圖片路徑
+const getImageUrl = (name: string) => {
+  return new URL(`../../assets/img/anchor/${name}.webp`, import.meta.url).href;
+};
+
+const mainStore = useMainStore();
+
+watch(dialog, (newVal, oldVal) => {
+  if (!newVal) {
+    router.push("/main/progress");
+  }
+});
+
+async function Submit() {
+  setTimeout(() => {
+    dialog.value = true;
+  }, 2000);
+  await (Form as any).value.validate();
+  if (valid.value) {
+    valid.value = false;
+
+    const video_data: VideoCreate = {
+      title: title.value,
+      anchor_id: anchor.value,
+      lang_id: 0,
+    };
+
+    await mainStore.uploadPlot(video_data, zipFiles.value[0]);
+    // (Form as any).value.reset();
+  }
+}
+</script>
+
+<template>
+  <v-container fluid>
+    <v-card class="ma-3 pa-3">
+      <v-card-title primary-title>
+        <h3 class="card-title mb-3">{{ t("makeArticle") }}</h3>
+      </v-card-title>
+      <v-card-text>
+        <v-form v-model="valid" ref="Form">
+          <v-text-field
+            :label="$t('articleTitle')"
+            v-model="title"
+            :rules="required"
+            prepend-icon="title"
+          >
+          </v-text-field>
+          <v-text-field :label="$t('articleLink')" prepend-icon="link">
+          </v-text-field>
+          <v-textarea
+            :label="$t('articleContent')"
+            prepend-icon="edit_document"
+          ></v-textarea>
+        </v-form>
+      </v-card-text>
+      <v-card-actions>
+        <v-spacer></v-spacer>
+        <v-btn @click="Submit" :disabled="!valid">
+          {{ t("send") }}
+        </v-btn>
+      </v-card-actions>
+    </v-card>
+
+    <template>
+      <div class="text-center">
+        <v-dialog v-model="dialog" width="auto">
+          <v-card>
+            <v-card-text>
+              <section class="d-flex flex-column align-center">
+                <v-icon
+                  style="font-size: 70px"
+                  icon="info"
+                  color="orange-darken-3"
+                />
+                <p class="mt-3">影片處理需要約 5-10 分鐘,敬請耐心等候</p>
+              </section>
+            </v-card-text>
+            <v-card-actions>
+              <v-btn color="primary" block @click="dialog = false">{{
+                t("close")
+              }}</v-btn>
+            </v-card-actions>
+          </v-card>
+        </v-dialog>
+      </div>
+    </template>
+  </v-container>
+</template>
+
+<style lang="scss">
+.anchor-list {
+  padding-left: 40px;
+  img {
+    width: 130px;
+    height: 110px;
+    object-fit: cover;
+  }
+  .v-card-item {
+    padding: 0;
+    text-align: center;
+    .v-card-title {
+      font-size: 18px;
+    }
+  }
+  .bg-success {
+    background: linear-gradient(
+      -225deg,
+      rgb(234, 84, 19) 35%,
+      rgb(178, 69, 146) 100%
+    ) !important;
+  }
+  .v-expansion-panel-title {
+    height: 55px;
+    min-height: 0;
+  }
+  .v-expansion-panel-text__wrapper {
+    padding: 0 !important;
+  }
+}
+.step-list {
+  list-style: none;
+  img {
+    width: 100%;
+    max-width: 800px;
+  }
+  li {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    font-size: 16px;
+    p {
+      line-height: 32px;
+    }
+    h4 {
+      margin: 20px auto;
+      color: #ea5413;
+      font-weight: bold;
+      text-align: center;
+      line-height: 34px;
+      font-size: 20px;
+    }
+  }
+
+  .link-btn {
+    display: inline-block;
+    padding: 12px 20px;
+    margin-top: 25px;
+    border-radius: 100px;
+    text-decoration: none;
+    color: #fff;
+    background: #ea5413;
+    transition: all 0.3s;
+    &:hover {
+      opacity: 0.8;
+    }
+  }
+
+  .point-list {
+    display: flex;
+    flex-direction: column;
+    align-items: baseline;
+    margin-left: 40px;
+  }
+
+  .excerpt::before {
+    content: "";
+    font-weight: bold;
+    display: inline-block;
+    border: 5px solid #ea5413;
+    border-radius: 20px;
+    margin-right: 10px;
+    margin-bottom: 2px;
+  }
+}
+</style>

+ 3 - 0
frontend/src/views/main/Main.vue

@@ -108,6 +108,9 @@ const routeGuardAdmin = async (
             <v-list-item to="/main/make-video" prepend-icon="video_call">
               <v-list-item-title>{{ t("makeVideo") }}</v-list-item-title>
             </v-list-item>
+            <v-list-item to="/main/make-article" prepend-icon="article">
+              <v-list-item-title>{{ t("makeArticle") }}</v-list-item-title>
+            </v-list-item>
             <v-list-item to="/main/progress" prepend-icon="list">
               <v-list-item-title>{{ t("progress") }}</v-list-item-title>
             </v-list-item>

+ 1 - 1
frontend/src/views/main/Upload.vue

@@ -84,7 +84,7 @@ async function Submit() {
       <v-card-text>
         <v-form v-model="valid" ref="Form">
           <v-text-field
-            :label="$t('title')"
+            :label="$t('videoTitle')"
             v-model="title"
             :rules="required"
             prepend-icon="title"