yangzj 11 months ago
parent
commit
35ff957573
4 changed files with 112 additions and 62 deletions
  1. 3 0
      src/api/path.js
  2. 7 7
      src/config/aside.js
  3. 65 27
      src/views/curriculum/curr.vue
  4. 37 28
      src/views/curriculum/video.vue

+ 3 - 0
src/api/path.js

@@ -53,6 +53,9 @@ const AJAXPATH = {
   'courseList':{
     'path':'/master/course'
   },
+  'courseStatus':{
+    'path':'/master/course/status'
+  },
   //章节
   'chapterList':{
     'path':'/master/chapter'

+ 7 - 7
src/config/aside.js

@@ -97,13 +97,13 @@ const SIDEBAR = [{
       icon: '',
       children: []
     },
-    {
-      name: "视频管理",
-      id: '2-2-3',
-      path: '/curriculum/video',
-      icon: '',
-      children: []
-    },
+    // {
+    //   name: "视频管理",
+    //   id: '2-2-3',
+    //   path: '/curriculum/video',
+    //   icon: '',
+    //   children: []
+    // },
     {
       name: "授课讲师管理",
       id: '2-2-4',

+ 65 - 27
src/views/curriculum/curr.vue

@@ -38,9 +38,10 @@
               </template>
               
               <!-- 任务状态 -->
-              <template v-if="column.key === 'switch'">
-                <a-switch v-model:checked='record.status' :checkedValue="1" :unCheckedValue="0"
-                  @change="switchChange(record)"></a-switch>
+              <template v-if="column.key === 'status'">
+                {{cuStatus[record.status]}}
+                <!-- <a-switch v-model:checked='record.status' :checkedValue="1" :unCheckedValue="0"
+                  @change="switchChange(record)"></a-switch> -->
               </template>
               <!-- 操作 -->
               <template v-if="column.key === 'handle'">
@@ -53,6 +54,8 @@
                 >
                   <a-button type="link" style="color:#FF4D4F">删除</a-button>
                 </a-popconfirm>
+                <a-button type="link" @click="manage(record)">视频维护</a-button>
+                <a-button type="link" @click="publish(record)">{{record.status==1?"下线":'发布'}}</a-button>
               </template>
             </template>
           </a-table>
@@ -98,6 +101,7 @@
     </div>
   </template>
   <script>
+  import { useRouter } from 'vue-router'
   import { defineComponent,onMounted,ref } from 'vue'
   
   import uploadImg from "../../components/upload-img.vue";
@@ -115,6 +119,7 @@
       CloseCircleTwoTone
     },
     setup() {
+      const router = useRouter()
       const formRef = ref();
       // 搜索数据
       const searchData = ref({
@@ -143,6 +148,7 @@
         getData({page:page})
       }
       const cuType = ref(['碳资产开发','碳核算'])
+      const cuStatus = ref(['草稿','已发布','下线'])
       //获取请求列表
       const getData = async(e) =>{ 
         const { code, data ,count} = await curriculAJAXREQUEST({
@@ -325,40 +331,67 @@
             data: {data:sort1,},
           });
           if(code == 0){
-            console.log( "排序");
-          }
+             message.success('修改成功');
+           }else{
+             message.error('修改失败');
+           }
+      };
+      const manage = (row) => {
+        router.push({ path: "/curriculum/video", query: { id: row.id } });
+      };
+      const publish = async (item)=>{
+          const { code} = await curriculAJAXREQUEST({
+            path: AJAXPATH.courseStatus.path+"/"+item.id,
+            method: 'put',
+            data: {status:!item.status,},
+          });
+          if(code == 0){
+             message.success('修改成功');
+           }else{
+             message.error('修改失败');
+           }
+          getData()
       };
       //页面加载
       onMounted(() =>{
         getData()
         // rowDrop()
       })
-  
+      
       return{
+        router,
         shopTable,
         formRef,
         rules,
         cuType,
+        cuStatus,
         columns:[
+            // {
+            //   title: "序号",
+            //   dataIndex: "key",
+            //   key: "key",
+            //   customRender: ({ text, record, index }) => {
+            //     return `${index + 1}`;
+            //   },
+            //   rowDrag: true,
+            // },
             {
-              title: "序号",
-              dataIndex: "key",
-              key: "key",
-              customRender: ({ text, record, index }) => {
-                return `${index + 1}`;
-              },
-              rowDrag: true,
+              title: "课程编号",
+              key: "id",
+              dataIndex: "id",
+              fixed: 'left',
             },
             {
               title: "标题",
               key: "title",
               dataIndex: "title",
+              fixed: 'left',
             },
-            {
-              title: "描述",
-              key: "desc",
-              dataIndex: "desc",
-            },
+            // {
+            //   title: "描述",
+            //   key: "desc",
+            //   dataIndex: "desc",
+            // },
             {
               title: "详情大图",
               key: "detailimg",
@@ -393,14 +426,11 @@
               key: "weight",
               dataIndex: "weight",
             },
-            { title: "课程介绍",
-              key: "richText",
-              dataIndex: "richText",
-            },
-            { title: "状态",
-              key: "switch",
-              dataIndex: "status",
-            },
+            // { title: "课程介绍",
+            //   key: "richText",
+            //   dataIndex: "richText",
+            // },
+            
             {
               title: "创建时间",
               key: "createdAt",
@@ -411,10 +441,16 @@
               key: "updatedAt",
               dataIndex: "updatedAt",
             },
+            { title: "状态",
+              key: "status",
+              dataIndex: "status",
+              fixed: 'right',
+            },
             {
               title: "操作",
               key: "handle",
               dataIndex: "handle",
+              fixed: 'right',
             },
           ],
         searchData,
@@ -434,7 +470,9 @@
         adCoverSuccess,
         delAdCover,
         rowDrop,
-        changePage
+        changePage,
+        publish,
+        manage,
       }
     },
   

+ 37 - 28
src/views/curriculum/video.vue

@@ -6,9 +6,12 @@
           <!-- 页面搜索 -->
           <div>
             <a-form :model="searchData" layout="inline" >
-              <a-form-item>
-                <a-button type="primary" @click="add">新视频</a-button>
-              </a-form-item>
+                <a-form-item>
+                    <a-button class="reset" @click="back()">返回</a-button>
+                </a-form-item>
+                <a-form-item>
+                    <a-button type="primary" @click="add">新视频</a-button>
+                </a-form-item>
             </a-form>
           </div>
         </div>
@@ -26,11 +29,11 @@
             >
             <template #bodyCell="{ column, record }">
               <!-- 图片样式 -->
-              <template v-if="column.key === 'img'">
+              <template v-if="column.key === 'coverimg'">
                 <a-image
                     :width="40"
                     :height="40"
-                    :src="record.img"
+                    :src="record.coverimg"
                     />
               </template>
               <!-- 任务状态 -->
@@ -94,6 +97,7 @@
     </div>
   </template>
   <script>
+  import { useRoute, useRouter  } from 'vue-router'
   import { defineComponent,onMounted,ref } from 'vue'
   
   import uploadImg from "../../components/upload-img.vue";
@@ -111,6 +115,11 @@
       CloseCircleTwoTone
     },
     setup() {
+        const router = useRouter()
+        const route = useRoute();
+        const back = () => {
+            router.back();
+        };
       const formRef = ref();
       // 搜索数据
       const searchData = ref({
@@ -134,9 +143,9 @@
       //获取请求列表
       const getData = async(e) =>{ 
         const { code, data ,count} = await curriculAJAXREQUEST({
-            path: AJAXPATH.bannerList.path,
-            method: AJAXPATH.bannerList.method,
-            data: {},
+            path: AJAXPATH.chapterList.path,
+            method: "get",
+            data: {id:projectId.value},
           });
           if(code == 0){
           dataList.value = data
@@ -168,7 +177,7 @@
       const delSubmit = async(id) =>{ 
         //  delempower(id)
          const { code} = await curriculAJAXREQUEST({
-            path: AJAXPATH.bannerList.path +"/"+ id,
+            path: AJAXPATH.chapterList.path +"/"+ id,
             method: 'DELETE',
           });
           if(code == 0){
@@ -216,7 +225,7 @@
           //  )
           //  if(!status){
           const { code} = await curriculAJAXREQUEST({
-            path: AJAXPATH.bannerList.path +"/"+ addData.value.id,
+            path: AJAXPATH.chapterList.path +"/"+ addData.value.id,
             method: 'put',
             data: addData.value,
           });
@@ -230,7 +239,7 @@
           //   addData.value
           //  )
           const { code} = await curriculAJAXREQUEST({
-            path: AJAXPATH.bannerList.path,
+            path: AJAXPATH.chapterList.path,
             method: 'POST',
             data: addData.value,
           });
@@ -254,7 +263,7 @@
         //
         console.log(record.id,record.status); 
         const { code} = await curriculAJAXREQUEST({
-          path: AJAXPATH.bannerList.path +"/"+ record.id,
+          path: AJAXPATH.chapterList.path +"/"+ record.id,
           method: 'put',
           data: record,
         });
@@ -317,15 +326,24 @@
           }
       };
       //页面加载
+      const projectId = ref(null);
       onMounted(() =>{
-        getData()
-        rowDrop()
+        if (route.query.id) {
+            projectId.value = route.query.id;
+            getData();
+            rowDrop()
+        }
+        // getData()
       })
   
       return{
+        route,
+        router,
+        back,
         shopTable,
         formRef,
         rules,
+        projectId,
         columns:[
             {
               title: "序号",
@@ -337,23 +355,14 @@
               rowDrag: true,
             },
             {
-              title: "首页头图名称",
+              title: "名称",
               key: "name",
-              dataIndex: "name",
+              dataIndex: "title",
             },
             {
-              title: "图片地址",
-              key: "img",
-              dataIndex: "img",
-            },
-            {
-              title: "链接地址",
-              key: "href",
-              dataIndex: "href",
-            },
-            { title: "状态",
-              key: "switch",
-              dataIndex: "status",
+              title: "视频封面",
+              key: "coverimg",
+              dataIndex: "coverimg",
             },
             {
               title: "创建时间",