mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 02:47:29 +08:00
Merge branch 'vue3' of https://gitee.com/beijing_hongye_huicheng/lilishop-ui into vue3
This commit is contained in:
@@ -6,6 +6,12 @@ import { getRequest, postRequest, postRequestWithNoForm, putRequest, deleteReque
|
||||
export const getLiveList = (params) => {
|
||||
return getRequest('/broadcast/studio', params)
|
||||
}
|
||||
|
||||
// 是否推荐直播间
|
||||
export const whetherStar = (params) => {
|
||||
return putRequest(`/broadcast/studio/recommend/${params.id}`, params)
|
||||
}
|
||||
|
||||
// 添加直播间
|
||||
export const addLive = (params) => {
|
||||
return postRequest('/broadcast/studio', params)
|
||||
|
||||
@@ -164,25 +164,27 @@
|
||||
</el-form-item>
|
||||
<el-form-item class="form-item-view-el" label="主图视频" prop="goodsVideo">
|
||||
<div class="goods-video">
|
||||
<div v-if="baseInfoForm.goodsVideo">
|
||||
<div>
|
||||
<video :src="baseInfoForm.goodsVideo" class="video" controls style="max-width: 300px;" />
|
||||
</div>
|
||||
<div v-if="baseInfoForm.goodsVideo" class="goods-video-preview">
|
||||
<video :src="baseInfoForm.goodsVideo" class="video" controls style="max-width: 300px;" />
|
||||
</div>
|
||||
<el-upload
|
||||
:action="uploadFileUrl"
|
||||
:headers="{ ...accessToken }"
|
||||
accept=".avi,.wmv,.mpeg,.mp4,.mov"
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeVideoUpload"
|
||||
:on-success="handleSuccessGoodsVideo"
|
||||
:on-error="() => { loadingVideo = false }"
|
||||
style="margin-left: 10px; display: inline-block"
|
||||
>
|
||||
<el-button :loading="loadingVideo" type="primary" link>
|
||||
{{ loadingVideo ? "正在上传..." : `${baseInfoForm.goodsVideo ? "已" : ""}上传视频` }}
|
||||
<div class="goods-video-actions">
|
||||
<el-upload
|
||||
:action="uploadFileUrl"
|
||||
:headers="{ ...accessToken }"
|
||||
accept=".avi,.wmv,.mpeg,.mp4,.mov"
|
||||
:show-file-list="false"
|
||||
:before-upload="beforeVideoUpload"
|
||||
:on-success="handleSuccessGoodsVideo"
|
||||
:on-error="() => { loadingVideo = false }"
|
||||
>
|
||||
<el-button :loading="loadingVideo" type="primary" link>
|
||||
{{ loadingVideo ? "正在上传..." : `${baseInfoForm.goodsVideo ? "已" : ""}上传视频` }}
|
||||
</el-button>
|
||||
</el-upload>
|
||||
<el-button v-if="baseInfoForm.goodsVideo" link type="danger" @click="handleRemoveGoodsVideo">
|
||||
删除
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<div class="layout" style="width: 100%">
|
||||
@@ -1074,6 +1076,15 @@ export default {
|
||||
file.url = file.response.result;
|
||||
this.baseInfoForm.goodsVideo = file.url;
|
||||
}
|
||||
this.loadingVideo = false;
|
||||
},
|
||||
handleRemoveGoodsVideo() {
|
||||
this.baseInfoForm.goodsVideo = "";
|
||||
this.showGoodsVideo = false;
|
||||
if (this.goodsVideo && typeof this.goodsVideo.destroy === "function") {
|
||||
this.goodsVideo.destroy();
|
||||
}
|
||||
this.goodsVideo = "";
|
||||
},
|
||||
// 图片大小不正确
|
||||
handleMaxSize(size = 2) {
|
||||
@@ -2361,9 +2372,23 @@ export default {
|
||||
}
|
||||
|
||||
.goods-video {
|
||||
align-items: flex-start;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.goods-video-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.goods-video-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.mb-10 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
|
||||
<div class="mt_10 page" style="display: flex; justify-content: flex-end; margin: 20px 0">
|
||||
<el-pagination
|
||||
v-model:current-page="searchForm.pageNumber"
|
||||
v-model:page-size="searchForm.pageSize"
|
||||
:current-page="searchForm.pageNumber"
|
||||
:page-size="searchForm.pageSize"
|
||||
:page-sizes="[20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@@ -68,7 +68,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getLiveList } from "@/api/promotion.js";
|
||||
import { getLiveList, whetherStar } from "@/api/promotion.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -100,14 +100,24 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async star(val, index) {
|
||||
let switched = this.liveData[index].recommend;
|
||||
await whetherStar({ id: val.id, recommend: switched });
|
||||
const switched = this.liveData[index].recommend;
|
||||
try {
|
||||
const res = await whetherStar({ id: val.id, recommend: switched });
|
||||
if (res.success) {
|
||||
this.getStoreLives();
|
||||
return;
|
||||
}
|
||||
this.liveData[index].recommend = !switched;
|
||||
} catch (e) {
|
||||
this.liveData[index].recommend = !switched;
|
||||
}
|
||||
},
|
||||
changePageSize(val) {
|
||||
this.searchForm.pageSize = val;
|
||||
this.getStoreLives();
|
||||
},
|
||||
changePageSize() {
|
||||
this.getStoreLives();
|
||||
},
|
||||
changePageNumber() {
|
||||
changePageNumber(val) {
|
||||
this.searchForm.pageNumber = val;
|
||||
this.getStoreLives();
|
||||
},
|
||||
async getStoreLives() {
|
||||
|
||||
Reference in New Issue
Block a user