HHSLinkSLink/HSLink-app/pages/tabbar/release/release.vue

167 lines
3.0 KiB
Vue
Raw Normal View History

2020-09-16 09:25:13 +08:00
<template>
2020-09-17 20:01:50 +08:00
<view class="page">
2020-10-10 10:44:32 +08:00
<view class="clear" @tap="clear">
重置
</view>
2020-09-17 20:01:50 +08:00
<view class="cu-item height">
<view class="action">
<text class="text-black">文章名称</text>
2020-09-16 09:25:13 +08:00
</view>
</view>
2020-09-17 20:01:50 +08:00
<view class="cu-item title">
<textarea placeholder="请输入文章名称"
v-model="noticeInfo.title"
maxlength=50
></textarea>
</view>
<view class="cu-item height">
<view class="action">
<text class="text-black">文章标签</text>
</view>
</view>
<view class="cu-item label">
<textarea placeholder="请输入文章标签"
v-model="noticeInfo.label"
maxlength=4
></textarea>
</view>
<view class="cu-item">
<view class="action">
<text class="text-black">文章内容</text>
</view>
</view>
2020-09-23 18:53:25 +08:00
<view class="cu-item content ">
2020-09-17 20:01:50 +08:00
<textarea placeholder="请输入文章内容"
v-model="noticeInfo.content"
auto-height="true"
2020-10-10 10:44:32 +08:00
maxlength=8000
2020-09-17 20:01:50 +08:00
></textarea>
</view>
2020-09-16 09:25:13 +08:00
</view>
2020-09-17 20:01:50 +08:00
</template>
2020-09-16 09:25:13 +08:00
<script>
2020-09-17 20:01:50 +08:00
import request from '@/util/request.js';
export default {
components: {
},
data() {
return {
//文章信息
noticeInfo: {
title: '',
label: '',
content: ''
},
}
},
2020-09-27 15:39:35 +08:00
onShow() {
2020-10-10 10:44:32 +08:00
},
mounted() {
2020-09-17 20:01:50 +08:00
this.noticeInfo = {
title: '',
label: '',
content: ''
}
},
2020-09-18 21:13:55 +08:00
onPullDownRefresh () {
uni.startPullDownRefresh();
},
2020-09-23 18:53:25 +08:00
onNavigationBarButtonTap() {
this.preservation()
},
2020-09-17 20:01:50 +08:00
methods: {
2020-10-10 10:44:32 +08:00
/**
* 清空
*/
clear() {
this.noticeInfo = {
title: '',
label: '',
content: ''
}
},
2020-09-17 20:01:50 +08:00
/**
* 发表
*/
preservation() {
const NOTICE_TYPE = {
"学生": "学生想法",
"家长": "家长建议",
"教师": "校园通知"
}
request.post('/hs/addArticle',{
id: this.noticeInfo.id,
label: this.noticeInfo.label,
title: this.noticeInfo.title,
content: this.noticeInfo.content,
release_id: uni.getStorageSync("userInfo").user_id,
type: NOTICE_TYPE[uni.getStorageSync("userInfo").user_type]
}).then(res => {
console.log("发表文章",res);
if (res.data === 1) {
uni.showToast({
icon: 'loading',
title: '发表成功'
});
setTimeout(() => {
uni.switchTab({
url: '/pages/tabbar/homepage/homepage'
});
},1000)
}
},err=>{
console.log("err",err);
})
}
2020-09-16 09:25:13 +08:00
}
}
</script>
2020-09-17 20:01:50 +08:00
<style scoped>
2020-10-10 10:44:32 +08:00
.clear{
position: absolute;
right: 20px;
color: #999;
}
2020-09-18 21:13:55 +08:00
.page{
background-color: #FFFFFF;
border-radius: 10rpx;
2020-09-23 18:53:25 +08:00
padding: 20rpx;
2020-09-18 21:13:55 +08:00
}
2020-09-17 20:01:50 +08:00
.button{
padding: 40rpx 100rpx 80rpx;
2020-09-16 09:25:13 +08:00
}
2020-09-17 20:01:50 +08:00
.cu-item{
2020-09-23 18:53:25 +08:00
padding: 20rpx 0;
2020-09-17 20:01:50 +08:00
}
.title{
padding-top: 0;
2020-09-16 09:25:13 +08:00
}
2020-09-23 18:53:25 +08:00
.title, .label, .content{
2020-09-17 20:01:50 +08:00
background-color: #F1F1F1;
2020-09-16 09:25:13 +08:00
width: 100%;
2020-09-23 18:53:25 +08:00
padding: 20rpx;
2020-09-17 20:01:50 +08:00
border-radius: 10rpx;
}
2020-09-23 18:53:25 +08:00
textarea{
text-indent: 32rpx;
line-height: 1.5;
width: 100%;
height: 100%;
}
2020-09-17 20:01:50 +08:00
.title textarea{
height: 128rpx;
font-weight: bold;
}
.label textarea{
height: 80rpx;
}
.content textarea{
min-height: 400rpx;
text-indent: 40rpx;
2020-09-16 09:25:13 +08:00
}
2020-09-17 20:01:50 +08:00
2020-09-16 09:25:13 +08:00
</style>