yangzj 11 tháng trước cách đây
mục cha
commit
0dfd30f764
2 tập tin đã thay đổi với 72 bổ sung48 xóa
  1. 3 1
      src/api/path.js
  2. 69 47
      src/views/curriculum/focus.vue

+ 3 - 1
src/api/path.js

@@ -33,7 +33,9 @@ const AJAXPATH = {
   // 焦点图管理
   'bannerList':{
     'path':'/master/banner',
-    'method': 'get'
+  },
+  'bannerSort':{
+    'path':'/master/banner/sort',
   }
 }
 

+ 69 - 47
src/views/curriculum/focus.vue

@@ -23,30 +23,32 @@
         :loading="loading"
         ref="shopTable"
         >
-        <!-- 图片样式 -->
-        <template #img="{record}">
-           <a-image
-              :width="40"
-              :height="40"
-              :src="record.img"
-              />
-        </template>
-        <!-- 任务状态 -->
-        <template #switch="{record}">
-          <a-switch v-model:checked='record.Status' :checkedValue="1" :unCheckedValue="0"
-         @change="switchChange(record.Id,record.Status)"></a-switch>
-        </template>
-        <!-- 操作 -->
-        <template #operation="{record}">
-          <a-button type="link" @click="edit(record)">编辑</a-button>
-          <a-popconfirm
-            title="是否确定删除?删除后不可恢复,请谨慎操作!"
-            ok-text="确认"
-            cancel-text="取消"
-            @confirm="delSubmit(record.id)"
-          >
-            <a-button type="link" style="color:#FF4D4F">删除</a-button>
-          </a-popconfirm>
+        <template #bodyCell="{ column, record }">
+          <!-- 图片样式 -->
+          <template v-if="column.key === 'img'">
+            <a-image
+                :width="40"
+                :height="40"
+                :src="record.img"
+                />
+          </template>
+          <!-- 任务状态 -->
+          <template v-if="column.key === 'switch'">
+            <a-switch v-model:checked='record.Status' :checkedValue="1" :unCheckedValue="0"
+              @change="switchChange(record.Id,record.Status)"></a-switch>
+          </template>
+          <!-- 操作 -->
+          <template v-if="column.key === 'handle'">
+            <a-button type="link" @click="edit(record)">编辑</a-button>
+            <a-popconfirm
+              title="是否确定删除?删除后不可恢复,请谨慎操作!"
+              ok-text="确认"
+              cancel-text="取消"
+              @confirm="delSubmit(record.id)"
+            >
+              <a-button type="link" style="color:#FF4D4F">删除</a-button>
+            </a-popconfirm>
+          </template>
         </template>
       </a-table>
       <!-- 页码-->
@@ -154,20 +156,24 @@ export default defineComponent({
       // 获取当前点击的行数据
       addData.value = {
         id:item.id,
-        address: item.address,
-        phone: item.phone,
-        title: item.title,
+        name:item.name,
         img: item.img,
-        coverimg: item.img,
-        longitude: item.longitude,
-        latitude: item.latitude,
-        created_at: item.created_at
+        href: item.href,
       }
       addPop.value = true
     }
     //删除数据
-    const delSubmit = (id) =>{ 
-       delempower(id)
+    const delSubmit = async(id) =>{ 
+      //  delempower(id)
+       const { code} = await curriculAJAXREQUEST({
+          path: AJAXPATH.bannerList.path +"/"+ id,
+          method: 'DELETE',
+        });
+        if(code == 0){
+           message.success('删除成功');
+        }else{
+           message.error('删除失败');
+        }
        getData()
     }
     //搜索数据
@@ -202,20 +208,32 @@ export default defineComponent({
       formRef.value.validate().then(async() => {
         //console.log('values', addData.value, toRaw(addData.value));
        if(addData.value.id){
-         const {status} = await updateempower(
-          addData.value.id,
-          addData.value
-         )
-         if(!status){
+        //  const {status} = await updateempower(
+        //   addData.value.id,
+        //   addData.value
+        //  )
+        //  if(!status){
+        const { code} = await curriculAJAXREQUEST({
+          path: AJAXPATH.bannerList.path +"/"+ addData.value.id,
+          method: 'put',
+          data: addData.value,
+        });
+        if(code == 0){
            message.success('修改成功');
          }else{
            message.error('修改失败');
          }
       }else{
-        const {status} = await addempower(
-          addData.value
-         )
-         if(!status){
+        // const {status} = await addempower(
+        //   addData.value
+        //  )
+        const { code} = await curriculAJAXREQUEST({
+          path: AJAXPATH.bannerList.path,
+          method: 'POST',
+          data: addData.value,
+        });
+        if(code == 0){
+        //  if(!status){
            message.success('新增成功');
          }else{
            message.error('新增失败');
@@ -257,7 +275,6 @@ export default defineComponent({
                trigger: 'blur',
             },
        ],
-       
     }
     const shopTable = ref(null);
 
@@ -277,10 +294,15 @@ export default defineComponent({
       });
     };
     const sortFocus = async (sort1) => {
-      const data = await shop_train({
-        list:sort1,
-      });
-      console.log( "排序");
+      // bannerSort
+      const { code} = await curriculAJAXREQUEST({
+          path: AJAXPATH.bannerSort.path,
+          method: 'put',
+          data: {data:sort1,},
+        });
+        if(code == 0){
+          console.log( "排序");
+        }
     };
     //页面加载
     onMounted(() =>{