123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <template>
- <view>
- <!-- 评价表单-->
- <view class="content bg-white">
- <!-- 标签 -->
- <view class="flex flex-wrap" style="padding: 16rpx;">
- <view class="tag-item" :class="{ 'tat-active': item.selected }" @tap="changeTag(index)"
- v-for="(item,index) in tagList" :key="index">{{ item.title }}</view>
- </view>
- <view class="uni-textarea">
- <textarea auto-height @input="textareaFun" :placeholder="placeholder"/>
- </view>
- </view>
- <view class="footer" @click="submitDafenFun">
- <view class="white text-center footer-text">
- 提交
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapGetters,
- mapActions
- } from 'vuex'
- import {
- getTagList,
- postSuggest
- } from '@/api/app';
- const app = getApp()
- export default {
- data() {
- return {
- reviewer: 0,
- targetId: null,
- target: null,
- content: '',
- tagList: [],
- activeTag: 0,
- placehoder:''
- };
- },
- onLoad(o) {
- this.getTagFun();
- },
- onShow() {
- this.getUser();
- },
- methods: {
- ...mapActions(['getUser']),
- textareaFun(e, index) {
- this.content = e.detail.value
- },
- changeTag(index) {
- this.tagList[index].selected = !this.tagList[index].selected
- let placehoder = '#';
- this.tagList.forEach((item, index) => {
- if (item.selected) {
- placehoder += item.title + '#';
- }
- })
- this.placeholder = placehoder;
- this.$forceUpdate();
- },
- async submitDafenFun() {
- if (!this.content) {
- this.$toast({
- title: '请输入内容'
- })
- return;
- }
- const {
- status,
- data,
- msg
- } = await postSuggest({
- title: this.placehoder,//标签
- content: this.content
- });
- if (status == 1) {
- this.$toast({
- title: msg
- }, {
- tab: 3,
- url: 1
- })
- }
- },
- async getTagFun() {
- const {
- status,
- data
- } = await getTagList({});
- if (status == 1) {
- this.tagList = data
- }
- },
- },
- computed: {
- ...mapGetters(['uid', 'userInfo'])
- }
- };
- </script>
- <style lang="scss">
- .content {
- margin: 24rpx;
- padding: 24rpx;
- box-shadow: 0rpx 8rpx 16rpx 2rpx rgba(0, 0, 0, 0.03);
- border-radius: 18rpx 18rpx 18rpx 18rpx;
- }
- .tag-item {
- margin: 8rpx;
- padding: 10rpx 28rpx;
- border-radius: 28rpx 28rpx 28rpx 28rpx;
- border: 2rpx solid #B8B8B8;
- }
- .tat-active {
- border: 2rpx solid #F37171;
- font-weight: 400;
- color: #F37171;
- }
- .uni-textarea {
- padding: 20rpx;
- height: 300rpx;
- background: #F7F7F7;
- border-radius: 5rpx;
- margin-bottom: 20rpx;
- textarea {
- width: 100%;
- height: 260rpx !important;
- min-height: 260rpx;
- max-height: 260rpx;
- overflow-y: hidden;
- font-size: 28rpx;
- }
- }
- .footer {
- margin-top: 40rpx;
- box-sizing: content-box;
- padding: 0 30rpx;
- .footer-text {
- height: 88rpx;
- line-height: 88rpx;
- background-color: $-color-primary;
- box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(221, 66, 80, 0.23);
- border-radius: 18rpx 18rpx 18rpx 18rpx;
- font-size: 32rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 500;
- }
- }
- .grade-form {
- //padding-bottom: calc(120rpx + env(safe-area-inset-bottom));
- }
- .user-content {
- padding: 30rpx;
- background-size: 100% auto;
- background-repeat: no-repeat;
- .user-img {
- width: 88rpx;
- height: 88rpx;
- overflow: hidden;
- border-radius: 50%;
- image {
- width: 100%;
- }
- }
- .user-text {}
- }
- </style>
|