Style(店铺):界面调整
This commit is contained in:
@@ -1,38 +1,69 @@
|
||||
<template>
|
||||
<view class="page-info-publish">
|
||||
<view class="tab-box flex jc-center">
|
||||
<text :class="{'active':tabIndex==index}" v-for="(item,index) in tabData" :key="item"
|
||||
@click="changeTab(index)">{{item.label}}</text>
|
||||
<text
|
||||
v-for="(item,index) in tabData"
|
||||
:key="item"
|
||||
:class="{
|
||||
'active': tabIndex === index
|
||||
}"
|
||||
@click="changeTab(index)"
|
||||
>{{item.label}}</text>
|
||||
</view>
|
||||
|
||||
<form @submit="formSubmit">
|
||||
<view class="form-item">
|
||||
<view class="title">标题:</view>
|
||||
<input v-model="title" type="text" placeholder="请输入动态标题..."
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;" />
|
||||
<input
|
||||
v-model="form.title"
|
||||
type="text"
|
||||
placeholder="请输入动态标题..."
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;"
|
||||
class="inp inp-input"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<textarea class="content-style" v-model="content" placeholder="请输入动态内容..."
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;" />
|
||||
<view class="title">简介:</view>
|
||||
<textarea
|
||||
v-model="form.intro"
|
||||
placeholder="请输入简介..."
|
||||
placeholder-style="font-size:24rpx;color:#C2C5CC;"
|
||||
class="content-style inp"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="form-item" v-if="showUpload">
|
||||
<tm-upload :dataList="picsArray" :upload_img_wh="uploadImgWH" :upload_max="uploadMax" :url="uploadUrl" :type='uploadType'
|
||||
:header="uploadHeader" @change="uploadedImgChange" />
|
||||
<view v-if="uploadType === 'image'" class="title">图片(最多9张):</view>
|
||||
<view v-else class="title">视频:</view>
|
||||
<tm-upload
|
||||
:dataList="picsArray"
|
||||
:upload_img_wh="uploadImgWH"
|
||||
:upload_max="uploadMax"
|
||||
:url="uploadUrl"
|
||||
:type='uploadType'
|
||||
:header="uploadHeader"
|
||||
@change="uploadedImgChange"
|
||||
/>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<view class="title">资讯详情:</view>
|
||||
<view class="inp">
|
||||
<jin-edit
|
||||
:html="form.content"
|
||||
placeholder="请输入内容"
|
||||
height="320px"
|
||||
@editOk="editOk"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="form-btn">
|
||||
<button form-type="submit">发布</button>
|
||||
</view>
|
||||
</form>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tmUpload from '@/pagesInn/components/tm-upload/tm-upload.vue';
|
||||
import jinEdit from '@/pagesInn/components/jin-edit/jin-edit.vue';
|
||||
import {
|
||||
VUE_APP_API_URL
|
||||
} from "@/config";
|
||||
@@ -41,7 +72,8 @@
|
||||
} from "@/api/inn.js";
|
||||
export default {
|
||||
components: {
|
||||
tmUpload
|
||||
tmUpload,
|
||||
jinEdit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -73,8 +105,11 @@
|
||||
}
|
||||
],
|
||||
tabIndex: 0,
|
||||
title: "",
|
||||
content: ""
|
||||
form: {
|
||||
title: '',
|
||||
intro: '',
|
||||
content: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
@@ -83,46 +118,48 @@
|
||||
methods: {
|
||||
changeTab(index) {
|
||||
this.tabIndex = index;
|
||||
this.showUpload=false;
|
||||
this.uploadType= this.tabData[index].uploadType;
|
||||
this.uploadCount= this.tabData[index].uploadCount;
|
||||
this.showUpload = false;
|
||||
this.uploadType = this.tabData[index].uploadType;
|
||||
this.uploadCount = this.tabData[index].uploadCount;
|
||||
|
||||
setTimeout(()=>{
|
||||
this.showUpload=true;
|
||||
this.showUpload = true;
|
||||
},100)
|
||||
},
|
||||
|
||||
editOk(res) {
|
||||
this.form.content = res.html
|
||||
},
|
||||
//文件上传结果
|
||||
uploadedImgChange: function(uploadedFilesList) {
|
||||
this.uploadedFilesArray = uploadedFilesList;
|
||||
},
|
||||
|
||||
formSubmit(e) {
|
||||
if (this.title.length == 0) {
|
||||
if (!this.form.title) {
|
||||
this.$dialog.error("请输入动态标题");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.content.length == 0) {
|
||||
this.$dialog.error("请输入动态内容");
|
||||
if (!this.form.intro) {
|
||||
this.$dialog.error("请输入简介");
|
||||
return;
|
||||
}
|
||||
if (!this.form.content) {
|
||||
this.$dialog.error("请输入资讯详情");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.uploadedFilesArray.length == 0) {
|
||||
this.$dialog.error("请上传动态图片或视频");
|
||||
return;
|
||||
}
|
||||
|
||||
let param = {
|
||||
hotelId: this.hotelId,
|
||||
name: this.title,
|
||||
content: this.content,
|
||||
type: this.tabData[this.tabIndex].type,
|
||||
resources: this.uploadedFilesArray.join(",")
|
||||
};
|
||||
|
||||
uni.showLoading();
|
||||
postHotelNewsAdd(param).then(res => {
|
||||
postHotelNewsAdd({
|
||||
hotelId: this.hotelId,
|
||||
name: this.form.title,
|
||||
intro: this.form.intro,
|
||||
content: this.form.content,
|
||||
type: this.uploadType === 'image' ? 'NT_TEXT' : 'NT_VIDEO',
|
||||
resources: this.uploadType === 'image' ? this.uploadedFilesArray : [],
|
||||
video: this.uploadType === 'image' ? '' : this.uploadedFilesArray[0]
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
this.$dialog.toast({
|
||||
mes: "发布成功!"
|
||||
@@ -141,6 +178,7 @@
|
||||
|
||||
<style lang="scss">
|
||||
.page-info-publish {
|
||||
padding: 0 0 80rpx 0;
|
||||
font-size: 28rpx;
|
||||
|
||||
.tab-box {
|
||||
@@ -173,10 +211,24 @@
|
||||
background: #fff;
|
||||
|
||||
.content-style {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
color: #C2C5CC;
|
||||
box-sizing: border-box;
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.inp {
|
||||
padding: 10rpx 16rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
.inp-input {
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
}
|
||||
.title {
|
||||
margin: 0 0 10rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.form-btn {
|
||||
|
||||
Reference in New Issue
Block a user