diff --git a/api/apiT.js b/api/apiT.js index 39c8386..48a36e4 100644 --- a/api/apiT.js +++ b/api/apiT.js @@ -1,6 +1,6 @@ // const baseUrl = "https://api.collect.hs.hnzhwlkj.club/"; //这里放置url域名32044 // const baseUrl = "https://api.collect.xyh.muzili.top/"; //这里放置url域名32044 -const baseUrl = "https://bsh.info.hb.hnzhwlkj.cn/"; //这里放置url域名32044 +const baseUrl = "https://cb.hnxinyouhe.com/"; //这里放置url域名32044 // const baseUrl = "https://114.215.24.240:8106/api/v1/"; //这里放置url域名32044 export function request(options){//封装的requset let { url,data,method } = options; diff --git a/common/locales/en.js b/common/locales/en.js index 69de3a8..3970e1c 100644 --- a/common/locales/en.js +++ b/common/locales/en.js @@ -4,7 +4,7 @@ export default { home: 'home', square: 'square', publish: 'publish', - message: 'message', + classify: 'classify', mine: 'mine' }, navbar: { diff --git a/common/locales/zh.js b/common/locales/zh.js index c92e3fc..34d2a06 100644 --- a/common/locales/zh.js +++ b/common/locales/zh.js @@ -4,7 +4,7 @@ export default { home: '首页', square: '广场', publish: '发布', - message: '消息', + classify: '分类', mine: '我的' }, navbar: { diff --git a/components/ClassifyCard.vue b/components/ClassifyCard.vue new file mode 100644 index 0000000..51f4005 --- /dev/null +++ b/components/ClassifyCard.vue @@ -0,0 +1,111 @@ + + + + + + diff --git a/components/PostCard.vue b/components/PostCard.vue new file mode 100644 index 0000000..43bc382 --- /dev/null +++ b/components/PostCard.vue @@ -0,0 +1,257 @@ + + + + + diff --git a/components/danmu/danmu.vue b/components/danmu/danmu.vue new file mode 100644 index 0000000..decd03e --- /dev/null +++ b/components/danmu/danmu.vue @@ -0,0 +1,124 @@ + + + + + diff --git a/manifest.json b/manifest.json index 8f1a7df..2fc96ee 100644 --- a/manifest.json +++ b/manifest.json @@ -100,8 +100,17 @@ "minified" : true, "postcss" : true }, + "permission": { + "scope.userFuzzyLocation": { + "desc": "用于为你推荐附近内容/门店" + } + }, + "requiredPrivateInfos": [ + "getFuzzyLocation", + "chooseLocation", + "chooseAddress" + ], "usingComponents" : true, - "permission" : {}, "uniStatistics" : { "enable" : true } diff --git a/pages.json b/pages.json index 32a1b6a..632719d 100644 --- a/pages.json +++ b/pages.json @@ -83,7 +83,17 @@ "enablePullDownRefresh": false, "navigationStyle":"custom"// 去掉微信小程序顶部导航 } + }, + { + "path" : "pages/classify/classify", + "style" : + { + "navigationBarTitleText" : "分类", + "enablePullDownRefresh": false, + "navigationStyle":"custom"// 去掉微信小程序顶部导航 + } } + ], "subPackages":[ { @@ -124,6 +134,15 @@ "enablePullDownRefresh": false, "navigationStyle":"custom"// 去掉微信小程序顶部导航 } + }, + { + "path" : "my_reply", + "style" : + { + "navigationBarTitleText" : "回复我的", + "enablePullDownRefresh": false, + "navigationStyle":"custom"// 去掉微信小程序顶部导航 + } } ] } @@ -147,7 +166,7 @@ }, "tabBar": { "color": "#7A7E83", - "selectedColor": "#0071FC", + "selectedColor": "#3BC6BD", "borderStyle": "white", "backgroundColor": "#fff", "list": [ @@ -158,10 +177,10 @@ "text": "首页" }, { - "pagePath": "pages/square/index", - "iconPath": "/static/image/square1.png", - "selectedIconPath": "/static/image/square.png", - "text": "广场" + "pagePath": "pages/classify/classify", + "iconPath": "/static/image/classify1.png", + "selectedIconPath": "/static/image/classify.png", + "text": "分类" }, { "pagePath": "pages/publish/index", @@ -169,6 +188,12 @@ "selectedIconPath": "/static/image/publish.png", "text": "发布" }, + { + "pagePath": "pages/square/index", + "iconPath": "/static/image/square1.png", + "selectedIconPath": "/static/image/square.png", + "text": "广场" + }, { "pagePath": "pages/index/mine", "iconPath": "/static/image/mine1.png", diff --git a/pages/classify/classify.vue b/pages/classify/classify.vue new file mode 100644 index 0000000..22f29da --- /dev/null +++ b/pages/classify/classify.vue @@ -0,0 +1,630 @@ + + + + + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index a4508dd..f457bf3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,489 +1,347 @@ - \ No newline at end of file + .tab.on::after { + opacity: 1; + } + + .divider { + width: 1px; + height: 24rpx; + background: #dcdcdc; + } +} + +.card { + padding: 10rpx; +} + diff --git a/pages/index/mine.vue b/pages/index/mine.vue index e9841c7..cc4938b 100644 --- a/pages/index/mine.vue +++ b/pages/index/mine.vue @@ -1,389 +1,327 @@ \ No newline at end of file diff --git a/pages/mine/changinfo.vue b/pages/mine/changinfo.vue index 88912fe..254606a 100644 --- a/pages/mine/changinfo.vue +++ b/pages/mine/changinfo.vue @@ -13,10 +13,41 @@ {{$t('mine.nickname')}} - + + + 店铺名称 + + + + + + + 店铺电话 + + + + + + + 店铺位置 + + + + + + + + @@ -28,6 +59,12 @@ export default { data() { return { + centerLat: 39.9042, + centerLng: 116.4074, + markers: [], + // 若需逆地理,请配置腾讯地图 key(可存储在此或通过 storage 注入) + qqMapKey: 'HQBBZ-SC76W-YUNRZ-34IAD-ARN6K-TZBZ4', + showMap: false, imageStyles: { width: 40, height: 40, @@ -38,8 +75,12 @@ userinfo:{ nickname:'', avatar:'', - company:'', phone:'', + shop_name:'', + mobile:'', + location_name:'', + latitude: null, + longitude: null }, } @@ -48,13 +89,124 @@ this.getinfo() }, 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 + }); + }); + }, + // 地图点选:更新“选点位置”marker + onMapTap(e) { + const { latitude, longitude } = e.detail || {}; + if (typeof latitude !== 'number' || typeof longitude !== 'number') return; + + // 用 id 2 表示“选点” + const picked = { + id: 2, + latitude, + longitude, + title: '选点位置' + }; + + // 只保留当前选点作为唯一标记 + this.markers = [picked]; + + // 也可以把地图中心移动到选点 + this.centerLat = latitude; + this.centerLng = longitude; + this.userinfo.latitude = latitude + this.userinfo.longitude = longitude + this.reverseGeocode(latitude, longitude) + }, getinfo(){ - var that= this; request({ url:'common/user/info', method:'POST', }).then(res => { - this.userinfo=res.data.data.user + this.userinfo = res.data.data.user || {} + + const lat = parseFloat(this.userinfo.latitude) + const lng = parseFloat(this.userinfo.longitude) + + if (!isNaN(lat) && !isNaN(lng)) { + this.centerLat = lat + this.centerLng = lng + this.markers = [{ + id: 1, + latitude: lat, + longitude: lng, + title: this.userinfo.location_name || '店铺位置' + }] + } else { + this.initFuzzyLocation() + } + }).catch(() => { + this.initFuzzyLocation() + }) + }, + // 优先使用接口位置,没有时回退到模糊定位 + initFuzzyLocation() { + try { + this.getFuzzy().then(res => { + this.centerLat = res.latitude; + this.centerLng = res.longitude; + console.log(res) + // 默认给一个“当前位置(模糊)”标记 + this.markers = [{ + id: 1, + latitude: res.latitude, + longitude: res.longitude, + title: '当前位置(模糊)' + }]; + }).catch(err => console.error(err)); + + } catch (e) { + console.error(e); + } + }, + // 逆地理:将经纬度转为位置文本,失败则回退为经纬度字符串 + reverseGeocode(lat, lng) { + const key = this.qqMapKey || uni.getStorageSync('qqMapKey') || '' + if (!key) { + this.userinfo.location_name = `${lat.toFixed(6)}, ${lng.toFixed(6)}` + return + } + uni.request({ + url: 'https://apis.map.qq.com/ws/geocoder/v1/', + method: 'GET', + data: { + location: `${lat},${lng}`, + key + }, + success: (res) => { + if (res.data && res.data.status === 0) { + const result = res.data.result || {} + const formatted = (result.formatted_addresses && result.formatted_addresses.recommend) || result.address + this.userinfo.location_name = formatted || `${lat.toFixed(6)}, ${lng.toFixed(6)}` + } else { + this.userinfo.location_name = `${lat.toFixed(6)}, ${lng.toFixed(6)}` + } + }, + fail: () => { + this.userinfo.location_name = `${lat.toFixed(6)}, ${lng.toFixed(6)}` + } }) }, uploadfn(imgUrl){ @@ -71,7 +223,7 @@ }); }, delfn(){ - that.userinfo.avatar ='' + this.userinfo.avatar ='' }, select(e){ const tempFilePaths = e.tempFilePaths; @@ -87,7 +239,12 @@ method:'POST', data:{ nickname:this.userinfo.nickname, - avatar:this.userinfo.avatar + avatar:this.userinfo.avatar, + mobile:this.userinfo.mobile, + shop_name:this.userinfo.shop_name, + location_name:this.userinfo.location_name, + latitude:this.userinfo.latitude, + longitude:this.userinfo.longitude } }).then(res => { uni.showToast({ diff --git a/pages/mine/my_favorites.vue b/pages/mine/my_favorites.vue index 5b487bd..c6fe71b 100644 --- a/pages/mine/my_favorites.vue +++ b/pages/mine/my_favorites.vue @@ -1,407 +1,232 @@ - \ No newline at end of file diff --git a/pages/mine/my_newmsg.vue b/pages/mine/my_newmsg.vue index 440d572..ae6bc8e 100644 --- a/pages/mine/my_newmsg.vue +++ b/pages/mine/my_newmsg.vue @@ -2,21 +2,23 @@ - - - - {{item.sender_user.nickname}} - {{item.created_at}} + + + + + {{item.sender_user.nickname}} + + - - {{ item.type==1?'点赞了': item.type==2?'收藏了':'评论了' }} - {{ formatContent(item.post && item.post.content) }} - + + {{ formatContent(item.post && item.post.content) }} + + @@ -80,15 +82,18 @@ padding: 20rpx; } .msg-item{ - display: flex; - align-items: center; padding: 24rpx 20rpx; margin-bottom: 20rpx; - border-bottom: 1px solid #e4e4e4; + background: #fff; + border-radius: 10rpx; + } + .msg-cont{ + display: flex; + align-items: center; } .msg-avatar{ - width: 96rpx; - height: 96rpx; + width: 60rpx; + height: 60rpx; border-radius: 50%; margin-right: 20rpx; } diff --git a/pages/mine/my_release.vue b/pages/mine/my_release.vue index 1dd1c0b..8a6cef8 100644 --- a/pages/mine/my_release.vue +++ b/pages/mine/my_release.vue @@ -6,15 +6,12 @@ - + @@ -22,10 +19,10 @@ + + diff --git a/pages/publish/index.vue b/pages/publish/index.vue index 2a5aac8..7fdae3d 100644 --- a/pages/publish/index.vue +++ b/pages/publish/index.vue @@ -1,68 +1,87 @@