|
|
@@ -1,12 +1,27 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
<view class="image-container" @click="selectShow = true">
|
|
|
- <view class="cuIcon-roundaddfill theme-color" style="font-size: 80upx;padding: 100upx 0 30upx 0;"></view>
|
|
|
- <view class="text-black text-bold text-sm">添加图片或视频</view>
|
|
|
+ <block v-if="$u.test.isEmpty(data.urls)">
|
|
|
+ <view class="cuIcon-roundaddfill theme-color" style="font-size: 80upx;padding: 100upx 0 30upx 0;"></view>
|
|
|
+ <view class="text-black text-bold text-sm">添加图片或视频</view>
|
|
|
+ </block>
|
|
|
+ <block v-else>
|
|
|
+ <block v-if="data.urlsType == 0">
|
|
|
+ <image :src="data.urls" style="height: 400upx;" @click="preViewImg(data.urls)"></image>
|
|
|
+ </block>
|
|
|
+ <block v-else>
|
|
|
+ <video :src="data.urls" style="height: 400upx;"></video>
|
|
|
+ </block>
|
|
|
+ </block>
|
|
|
</view>
|
|
|
- <view class="image-container" v-if="data.urlsType==1">
|
|
|
- <view class="cuIcon-roundaddfill theme-color" style="font-size: 80upx;padding: 100upx 0 30upx 0;"></view>
|
|
|
- <view class="text-black text-bold text-sm">请上传作品封面</view>
|
|
|
+ <view class="image-container" @click="uploadCover" v-if="data.urlsType == 1">
|
|
|
+ <block v-if="$u.test.isEmpty(data.cover)">
|
|
|
+ <view class="cuIcon-roundaddfill theme-color" style="font-size: 80upx;padding: 100upx 0 30upx 0;"></view>
|
|
|
+ <view class="text-black text-bold text-sm">请上传作品封面</view>
|
|
|
+ </block>
|
|
|
+ <block v-else>
|
|
|
+ <image :src="data.cover" style="height: 400upx;" @click="preViewImg(data.cover)"></image>
|
|
|
+ </block>
|
|
|
</view>
|
|
|
|
|
|
<u-action-sheet :list="list" @click="upload" v-model="selectShow"></u-action-sheet>
|
|
|
@@ -17,27 +32,27 @@
|
|
|
</view>
|
|
|
<view class="padding-sm flex justify-around align-center">
|
|
|
<block v-for="(item, index) in classification" :key="index">
|
|
|
- <view class="tags" :class="current == index ? 'theme-bg-color text-white' : ''" @click="current = index;data.personType=item">{{item}}</view>
|
|
|
+ <view class="tags" :class="current == index ? 'theme-bg-color text-white' : ''" @click="select(index,item)">{{item}}</view>
|
|
|
</block>
|
|
|
</view>
|
|
|
<view class="padding-sm">
|
|
|
<text class="text-black text-bold text-lg padding-left-sm">{{detail.personTitle}}</text>
|
|
|
<view style="padding: 30upx 20upx;">
|
|
|
- <u-input v-model="data.personName" :placeholder="'请输入'+detail.personTitle" />
|
|
|
+ <u-input v-model="data.personName" :placeholder="'请输入' + detail.personTitle" />
|
|
|
</view>
|
|
|
<view style="padding: 0 20upx 40upx 20upx;">
|
|
|
<u-line color="#e3e3e3" />
|
|
|
</view>
|
|
|
<text class="text-black text-bold text-lg padding-left-sm">{{detail.productionTitle}}</text>
|
|
|
<view style="padding: 30upx 20upx;">
|
|
|
- <u-input v-model="data.title" :placeholder="'请输入'+detail.productionTitle" />
|
|
|
+ <u-input v-model="data.title" :placeholder="'请输入' + detail.productionTitle" />
|
|
|
</view>
|
|
|
<view style="padding: 0 20upx 40upx 20upx;">
|
|
|
<u-line color="#e3e3e3" />
|
|
|
</view>
|
|
|
<text class="text-black text-bold text-lg padding-left-sm">{{detail.introductionTitle}}</text>
|
|
|
<view style="padding: 30upx 20upx 0 20upx;">
|
|
|
- <u-input v-model="data.introduce" type="textarea" :clearable="false" height="140" :autoHeight="false" maxlength="60" :placeholder="'请输入'+detail.productionTitle" />
|
|
|
+ <u-input v-model="data.introduce" type="textarea" :clearable="false" height="140" :autoHeight="false" maxlength="60" :placeholder="'请输入' + detail.productionTitle" />
|
|
|
</view>
|
|
|
<view class="flex justify-end padding-right-sm padding-bottom-sm text-gray">{{data.introduce.length}} / 60</view>
|
|
|
<view style="padding: 0 20upx 40upx 20upx;">
|
|
|
@@ -63,37 +78,43 @@
|
|
|
text: '上传视频'
|
|
|
}],
|
|
|
current: 0,
|
|
|
- type:0,
|
|
|
classification: [],
|
|
|
- name: '',
|
|
|
- introduction: '',
|
|
|
-
|
|
|
- data:{
|
|
|
- userId:'',
|
|
|
- urlsType:0,
|
|
|
- urls:'',
|
|
|
- person_name:'',
|
|
|
- introduce:''
|
|
|
+ data: {
|
|
|
+ userId: '',
|
|
|
+ urlsType: 0,
|
|
|
+ urls: '',
|
|
|
+ cover: '',
|
|
|
+ title: '',
|
|
|
+ personName: '',
|
|
|
+ personType: '',
|
|
|
+ introduce: '',
|
|
|
+ activityId: '',
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
this.getActivityDetail(options.activityId);
|
|
|
+ this.data.activityId = options.activityId;
|
|
|
+ this.data.userId = uni.getStorageSync("userId");
|
|
|
},
|
|
|
methods: {
|
|
|
async upload(index) {
|
|
|
console.log(index);
|
|
|
let res;
|
|
|
- this.data.urlsType=index
|
|
|
- if (index==0) {
|
|
|
+ this.data.urlsType = index
|
|
|
+ if (index == 0) {
|
|
|
//上传图片
|
|
|
- res=await this.$mpi.uploadFile()
|
|
|
- }else{
|
|
|
+ res = await this.$mpi.uploadFile()
|
|
|
+ } else {
|
|
|
//上传视频
|
|
|
- res=await this.$mpi.uploadVideo()
|
|
|
+ res = await this.$mpi.uploadVideo()
|
|
|
}
|
|
|
let obj = JSON.parse(res);
|
|
|
- this.data.urls=obj.data
|
|
|
+ this.data.urls = obj.data
|
|
|
+ },
|
|
|
+ async uploadCover() {
|
|
|
+ let res = await this.$mpi.uploadFile()
|
|
|
+ this.data.cover = JSON.parse(res).data;
|
|
|
},
|
|
|
getActivityDetail(id) {
|
|
|
this.$u.api.activity.detail({id: id}).then(res => {
|
|
|
@@ -101,11 +122,64 @@
|
|
|
this.classification = res.classification.split(',');
|
|
|
})
|
|
|
},
|
|
|
+ preViewImg(url){
|
|
|
+ uni.previewImage({
|
|
|
+ urls: [url]
|
|
|
+ });
|
|
|
+ },
|
|
|
+ select(index, item) {
|
|
|
+ this.current = index;
|
|
|
+ this.data.personType = item;
|
|
|
+ },
|
|
|
navWithParam() {
|
|
|
console.log(this.data);
|
|
|
- // uni.navigateTo({
|
|
|
- // url: '/pages/activityList/mine/introduction'
|
|
|
- // })
|
|
|
+ if (this.$u.test.isEmpty(this.data.urls)) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "请上传作品"
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.data.urlsType == 1 && this.$u.test.isEmpty(this.data.cover)) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "请上传作品封面"
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.$u.test.isEmpty(this.data.personName)) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "请填写个人名称"
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.$u.test.isEmpty(this.data.title)) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "请填写" + this.detail.productionTitle
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.$u.test.isEmpty(this.data.introduce)) {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "请填写个人介绍"
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$u.api.activity.signUp(this.data).then(res => {
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: "提交成功",
|
|
|
+ duration: 3000,
|
|
|
+ success: () => {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/activityList/mine/introduction?detail='+JSON.stringify(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|