Преглед изворни кода

简繁体切换放到设置栏

dsy пре 21 часа
родитељ
комит
966b078966
1 измењених фајлова са 44 додато и 17 уклоњено
  1. 44 17
      src/web_preview/index.vue

+ 44 - 17
src/web_preview/index.vue

@@ -32,9 +32,6 @@
           >显示分组</span
         >
         <span class="link">
-          <el-checkbox v-model="chinese" true-label="zh-Hant" false-label="zh-Hans">繁体</el-checkbox>
-        </span>
-        <span class="link">
           <el-checkbox v-model="showPinYin" true-label="true" false-label="false">拼音</el-checkbox>
         </span>
         <div class="operator">
@@ -328,6 +325,20 @@
           <template v-if="curToolbarIcon === 'audit'">
             <AuditRemark :remark-list="remark_list" :is-audit="isShowAudit" @deleteRemarks="deleteRemarks" />
           </template>
+
+          <!-- 设置 -->
+          <div v-if="curToolbarIcon === 'setting'" class="setting">
+            <h5>{{ drawerTitle }}</h5>
+            <div class="setting-content">
+              <el-switch
+                v-model="chinese"
+                active-value="zh-Hant"
+                active-text="繁体"
+                inactive-value="zh-Hans"
+                inactive-text="简体"
+              />
+            </div>
+          </div>
         </div>
 
         <div class="back-top" @click="backTop">
@@ -367,7 +378,6 @@
     />
 
     <TranslateDialog :open.sync="showTranslate" :init-text="translateText" :book-id="projectId" title-text="翻译" />
-
   </div>
 </template>
 
@@ -448,7 +458,7 @@ export default {
       { icon: 'collect', title: '收藏', handle: 'getCollect', param: { type: '11' } },
       { icon: 'note', title: '笔记', handle: 'getNote', param: { type: '12' } },
       { icon: 'translate', title: '多语言', handle: 'openTranslate', param: { type: '21' } },
-      { icon: 'setting', title: '设置', handle: '', param: {} },
+      { icon: 'setting', title: '设置', handle: 'openSetting', param: { type: 6 } },
     ];
 
     const book_id = getLocalStore('book_id') || '';
@@ -493,6 +503,17 @@ export default {
         componentId: 'WHOLE',
       },
       curToolbarIcon: this.isShowAudit ? 'audit' : '',
+      titleMap: {
+        0: '图片资源',
+        1: '音频资源',
+        2: '视频资源',
+        5: '文本资源',
+        6: '设置',
+        11: '收藏列表',
+        12: '笔记列表',
+        13: '搜索结果',
+        21: '多语言',
+      },
       sidebarIconList,
       twoSidebarList: [],
       twoCurToolbarIcon: '',
@@ -564,17 +585,7 @@ export default {
       return result;
     },
     drawerTitle() {
-      const titleMap = {
-        0: '图片资源',
-        1: '音频资源',
-        2: '视频资源',
-        5: '文本资源',
-        11: '收藏列表',
-        12: '笔记列表',
-        13: '搜索结果',
-        21: '多语言',
-      };
-      return titleMap[this.drawerType] || '资源列表';
+      return this.titleMap[this.drawerType] || '资源列表';
     },
     shouldMediaShowItem() {
       return (chapter, item) => {
@@ -869,9 +880,11 @@ export default {
      * 打开选择语言弹窗
      */
     openTranslate(params) {
-      // this.visibleTranslate = true;
       if (params && params.type) this.drawerType = Number(params.type);
     },
+    openSetting({ type }) {
+      this.drawerType = type;
+    },
     // 计算抽屉滑出位置
     calcDrawerPosition() {
       const menu = this.$refs.sidebarMenu;
@@ -1728,6 +1741,20 @@ $total-width: $courseware-width + $courseware-left-margin + $courseware-right-ma
         flex: 1;
         background-color: #fff;
 
+        .setting {
+          h5 {
+            padding: 0 5px;
+            margin: 0;
+            font-size: 18px;
+            line-height: 40px;
+            background: #f2f3f5;
+          }
+
+          &-content {
+            padding: 10px;
+          }
+        }
+
         .resource_box {
           height: 100%;
           overflow-y: auto;