courseComment.vue
2.8 KB
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
<template>
<!-- 评论 -->
<view class="course_comment">
<view class="comment_content">
<textarea v-model="content" placeholder="请输入评论内容,最多1000字" />
<!-- 字数 -->
<view class="word_num">{{content.length}}/1000</view>
<view v-if="addpic">
<!-- 添加图片 -->
<view class="add_pic layer_star" @click="uploadpic">
<image src="../../static/tupian_icon@2x.png" mode="widthFix"></image>
<view class="add_word">添加图片</view>
</view>
</view>
<view class="picbox" v-else>
<!-- 上传的图片 -->
<view class="upload_pic" @click="uploadImg()">
<image :src="img" mode="widthFix"></image>
</view>
</view>
</view>
<!-- 按钮 -->
<view class="send_wrap">
<view class="send_box">发送</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
content:"",
img:"../../static/addpic.png",
addpic:true
}
},
methods: {
uploadpic(){
console.log(3874273487)
this.addpic=false
},
// 上传图片
uploadImg(){
let t = this;
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: chooseImageRes => {
const tempFilePaths = chooseImageRes.tempFilePaths;
this.img = tempFilePaths[0]
// App.upload(tempFilePaths[0]).then(res => {
// this.front_image = res.url;
// });
}
});
},
},
}
</script>
<style lang="scss">
page{
background-color: #fafbfd;
}
.picbox{
margin-top:85rpx;
}
.course_comment{
padding: 36upx 32upx 150upx;
// 信息
.comment_content{
position: relative;
border:2upx solid rgba(189,196,206,1);
padding: 26upx 28upx 50upx;
background-color: #fff;
textarea{
width: 100%;
box-sizing: border-box;
height: 500upx;
}
// 添加图片
.add_pic{
position: absolute;
left: 26upx;
bottom: 14upx;
image{
width: 36upx;
margin-right: 12upx;
}
.add_word{
color: #3D444D;
font-size: 24upx;
border-bottom: 1px solid #000;
}
}
// 字数
.word_num{
position: absolute;
right: 26upx;
top: 530upx;
color: #3D444D;
font-size: 24upx;
}
}
// 上传的图片
.upload_pic{
width:200upx;
height:200upx;
font-size:0;
}
// 按钮
.send_wrap{
width: 100%;
position: fixed;
left: 0;
padding-bottom: 36upx;
bottom:0;
left:0;
display:flex;
justify-content: center;
background: #fff;
.send_box{
width:686upx;
margin: 0 32upx;
height: 96upx;
text-align: center;
line-height: 96upx;
border-radius: 48upx;
color: #fff;
background-color: #EE8B27;
font-size: 28upx;
}
}
}
</style>