This commit is contained in:
曹辉 2023-04-06 12:11:58 +08:00
parent 2abe096216
commit 7fcef1d1ad
2 changed files with 70 additions and 30 deletions

View File

@ -45,9 +45,9 @@ export function delMotionPrescriptionLibrary(id) {
//点击视频上传 //点击视频上传
export function prescriptionVideoUpload(id) { export function getPrescriptionVideoInfo(id) {
return request({ return request({
url: `/system/motionPrescriptionLibrary/prescriptionVideoUpload?id=${id}`, url: `/system/motionPrescriptionLibrary/getPrescriptionVideoInfo?motionPrescriptionId=${id}`,
method: 'get', method: 'get',
}) })
} }
@ -56,9 +56,10 @@ export function prescriptionVideoUpload(id) {
//上传视频 //上传视频
export function confirmUploadVideo(motionPrescriptionId, prescriptionVideoUrl) { export function confirmUploadVideo(data) {
return request({ return request({
url: `/system/motionPrescriptionLibrary/confirmUploadVideo?motionPrescriptionId=${motionPrescriptionId}&&prescriptionVideoUrl=${prescriptionVideoUrl}`, url: `/system/motionPrescriptionLibrary/confirmUploadVideo`,
method: 'post', method: 'post',
data
}) })
} }

View File

@ -39,7 +39,6 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -85,7 +84,6 @@
</el-col>--> </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="motionPrescriptionLibraryList" :data="motionPrescriptionLibraryList"
@ -102,16 +100,20 @@
<el-table-column label="运动量" align="center" prop="motionCapacity" /> <el-table-column label="运动量" align="center" prop="motionCapacity" />
<el-table-column label="进阶时间" align="center" prop="advancedTime" /> <el-table-column label="进阶时间" align="center" prop="advancedTime" />
<el-table-column label="进阶方案" align="center" prop="advancedScheme" show-overflow-tooltip /> <el-table-column label="进阶方案" align="center" prop="advancedScheme" show-overflow-tooltip />
<el-table-column label="处方视频" align="center" prop="prescriptionVideoUrl" /> <el-table-column label="处方视频" align="center" prop="prescriptionVideoUrl">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-upload2" icon="el-icon-view"
@click="uploadhandle(scope.row)" @click="uploadhandle(scope.row)"
v-hasPermi="['system:motionPrescriptionLibrary:prescriptionVideoUpload']" v-hasPermi="['system:motionPrescriptionLibrary:getPrescriptionVideoInfo']"
>上传视频</el-button> >查看</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-upload2" @click="uploadopentrue">上传视频</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -129,7 +131,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
@ -137,7 +138,6 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改运动处方库数据对话框 --> <!-- 添加或修改运动处方库数据对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px" :inline="true"> <el-form ref="form" :model="form" :rules="rules" label-width="120px" :inline="true">
@ -190,15 +190,14 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- // --> <!-- // -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<video <!-- <video
v-if="videourl" v-if="videourl"
:src="baseurl+videourl" :src="baseurl+videourl"
style="width:350px;height:200px" style="width:350px;height:200px"
controls="controls" controls="controls"
></video> ></video>-->
<el-upload <el-upload
ref="upload" ref="upload"
:headers="upload.headers" :headers="upload.headers"
@ -207,6 +206,9 @@
:on-progress="handleFileUploadProgress" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
:data="upload.data" :data="upload.data"
:file-list="fileList"
:on-change="handleChange"
:limit="5"
drag drag
> >
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
@ -220,9 +222,26 @@
<el-button @click="upload.open = false"> </el-button> <el-button @click="upload.open = false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 查看视频 -->
<el-dialog title="查看" :visible.sync="lookvideoshow" width="1200px" append-to-body>
<div
v-for="(item,index) in lookvideolist"
:key="index"
style="display: inline-block;margin:0 30px 30px 0"
>
<video
:src="item"
style="width:350px;height:200px;display: inline-block;"
controls="controls"
></video>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="lookvideoshow = false"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { import {
listMotionPrescriptionLibrary, listMotionPrescriptionLibrary,
@ -230,7 +249,7 @@ import {
delMotionPrescriptionLibrary, delMotionPrescriptionLibrary,
addMotionPrescriptionLibrary, addMotionPrescriptionLibrary,
updateMotionPrescriptionLibrary, updateMotionPrescriptionLibrary,
prescriptionVideoUpload, getPrescriptionVideoInfo,
confirmUploadVideo confirmUploadVideo
} from "@/api/system/motionPrescriptionLibrary"; } from "@/api/system/motionPrescriptionLibrary";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
@ -258,6 +277,10 @@ export default {
title: "", title: "",
// //
open: false, open: false,
//
lookvideoshow: false,
//
lookvideolist: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -278,7 +301,7 @@ export default {
form: {}, form: {},
// //
// //
videourl: null, videourl: [],
upload: { upload: {
// //
open: false, open: false,
@ -371,7 +394,8 @@ export default {
trigger: "blur" trigger: "blur"
} }
] ]
} },
fileList: []
}; };
}, },
created() { created() {
@ -492,13 +516,23 @@ export default {
); );
}, },
uploadhandle(e) { uploadhandle(e) {
this.upload.data.motionPrescriptionId = e.id; this.lookvideolist = [];
prescriptionVideoUpload(e.id).then(res => { getPrescriptionVideoInfo(e.id).then(res => {
console.log(res); res.data.forEach(e => {
this.videourl = res.data.prescriptionVideoUrl; e.prescriptionVideoUrl = baseurl + e.prescriptionVideoUrl;
this.upload.open = true; this.lookvideolist.push(e.prescriptionVideoUrl);
});
this.lookvideoshow = true;
}); });
}, },
//
uploadopentrue() {
this.upload.open = true;
this.videourl = [];
this.fileList = [];
},
//
handleChange(file, fileList) {},
// //
handleFileUploadProgress(event, file, fileList) { handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true; this.upload.isUploading = true;
@ -506,6 +540,7 @@ export default {
// //
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
this.upload.isUploading = false; this.upload.isUploading = false;
this.fileList = fileList.slice();
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
// this.$alert( // this.$alert(
// "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + // "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
@ -514,18 +549,22 @@ export default {
// "", // "",
// { dangerouslyUseHTMLString: true } // { dangerouslyUseHTMLString: true }
// ); // );
this.videourl = response.prescriptionVideoUrl; this.videourl.push(response.prescriptionVideoUrl);
}, },
// //
submitFileForm() { submitFileForm() {
confirmUploadVideo( var obj = {
this.upload.data.motionPrescriptionId, motionPrescriptionId: this.upload.data.motionPrescriptionId,
this.videourl prescriptionVideoUrlList: this.videourl
).then(res => { };
confirmUploadVideo(obj).then(res => {
this.upload.open = false; this.upload.open = false;
this.$modal.msgSuccess("上传视频成功");
this.getList(); this.getList();
}); });
} }
} }
}; };
</script> </script>
<style scoped>
</style>