Lou
2024-01-06 29dd94060e1ab443ece53177fd1bf13d4390744d
subPackage/grid/comment.vue
@@ -1,39 +1,64 @@
<template>
   <view class="container">
       <view class="content">
          <u-textarea v-model="content" placeholder="请输入内容" ></u-textarea>
       </view>
      <button class="submit-btn bgc-main c-ff f-30"  @click="submitInfo">提交</button>
   <!-- <view class="container">
      <view class="content">
         <u-textarea v-model="content" placeholder="请输入内容"></u-textarea>
      </view>
      <button class="submit-btn bgc-main c-ff f-30" @click="submitInfo">提交</button>
   </view> -->
   <view class="">
      <my-issue @submit="submitInfo" :score="score" :textareaShow="isEdit?false:true" :headTitleValue="title" />
   </view>
</template>
<script>
   import { addComment} from "@/api/article/article.js"
   export default{
      data(){
   import {
      addTenementComment
   } from "@/api/grid/grid.js"
   import myIssue from "@/components/myIssue/myIssue.vue"
   export default {
      components: {
         myIssue
      },
      data() {
         return {
            content:"",
            articleId:""
            content: "",
            id: "",
            title: "",
            isEdit: false,
            score: 0
         }
      },
      onLoad(option){
         this.articleId = option.id;
      onLoad(option) {
         this.id = option.id;
         this.title = option.title;
         if (option.data) {
            let data = JSON.parse(option.data);
            this.score = data.score;
            this.isEdit = true;
         }
      },
      methods:{
         submitInfo(){
            if(!this.content)return
            addComment({
               content:this.content,
               articleId:this.articleId
            }).then(res=>{
               if(res.code == 200){
      methods: {
         submitInfo(val) {
            let data = val;
            data.propertyCompanyid = this.id;
            data.createUser = uni.getStorageSync("userInfo").user_id;
            if (this.isEdit) {
               delete data.content;
            }
            addTenementComment(data).then(res => {
               if (res.code == 200) {
                  uni.showToast({
                     title:"提交成功!"
                     title: "提交成功!"
                  })
                  uni.$emit("refreshComment")
                  setTimeout(()=>{
                  setTimeout(() => {
                     uni.navigateBack();
                  },1000)
                  }, 1000)
               }
            })
         }
@@ -42,18 +67,20 @@
</script>
<style>
   .container{
      padding:30rpx 30rpx 0;
   .container {
      padding: 30rpx 30rpx 0;
   }
   .content{
      margin-bottom:50rpx;
   .content {
      margin-bottom: 50rpx;
   }
   .submit-btn{
      width:100%;
      height:80rpx;
      line-height:80rpx;
      border:none;
   .submit-btn {
      width: 100%;
      height: 80rpx;
      line-height: 80rpx;
      border: none;
      border-radius: 40rpx;
   }
</style>