| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <template>
- <view>
- <view class="image-container" @click="selectShow = true">
- <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>
- <view class="text-sm text-gray margin-top-xs">建议上传横排照片或者视频</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" @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>
- <view class="basic-container">
- <view class="padding-sm">
- <text class="cuIcon-titles theme-color" style="font-size: 36upx;"></text>
- <text class="text-black text-bold text-lg">基本信息</text>
- </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="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" />
- </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" />
- </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" />
- </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;">
- <u-line color="#e3e3e3" />
- </view>
- <view style="margin: 30upx 0 40upx 0;">
- <u-button class="custom-style" shape="circle" @click="navWithParam">确定提交</u-button>
- </view>
- </view>
- </view>
- <view class="homeBtn" @click="home">
- <image src="/static/home.png" style="width: 40upx;height: 40upx;" />
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- detail:{},
- selectShow: false,
- list: [{
- text: '上传图片'
- }, {
- text: '上传视频'
- }],
- current: 0,
- classification: [],
- 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) {
- //上传图片
- res = await this.$mpi.uploadFile()
- } else {
- //上传视频
- res = await this.$mpi.uploadVideo()
- }
- let obj = JSON.parse(res);
- this.data.urls = obj.data
- },
- async uploadCover() {
- let res = await this.$mpi.uploadFile()
- this.data.cover = JSON.parse(res).data;
- },
- home() {
- uni.navigateTo({
- url: "/pages/activityList/home/home?activityId=" + this.data.activityId,
- })
- },
- getActivityDetail(id) {
- this.$u.api.activity.detail({id: id}).then(res => {
- this.detail = res
- this.classification = res.classification.split(',');
- this.data.personType = this.classification[0];
- })
- },
- preViewImg(url){
- uni.previewImage({
- urls: [url]
- });
- },
- select(index, item) {
- this.current = index;
- this.data.personType = item;
- },
- navWithParam() {
- console.log(this.data);
- if (this.$u.test.isEmpty(this.data.userId)) {
- uni.showToast({
- icon: "none",
- title: "请登录后再操作"
- })
- return;
- }
- 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;
- } else {
- this.$u.api.activity.signUp(this.data).then(res => {
- uni.showToast({
- icon: "none",
- title: "提交成功",
- duration: 3000,
- success: () => {
- uni.redirectTo({
- url: '/pages/activityList/mine/introduction?id=' + res.id
- })
- }
- })
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .image-container {
- text-align: center;
- background-color: #FFFFFF;
- height: 400upx;
- margin: 30upx;
- border-radius: 30upx;
- }
- .basic-container {
- background-color: #FFFFFF;
- margin: 20upx;
- border-radius: 30upx;
- }
- .tags {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 30%;
- height: 70upx;
- border: #4f4f4f 1px solid;
- border-radius: 28upx;
- }
- .custom-style {
- background-color: #5a3ee8;
- color: #FFFFFF;
- width: 400rpx;
- }
- </style>
|