|
|
@@ -64,9 +64,9 @@
|
|
|
<view class="title">地理位置</view>
|
|
|
<view class=" booder-top" style="padding-bottom: 16upx" :style="{ display: mapIsHidden }"
|
|
|
@click="selectAddress">
|
|
|
- <tdmap
|
|
|
- :allowSelection="false"
|
|
|
- :showCoordinates="false"
|
|
|
+ <tdmap
|
|
|
+ :allowSelection="false"
|
|
|
+ :showCoordinates="false"
|
|
|
:key="mapKey"
|
|
|
></tdmap>
|
|
|
</view>
|
|
|
@@ -80,7 +80,7 @@
|
|
|
<button class="cu-btn round line-gray shadow" @click="back()">取消</button>
|
|
|
<button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round " @click="sumbit">提交</button>
|
|
|
</view>
|
|
|
- <u-picker v-model="show" mode="time" :default-time="date" @confirm="selectTime" style="z-index: 999 !important;"></u-picker>
|
|
|
+ <u-picker v-model="show" mode="time" :default-time="date||''" @confirm="selectTime" style="z-index: 999 !important;"></u-picker>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -120,7 +120,7 @@
|
|
|
mapIsHidden: 'block', // 修复:初始为block,确保地图容器显示
|
|
|
mapKey: 1,
|
|
|
// 修复:初始化savedLocation为合法对象,避免undefined
|
|
|
- savedLocation: { lng: 112.55, lat: 37.87 }
|
|
|
+ savedLocation: { lng: 112.55, lat: 37.87 }
|
|
|
};
|
|
|
},
|
|
|
onLoad(data) {
|
|
|
@@ -130,7 +130,7 @@
|
|
|
obj.photo = obj.photo ? obj.photo.split(',').filter(id => id !== '') : [];
|
|
|
this.form = obj;
|
|
|
this.date = this.form.openingTime;
|
|
|
-
|
|
|
+
|
|
|
// 修复:从obj中赋值坐标,确保数字类型
|
|
|
if (obj.longitude && obj.latitude) {
|
|
|
this.savedLocation = {
|
|
|
@@ -154,14 +154,14 @@
|
|
|
uni.showToast({ icon:'none', title:res.data.message });
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
// 修复:安全获取存储的地址,避免da为undefined
|
|
|
let da = uni.getStorageSync("address") || {};
|
|
|
// console.log(da)
|
|
|
// 核心:确保lng/lat是合法数字,兜底默认值
|
|
|
const lng = Number(da.lng) || 112.55;
|
|
|
const lat = Number(da.lat) || 37.87;
|
|
|
-
|
|
|
+
|
|
|
// 更新savedLocation(触发子组件props更新)
|
|
|
this.savedLocation = {
|
|
|
lng: lng,
|
|
|
@@ -171,7 +171,7 @@
|
|
|
uni.setStorageSync('mapMarkData',this.savedLocation)
|
|
|
this.latitude = lat;
|
|
|
this.longitude = lng;
|
|
|
-
|
|
|
+
|
|
|
// 优化:仅当坐标变化时更新mapKey,避免频繁刷新
|
|
|
if (lng !== 112.55 || lat !== 37.87) {
|
|
|
this.mapKey += 1;
|