You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
480 lines
14 KiB
480 lines
14 KiB
<template>
|
|
<view class="v-page">
|
|
<view class="v-card contain" style="padding-bottom: 120rpx;">
|
|
<evan-form class="v-form" ref="form" :hide-required-asterisk="hideRequiredAsterisk" :model="info">
|
|
<view class="v-card-item">
|
|
<view class="v-card-box">
|
|
<common-title :title="'基础信息'"></common-title>
|
|
<evan-form-item label="资源名称:">
|
|
<input v-model="info.resourceName" class="form-input" placeholder="请输入资源名称"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
<evan-form-item label="资源等级:">
|
|
<!-- <input v-model="info.grade" class="form-input" placeholder="请输入资源名称" placeholder-class="form-input-placeholder" /> -->
|
|
<picker class="level-picker" @change="bindPickerChange" :value="index" :range="array">
|
|
<view class="uni-input">{{ array[index] }}</view>
|
|
</picker>
|
|
</evan-form-item>
|
|
<evan-form-item label="资源标签:">
|
|
<!-- <input v-model="info.label" class="form-input" placeholder="请输入资源名称" placeholder-class="form-input-placeholder" /> -->
|
|
<view :class="['select', form.selectValue ? 'selected' : '']"
|
|
@tap="handleMultiple(form.selectIndex)">
|
|
{{ form.selectValue || '请选择' }}
|
|
</view>
|
|
</evan-form-item>
|
|
<evan-form-item label="联系人:">
|
|
<input v-model="info.contacts" class="form-input" placeholder="请输入联系人"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
<evan-form-item label="联系电话:">
|
|
<input v-model="info.telephone" class="form-input" placeholder="请输入联系电话"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
<evan-form-item label="投诉电话:">
|
|
<input v-model="info.complaintPhone" class="form-input" placeholder="请输入投诉电话"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
<evan-form-item label="服务电话:">
|
|
<input v-model="info.servicePhone" class="form-input" placeholder="请输入服务电话"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
<evan-form-item label="最大承载量:">
|
|
<input v-model="info.maxLoad" class="form-input" placeholder="请输入最大承载量"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
<evan-form-item label="瞬时承载量:">
|
|
<input v-model="info.instantLoad" class="form-input" placeholder="请输入瞬时承载量"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
<evan-form-item label="预警值:">
|
|
<input v-model="info.warningNum" class="form-input" placeholder="请输入预警值"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
<evan-form-item label="详细地址:">
|
|
<input v-model="info.address" class="form-input" placeholder="请输入详细地址"
|
|
placeholder-class="form-input-placeholder" />
|
|
</evan-form-item>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="v-card-item">
|
|
<view class="v-card-box">
|
|
<common-title :title="'景区信息'"></common-title> -->
|
|
<!-- <view class="title-pic">开放时间</view> -->
|
|
<!-- <textarea class="area-text" v-model="info.openTime" auto-height /> -->
|
|
<!-- <evan-form-item label="开放时间:">
|
|
<picker class="time-picker" mode="time" :value="startTime" start="00:00" end="23:59"
|
|
@change="bindTimeChange">
|
|
<view class="uni-input">{{ startTime }}</view>
|
|
</picker>
|
|
-
|
|
<picker class="time-picker" mode="time" :value="endTime" start="00:00" end="23:59"
|
|
@change="bindTimeChange1">
|
|
<view class="uni-input">{{ endTime }}</view>
|
|
</picker>
|
|
</evan-form-item> -->
|
|
<!-- </view> -->
|
|
<!-- </view> -->
|
|
<view class="v-card-item">
|
|
<view class="v-card-box">
|
|
<common-title :title="'开放时间'"></common-title>
|
|
<textarea class="area-text" v-model="info.openTime" auto-height />
|
|
</view>
|
|
</view>
|
|
<view class="v-card-item">
|
|
<view class="v-card-box">
|
|
<common-title :title="'门票说明'"></common-title>
|
|
<textarea class="area-text" v-model="info.ticketExplain" auto-height />
|
|
</view>
|
|
</view>
|
|
<view class="v-card-item">
|
|
<view class="v-card-box">
|
|
<common-title :title="'资源简介'"></common-title>
|
|
<textarea class="area-text" v-model="info.introduction" auto-height />
|
|
</view>
|
|
</view>
|
|
<view class="v-card-item">
|
|
<view class="v-card-box">
|
|
<common-title :title="'图片'"></common-title>
|
|
<w-upload ref="wUpload" :token="token" :imgShow="imgShow" :requestUrl="requestUrl"
|
|
:imgType="imgType" @updateImgList="updateImgList" :imgList="imgList"
|
|
@imgSuccess="imgSuccess"></w-upload>
|
|
</view>
|
|
</view>
|
|
<view class="v-card-item">
|
|
<view class="v-card-box">
|
|
<common-title :title="'语音讲解'"></common-title>
|
|
<audio-upload :title="'语音讲解'" :url="info.mp3Url" @fileSuccess="fileSuccess"></audio-upload>
|
|
</view>
|
|
</view>
|
|
<view class="v-card-item">
|
|
<view class="v-card-box">
|
|
<common-title :title="'宣传视频'"></common-title>
|
|
<htz-image-upload :data-type="1" v-model="ceshiData" mediaType="video" :sourceType="['album']"
|
|
:compress="false" :remove="true" :headers="{'Authorization':token}"
|
|
@uploadSuccess="ceshiUploadSuccess1" @imgDelete="ceshiImgDelete"
|
|
@uploadFail="ceshiUploadFail" :action="requestUrl"></htz-image-upload>
|
|
|
|
</view>
|
|
</view>
|
|
</evan-form>
|
|
<view class="v-page-button contain">
|
|
<button class="v-btn-large" @click="save">保存</button>
|
|
</view>
|
|
</view>
|
|
|
|
<multiple-picker title="请选择" :show="selectMultiple.show" :columns="selectMultiple.columns"
|
|
:defaultIndex="selectMultiple.index" @confirm="confirmMultiple" @cancel="selectMultiple.show = false"
|
|
@change="changeMultiple"></multiple-picker>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
scenicManageDetail,
|
|
scenicManageUpdate
|
|
} from '@/api/word/scenicAreaManagementEdit.js';
|
|
import {
|
|
getDicts
|
|
} from '@/api/system/dict/data.js'
|
|
import audioUpload from '@/components/audio-unpload/audioUpload.vue';
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue';
|
|
import wUpload from '@/components/file-img-upload/w-upload.vue';
|
|
import {
|
|
getToken
|
|
} from '@/utils/auth.js';
|
|
import config from '@/config.js';
|
|
const baseUrl = config.baseUrl;
|
|
|
|
export default {
|
|
components: {
|
|
audioUpload,
|
|
wUpload,
|
|
htzImageUpload
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
token: getToken(),
|
|
imgShow: true,
|
|
baseUr:baseUrl,
|
|
requestUrl: baseUrl + '/common/upload',
|
|
imgType: 'jpg,png,gif',
|
|
imgList: [],
|
|
ceshiData: [],
|
|
ceshiData1: [],
|
|
hideRequiredAsterisk: false,
|
|
array: ['其他','A', 'AA', 'AAA', 'AAAA', 'AAAAA'],
|
|
index: 0,
|
|
id: 0,
|
|
form: {
|
|
selectValue: '人文景观,城市观光',
|
|
selectIndex: ['2', '3']
|
|
},
|
|
startTime: '00:00',
|
|
endTime: '00:00',
|
|
selectMultiple: {
|
|
show: false,
|
|
index: [],
|
|
columns: [{
|
|
label: '自然风光',
|
|
value: '1'
|
|
},
|
|
{
|
|
label: '人文景观',
|
|
value: '2'
|
|
},
|
|
{
|
|
label: '城市观光',
|
|
value: '3'
|
|
},
|
|
{
|
|
label: '历史遗产',
|
|
value: '4'
|
|
},
|
|
{
|
|
label: '休闲度假',
|
|
value: '5'
|
|
},
|
|
{
|
|
label: '红色旅游',
|
|
value: '6'
|
|
},
|
|
{
|
|
label: '研学基地',
|
|
value: '7'
|
|
},
|
|
{
|
|
label: '新业态',
|
|
value: '8'
|
|
}
|
|
]
|
|
},
|
|
info: {
|
|
id: null,
|
|
resourceCode: null,
|
|
resourceName: '',
|
|
grade: '',
|
|
label: '',
|
|
contacts: '',
|
|
telephone: '',
|
|
complaintPhone: null,
|
|
servicePhone: null,
|
|
maxLoad: null,
|
|
instantLoad: null,
|
|
warningNum: null,
|
|
address: '',
|
|
openTime: '',
|
|
ticketExplain: '',
|
|
introduction: '',
|
|
imageUrl: null,
|
|
mp3Url: '',
|
|
videoUrl: '',
|
|
longitude: '',
|
|
latitude: ''
|
|
}
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
this.id = option.id
|
|
this.scenicManageDetail(this.id);
|
|
this.getArrayDicts("scenic_level")
|
|
this.getSelectMultipleDicts("scenic_type")
|
|
},
|
|
// onShow() {
|
|
// this.scenicManageDetail();
|
|
// },
|
|
mounted() {
|
|
this.$refs.form.setRules(this.rules);
|
|
},
|
|
methods: {
|
|
fileSuccess(val) {
|
|
let this_ = this
|
|
if (val) {
|
|
this_.info.mp3Url = val
|
|
}
|
|
},
|
|
ceshiUploadSuccess1(res) { //上传成功
|
|
var _res = JSON.parse(res.data);
|
|
//console.log('_res', _res)
|
|
let this_ = this
|
|
if (_res.code == 200) {
|
|
this_.ceshiData.push(this_.baseUr + _res.fileName);
|
|
|
|
console.log(this_.ceshiData,'上传视频后')
|
|
this_.ceshiData1.push(_res.fileName);
|
|
}
|
|
console.log(this_.ceshiData)
|
|
},
|
|
bindTimeChange(e) {
|
|
let this_ = this
|
|
console.log(this_.info)
|
|
this_.startTime = e.detail.value;
|
|
this_.info.openTime = this_.startTime + "-" + this_.endTime
|
|
console.log(this_.info.openTime)
|
|
},
|
|
bindTimeChange1(e) {
|
|
let this_ = this
|
|
console.log(this_.info)
|
|
this_.endTime = e.detail.value;
|
|
this_.info.openTime = this_.startTime + "-" + this_.endTime
|
|
console.log(this_.info.openTime)
|
|
},
|
|
updateImgList(val) {
|
|
console.log(val);
|
|
this.imgList.forEach((i, j) => {
|
|
if (j == val[0]) {
|
|
this.imgList.splice(j, 1);
|
|
this.$forceUpdate(); //强制更新视图
|
|
}
|
|
});
|
|
},
|
|
imgSuccess(val) {
|
|
console.log(val);
|
|
this.imgList.push(val);
|
|
this.$forceUpdate(); //强制更新视图
|
|
},
|
|
ceshiUploadFail(err) { //上传失败
|
|
console.log('err', err)
|
|
},
|
|
ceshiImgDelete(e) {
|
|
console.log('ceshiImgDelete', e)
|
|
let this_ = this
|
|
this_.ceshiData1 = []
|
|
console.log(this_.ceshiData1)
|
|
},
|
|
bindPickerChange: function(e) {
|
|
console.log('picker发送选择改变,携带值为', e.detail.value);
|
|
this.index = e.detail.value;
|
|
},
|
|
handleMultiple(val) {
|
|
console.log(val);
|
|
|
|
this.selectMultiple.index = val || [];
|
|
this.selectMultiple.show = true;
|
|
},
|
|
confirmMultiple(e) {
|
|
console.log(e);
|
|
|
|
let temp = [];
|
|
e.selected.forEach((item) => {
|
|
temp.push(item.label);
|
|
});
|
|
this.form.selectValue = temp.toString();
|
|
this.form.selectIndex = e.value;
|
|
this.selectMultiple.show = false;
|
|
},
|
|
changeMultiple(e) {
|
|
console.log(e);
|
|
},
|
|
scenicManageDetail(id) {
|
|
let this_ = this
|
|
scenicManageDetail(id).then((res) => {
|
|
if (res.code == 200) {
|
|
console.log(res.data)
|
|
this.info = res.data
|
|
if(res.data.videoUrl&&res.data.videoUrl!=null){
|
|
this_.ceshiData1 = res.data.videoUrl.split(",")
|
|
this_.ceshiData1.forEach(item=>{
|
|
this.ceshiData.push(this_.baseUr+item)
|
|
})
|
|
}
|
|
// if(res.data.openTime!=null){
|
|
// this.startTime = res.data.openTime.split('-')[0]
|
|
// this.endTime = res.data.openTime.split('-')[1]
|
|
// }else{
|
|
// this.startTime = ''
|
|
// this.endTime = ''
|
|
// }
|
|
this.selectMultiple.index = res.data.label.split(',');
|
|
this.form.selectIndex = res.data.label.split(',');
|
|
this.form.selectValue = res.data.labelValue;
|
|
console.log(this.form)
|
|
this.index = res.data.grade
|
|
let imgs = res.data.imageUrl;
|
|
if (imgs != null) {
|
|
this.imgList = imgs.split(',')
|
|
}
|
|
}
|
|
})
|
|
},
|
|
getArrayDicts(item) {
|
|
getDicts(item).then(res => {
|
|
if (res.code === 200) {
|
|
this.array = []
|
|
res.data.forEach(item => {
|
|
console.log(item.dictLabel)
|
|
this.array.push(item.dictLabel)
|
|
})
|
|
this.array.reverse();
|
|
}
|
|
})
|
|
},
|
|
getSelectMultipleDicts(item) {
|
|
getDicts(item).then(res => {
|
|
if (res.code === 200) {
|
|
this.selectMultiple.columns = []
|
|
res.data.forEach(item => {
|
|
let data = {
|
|
label: item.dictLabel,
|
|
value: item.dictValue
|
|
}
|
|
this.selectMultiple.columns.push(data)
|
|
})
|
|
}
|
|
})
|
|
},
|
|
save() {
|
|
let this_ = this;
|
|
// this_.info.openTime = this_.startTime + "-" + this_.endTime
|
|
if(this_.imgList&&this_.imgList.length>0){
|
|
this_.info.imageUrl = this_.imgList.join(",");
|
|
}
|
|
|
|
|
|
this.$refs.form.validate((res) => {
|
|
if (res) {
|
|
|
|
if(this_.ceshiData1&&this_.ceshiData1.length>0){
|
|
this_.info.videoUrl = this.ceshiData1.join(",")
|
|
}else{
|
|
this_.info.videoUrl = ''
|
|
}
|
|
this.info.label = this.form.selectIndex.join(",");
|
|
this.info.grade = this.index;
|
|
console.log(this_.info)
|
|
scenicManageUpdate(this.info).then(res => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: '编辑成功'
|
|
});
|
|
setTimeout(() => {
|
|
uni.navigateBack();
|
|
}, 500)
|
|
}
|
|
})
|
|
|
|
}
|
|
});
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
::v-deep .evan-form-item-container__label {
|
|
padding-left: 20rpx;
|
|
text-align-last: unset;
|
|
width: 25%;
|
|
}
|
|
|
|
.title-pic {
|
|
padding: 10px 15px;
|
|
color: #4d4d4d;
|
|
}
|
|
|
|
.area-text {
|
|
height: auto;
|
|
width: 90%;
|
|
min-height: 50rpx;
|
|
margin: 0 5%;
|
|
padding: 10rpx;
|
|
border-radius: 10rpx;
|
|
background-color: #f3f3f3;
|
|
}
|
|
|
|
.select {
|
|
width: 100%;
|
|
padding-top: 6px;
|
|
padding-bottom: 6px;
|
|
// padding-left: 9px;
|
|
padding-right: 9px;
|
|
border-radius: 4px;
|
|
font-size: 15px;
|
|
box-sizing: border-box;
|
|
color: #cccccc;
|
|
line-height: 26px;
|
|
|
|
&.selected {
|
|
color: #000;
|
|
}
|
|
}
|
|
|
|
.level-picker {
|
|
width: 100%;
|
|
padding: 5px 10px 5px 0;
|
|
}
|
|
|
|
.evan-form-show__button {
|
|
position: fixed;
|
|
bottom: 20rpx;
|
|
width: 94%;
|
|
transform: translateX(3%);
|
|
background-color: rgb(54, 127, 255);
|
|
color: #eee;
|
|
z-index: 99;
|
|
}
|
|
|
|
.g-body {
|
|
padding-bottom: 180rpx;
|
|
}
|
|
</style>
|
|
|