Browse Source

feat: save

gemercheung 6 months ago
parent
commit
988c4789f4

+ 5 - 2
packages/web/src/locales/json/en.json

@@ -2,7 +2,7 @@
   "zh": "简体中文",
   "en": "English",
   "helperTip": "What Can I help you?",
-  "enter_key":"Enter keywords",
+  "enter_key": "Enter keywords",
   "web_title": "Help Center",
   "sell_cor": "Business Cooperation",
   "pub_r": "Publicity",
@@ -24,5 +24,8 @@
   "about_us": "About Us",
   "company_profile": "Company Profile",
   "news_report": "News Report",
-  "distributor": "Be Our Distributor"
+  "distributor": "Be Our Distributor",
+  "publish": "Publish At",
+  "main_content": "Main Content",
+  "read": "Read"
 }

+ 4 - 1
packages/web/src/locales/json/zh.json

@@ -25,5 +25,8 @@
   "about_us": "关于我们",
   "company_profile": "公司介绍",
   "news_report": "新闻中心",
-  "distributor": "成为经销商"
+  "distributor": "成为经销商",
+  "publish":"发布于",
+  "main_content":"主要内容",
+  "read":"阅读"
 }

+ 11 - 25
packages/web/src/pages/showdoc/[id].vue

@@ -3,7 +3,7 @@
     <div v-if="detail">
       <div class="breadcrumb my-[30px] pb-[20px] bb-1px_#EBEBEB" role="navigation">
         <n-breadcrumb separator=">" v-if="breadcrumb">
-        <!-- {{ breadcrumb }} -->
+          <!-- {{ breadcrumb }} -->
           <template v-for="(bread, index) in breadcrumb" :key="index">
             <n-breadcrumb-item :clickable="false"> {{ bread.title }}</n-breadcrumb-item>
           </template>
@@ -14,18 +14,9 @@
       </div>
       <div class="w-full flex flex-row flex-nowrap">
         <div class="flex-basis-[240px] flex-grow-0 flex-shrink-0 br-1px_#EBEBEB">
-          <n-tree
-            class="left-tree"
-            v-if="mainCategories.children"
-            block-line
-            :data="mainCategories.children"
-            :default-expanded-keys="defaultExpandedKeys"
-            :node-props="nodeProps"
-            key-field="id"
-            label-field="title"
-            children-field="children"
-            selectable
-          />
+          <n-tree class="left-tree" v-if="mainCategories.children" block-line :data="mainCategories.children"
+            :default-expanded-keys="defaultExpandedKeys" :node-props="nodeProps" key-field="id" label-field="title"
+            children-field="children" selectable />
           <!--          <n-collapse class="br-1px_#EBEBEB py-[10px]">-->
           <!--            <template v-for="(cate, index) in mainCategories.children" :key="index">-->
           <!--              <n-collapse-item :title="cate.title" :name="cate.title">-->
@@ -45,8 +36,8 @@
           <div class="bb-1px_#EBEBEB color-[#999999]">
             <n-h1 class="font-700"> {{ detail.title }}</n-h1>
             <span class="flex flex-row gap-col-6 pb-[15px]">
-              <p>发布于{{ dayjs(detail.createTime).format('YYYY-MM-DD') }}</p>
-              <p>阅读 ( {{ detail.readCount }} )</p>
+              <p>{{ $t('publish') }} {{ dayjs(detail.createTime).format('YYYY-MM-DD') }}</p>
+              <p>{{ $t('read') }} ( {{ detail.readCount }} )</p>
             </span>
           </div>
 
@@ -55,15 +46,10 @@
 
         <div class="flex-basis-[240px] flex-grow-0 flex-shrink-0">
           <div class="min-h-[200px] bg-[#F5F9FF] b-r-[8px] p-[20px]">
-            <n-h4 class="font-600 ext-size-base">主要内容</n-h4>
+            <n-h4 class="font-600 ext-size-base">{{ $t('main_content') }}</n-h4>
             <n-anchor :show-rail="false">
-              <n-anchor-link
-                class="text-size-base color-[#999999]"
-                v-for="(item, index) in mainContents"
-                :key="index"
-                :title="item.text"
-                :href="`#my-section-${index + 1}`"
-              >
+              <n-anchor-link class="text-size-base color-[#999999]" v-for="(item, index) in mainContents" :key="index"
+                :title="item.text" :href="`#my-section-${index + 1}`">
               </n-anchor-link>
             </n-anchor>
           </div>
@@ -157,11 +143,11 @@ watchEffect(() => {
             if (mainCategories.value) {
               debugger
               currentCate.value = findNodeById(
-                mainCategories.value as unknown as TreeNode[] ||[],
+                mainCategories.value as unknown as TreeNode[] || [],
                 String(detail.value.categoryId),
               ) as unknown as CategoryItem
               defaultExpandedKeys.value = [currentCate.value.parentId]
-              breadcrumb.value = findBreadcrumbPath(mainCategories.value as unknown as TreeNode[] ||[], String(detail.value.categoryId))
+              breadcrumb.value = findBreadcrumbPath(mainCategories.value as unknown as TreeNode[] || [], String(detail.value.categoryId))
               console.log('breadcrumb', breadcrumb.value)
             }
           }