|
@@ -1,9 +1,10 @@
|
|
<script setup>
|
|
<script setup>
|
|
|
|
+import { watch } from "vue";
|
|
import { ref, reactive } from "vue";
|
|
import { ref, reactive } from "vue";
|
|
-import { Camera } from "@/assets/svg";
|
|
|
|
|
|
+// import { Camera } from "@/assets/svg";
|
|
|
|
|
|
// 传入信息
|
|
// 传入信息
|
|
-defineProps({
|
|
|
|
|
|
+const props = defineProps({
|
|
avatarUrl: {
|
|
avatarUrl: {
|
|
type: String,
|
|
type: String,
|
|
},
|
|
},
|
|
@@ -18,27 +19,47 @@ defineProps({
|
|
type: String,
|
|
type: String,
|
|
default: "",
|
|
default: "",
|
|
},
|
|
},
|
|
|
|
+ modelValue: {
|
|
|
|
+ type: Object,
|
|
|
|
+ default: () => ({}),
|
|
|
|
+ },
|
|
data: {
|
|
data: {
|
|
type: Object,
|
|
type: Object,
|
|
default: () => ({}),
|
|
default: () => ({}),
|
|
},
|
|
},
|
|
});
|
|
});
|
|
const isFocus = ref(false);
|
|
const isFocus = ref(false);
|
|
-//
|
|
|
|
const formData = reactive({
|
|
const formData = reactive({
|
|
- score: "",
|
|
|
|
- content: "",
|
|
|
|
- filedIds: [],
|
|
|
|
|
|
+ score: 5,
|
|
|
|
+ comment: "",
|
|
});
|
|
});
|
|
-const imgsList = ref([]);
|
|
|
|
|
|
+// 监听分数变化
|
|
|
|
+watch(
|
|
|
|
+ () => formData.score,
|
|
|
|
+ () => {
|
|
|
|
+ changeValue();
|
|
|
|
+ }
|
|
|
|
+);
|
|
|
|
+// 监听评论内容变化
|
|
|
|
+watch(
|
|
|
|
+ () => formData.comment,
|
|
|
|
+ () => {
|
|
|
|
+ changeValue();
|
|
|
|
+ }
|
|
|
|
+);
|
|
|
|
+// 修改值
|
|
|
|
+const emit = defineEmits(["update:modelValue"]);
|
|
|
|
+function changeValue() {
|
|
|
|
+ const newItems = { ...props.modelValue };
|
|
|
|
+ Object.assign(newItems, formData);
|
|
|
|
+ emit("update:modelValue", newItems);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// const imgsList = ref([]);
|
|
|
|
+// 设置激活样式
|
|
function changeIsFocus(flag) {
|
|
function changeIsFocus(flag) {
|
|
isFocus.value = flag;
|
|
isFocus.value = flag;
|
|
}
|
|
}
|
|
-defineExpose({
|
|
|
|
- getFormData() {
|
|
|
|
- return formData;
|
|
|
|
- },
|
|
|
|
-});
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -52,7 +73,7 @@ defineExpose({
|
|
<view class="user-discuss-info">
|
|
<view class="user-discuss-info">
|
|
<view class="user-name">{{ cardName }}</view>
|
|
<view class="user-name">{{ cardName }}</view>
|
|
<view class="star">
|
|
<view class="star">
|
|
- <view class="star-text">评分</view>
|
|
|
|
|
|
+ <view class="star-text">score</view>
|
|
<view class="star-area">
|
|
<view class="star-area">
|
|
<uni-rate
|
|
<uni-rate
|
|
:max="5"
|
|
:max="5"
|
|
@@ -76,11 +97,11 @@ defineExpose({
|
|
:maxlength="1000"
|
|
:maxlength="1000"
|
|
@focus="changeIsFocus(true)"
|
|
@focus="changeIsFocus(true)"
|
|
@blur="changeIsFocus(false)"
|
|
@blur="changeIsFocus(false)"
|
|
- v-model="formData.content"
|
|
|
|
|
|
+ v-model="formData.comment"
|
|
>
|
|
>
|
|
</textarea>
|
|
</textarea>
|
|
</view>
|
|
</view>
|
|
- <view class="pictures">
|
|
|
|
|
|
+ <!-- <view class="pictures">
|
|
<view class="picture-list">
|
|
<view class="picture-list">
|
|
<view
|
|
<view
|
|
class="picture-list-item"
|
|
class="picture-list-item"
|
|
@@ -95,12 +116,15 @@ defineExpose({
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- </view>
|
|
|
|
|
|
+ </view> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
+.user-discuss {
|
|
|
|
+ margin-top: 40rpx;
|
|
|
|
+}
|
|
.user-avatar {
|
|
.user-avatar {
|
|
border: 2rpx solid #f2f2f2;
|
|
border: 2rpx solid #f2f2f2;
|
|
border-radius: 10rpx;
|
|
border-radius: 10rpx;
|
|
@@ -133,14 +157,14 @@ defineExpose({
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.star-text {
|
|
.star-text {
|
|
- font-size: 24rpx;
|
|
|
|
|
|
+ font-size: 34rpx;
|
|
color: #888;
|
|
color: #888;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.user-discuss-content {
|
|
.user-discuss-content {
|
|
width: 100%;
|
|
width: 100%;
|
|
border-radius: 20rpx;
|
|
border-radius: 20rpx;
|
|
- margin-top: 20rpx;
|
|
|
|
|
|
+ margin-top: 40rpx;
|
|
background-color: #f7f6f9;
|
|
background-color: #f7f6f9;
|
|
min-height: 140rpx;
|
|
min-height: 140rpx;
|
|
padding: 20rpx;
|
|
padding: 20rpx;
|