156 lines
3.3 KiB
Vue
156 lines
3.3 KiB
Vue
<template>
|
|
<view>
|
|
<view class="navbar-box fixed-top">
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
<view :style="{height: `${$u.sys().statusBarHeight}px;`}" />
|
|
<!-- #endif -->
|
|
<!-- #ifdef APP -->
|
|
<view :style="`height: ${$u.sys().statusBarHeight}px;`" />
|
|
<!-- #endif -->
|
|
<view class="navbar-title text-center rel">
|
|
<view class="back nav-item abs">
|
|
<u-icon name="arrow-left" size="22" />
|
|
</view>
|
|
发帖子
|
|
<view class="btn abs nav-item">
|
|
<u-button @click="issueFn" :customStyle="{margin: 0, width: '144rpx', height: '56rpx'}"
|
|
color="#13AFA8">发布</u-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 防塌陷 -->
|
|
<view class="">
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
<view :style="{height: `${$u.sys().statusBarHeight}px;`}" />
|
|
<!-- #endif -->
|
|
<!-- #ifdef APP -->
|
|
<view :style="`height: ${$u.sys().statusBarHeight}px;`" />
|
|
<!-- #endif -->
|
|
<view class="" style="height: 88rpx;" />
|
|
</view>
|
|
<view class="textarea-box">
|
|
<u-textarea border="none" v-model="content" placeholder="请输入你的内容"></u-textarea>
|
|
</view>
|
|
<view class="upload-image-box flex-wrap align-center">
|
|
<view class="upload-image-item rel" :style="{marginRight: index%3==2 ? '0' : '24rpx'}"
|
|
v-for="(item,index) in picList" :key="index">
|
|
<image class="upload-image" :src="item" mode=""></image>
|
|
<image class="clear abs" src="@/static/images/app/serve/realname_clea.png" @click="DelPic('faultImage')"
|
|
mode=""></image>
|
|
</view>
|
|
<view class="upload-image-item" @click="getImage">
|
|
<image class="upload-image" src="@/static/images/app/serve/realname_upload.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
plazaNoteAdd
|
|
} from "@/api/discover/discover.js"
|
|
export default {
|
|
data() {
|
|
return {
|
|
picList: [],
|
|
content: '',
|
|
//分类id
|
|
categoryId:1,
|
|
};
|
|
},
|
|
methods: {
|
|
//发布
|
|
issueFn() {
|
|
console.log(this.content, '文本');
|
|
console.log(this.picList, '图片');
|
|
uni.showLoading({
|
|
title: '发布中...'
|
|
});
|
|
plazaNoteAdd({
|
|
content:this.content,
|
|
image:this.picList.join(','),
|
|
replyStatus:1,
|
|
type:1,
|
|
categoryId:this.categoryId
|
|
}).then(res=>{
|
|
console.log('发布成功');
|
|
uni.hideLoading();
|
|
uni.navigateBack()
|
|
})
|
|
},
|
|
//传图片
|
|
getImage() {
|
|
this.$util.uploadImageOne({
|
|
count: 9,
|
|
sizeType: ['original'],
|
|
sourceType: ['album', 'camera'],
|
|
dir: 'crmebimage/public/product/'
|
|
}, null, res => {
|
|
this.picList.push(res.data)
|
|
uni.hideLoading();
|
|
});
|
|
},
|
|
DelPic(index) {
|
|
this.picList.splice(index, 1)
|
|
},
|
|
},
|
|
onLoad(options) {
|
|
console.log(options);
|
|
this.categoryId=options.type
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.navbar-box {
|
|
border-bottom: 1rpx solid #eee;
|
|
|
|
.navbar-title {
|
|
width: 750rpx;
|
|
line-height: 88rpx;
|
|
|
|
.back {
|
|
left: 24rpx;
|
|
}
|
|
|
|
.btn {
|
|
right: 24rpx;
|
|
}
|
|
|
|
.nav-item {
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
}
|
|
}
|
|
}
|
|
|
|
.textarea-box {
|
|
padding: 48rpx;
|
|
width: 750rpx;
|
|
height: 434rpx;
|
|
}
|
|
|
|
.upload-image-box {
|
|
padding: 0 48rpx;
|
|
width: 750rpx;
|
|
|
|
.upload-image-item {
|
|
margin-bottom: 24rpx;
|
|
width: 202rpx;
|
|
height: 202rpx;
|
|
}
|
|
|
|
.upload-image {
|
|
width: 202rpx;
|
|
height: 202rpx;
|
|
border-radius: 8rpx;
|
|
}
|
|
|
|
.clear {
|
|
top: -16rpx;
|
|
right: -16rpx;
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
}
|
|
}
|
|
</style> |