Browse Source

我的模板库列表

natasha 2 weeks ago
parent
commit
537eab36e6

+ 9 - 0
src/api/list.js

@@ -74,3 +74,12 @@ export function PageQueryProjectResourceList(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=page_query-PageQueryProjectResourceList`, data);
 }
 
+/**
+ * @description 分页查询模板列表-个人模板
+ * @param {object} data
+ * @param {number} data.page_capacity - 每页容量
+ * @param {number} data.cur_page - 当前查询页码
+ */
+export function PageQueryTemplateListPersonal(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=page_query-PageQueryTemplateList_Personal`, data);
+}

+ 6 - 0
src/api/template.js

@@ -0,0 +1,6 @@
+import { http } from '@/utils/http';
+
+// 创建个人模板
+export function createTemplatePersonal(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=template_manager-CreateTemplate_Personal`,data);
+}

+ 9 - 0
src/router/modules/project.js

@@ -90,6 +90,15 @@ const personalWorkPage = {
       },
       component: () => import('@/views/personal_workbench/project/ProductionResourceManage.vue'),
     },
+    // 我的模板库
+    {
+      path: '/personal_workbench/template_list',
+      name: 'PersonalWorkbenchTemplate',
+      meta: {
+        title: '我的模板库',
+      },
+      component: () => import('@/views/personal_workbench/template_list/index.vue'),
+    },
   ],
 };
 

+ 5 - 0
src/views/book/courseware/preview/components/new_word/components/writeTableZoom.vue

@@ -245,6 +245,7 @@ export default {
       showLeft: true,
       curTime: 0,
       stopAudioS: false,
+      ed: null,
     };
   },
   // 计算属性 类似于data概念
@@ -285,6 +286,10 @@ export default {
       this.showLeft = !this.showLeft;
       this.isFlipped = !this.isFlipped;
     },
+    changeRota() {
+      this.showLeft = true;
+      this.isFlipped = false;
+    },
     // 点击播放某个句子
     handleChangeTime(time, edTime) {
       this.curTime = time;

+ 10 - 3
src/views/personal_workbench/common/menu.vue

@@ -33,13 +33,20 @@ export default {
       { key: '/project_manage/book', name: '已上架教材' },
     ];
 
-    const onlyMenuList = [
+    const onlyMenuList = [{ key: '/personal_workbench/check_task', name: '我的审校任务' }];
+
+    // 教材制作增加模板库标签
+    const subMenuLists = [
       { key: '/personal_workbench/edit_task', name: '我的编辑任务' },
-      { key: '/personal_workbench/check_task', name: '我的审校任务' },
+      { key: '/personal_workbench/template_list', name: '我的模板库' },
     ];
 
     if (this.onlyKey) {
-      subMenuList = [onlyMenuList.find((item) => item.key === this.onlyKey)];
+      if (this.onlyKey === '/personal_workbench/check_task') {
+        subMenuList = onlyMenuList;
+      } else {
+        subMenuList = subMenuLists;
+      }
     }
     return {
       activeKey: this.onlyKey ? this.onlyKey : this.curKey,

+ 222 - 0
src/views/personal_workbench/template_list/index.vue

@@ -0,0 +1,222 @@
+<template>
+  <div class="template">
+    <MenuPage only-key="/personal_workbench/template_list" />
+
+    <div class="template-list">
+      <div id="query-form">
+        <el-form inline>
+          <el-form-item prop="name" label="名称">
+            <el-input v-model="form.name" />
+          </el-form-item>
+
+          <el-form-item prop="status" label="状态">
+            <el-select v-model="form.status">
+              <el-option v-for="item in status_list" :key="item.value" :value="item.value" :label="item.label" />
+            </el-select>
+          </el-form-item>
+          <el-form-item class="search-box">
+            <el-button class="search-btn" type="primary" @click="queryList">查询</el-button>
+          </el-form-item>
+        </el-form>
+        <el-button type="primary" size="small" @click="visible = true"> 创建模板 </el-button>
+      </div>
+      <el-table v-if="tableHeight" :data="list" :max-height="tableHeight + 'px'">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="60"
+          align="center"
+          :index="(form.cur_page - 1) * form.page_capacity + 1"
+          header-align="center"
+          class-name="index-column"
+        />
+        <el-table-column prop="id" width="130" label="编号" align="center" header-align="center" />
+        <el-table-column prop="name" width="130" label="名称" align="center" header-align="center" />
+        <el-table-column prop="share_status" label="共享状态" align="center" header-align="center">
+          <template slot-scope="{ row }">
+            {{ row.share_status === 0 ? '未共享' : '已共享' }}
+          </template>
+        </el-table-column>
+
+        <el-table-column prop="status" label="发布状态" align="center" header-align="center">
+          <template slot-scope="{ row }">
+            {{ status_list.find((item) => item.value === row.status).label }}
+          </template>
+        </el-table-column>
+
+        <el-table-column prop="create_time" label="创建时间" align="center" width="170" header-align="center" />
+
+        <el-table-column prop="operation" label="操作" fixed="right" width="200" align="center" header-align="center">
+          <template slot-scope="{ row }">
+            <span class="link" @click="setOrgManager(row)">{{
+              row.is_org_manager === 'true' ? '取消机构管理员' : '设为机构管理员'
+            }}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <PaginationPage ref="pagination" :total="total" @getList="queryTemplateList" />
+    </div>
+    <el-dialog
+      title="创建模板"
+      :visible="visible"
+      width="460px"
+      :close-on-click-modal="false"
+      class="add-chapter"
+      @close="dialogClose"
+    >
+      <el-form ref="form" :model="data" :rules="rules" label-width="80px">
+        <el-form-item label="模板名称" prop="name">
+          <el-input ref="name" v-model="data.name" placeholder="请输入模板名称" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer">
+        <el-button @click="dialogClose">取消</el-button>
+        <el-button type="primary" @click="addTemplate" :loading="loading">确定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import MenuPage from '../common/menu.vue';
+import PaginationPage from '@/components/PaginationPage.vue';
+
+import { PageQueryTemplateListPersonal } from '@/api/list.js';
+import { createTemplatePersonal } from '@/api/template';
+
+export default {
+  name: 'PersonalWorkbenchTemplate',
+  components: {
+    MenuPage,
+    PaginationPage,
+  },
+  data() {
+    return {
+      list: [],
+      total: 0,
+      cur_page_begin_index: 0,
+      status_list: [
+        {
+          value: -1,
+          label: '全部',
+        },
+        {
+          value: 0,
+          label: '草稿',
+        },
+        {
+          value: 1,
+          label: '申请发布',
+        },
+        {
+          value: 2,
+          label: '已发布',
+        },
+        {
+          value: 3,
+          label: '未发布',
+        },
+        {
+          value: 4,
+          label: '驳回发布申请',
+        },
+      ],
+      form: {
+        name: '',
+        status: -1,
+        page_capacity: 10,
+        cur_page: 1,
+      },
+      tableHeight: 0,
+      rules: {
+        name: [{ required: true, message: '请输入模板名称', trigger: 'blur' }],
+      },
+      data: {
+        name: '',
+      },
+      visible: false,
+      loading: false,
+    };
+  },
+  mounted() {
+    this.tableHeight =
+      document.getElementsByClassName('app-container')[0].clientHeight -
+      document.getElementById('query-form').clientHeight -
+      document.getElementsByClassName('el-pagination')[0].clientHeight -
+      10;
+  },
+  methods: {
+    queryTemplateList(data) {
+      this.form.page_capacity = data.page_capacity;
+      this.form.cur_page = data.cur_page;
+      PageQueryTemplateListPersonal(this.form).then(({ total_count, template_list }) => {
+        this.total = total_count;
+        this.list = template_list;
+        this.list = [
+          {
+            id: '000001-111111111', //
+            name: '生词模板', // 名称
+            status: 1, // 状态、发布状态 0 【草稿】、1【申请发布】、2【已发布】、3【未发布】、4【驳回发布申请】"share_status":1, // 共享状态 0 【未共享】、1【已共享】
+            use_scope: 1, // 使用范围 0【本机构】,1【全域】"org_id":"00000-0001", // 所属机构 ID
+            org_name: '北语社', // 所属机构
+            create_time: '2025-05-01 12:00:00', // 创建时间
+            book_id: '000001-111111111', // 模板内部包含的教材 ID,每个模板内部实际是一个教材// 目前只有一个课件
+            courseware_id: '000001-111111111', // 目前模板只有唯一一个课件}
+          },
+        ];
+      });
+    },
+    queryList() {
+      this.queryTemplateList({ cur_page: 1, page_capacity: this.form.page_capacity });
+    },
+    // 关闭弹窗
+    dialogClose() {
+      this.visible = false;
+    },
+    // 确定创建模板
+    addTemplate() {
+      this.loading = true;
+      createTemplatePersonal(this.data)
+        .then((res) => {
+          this.loading = false;
+          this.visible = false;
+          if (res.status === 1) {
+            this.$message({
+              type: 'success',
+              message: '创建成功!',
+            });
+            this.data = {
+              name: '',
+            };
+
+            this.queryList();
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+@use '@/styles/mixin.scss' as *;
+
+.template {
+  @include page-base;
+  @include table-list;
+
+  #query-form {
+    display: flex;
+    gap: 10px;
+    align-items: center;
+    justify-content: space-between;
+
+    :deep .el-form-item--small.el-form-item {
+      margin-bottom: 5px;
+    }
+  }
+}
+</style>