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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<template>
    <view class='issue'>
        <view class="issue-head">
            <!--     <slot name="headPic"></slot>
            <image v-if="headPicShow" :src="headPicValue" class="issue-head-pic" mode=""></image> -->
            <text v-if="headTitleShow" class="issue-head-title">{{headTitleValue.slice(0,5)}}</text>
 
            <view class="issue-head-star-box" v-if="starsShow">
                <u-number-box :min="0" :max="5" :step="0.5" v-model="infoReceive.score"
                    @change="valChange"></u-number-box>
                <!-- <image v-for="(item,index) in starsMax" :key="index" :src="(index+1)>formatScore?starDefault:starActive"
                    mode="" @click="setScore(index+1)"></image> -->
            </view>
        </view>
        <!-- <textarea v-if="textareaShow" @blur="blur" v-model="infoReceive.content" :placeholder="textareaPlaceholder" /> -->
        <view class="issue-btn-box" v-if="submitShow">
            <button class="submit-btn bgc-main c-ff" :disabled="infoReceive.score?false:true"
                @click="doSubmit">{{submitText}}</button>
            <slot name="submit"></slot>
        </view>
    </view>
</template>
<script>
    export default {
        props: {
            headPicShow: { //图片
                type: [String, Boolean],
                default: true,
            },
            // headPicValue: {
            //     type: String,
            //     default: require('@/static/icon/st_pic.png')
            // },
 
            headTitleShow: { //标题
                type: [String, Boolean],
                default: true,
            },
            headTitleValue: {
                type: String,
                default: "物业评分"
            },
 
            starsShow: {
                type: [String, Boolean],
                default: true,
            },
            starsMax: { // 星星最大个数
                type: [String, Number],
                default: 10,
            },
            starDefault: { //未选中
                type: String,
                default: '/static/icon/st_star.png',
            },
            starActive: {
                type: String,
                default: '/static/icon/st_star_active.png',
            },
            score: { //默认分数
                type: [Number, String],
                default: 0
            },
            starsDisabled: { //是否禁用star
                type: [Boolean],
                default: false
            },
 
            textareaShow: { // 多行文本显示
                type: [String, Boolean],
                default: true,
            },
            textareaPlaceholder: {
                type: [String],
                default: "说点什么..."
            },
 
 
            submitShow: { // 发布按钮
                type: [String, Boolean],
                default: true,
            },
            submitText: {
                type: String,
                default: "发布",
            },
 
            // infoReceive: { // 获取值
            //     type: Object,
            //     default: function() {
            //         return {
            //             score: 0,
            //             content: ""
            //         }
            //     }
            // }
        },
        data() {
            return {
                infoReceive: {
                    score: 0,
                    content: ""
                },
                canSubmit: false
            }
 
        },
 
        watch: {
            score(newVal, oldVal) {
                this.infoReceive.score = newVal;
            }
        },
 
        computed: {
            formatScore() {
                return this.infoReceive.score
            }
        },
        methods: {
            /**
             * @name 设置分数
             */
            setScore(score) {
                if (this.starsDisabled !== false) return
                console.log(score)
                this.infoReceive.score = score
                this.$emit("scoreChange", score)
            },
 
            /**
             * @name 获取textarea内容
             */
 
            blur(e) {
                this.infoReceive.content = e.detail.value
            },
 
            /**
             * @name 提交
             */
            doSubmit() {
 
                this.$emit('submit', this.infoReceive)
 
            }
        },
        created() {
            this.infoReceive.score = this.score
        }
    }
</script>
<style lang='scss'>
    $backgroundC: #f9f9f9;
    $borderColor: #f5f5f5;
    $white: #ffffff;
    $fontSize: 28upx;
 
    .issue {
        /* background-color: $backgroundC; */
 
        &-head {
            background-color: $white;
            height: 100upx;
            border-top: 1upx solid $borderColor;
            border-bottom: 1upx solid $borderColor;
            padding: 0 25upx;
 
            &-pic {
                width: 70upx;
                height: 70upx;
                border-radius: 50%;
                vertical-align: middle;
                margin-right: 17upx;
            }
 
            &-title {
                line-height: 100upx;
                font-size: 30upx;
                vertical-align: middle;
                margin-right: 35upx;
            }
 
            &-star-box {
                display: inline-block;
 
                image {
                    width: 32upx;
                    height: 32upx;
                    vertical-align: middle;
                    margin-right: 14upx;
                }
 
                /* image.active {
                    animation: star_move ease-in 1 1s, star_rotate ease 1.5s infinite 1s;
                } */
            }
        }
 
        textarea {
            width: 100%;
            height: 420upx;
            background-color: $white;
            font-size: $fontSize;
            color: #898989;
            padding: 24upx;
            box-sizing: border-box;
            line-height: 40upx
        }
 
        &-btn-box {
            padding: 54upx 30upx;
 
            button {
                width: 100%;
                height: 80upx;
                border-radius: 80upx;
                font-size: $fontSize;
                /* background-color: #3682FF; */
                line-height: 80upx
            }
 
            button[disabled] {
                color: #fff !important;
                border-color: #999 !important;
                background-color: #999 !important;
            }
        }
    }
 
    @keyframes star_move {
        from {
            width: 50upx;
            height: 50upx;
            transform: rotate(180deg)
        }
 
        to {
            width: 32upx;
            height: 32upx;
            transform: rotate(0)
        }
    }
 
    @keyframes star_rotate {
        0% {
            transform: rotateY(360deg)
        }
 
        100% {
            transform: rotateY(180deg)
        }
    }
</style>