|
@@ -55,18 +55,18 @@
|
55
|
55
|
{ pattern, message: '记录必须包含汉字' },
|
56
|
56
|
]"
|
57
|
57
|
/>
|
58
|
|
- <!-- :before-delete="handleDelete" -->
|
|
58
|
+ <!-- :before-delete="handleDelete" -->
|
59
|
59
|
<van-field name="followImg" label="上传图片">
|
60
|
60
|
<template #input>
|
61
|
61
|
<van-uploader
|
62
|
62
|
v-model="imgUrl"
|
63
|
63
|
:after-read="handleUpload"
|
64
|
|
- :max-count="1"
|
|
64
|
+ :max-count="1"
|
65
|
65
|
/>
|
66
|
66
|
</template>
|
67
|
67
|
</van-field>
|
68
|
|
- <div style="margin: 16px;">
|
69
|
|
- <van-button round block type="primary" native-type="submit">
|
|
68
|
+ <div style="margin: 16px">
|
|
69
|
+ <van-button block type="warning" native-type="submit">
|
70
|
70
|
提交
|
71
|
71
|
</van-button>
|
72
|
72
|
</div>
|
|
@@ -75,7 +75,7 @@
|
75
|
75
|
</template>
|
76
|
76
|
|
77
|
77
|
<script>
|
78
|
|
-import { reactive, ref, onMounted } from "vue";
|
|
78
|
+import { reactive, ref, onMounted } from "vue"
|
79
|
79
|
import {
|
80
|
80
|
Form,
|
81
|
81
|
Button,
|
|
@@ -84,11 +84,10 @@ import {
|
84
|
84
|
Popup,
|
85
|
85
|
DatetimePicker,
|
86
|
86
|
Uploader,
|
87
|
|
-} from "vant";
|
88
|
|
-import { useRouter } from "vue-router";
|
89
|
|
-import { useModel } from "@zjxpcyc/vue-tiny-store";
|
90
|
|
-import uploadImage from '@/utils/uploadImage'
|
91
|
|
-
|
|
87
|
+} from "vant"
|
|
88
|
+import { useRouter } from "vue-router"
|
|
89
|
+import { useModel } from "@zjxpcyc/vue-tiny-store"
|
|
90
|
+import uploadImage from "@/utils/uploadImage"
|
92
|
91
|
|
93
|
92
|
export default {
|
94
|
93
|
name: "lookrecord",
|
|
@@ -103,91 +102,46 @@ export default {
|
103
|
102
|
|
104
|
103
|
// Secondhand:secondhand,
|
105
|
104
|
},
|
106
|
|
- data() {
|
107
|
|
- return {};
|
108
|
|
- },
|
109
|
105
|
setup() {
|
110
|
|
- const router = useRouter();
|
111
|
|
- const roomId = router.currentRoute.value.query.roomId;
|
112
|
|
- const showTimePicker = ref(false);
|
113
|
|
- const imgUrl = ref([]);
|
114
|
|
-
|
115
|
|
- const { detail, getDetail } = useModel("room");
|
|
106
|
+ const router = useRouter()
|
|
107
|
+ const roomId = router.currentRoute.value.query.roomId
|
|
108
|
+ const showTimePicker = ref(false)
|
|
109
|
+ const imgUrl = ref([])
|
|
110
|
+
|
|
111
|
+ const { detail, getDetail } = useModel("room")
|
116
|
112
|
const formData = reactive({
|
117
|
113
|
roomId: roomId,
|
118
|
114
|
followType: 0, //根据类型
|
119
|
115
|
followTime: new Date(), //看房时间
|
120
|
116
|
followDesc: undefined, //根进描述
|
121
|
117
|
followImg: undefined, //图片
|
122
|
|
- });
|
123
|
|
- const pattern = /[\u4E00-\u9FA5\uF900-\uFA2D]/;
|
|
118
|
+ })
|
|
119
|
+ const pattern = /[\u4E00-\u9FA5\uF900-\uFA2D]/
|
124
|
120
|
|
125
|
121
|
const onSubmit = () => {
|
126
|
|
- console.log("submit", formData);
|
127
|
|
- };
|
|
122
|
+ console.log("submit", formData)
|
|
123
|
+ }
|
128
|
124
|
|
129
|
125
|
const onConfirm = (value) => {
|
130
|
|
- console.log(value, "value");
|
131
|
|
- formData.followTime = value;
|
132
|
|
- showTimePicker.value = false;
|
133
|
|
- };
|
|
126
|
+ console.log(value, "value")
|
|
127
|
+ formData.followTime = value
|
|
128
|
+ showTimePicker.value = false
|
|
129
|
+ }
|
134
|
130
|
|
135
|
|
- const handleUpload = file => {
|
|
131
|
+ const handleUpload = (file) => {
|
136
|
132
|
if (file && file.file) {
|
137
|
|
- console.log(file, )
|
138
|
|
-uploadImage(file.file, '', 1).then((url) => {
|
139
|
|
- // const img = {
|
140
|
|
- // roomId,
|
141
|
|
- // url,
|
142
|
|
- // imgType: type,
|
143
|
|
- // sort,
|
144
|
|
- // };
|
145
|
|
-
|
146
|
|
-
|
147
|
|
- console.log(url,'url')
|
148
|
|
- formData.followImg=url
|
149
|
|
- imgUrl.value=[{url:url}]
|
150
|
|
- // willSave.value.push(img);
|
151
|
|
- // initData.value = {
|
152
|
|
- // ...initData.value,
|
153
|
|
- // rescList: {
|
154
|
|
- // ...(initData.value.rescList || {}),
|
155
|
|
- // [type]: (initData.value.rescList[type] || []).concat(img),
|
156
|
|
- // },
|
157
|
|
- // };
|
158
|
|
- });
|
159
|
|
-
|
160
|
|
-
|
|
133
|
+ uploadImage(file.file, "", 1).then((url) => {
|
|
134
|
+ formData.followImg = url
|
|
135
|
+ imgUrl.value = [{ url: url }]
|
|
136
|
+ })
|
161
|
137
|
}
|
162
|
|
- // const sort =
|
163
|
|
- // (initData.value.rescList[type] || []).length +
|
164
|
|
- // willSave.value.filter((x) => x.imgType === type).length;
|
165
|
|
-
|
166
|
|
- // uploadImage(file, "1").then((url) => {
|
167
|
|
- // // const img = {
|
168
|
|
- // // roomId,
|
169
|
|
- // // url,
|
170
|
|
- // // imgType: type,
|
171
|
|
- // // sort,
|
172
|
|
- // // };
|
173
|
|
- // url;
|
174
|
|
- // type;
|
175
|
|
- // // willSave.value.push(img);
|
176
|
|
- // // initData.value = {
|
177
|
|
- // // ...initData.value,
|
178
|
|
- // // rescList: {
|
179
|
|
- // // ...(initData.value.rescList || {}),
|
180
|
|
- // // [type]: (initData.value.rescList[type] || []).concat(img),
|
181
|
|
- // // },
|
182
|
|
- // // };
|
183
|
|
- // });
|
184
|
|
- };
|
|
138
|
+ }
|
185
|
139
|
|
186
|
140
|
onMounted(() => {
|
187
|
141
|
if (!detail.roomInfo) {
|
188
|
|
- getDetail(roomId);
|
|
142
|
+ getDetail(roomId)
|
189
|
143
|
}
|
190
|
|
- });
|
|
144
|
+ })
|
191
|
145
|
|
192
|
146
|
return {
|
193
|
147
|
detail,
|
|
@@ -198,10 +152,14 @@ uploadImage(file.file, '', 1).then((url) => {
|
198
|
152
|
showTimePicker,
|
199
|
153
|
handleUpload,
|
200
|
154
|
imgUrl,
|
201
|
|
- };
|
|
155
|
+ }
|
202
|
156
|
},
|
203
|
|
-};
|
|
157
|
+}
|
204
|
158
|
</script>
|
205
|
159
|
|
206
|
160
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
207
|
|
-<style lang="less" scoped></style>
|
|
161
|
+<style lang="less" scoped>
|
|
162
|
+.lookrecord {
|
|
163
|
+ padding-top: 1em;
|
|
164
|
+}
|
|
165
|
+</style>
|