Feat(店铺入驻):增加视频封面配置

This commit is contained in:
lifizer
2024-03-20 16:26:32 +08:00
parent 686e5d3eaa
commit 326010949b
2 changed files with 169 additions and 34 deletions
+124 -34
View File
@@ -16,18 +16,80 @@
</template>
</u-cell>
</u-form-item>
<u-form-item prop="cover">
<u-cell title="店铺封面图" :border="false">
<u-form-item prop="coverType">
<u-cell title="封面类型" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-radio-group
v-model="form.coverType"
placement="row"
>
<u-radio
:name="1"
:customStyle="{marginRight: '16px'}"
active-color="red"
label="图片"
/>
<u-radio
:name="2"
active-color="red"
label="视频"
/>
</u-radio-group>
</template>
</u-cell>
</u-form-item>
<u-form-item v-if="form.coverType === 1" prop="cover">
<u-cell title="店铺图片封面" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('cover')">
<view class="btn-upload" v-if="form.cover.length===0 || form.cover==null">上传图片</view>
<image class="img-preview" :src="form.cover" v-else/>
<view
class="box-upload"
@click="chooseLogoImg('cover')"
>
<view
v-if="!form.cover"
class="btn-upload"
>上传图片</view>
<image
v-else
:src="form.cover"
class="img-preview"
/>
</view>
</template>
</u-cell>
</u-form-item>
<u-form-item v-if="form.coverType === 2" prop="coverVideo">
<u-cell title="店铺视频封面" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
<u-cell :border="false">
<template #title>
<view
class="box-upload"
@click="chooseLogoVideo()"
>
<view
v-if="!form.coverVideo"
class="btn-upload"
>上传视频</view>
<video
v-else
:src="form.coverVideo"
:poster="form.coverVideo + '?vframe/jpg/offset/1'"
:controls="false"
play-btn-position="center"
class="video-item"
/>
</view>
</template>
</u-cell>
@@ -241,36 +303,50 @@
</template>
<script>
import CitySelect from "@/components/CitySelect";
import {getShopData, getShopInfo, removeApply, saveShop} from "@/api/join";
import {getCity, registerVerify} from "@/api/user";
import {chooseImage, moreImage, uploadImage} from "@/utils";
import CitySelect from "@/components/CitySelect"
import {
getShopData,
getShopInfo,
removeApply,
saveShop
} from "@/api/join"
import {
getCity,
registerVerify
} from "@/api/user"
import {
chooseImage,
moreImage,
uploadImage,
chooseVideoToUpload
} from "@/utils"
export default {
name: "pkgJoinShop",
name: "PkgJoinShop",
components: {
CitySelect
},
data() {
return {
partnerId: null,
pics: [],
quaPics: [],
tips: "",
tips: '',
form: {
name: "",
cover: "",
logo: "",
qualification: "",
name: '',
cover: '',
coverVideo: '',
coverType: 1, // coverType: 1-图片,2-视频
logo: '',
qualification: '',
type: 0,
typeText: "",
phone: "",
captcha: "",
area: "",
address: "",
position: "",
content: ""
typeText: '',
phone: '',
captcha: '',
area: '',
address: '',
position: '',
content: ''
},
rules: {
'name': {
@@ -282,7 +358,13 @@ export default {
'cover': {
type: 'string',
required: true,
message: '请上传店铺封面',
message: '请上传店铺图片封面',
trigger: ['blur', 'change']
},
'coverVideo': {
type: 'string',
required: true,
message: '请上传店铺视频方面',
trigger: ['blur', 'change']
},
'logo': {
@@ -340,23 +422,19 @@ export default {
trigger: ['blur', 'change']
}
},
showType: false,
columnsType: [],
indexType: [0],
district: [],
address: {},
isAgree: false,
show: false,
notice: "",
notice: '',
showRemove: false,
isDraft: null,
reviewStatus: null,
stateTitle: "",
stateType: "primary",
stateTitle: '',
stateType: 'primary',
isPass: false
}
},
@@ -458,6 +536,11 @@ export default {
this.form[target] = img;
});
},
chooseLogoVideo() {
chooseVideoToUpload(path => {
this.form.coverVideo = path
})
},
chooseShopImg() {
let that = this;
@@ -593,8 +676,11 @@ export default {
this.form.qualification += (item.url + ",");
})
this.form.qualification = this.form.qualification.substring(0, this.form.qualification.length - 1);
saveShop(this.form, this.partnerId).then(res => {
const postData = Object.assign({}, this.form)
if (postData.coverType === 2) {
postData.cover = postData.coverVideo
}
saveShop(postData, this.partnerId).then(res => {
if (res.status === 200) {
uni.showToast({
title: "您的入驻申请已提交成功,请耐心等待审核",
@@ -643,4 +729,8 @@ export default {
.font-color-red {
font-size: 22rpx;
}
.video-item {
width: 80px;
height: 80px;
}
</style>