瑶都万能墙
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.
 
 
 

356 lines
6.5 KiB

<template>
<view class="publishPost">
<navbar
leftClick
@leftClick="$utils.navigateBack"
title="发布动态"/>
<view class="title-input box">
<input type="text" placeholder="取个吸引人的标题吧" v-model="form.title"/>
</view>
<view class="category">
<view class="title">
选择分区
</view>
<view class="tagList">
<view
:class="{act : i == categoryIndex}"
@click="clickCategory(item, i)"
v-for="(t, i) in category"
:key="i">
{{ t.name }}
</view>
</view>
</view>
<view class="content-input">
<uv-textarea
v-model="form.content"
:maxlength="200"
autoHeight
count
placeholder="说点什么吧"></uv-textarea>
</view>
<view class="images box">
<uv-upload
:fileList="fileList"
:maxCount="4"
multiple
width="150rpx"
height="150rpx"
@delete="deleteImage"
@afterRead="afterRead"
:previewFullImage="true"></uv-upload>
</view>
<!-- <view class="upTop"
>
<view class="title">
<uv-icon name="pushpin-fill"></uv-icon>
是否置顶
</view>
<uv-radio-group v-model="form.topId">
<view class="list">
<view class="item">
<view class="left">
不需要置顶
</view>
<view class="right">
<uv-radio
size="35rpx"
icon-size="35rpx"
:disabled="!!id"
:name="0">
</uv-radio>
</view>
</view>
<view class="item"
v-for="(item, index) in upTopList"
:key="index">
<view class="left">
置顶{{ item.day }}{{ item.money }}
</view>
<view class="right">
<uv-radio
size="35rpx"
:disabled="!!id"
icon-size="35rpx"
:name="item.id">
</uv-radio>
</view>
</view>
</view>
</uv-radio-group>
</view> -->
<view class="configBtn"
@click="$refs.configPopup.open('getPublishPostNotice')">
发布须知
</view>
<configPopup
ref="configPopup"
/>
</view>
</template>
<script>
export default {
components : {
},
data() {
return {
form : {
// image : [],
content : '',
topId : 0,
title : '',
},
fileList: [
// {
// url: 'https://cdn.uviewui.com/uview/swiper/2.jpg'
// },
],
id : 0,
categoryIndex : 0,
category : [
{
name : '圈子动态',
},
{
name : '二手集市',
},
],
};
},
computed : {
// topInfo(){
// for (var i = 0; i < this.upTopList.length; i++) {
// if(this.upTopList[i].id == this.form.topId){
// return this.upTopList[i]
// }
// }
// return {}
// },
},
onLoad(args) {
this.id = args.id
},
onShow() {
},
methods : {
clickCategory(item, index){
this.categoryIndex = index
},
getDateil(){
if(!this.id){
return
}
let self = this
this.$api('indexGetTrendsDetail', {
id : this.id
}, res => {
if (res.code == 200) {
}
})
},
deleteImage(e){
this.fileList.splice(e.index, 1)
},
afterRead(e){
let self = this
e.file.forEach(file => {
self.$Oss.ossUpload(file.url).then(url => {
self.fileList.push({
url
})
})
})
},
// 发起支付
payOrder(){
let self = this
let data = {
// ...this.form,
content : this.form.content,
topId : this.form.topId,
title : this.form.title,
isCard : 'Y',
state : 0,
image : this.fileList.map((item) => item.url).join(","),
isTop : this.form.topId ? 'Y' : 'N',
}
if(this.id){
data.id = this.id
}
this.$api('infoReleaseTrends', data,
res => {
if(res.code == 200){
if(self.form.topId && !this.id){
uni.requestPayment({
provider: 'wxpay', // 服务提提供商
timeStamp: res.result.timeStamp, // 时间戳
nonceStr: res.result.nonceStr, // 随机字符串
package: res.result.packageValue,
signType: res.result.signType, // 签名算法
paySign: res.result.paySign, // 签名
success: function (res) {
console.log('支付成功',res);
self.$refs.confirmationPopupUpload.open()
// self.$refs.confirmationPopup.close()
},
fail: function (err) {
console.log('支付失败',err);
self.$refs.confirmationPopup.close()
uni.showToast({
icon:'none',
title:"支付失败"
})
}
});
}else{
self.$refs.confirmationPopupUpload.open()
}
}
})
},
// 提交
submit(){
if(this.fileList.length == 0){
return uni.showToast({
title: '请上传图片',
icon : 'none'
})
}
if (this.$utils.verificationAll(this.form, {
title: '请输入标题',
content: '请输入正文',
})) {
return
}
},
preview(){},
draft(){},
}
}
</script>
<style lang="scss" scoped>
.publishPost{
background-color: #fff;
min-height: 100vh;
font-size: 28rpx;
padding-bottom: 150rpx;
/deep/ .uv-textarea{
background-color: transparent;
border: none;
}
/deep/ .uv-textarea__count{
background-color: transparent !important;
}
.box{
padding: 0 20rpx;
}
.images{
display: flex;
flex-wrap: wrap;
padding: 20rpx;
}
.title-input{
border-bottom: 1px solid #00000015;
padding-bottom: 25rpx;
margin-bottom: 15rpx;
}
.content-input{
min-height: 400rpx;
}
.upTop{
.title{
padding-top: 20rpx;
padding-left: 20rpx;
border-top: 1px solid #00000015;
display: flex;
align-items: center;
}
.list{
padding-top: 30rpx;
width: 100%;
.item{
display: flex;
padding: 20rpx;
padding-left: 80rpx;
justify-content: space-between;
width: 600rpx;
border-bottom: 1px solid #00000015;
align-items: center;
}
}
}
.configBtn{
padding: 20rpx;
color: #777;
padding-top: 40rpx;
font-size: 28rpx;
}
.confirmationPopup{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 300rpx;
image{
margin-top: 40rpx;
}
.info{
margin-top: 40rpx;
font-size: 26rpx;
}
}
}
.category{
padding: 20rpx;
.title{
// font-weight: 900;
// font-size: 30rpx;
}
.tagList{
display: flex;
flex-wrap: wrap;
padding: 10rpx 0;
view{
background: rgba($uni-color, 0.1);
padding: 10rpx 20rpx;
margin: 10rpx;
border-radius: 10rpx;
font-size: 26rpx;
}
.act{
color: #fff;
background: $uni-color;
}
}
}
</style>