linwe
2024-08-08 3c738f4fe2762bba8087e5a22fc0dc06560eab0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<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>
</template>
 
<script>
    import { addComment} from "@/api/article/article.js"
    export default{
        data(){
            return {
                content:"",
                articleId:""
            }
        },
        onLoad(option){
            this.articleId = option.id;
        },
        methods:{
            submitInfo(){
                if(!this.content)return 
                console.log(this,555)
                addComment({
                    content:this.content,
                    articleId:this.articleId
                }).then(res=>{
                    if(res.code == 200){
                        uni.showToast({
                            title:"提交成功!"
                        })
                        uni.$emit("refreshComment")
                        setTimeout(()=>{
                            uni.navigateBack();
                        },1000)
                    }
                })
            }
        }
    }
</script>
 
<style>
    .container{
        padding:30rpx 30rpx 0;
    }
    .content{
        margin-bottom:50rpx;
    }
    .submit-btn{
        width:100%;
        height:80rpx;
        line-height:80rpx;
        border:none;
        border-radius: 40rpx;
        
    }
</style>