-
@@ -696,10 +711,9 @@
import aboutPop from '@/components/edit/about-pop.vue'
import mapComponent from '@/components/edit/map.vue'
+import choosingIdentity from '@/components/edit/choosingIdentity.vue'
export default {
- setup() {
- },
name: 'ZufangEdit',
data() {
return {
@@ -729,7 +743,7 @@ export default {
uniqid: "",
token: "",
status: 0, // 发布 状态
- intermediary: 3,
+ intermediary: 1,
type: "", // 编辑类型
locationData: [],
locationValue: 1,
@@ -763,7 +777,6 @@ export default {
acreage_min: null,
acreage_max: null,
-
targetAreaState: false, // 目标区域弹窗的状态
howBoxState: false, // 如何获取微信二维码弹窗状态
@@ -834,12 +847,14 @@ export default {
const urlParams = new URLSearchParams(queryString);
this.uniqid = urlParams.get('uniqid');
this.token = urlParams.get('token');
+ this.verified = urlParams.get('verified') || 0;
this.init();
},
components: {
aboutPop,
- mapComponent
+ mapComponent,
+ choosingIdentity,
},
methods: {
@@ -851,6 +866,13 @@ export default {
return require(url)
},
init() {
+ this.loading = this.$loading({
+ lock: true,
+ text: 'Loading',
+ spinner: 'el-icon-loading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ });
+
this.$post('/tenement/forum', {
intermediary: this.intermediary,
token: this.token,
@@ -916,6 +938,8 @@ export default {
// communityid: ""
// communityname: ""
+ if (info['type']) this.typeValue = info['type'] >>> 0
+
if (!info['leasetime']) info['leasetime'] = null
let intermediary = data.intermediary
@@ -934,7 +958,13 @@ export default {
if (info["rentalduration"]) info['rentalduration'] = Number(info['rentalduration'])
let arr = ["property", "floor", "sunshinearea"]
+
arr.forEach(element => {
+
+ if (info[element] && info[element].length == 1 && info[element][0] == 0) {
+ info[element] = []
+ }
+
if (info[element] && info[element].length != 0) {
info[element].forEach((ele, i) => {
info[element][i] = Number(ele)
@@ -982,13 +1012,14 @@ export default {
this.offshelftime = data.offshelftime
this.updatetime = data.updatetime
+ }).finally(() => {
+ this.loading.close()
})
},
// 处理出租方式
handleType(key, value) {
- // this.typePopState = !this.typePopState
if (key >>> 0 == key) {
this.typeValue = key
this.info['type'] = null
@@ -1178,7 +1209,17 @@ export default {
// 提交
submit(status = 0) {
- // /tenement/forum/submit
+ let info = { ...this.info }
+
+ if (info['images'] && info['images'].length > 1 && !info['aid']) {
+ this.$message.error("请选择封面");
+ return
+ }
+
+ if (this.acreage_min) info['acreage'] = [this.acreage_min, this.acreage_max]
+
+
+
if (this.submitState) return
this.submitState = true
@@ -1190,7 +1231,6 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
});
- let info = { ...this.info }
let intermediary = this.intermediary
@@ -1214,7 +1254,7 @@ export default {
status,
}).then(res => {
if (res.code != 200) {
- let data = res.data
+ let data = res.data || []
let rule = data['rule'] || 0
if (rule == 3) {
this.failPopState = true
@@ -1226,35 +1266,36 @@ export default {
let targetElement = this.$refs[data.field]
if (!targetElement) return
- console.log("targetElement", this.$refs[data.field]);
if (Array.isArray(targetElement)) {
targetElement.forEach(element => {
- console.log("element", element);
element.style.borderColor = "rgba(249, 93, 93, 1)";
})
} else targetElement.style.borderColor = "rgba(249, 93, 93, 1)";
- // targetElement.style.borderColor = "rgba(249, 93, 93, 1)";
-
-
this.$watch(`info.${data.field}`, (newVal, oldVal) => {
if (newVal != null && newVal != undefined) {
if (Array.isArray(targetElement)) {
targetElement.forEach(element => {
- console.log("element", element);
element.style.borderColor = "#aaaaaa";
})
} else targetElement.style.borderColor = "#aaaaaa";
- // targetElement.style.borderColor = "#aaaaaa";
}
})
// 设置滚动距离
- const top = targetElement.offsetTop - 150 || 300;
- if (Array.isArray(targetElement)) targetElement[0].offsetTop - 150 || 300;
- else targetElement.offsetTop - 150 || 300;
+ let top = 0
+ if (Array.isArray(targetElement)) top = targetElement[0].getBoundingClientRect().top + window.pageYOffset;
+ else top = targetElement.getBoundingClientRect().top + window.pageYOffsetp;
- document.body.scrollTop = document.documentElement.scrollTop = top;
+ if (top) top -= 150
+ else top = 300
+
+
+ // document.body.scrollTop = document.documentElement.scrollTop = top;
+ window.scrollTo({
+ top,
+ behavior: "smooth"
+ })
return
} else {
@@ -1337,12 +1378,6 @@ export default {
// 点击选择地址弹窗 处理经纬度
handleLocationData() {
-
- let info = this.info
- console.log(info);
- // console.log(info['location'], info['latitude'], info['longitude']);
-
-
this.mapComponentState = true
},
@@ -1388,7 +1423,7 @@ export default {
let info = this.info
if (!id) {
- info['communityid'] = null
+ info['communityid'] = 0
info['communityname'] = null
} else {
info['communityid'] = id
@@ -1413,8 +1448,9 @@ export default {