party-rank-uniapp/src/pages/feedback/add.vue

64 lines
1.1 KiB
Vue

<template>
<view class="page">
<view class="form">
<textarea v-model="content" name="content" placeholder="请填写内容" focus auto-height />
</view>
<view class="block">
<button class="btn-danger" @click="submit"></button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
content: ''
}
},
methods: {
submit() {
if (!this.content) {
return uni.showToast({
title: '请填写内容',
icon: 'error'
})
}
this.$ajax.post('/api/feedback', { content: this.content }, { custom: { loading: true } }).then(res => {
if (res.status == 0) {
this.content = ''
uni.showToast({
title: '提交成功',
icon: 'succsss'
})
}
})
}
}
}
</script>
<style>
.page {
background-color: white;
}
.form {
padding: 20rpx;
margin-top: 150rpx;
}
::v-deep uni-textarea {
border: 1px solid #ddd;
width: 100%;
box-sizing: border-box;
padding: 10rpx;
min-height: 400rpx;
}
.block {
padding: 20rpx;
margin-top: 40rpx;
}
.block .btn-danger {
width: 100%;
}
</style>