Commit a1cb9b38 authored by wangqinghua's avatar wangqinghua

视频上传和文件上的类型

文件地址错误
parent d9d7174c
This source diff could not be displayed because it is too large. You can view the blob instead.
#Tue May 14 10:28:01 CST 2019
#Tue May 14 16:17:30 CST 2019
base.0=/Users/ben/gitLab-project/party-build-cloud/platforms/android/app/build/intermediates/transforms/dexMerger/debug/0
renamed.0=classes.dex
file.0=/Users/ben/gitLab-project/party-build-cloud/platforms/android/app/build/intermediates/transforms/dexMerger/debug/0/classes.dex
......@@ -32,10 +32,12 @@
</ion-item>
<ion-item *ngIf="type == 'image'">
<ion-row>
<ion-col class="imgList" col-4 *ngFor="let img of fileList">
<ion-col class="imgList" col-4 *ngFor="let img of fileList;let i = index;" >
<span class="imgTips" *ngIf="i == 0">标题图片</span>
<ion-icon (click)="deleteFile(i)" class="main-color" name="close-circle"></ion-icon>
<img [src]="pictrue + img.path" alt="标题图片">
</ion-col>
<ion-col col-4>
<ion-col col-4 *ngIf="fileList.length < 9">
<div class="selectDiv" (click)="tackePic()">
<div class="height"></div>
<div class="width"></div>
......@@ -45,10 +47,13 @@
</ion-item>
<ion-item *ngIf="type == 'video'">
<ion-row>
<ion-col class="imgList" col-4 *ngFor="let video of fileList">
<video [src]="pictrue + video.path"></video>
<ion-col class="imgList" col-4 *ngFor="let video of fileList;let i = index;">
<ion-icon (click)="deleteFile(i)" class="main-color" name="close-circle"></ion-icon>
<video width="100%" height="100%" [src]="pictrue + video.path" controls="controls">
您的浏览器不支持 html5。
</video>
</ion-col>
<ion-col col-4>
<ion-col col-4 *ngIf="fileList.length < 3">
<div class="selectDiv" (click)="selectVideo()">
<div class="height"></div>
<div class="width"></div>
......
......@@ -53,8 +53,23 @@ page-publish {
}
}
.imgList{
text-align: center;
.imgTips{
position: absolute;
top: 5px;
left: 5px;
font-size: 1.4rem;
color: #888888;
}
ion-icon{
position: absolute;
top: 2px;
right: 2px;
font-size: 1.8rem;
color: #999999;
}
video,img{
width: 100%;
max-width: 100%;
max-height: 100px;
}
}
......
......@@ -96,6 +96,10 @@ export class PublishPage {
//选择图片
selectPicture(srcType) {
if(this.fileList.length > 8){
this.commonSer.toast('一批文章最多上传9个图片');
return false;
}
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
......@@ -124,6 +128,10 @@ export class PublishPage {
//选择视频
selectVideo() {
if(this.fileList.length > 2){
this.commonSer.toast('一批文章最多上传3个视频');
return false;
}
const options: CameraOptions = {
quality: 30,
destinationType: this.camera.DestinationType.FILE_URI,
......@@ -180,7 +188,7 @@ export class PublishPage {
this.commonSer.toast('上传成功');
const data = JSON.parse(res.response);
const obj = {
resourceType: 1,
// resourceType: this.type === 'image'?1:2, //1 标题图片 2 轮播图 3 视频
path: data.data[0].filePath,
name: data.data[0].showName,
};
......@@ -194,6 +202,27 @@ export class PublishPage {
//发布
publish() {
let attachmentsArr = [];
if(this.fileList.length > 0){
if(this.type == 'image'){ //将第一张图片作为标题图片 ,后面的图片 作为文章里面的图片
const obj = {
resourceType:1,
path: this.fileList[0].path,
name: this.fileList[0].name,
};
attachmentsArr = this.fileList.splice(1,this.fileList.length -1);
attachmentsArr.forEach(e=>{
this.obj.content += `<br><img src="/wisdomgroup/${e.path} " alt="图片">`;
});
this.fileList = [obj];
}
}
if(this.type == 'video'){
this.fileList.forEach(e=>{
e.resourceType = 3;
})
}
const data = {
title: this.obj.title,
plateType: this.obj.type,
......@@ -254,4 +283,9 @@ export class PublishPage {
actionSheet.present();
}
//删除文件
deleteFile(i){
this.fileList.splice(i,1);
}
}
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