diff --git a/components/PostCard.vue b/components/PostCard.vue
index 87ecc53..f04057f 100644
--- a/components/PostCard.vue
+++ b/components/PostCard.vue
@@ -1,6 +1,6 @@
-
-
+
+
{{ item.user.nickname || '用户名' }}
@@ -40,7 +40,7 @@
/>
-
+
{{ item.location_name }}
@@ -48,6 +48,9 @@
+
+ 编辑
+
@@ -139,6 +142,76 @@ export default {
},
handleComment() {
this.$emit('comment', this.item);
+ },
+ handleEdit() {
+ this.$emit('edit', this.item);
+ },
+ // 点击位置:获取(模糊)当前位置 -> 打开系统地图并可导航到店铺位置
+ async locationfn(item) {
+ try {
+ const lat = Number((item && item.latitude));
+ const lng = Number((item && item.longitude));
+ if (!Number.isFinite(lat) || !Number.isFinite(lng)) {
+ uni.showToast({ title: '该店铺未设置定位', icon: 'none' });
+ return;
+ }
+
+ // 1) 先尝试获取(模糊)当前位置,主要用于触发授权 & 让地图页显示“我的位置”
+ await this._getFuzzyCurrentLocationSafe();
+
+ // 2) 打开地图并指向店铺坐标;地图页自带“导航/到这去”
+ uni.openLocation({
+ latitude: lat,
+ longitude: lng,
+ name: (item && item.location_name) || '店铺位置',
+ address: (item && item.location_address) || (item && item.location_name) || '',
+ scale: 16,
+ fail: () => {
+ uni.showToast({ title: '打开地图失败', icon: 'none' });
+ }
+ });
+ } catch (e) {
+ // 兜底:即使定位授权失败,也尽量打开店铺位置
+ const lat = Number((item && item.latitude));
+ const lng = Number((item && item.longitude));
+ if (Number.isFinite(lat) && Number.isFinite(lng)) {
+ uni.openLocation({
+ latitude: lat,
+ longitude: lng,
+ name: (item && item.location_name) || '店铺位置',
+ address: (item && item.location_address) || (item && item.location_name) || '',
+ scale: 16
+ });
+ } else {
+ uni.showToast({ title: '打开地图失败', icon: 'none' });
+ }
+ }
+ },
+
+ // 获取模糊定位(不抛错版本):用于触发授权&让地图显示“我的位置”
+ _getFuzzyCurrentLocationSafe() {
+ return new Promise((resolve) => {
+ // 仅微信小程序支持 getFuzzyLocation
+ // #ifdef MP-WEIXIN
+ uni.authorize({
+ scope: 'scope.userFuzzyLocation',
+ success: () => {
+ // 直接调用微信的模糊定位
+ wx.getFuzzyLocation({
+ type: 'wgs84',
+ success: () => resolve(),
+ fail: () => resolve()
+ });
+ },
+ fail: () => resolve()
+ });
+ // #endif
+
+ // #ifndef MP-WEIXIN
+ // 其他端不处理,直接放过
+ resolve();
+ // #endif
+ });
}
}
}
@@ -254,4 +327,13 @@ export default {
font-size: 26rpx;
color: #666;
}
+.actions{
+ display: flex;
+ justify-content: flex-end;
+}
+.edit-btn{
+ font-size: 26rpx;
+ color: #3BC6BD;
+ padding: 10rpx 0;
+}
diff --git a/pages.json b/pages.json
index 5e3334c..ed80f17 100644
--- a/pages.json
+++ b/pages.json
@@ -57,6 +57,14 @@
"navigationStyle":"custom"
}
},
+ {
+ "path":"pages/publish/edit",
+ "style":{
+ "navigationBarTitleText":"编辑发布",
+ "enablePullDownRefresh":false,
+ "navigationStyle":"custom"
+ }
+ },
{
"path" : "pages/login/agreement",
"style" :
diff --git a/pages/mine/my_favorites.vue b/pages/mine/my_favorites.vue
index 62fbb0c..78aa01b 100644
--- a/pages/mine/my_favorites.vue
+++ b/pages/mine/my_favorites.vue
@@ -22,6 +22,7 @@
:ismysq="true"
@userClick="goto"
@view="goto"
+ @edit="handleEdit"
@contact="handleContact"
@comment="handleComment">
@@ -99,6 +100,11 @@ export default {
url: '/pages/square/detiles?id='+item.id
});
},
+ handleEdit(item){
+ uni.navigateTo({
+ url: '/pages/publish/edit?id=' + item.id
+ });
+ },
click(item) {
this.page = 1
this.hasMore = true
diff --git a/pages/publish/edit.vue b/pages/publish/edit.vue
new file mode 100644
index 0000000..33200d2
--- /dev/null
+++ b/pages/publish/edit.vue
@@ -0,0 +1,752 @@
+
+
+
+
+
+
+ {{form.category || '请输入/选择型号'}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请上传产品实物的正、侧、背多角度照片(禁止效果图),图片不多于9张
+
+
+
+
+
+
+ {{form.age || '请选择样机新旧程度'}}
+
+
+
+
+
+
+
+ 元
+
+
+ * 是否包邮:
+
+
+
+
+
+ 产品名称:{{skudetils.product_name}}
+
+ 零售价:
+ {{ skudetils.price }}
+
+
+ 品牌:
+ {{ skudetils.brand }}
+
+
+ {{item.attr_name}}:
+ {{ item.attr_value }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+