commit
98ee348f2f
@ -403,6 +403,8 @@ public class WechatAppletController extends BaseController {
|
||||
}
|
||||
if(StringUtils.isNotEmpty(sysNutritionalVideo.getCoverUrl())){
|
||||
nutritionalVideoResponse.setCoverUrl(AliyunOSSUtils.generatePresignedUrl(sysNutritionalVideo.getCoverUrl()));
|
||||
}else{
|
||||
nutritionalVideoResponse.setCoverUrl(AliyunVideoUtils.getVideoCoverUrl(videoId));
|
||||
}
|
||||
nutritionalVideoResponse.setDescription(sysNutritionalVideo.getDescription());
|
||||
nutritionalVideoResponse.setTags(sysNutritionalVideo.getTags());
|
||||
|
@ -238,6 +238,29 @@ public class AliyunVideoUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据VideoId获取封面
|
||||
* @param videoId
|
||||
* @return
|
||||
*/
|
||||
public static String getVideoCoverUrl(String videoId){
|
||||
String coverUrl = null;
|
||||
try{
|
||||
com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient();
|
||||
GetVideoInfoRequest getVideoInfoRequest = new GetVideoInfoRequest()
|
||||
.setVideoId(videoId);
|
||||
GetVideoInfoResponse response = client.getVideoInfo(getVideoInfoRequest);
|
||||
if(response != null){
|
||||
GetVideoInfoResponseBody body = response.body;
|
||||
GetVideoInfoResponseBody.GetVideoInfoResponseBodyVideo video = body.video;
|
||||
coverUrl = video.coverURL;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return coverUrl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -9,11 +9,14 @@
|
||||
:before-upload="beforeAvatarUpload">
|
||||
<img v-if="imageUrl || coverUrl" :src="imageUrl || coverUrl" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
|
||||
<div class="el-upload__tip" slot="tip" style="color:#1890ff">
|
||||
<el-button v-if="imageUrl || coverUrl" size="small" type="danger" @click="removeFile">移除</el-button>
|
||||
<div>1、只能上传png、jpg文件,且每个文件不超过{{
|
||||
upload.fileSize / (1024 * 1024)
|
||||
}}M</div>
|
||||
<div style="margin-top:-10px;">{{tips ? ('2、'+tips) : ''}}</div>
|
||||
<div style="margin-top:5px;">{{tips ? ('2、'+tips) : ''}}</div>
|
||||
|
||||
</div>
|
||||
</el-upload>
|
||||
</template>
|
||||
@ -42,7 +45,7 @@ export default {
|
||||
methods: {
|
||||
resetUpload(){
|
||||
this.imageUrl = null;
|
||||
this.fileUrl = null
|
||||
this.fileUrl = null;
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
@ -56,6 +59,11 @@ export default {
|
||||
this.$message.error("文件上传失败");
|
||||
}
|
||||
},
|
||||
removeFile(){
|
||||
this.resetUpload();
|
||||
this.coverUrl = null;
|
||||
this.$emit("callbackMethod", '');
|
||||
},
|
||||
// 文件上传失败处理
|
||||
handleFileFail(err, file, fileList) {
|
||||
this.$message.error("文件上传失败");
|
||||
|
@ -196,7 +196,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面" prop="coverUrl">
|
||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" :coverUrl="form.previewUrl" @callbackMethod="handleCoverUrl"></UploadFile>
|
||||
<UploadFile ref="uploadFile" v-if="open" :prefix="'videoCover'" :coverUrl="form.previewUrl" @callbackMethod="handleCoverUrl" :tips="'视频未传封面图片时,会主动截取封面,但会存在延迟,请勿直接发布到小程序'"></UploadFile>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="form.cateId" clearable filterable placeholder="请选择类别">
|
||||
@ -224,7 +224,7 @@
|
||||
active-text="小程序展示"
|
||||
inactive-text="小程序不展示">
|
||||
</el-switch>
|
||||
<div>提示:请保证内容正确再展示到小程序</div>
|
||||
<div style="color:red">提示:请保证内容正确再展示到小程序</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@ -440,6 +440,7 @@
|
||||
},
|
||||
handleCoverUrl(url){
|
||||
this.form.coverUrl = url;
|
||||
console.log(this.form.coverUrl);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user