dusenyao 1 سال پیش
والد
کامیت
97bb37d4f9

+ 27 - 0
src/api/exercise.js

@@ -233,3 +233,30 @@ export function GetShareConfig(data) {
 export function EndAnswer(data) {
   return http.post(`/TeachingServer/ExerciseAnswerManager/EndAnswer`, data);
 }
+
+/**
+ * 开始编辑
+ * @param {object} data
+ * @param {string} data.share_record_id 分享记录id
+ */
+export function StartEdit(data) {
+  return http.post(`/TeachingServer/ExerciseManager/StartEdit`, data);
+}
+
+/**
+ * 删除我的分享编辑练习题
+ * @param {object} data
+ * @param {string} data.exercise_id 练习题id
+ */
+export function DeleteMyShareEditExercise(data) {
+  return http.post(`/TeachingServer/ExerciseManager/DeleteMyShareEditExercise`, data);
+}
+
+/**
+ * 停止分享记录
+ * @param {object} data
+ * @param {string} data.share_record_id 分享记录id
+ */
+export function StopShareRecord(data) {
+  return http.post(`/TeachingServer/ExerciseManager/StopShareRecord`, data);
+}

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

@@ -33,16 +33,25 @@ export const HomePage = {
   redirect: '/home',
   meta: { title: '练习管理', icon: 'practice' },
   children: [
+    // 公共题库
     {
       path: 'home',
       name: 'Home',
       component: () => import('@/views/home/public_question'),
     },
+    // 个人题库
     {
       path: 'personal_question',
       name: 'Personal',
       component: () => import('@/views/home/personal_question'),
     },
+    // 协作题库
+    {
+      path: 'collaborate_question',
+      name: 'Collaborate',
+      component: () => import('@/views/home/collaborate_question'),
+    },
+    // 回收页
     {
       path: 'recovery',
       meta: { title: '回收' },

+ 4 - 4
src/views/exercise_questions/answer/index.vue

@@ -346,8 +346,8 @@ export default {
         this.curQuestionIndex = 0;
         return;
       }
-      StartAnswer({ exercise_id: this.exercise_id, share_record_id: this.share_record_id }).then(
-        ({ answer_mode, answer_record_id, answer_time_limit_minute }) => {
+      StartAnswer({ exercise_id: this.exercise_id, share_record_id: this.share_record_id })
+        .then(({ answer_mode, answer_record_id, answer_time_limit_minute }) => {
           this.questionList = this.questionList.map((item) => ({
             ...item,
             isFill: false,
@@ -359,8 +359,8 @@ export default {
           this.answer_mode = answer_mode;
           this.curQuestionIndex = 0;
           this.isSubmit = false;
-        },
-      );
+        })
+        .catch(() => {});
     },
     preQuestion() {
       if (this.curQuestionIndex === 0) return;

+ 3 - 7
src/views/exercise_questions/create/components/exercises/ReplaceAnswerQuestion.vue

@@ -27,12 +27,8 @@
       <div class="content">
         <ul>
           <li v-for="(item, i) in data.option_list" :key="i" class="content-item repeat-option">
-            <div class="option-content" v-for="(items, indexs) in item" :key="indexs">
-              <el-input
-                v-model="items.content"
-                placeholder="输入内容"
-                @blur="items.content = items.content.trim()"
-              ></el-input>
+            <div v-for="(items, indexs) in item" :key="indexs" class="option-content">
+              <el-input v-model="items.content" placeholder="输入内容" @blur="items.content = items.content.trim()" />
             </div>
           </li>
         </ul>
@@ -93,9 +89,9 @@
         </el-form-item>
         <el-form-item label="行数">
           <el-input-number
+            v-model="data.property.row_count"
             :min="1"
             :step="1"
-            v-model="data.property.row_count"
             class="word-num-input"
             :precision="0"
             @change="handleChangeRows"

+ 3 - 2
src/views/exercise_questions/create/components/exercises/SelectQuestion.vue

@@ -99,7 +99,8 @@
             {{ label }}
           </el-radio>
         </el-form-item>
-        <el-form-item label="选项细分">
+        <!-- TODO 选项细分 -->
+        <!-- <el-form-item label="选项细分">
           <el-radio
             v-for="{ value, label } in switchOption"
             :key="value"
@@ -118,7 +119,7 @@
             :step="1"
             :disabled="!isEnable(data.property.is_option_subdivision)"
           />
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="听力">
           <el-radio
             v-for="{ value, label } in switchOption"

+ 107 - 0
src/views/home/collaborate_question/index.vue

@@ -0,0 +1,107 @@
+<template>
+  <div class="collaborate">
+    <HomeCommon ref="common" :data="exercise_list" :total="total_count" @getList="pageQueryExerciseList">
+      <template #default>
+        <el-table-column prop="index" label="序号" width="70">
+          <template slot-scope="{ $index }">{{ $index + 1 }}</template>
+        </el-table-column>
+        <el-table-column prop="name" label="练习名称" width="280" />
+        <el-table-column prop="tag" label="标签" width="180">
+          <template slot-scope="{ row }">
+            <span v-for="(item, i) in row.label_list" :key="i" class="tag">{{ item }}</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="creator_name" label="创建者" width="160" />
+        <el-table-column prop="create_time" label="创建时间" width="180" />
+        <el-table-column prop="last_modifier_name" label="最近编辑" width="140" />
+        <el-table-column prop="last_modify_time" label="最近编辑时间" width="180" />
+        <el-table-column prop="intro" label="简介" width="240" />
+
+        <el-table-column prop="operation" label="操作" fixed="right" width="300">
+          <template slot-scope="{ row }">
+            <span
+              class="link"
+              @click="$router.push({ path: '/exercise', query: { id: row.id, back_url: '/collaborate_question' } })"
+            >
+              编辑
+            </span>
+            <span class="link danger" @click="deleteMyShareEditExercise(row.id)">删除</span>
+          </template>
+        </el-table-column>
+      </template>
+
+      <template #operation> </template>
+
+      <template #search>
+        <span class="search-name">搜索</span>
+        <el-input
+          v-model="searchData.search_content"
+          placeholder="全部"
+          suffix-icon="el-icon-search"
+          @keyup.enter.native="getPageList"
+        />
+
+        <span class="search-name">创建者</span>
+        <el-input v-model="searchData.creator_name" placeholder="请输入内容" @keyup.enter.native="getPageList" />
+      </template>
+    </HomeCommon>
+  </div>
+</template>
+
+<script>
+import { PageQueryExerciseList, DeleteMyShareEditExercise } from '@/api/exercise';
+import HomeCommon from '../common.vue';
+
+export default {
+  name: 'CollaborateQuestion',
+  components: {
+    HomeCommon,
+  },
+  data() {
+    return {
+      // 搜索数据
+      searchData: {
+        search_content: '',
+        creator_name: '',
+      },
+      total_count: 0, // 总条数
+      exercise_list: [],
+    };
+  },
+  methods: {
+    getPageList() {
+      this.$refs.common.getList();
+    },
+    pageQueryExerciseList(data) {
+      PageQueryExerciseList({ ...data, store_type: 10, ...this.searchData }).then(({ total_count, exercise_list }) => {
+        this.total_count = total_count;
+        this.exercise_list = exercise_list;
+      });
+    },
+    deleteMyShareEditExercise(exercise_id) {
+      this.$confirm('是否删除当前练习题', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(() => {
+          DeleteMyShareEditExercise({ exercise_id })
+            .then(() => {
+              this.$message.success('删除成功');
+              this.getPageList();
+            })
+            .catch(() => {
+              this.$message.error('删除失败');
+            });
+        })
+        .catch(() => {});
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.collaborate {
+  height: 100%;
+}
+</style>

+ 24 - 4
src/views/home/common.vue

@@ -7,8 +7,14 @@
     </div>
 
     <div class="menu">
-      <div :class="['menu-item', isPublic ? 'active' : '']" @click="$router.push('/')">公共题库</div>
-      <div :class="['menu-item', isPublic ? '' : 'active']" @click="$router.push('personal_question')">个人题库</div>
+      <div
+        v-for="{ name, path } in menuList"
+        :key="path"
+        :class="['menu-item', { active: path === curPath }]"
+        @click="$router.push(path)"
+      >
+        {{ name }}
+      </div>
     </div>
 
     <div class="search">
@@ -55,11 +61,25 @@ export default {
     return {
       cur_page: 1,
       page_capacity: this.pageSize,
+      menuList: [
+        {
+          name: '公共题库',
+          path: '/home',
+        },
+        {
+          name: '个人题库',
+          path: '/personal_question',
+        },
+        {
+          name: '协作题库',
+          path: '/collaborate_question',
+        },
+      ],
     };
   },
   computed: {
-    isPublic() {
-      return this.$route.path === '/home';
+    curPath() {
+      return this.$route.path;
     },
   },
   created() {

+ 42 - 10
src/views/home/recovery/index.vue

@@ -7,6 +7,11 @@
         <template slot-scope="{ $index }">{{ $index + 1 }}</template>
       </el-table-column>
       <el-table-column prop="url" label="链接" width="800" />
+      <el-table-column label="类型" width="60">
+        <template slot-scope="{ row }">
+          <span>{{ row.access_popedom === 1 ? '协作' : '答题' }}</span>
+        </template>
+      </el-table-column>
       <el-table-column prop="memo" label="备注" width="180" />
       <el-table-column prop="finish_person_count" label="完成练习" width="180" />
       <el-table-column prop="begin_date" label="开始日期" width="120" />
@@ -14,15 +19,20 @@
 
       <el-table-column prop="operation" label="操作" fixed="right" width="200">
         <template slot-scope="{ row }">
-          <span
-            class="link"
-            @click="
-              $router.push({ path: '/answer_data', query: { share_record_id: row.id, exercise_id: exercise_id } })
-            "
-          >
-            查看
-          </span>
-          <span class="link danger">停止</span>
+          <template v-if="row.access_popedom === 1 && row.status === 0">
+            <span class="link danger" @click="stopShareRecord(row.id)">停止协作</span>
+          </template>
+          <template v-if="row.access_popedom === 2">
+            <span
+              class="link"
+              @click="
+                $router.push({ path: '/answer_data', query: { share_record_id: row.id, exercise_id: exercise_id } })
+              "
+            >
+              查看
+            </span>
+            <span v-if="row.status === 0" class="link danger" @click="stopShareRecord(row.id)">停止</span>
+          </template>
         </template>
       </el-table-column>
     </el-table>
@@ -32,7 +42,7 @@
 </template>
 
 <script>
-import { PageQueryExerciseShareRecordList } from '@/api/exercise';
+import { PageQueryExerciseShareRecordList, StopShareRecord } from '@/api/exercise';
 
 import PaginationPage from '@/components/common/PaginationPage.vue';
 
@@ -54,6 +64,9 @@ export default {
     };
   },
   methods: {
+    getPageList() {
+      this.$refs.pagination.getList();
+    },
     pageQueryExerciseShareRecordList(data) {
       PageQueryExerciseShareRecordList({ ...data, exercise_id: this.exercise_id })
         .then(({ total_count, exercise_info, share_record_list }) => {
@@ -63,6 +76,25 @@ export default {
         })
         .catch(() => {});
     },
+    stopShareRecord(share_record_id) {
+      this.$confirm('是否停止当前分享记录', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(() => {
+          StopShareRecord({ share_record_id })
+            .then(() => {
+              console.log(1);
+              this.$message.success('停止成功');
+              this.getPageList();
+            })
+            .catch(() => {
+              this.$message.error('停止失败');
+            });
+        })
+        .catch(() => {});
+    },
   },
 };
 </script>

+ 16 - 3
src/views/share/ShareExercise.vue

@@ -50,7 +50,7 @@
 </template>
 
 <script>
-import { GetShareRecordInfo } from '@/api/exercise';
+import { GetShareRecordInfo, StartEdit } from '@/api/exercise';
 import md5 from 'md5';
 import { GetVerificationCodeImage, GetLogo, ParseAccessToken } from '@/api/app';
 import { setConfig } from '@/utils/auth';
@@ -69,6 +69,11 @@ export default {
         access_popedom: -1,
         exercise_id: '',
       },
+      // 用户编辑记录信息
+      user_edit_record_info: {
+        is_exist_edit_record: 'false', // 是否存在编辑记录
+        edit_record_id: '', // 编辑记录id
+      },
       showLogin: false,
       is_remember: false, // 记住我
       is_agreement: true, // 用户协议
@@ -123,8 +128,9 @@ export default {
       GetShareRecordInfo({
         share_record_id: this.share_record_id,
       })
-        .then(({ share_record }) => {
+        .then(({ share_record, user_edit_record_info }) => {
           this.share_record = share_record;
+          this.user_edit_record_info = user_edit_record_info;
           if (this.share_record.access_popedom === 1) {
             this.form.user_type = 'TEACHER';
           }
@@ -158,7 +164,14 @@ export default {
         return;
       }
       if (this.share_record.access_popedom === 1) {
-        this.$router.push({ path: '/exercise', query: { id: this.share_record.exercise_id } });
+        StartEdit({ share_record_id: this.share_record_id })
+          .then(() => {
+            this.$router.push({
+              path: '/exercise',
+              query: { id: this.share_record.exercise_id, back_url: '/collaborate_question' },
+            });
+          })
+          .catch(() => {});
       }
       if (this.share_record.access_popedom === 2) {
         this.$router.push({