|
@@ -0,0 +1,173 @@
|
|
|
|
+<script setup>
|
|
|
|
+import { ref, reactive } from "vue";
|
|
|
|
+import { Camera } from "@/assets/svg";
|
|
|
|
+
|
|
|
|
+// 传入信息
|
|
|
|
+defineProps({
|
|
|
|
+ avatarUrl: {
|
|
|
|
+ type: String,
|
|
|
|
+ },
|
|
|
|
+ cardName: {
|
|
|
|
+ type: String,
|
|
|
|
+ },
|
|
|
|
+ imgs: {
|
|
|
|
+ type: Array,
|
|
|
|
+ default: () => [],
|
|
|
|
+ },
|
|
|
|
+ placeholder: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: "",
|
|
|
|
+ },
|
|
|
|
+ data: {
|
|
|
|
+ type: Object,
|
|
|
|
+ default: () => ({}),
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+const isFocus = ref(false);
|
|
|
|
+//
|
|
|
|
+const formData = reactive({
|
|
|
|
+ score: "",
|
|
|
|
+ content: "",
|
|
|
|
+ filedIds: [],
|
|
|
|
+});
|
|
|
|
+const imgsList = ref([]);
|
|
|
|
+function changeIsFocus(flag) {
|
|
|
|
+ isFocus.value = flag;
|
|
|
|
+}
|
|
|
|
+defineExpose({
|
|
|
|
+ getFormData() {
|
|
|
|
+ return formData;
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<template>
|
|
|
|
+ <view class="user-discuss">
|
|
|
|
+ <view class="user-discuss-header">
|
|
|
|
+ <view class="user-avatar">
|
|
|
|
+ <view class="avatar-center-wrap">
|
|
|
|
+ <image class="avatar-img" mode="aspectFit" :src="avatarUrl" />
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="user-discuss-info">
|
|
|
|
+ <view class="user-name">{{ cardName }}</view>
|
|
|
|
+ <view class="star">
|
|
|
|
+ <view class="star-text">评分</view>
|
|
|
|
+ <view class="star-area">
|
|
|
|
+ <uni-rate
|
|
|
|
+ :max="5"
|
|
|
|
+ v-model="formData.score"
|
|
|
|
+ :size="18"
|
|
|
|
+ :margin="2"
|
|
|
|
+ :value="5"
|
|
|
|
+ />
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view
|
|
|
|
+ class="user-discuss-content"
|
|
|
|
+ :class="{ discussContentFocus: isFocus }"
|
|
|
|
+ >
|
|
|
|
+ <view class="input-area">
|
|
|
|
+ <textarea
|
|
|
|
+ class="textarea"
|
|
|
|
+ :placeholder="placeholder"
|
|
|
|
+ :maxlength="1000"
|
|
|
|
+ @focus="changeIsFocus(true)"
|
|
|
|
+ @blur="changeIsFocus(false)"
|
|
|
|
+ v-model="formData.content"
|
|
|
|
+ >
|
|
|
|
+ </textarea>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="pictures">
|
|
|
|
+ <view class="picture-list">
|
|
|
|
+ <view
|
|
|
|
+ class="picture-list-item"
|
|
|
|
+ v-for="(item, index) in imgsList"
|
|
|
|
+ :key="index"
|
|
|
|
+ >
|
|
|
|
+ <image mode="aspectFit" class="list-item-img" :src="item" />
|
|
|
|
+ </view>
|
|
|
|
+ <view class="picture-list-item">
|
|
|
|
+ <view class="picture-btn wrap-center">
|
|
|
|
+ <Camera width="40" height="40" />
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+.user-avatar {
|
|
|
|
+ border: 2rpx solid #f2f2f2;
|
|
|
|
+ border-radius: 10rpx;
|
|
|
|
+ width: 100rpx;
|
|
|
|
+ height: 100rpx;
|
|
|
|
+ padding: 10rpx;
|
|
|
|
+ margin-right: 20rpx;
|
|
|
|
+ .avatar-center-wrap {
|
|
|
|
+ background: #000;
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.avatar-img,
|
|
|
|
+.list-item-img {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+}
|
|
|
|
+.user-discuss-header {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ .star {
|
|
|
|
+ margin-top: 10rpx;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ .star-area {
|
|
|
|
+ margin-left: 6rpx;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .star-text {
|
|
|
|
+ font-size: 24rpx;
|
|
|
|
+ color: #888;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.user-discuss-content {
|
|
|
|
+ width: 100%;
|
|
|
|
+ border-radius: 20rpx;
|
|
|
|
+ margin-top: 20rpx;
|
|
|
|
+ background-color: #f7f6f9;
|
|
|
|
+ min-height: 140rpx;
|
|
|
|
+ padding: 20rpx;
|
|
|
|
+ transition: 0.4s all linear;
|
|
|
|
+}
|
|
|
|
+.picture-list {
|
|
|
|
+ display: flex;
|
|
|
|
+ margin: 0 -5rpx;
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
+ .picture-list-item {
|
|
|
|
+ padding: 0 5rpx;
|
|
|
|
+ margin-bottom: 20rpx;
|
|
|
|
+ width: 33.33%;
|
|
|
|
+ height: 200rpx;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.discussContentFocus {
|
|
|
|
+ box-shadow: 0px 0px 2px 2px #edd5d9;
|
|
|
|
+}
|
|
|
|
+.textarea {
|
|
|
|
+ width: 100%;
|
|
|
|
+}
|
|
|
|
+.picture-btn {
|
|
|
|
+ border-radius: 10rpx;
|
|
|
|
+ border: 2rpx solid #ccc;
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+}
|
|
|
|
+</style>
|