diff --git a/components/PostCard.vue b/components/PostCard.vue index 43bc382..b3d0818 100644 --- a/components/PostCard.vue +++ b/components/PostCard.vue @@ -11,7 +11,6 @@ v-else class="chat-btn" :class="item.status==1 ? 'chat-btn1' : item.status==2 ? 'chat-btn2' : item.status==3 ? 'chat-btn3' : 'chat-btn4'" - @click.stop="handleContact" > {{ item.status==1 ? '已发布' : item.status==2 ? '审核中' : item.status==3 ? '未通过' : '已过期' }} diff --git a/pages/classify/classify.vue b/pages/classify/classify.vue index 22f29da..f7b2513 100644 --- a/pages/classify/classify.vue +++ b/pages/classify/classify.vue @@ -102,7 +102,9 @@ export default { { key: 'latest', label: '最新发布' }, { key: 'near', label: '距离最近' } ], - currentTab: 'latest', + latitude:'', + longitude:'', + currentTab:'latest', flist: [], slist: [], selfChecked: false, @@ -122,6 +124,11 @@ export default { }, onShow() { this.loadCategoryList(); + this.getFuzzy().then(res => { + this.latitude = res.latitude + this.longitude = res.longitude + console.log(res); + }).catch(err => console.error(err)); // this.syncTabbar() // // 从详情页返回后,重新拉取当前分类数据 // if (this.categoriesLoaded) { @@ -129,6 +136,29 @@ export default { // } }, methods: { + getFuzzy() { + return new Promise((resolve, reject) => { + wx.getSetting({ + success: (st) => { + const ok = st.authSetting['scope.userFuzzyLocation']; + const run = () => wx.getFuzzyLocation({ + type: 'wgs84', + success: resolve, + fail: reject + }); + + if (ok) return run(); + + wx.authorize({ + scope: 'scope.userFuzzyLocation', + success: run, + fail: () => wx.openSetting({ success: () => reject(new Error('未授权')) }) + }); + }, + fail: reject + }); + }); + }, goprivacy(){ uni.navigateTo({ url: '/pages/login/agreement',// 替换为你要跳转的页面路径 @@ -215,6 +245,7 @@ export default { // 根据分类id加载分类下的内容 loadCategoryData(categoryId, isLoadMore = false) { + const collectUrl = this.currentTab=='latest' ? 'common/post/list' : 'common/post/nearby' // 防止重复请求:如果是加载更多,需要检查所有加载状态 if (isLoadMore) { if (this.loadingMore || this.loading || this.refreshing) { @@ -236,15 +267,23 @@ export default { this.hasMore = true; this.slist = []; // 清空之前的数据 } - + var that = this; + const params = { + current:this.page, + size:10, + status:1, + category_id:categoryId + }; + // 添加排序参数(如果后端支持) + if(this.currentTab=='near'){ + params.lng = this.longitude; + params.lat = this.latitude; + } else { + } request({ - url:'common/post/list', + url:collectUrl, method:'GET', - data:{ - category_id:categoryId, - current: this.page, - size: this.pageSize - } + data:params }).then(res => { this.loading = false; this.loadingMore = false; diff --git a/pages/index/index.vue b/pages/index/index.vue index f457bf3..4d2e5e6 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -20,9 +20,9 @@ - + @@ -145,10 +145,11 @@ export default { }); }, handleContact(item) { - uni.showToast({ - title: '联系门店功能', - icon: 'none' - }); + const phone = item.user.mobile + if (!phone) return uni.showToast({ title: '号码为空', icon: 'none' }); + // 简单清洗:去空格/横杠 + const num = String(phone).replace(/[^\d+]/g, ''); + uni.makePhoneCall({ phoneNumber: num }); }, handleComment(item) { uni.navigateTo({ @@ -160,6 +161,7 @@ export default { var that = this; const params = { current:pageNo, + status:1, size:10 }; const collectUrl = this.activeTab==0 ? 'common/post/list' : 'common/post/nearby' @@ -226,7 +228,15 @@ export default { }); }); } - } + }, + // 分享给好友 + onShareAppMessage() { + return { + title: '西门子样机福利平台', + path: '/pages/index/index?from=share', + imageUrl: "/static/image/share.jpg" // 封面图 + } + }, } @@ -267,12 +277,13 @@ export default { height: 80rpx; border-radius: 50%; background: #fff; + padding: 4rpx; display: flex; align-items: center; justify-content: center; image{ - width: 48rpx; - height: 48rpx; + width: 60rpx; + height: 60rpx; } .share{ width: 36rpx; diff --git a/pages/mine/my_newmsg.vue b/pages/mine/my_newmsg.vue index ae6bc8e..4e5f82d 100644 --- a/pages/mine/my_newmsg.vue +++ b/pages/mine/my_newmsg.vue @@ -11,14 +11,17 @@ {{item.sender_user.nickname}} - + {{item.created_at}} + {{ item.type==1?'点赞了': item.type==2?'收藏了':'评论了' }} {{ formatContent(item.post && item.post.content) }} - + + {{ item.comment.content }} + @@ -127,4 +130,7 @@ color: #666; line-height: 38rpx; } + .msg-text1{ + color: #000; + } \ No newline at end of file diff --git a/pages/mine/my_reply.vue b/pages/mine/my_reply.vue index 4c58f7a..a9d3045 100644 --- a/pages/mine/my_reply.vue +++ b/pages/mine/my_reply.vue @@ -1,81 +1,83 @@