Commit 29808f01 authored by Liu Peng's avatar Liu Peng

增加轮播图发布,删除功能

parent b434c5cc
...@@ -41,3 +41,11 @@ export const removeHomeRecVideos = (id) => { ...@@ -41,3 +41,11 @@ export const removeHomeRecVideos = (id) => {
return request("get", `/api/mgr/recommendConfig/delete/${id}`, {}); return request("get", `/api/mgr/recommendConfig/delete/${id}`, {});
}; };
export const removeSwiper = (id) => {
return request("get", `/api/mgr/swiperConfig/remove/${id}`, {});
};
export const changeSwiperStatus = (data) => {
return request("post", `/api/mgr/swiperConfig/modifyStatus`, data);
};
...@@ -10,18 +10,15 @@ ...@@ -10,18 +10,15 @@
:key="swiper.id" :key="swiper.id"
:value="swiper.id" :value="swiper.id"
> >
<div <div class="swiper-div">
class="swiper-div"
@click="updateSwiper(swiper)"
>
<div class="img-container"> <div class="img-container">
<img <img
@click="updateSwiper(swiper)"
class="image" class="image"
v-if="swiper.imageUrl" v-if="swiper.imageUrl"
:src="swiper.imageUrl" :src="swiper.imageUrl"
/> />
<div class="swiper-image-status"> <div class="swiper-image-status">
<a-tooltip <a-tooltip
v-if="swiper.status === 'ENABLE'" v-if="swiper.status === 'ENABLE'"
placement="bottom" placement="bottom"
...@@ -30,6 +27,8 @@ ...@@ -30,6 +27,8 @@
<a-icon <a-icon
type="star" type="star"
theme="filled" theme="filled"
class="published-swiper"
@click="changeSwiperStatus(swiper,false)"
/> />
</a-tooltip> </a-tooltip>
<a-tooltip <a-tooltip
...@@ -37,8 +36,15 @@ ...@@ -37,8 +36,15 @@
placement="bottom" placement="bottom"
title="未发布" title="未发布"
> >
<a-icon type="star" /> <a-icon
type="star"
@click="changeSwiperStatus(swiper,true)"
/>
</a-tooltip> </a-tooltip>
<a-icon
type="delete"
@click="removeSwiper(swiper)"
/>
</div> </div>
</div> </div>
<div class="course-name"> <div class="course-name">
...@@ -198,8 +204,8 @@ ...@@ -198,8 +204,8 @@
v-model="currentSwiper.status" v-model="currentSwiper.status"
default-value="DISABLE" default-value="DISABLE"
> >
<a-radio value="ENABLE">上架</a-radio> <a-radio value="ENABLE">已发布</a-radio>
<a-radio value="DISABLE">下架</a-radio> <a-radio value="DISABLE">未发布</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
</a-form> </a-form>
...@@ -279,6 +285,8 @@ import { ...@@ -279,6 +285,8 @@ import {
fetchAvailRecVideos, fetchAvailRecVideos,
addHomeRecVideos, addHomeRecVideos,
removeHomeRecVideos, removeHomeRecVideos,
removeSwiper,
changeSwiperStatus,
} from "@/api/biz/settings"; } from "@/api/biz/settings";
import { uploadFile } from "@/api/biz/resource"; import { uploadFile } from "@/api/biz/resource";
import { fetchList as fetchCourseList } from "@/api/biz/course"; import { fetchList as fetchCourseList } from "@/api/biz/course";
...@@ -323,8 +331,10 @@ export default { ...@@ -323,8 +331,10 @@ export default {
}, },
beforeUpdate() {}, beforeUpdate() {},
methods: { methods: {
removeSwiper(swiper) {
console.log(swiper);
},
removeHomeRecVideo(video) { removeHomeRecVideo(video) {
console.log(video);
removeHomeRecVideos(video.id).then((resp) => { removeHomeRecVideos(video.id).then((resp) => {
this.fetchHomeRecVideos(); this.fetchHomeRecVideos();
}); });
...@@ -389,6 +399,14 @@ export default { ...@@ -389,6 +399,14 @@ export default {
this.currentSwiper = swiper; this.currentSwiper = swiper;
this.showSwiperCreator = true; this.showSwiperCreator = true;
}, },
changeSwiperStatus(swiper, status) {
changeSwiperStatus({
id: swiper.id,
status: status ? "ENABLE" : "DISABLE",
}).then((resp) => {
this.loadAllSwiper();
});
},
loadAllSwiper() { loadAllSwiper() {
fetchAllSwiper().then((resp) => { fetchAllSwiper().then((resp) => {
this.swipers = resp.datas; this.swipers = resp.datas;
...@@ -495,6 +513,10 @@ export default { ...@@ -495,6 +513,10 @@ export default {
margin-top: 10px; margin-top: 10px;
} }
.price-config-container .swiper-config .published-swiper {
color: #f0943c;
}
.price-config-container .swiper-config-hometags { .price-config-container .swiper-config-hometags {
padding-top: 20px; padding-top: 20px;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment