From ae0e2e117e956e56e6b6df1bdca6cbcdadb2fed4 Mon Sep 17 00:00:00 2001 From: xiaohei <1494046114@qq.com> Date: Mon, 27 Nov 2023 14:04:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E6=99=BA=E6=85=A7=E7=A4=BE=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/people/pages/second/second.vue | 28 +- src/pages/life/life.vue | 852 +++++++++++--------- src/pages/people/people.vue | 22 +- vite.config.ts | 11 + 4 files changed, 516 insertions(+), 397 deletions(-) diff --git a/src/packages/people/pages/second/second.vue b/src/packages/people/pages/second/second.vue index e775433..8c541b0 100644 --- a/src/packages/people/pages/second/second.vue +++ b/src/packages/people/pages/second/second.vue @@ -149,7 +149,9 @@ tabsIndex: 0, pageNo: 1, pageSize: 12, - total: 0 + total: 0, + latitude:0, + longitude:0 }; }, /** @@ -159,6 +161,24 @@ this.option = option this.recursionApi(); this.callFcuntion(); + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition( + function (position) { + console.log(position.coords.latitude); + this.latitude = position.coords.latitude; + this.longitude = position.coords.longitude; + uni.setStorageSync( + "userLocation", + position.coords.longitude + "," + position.coords.latitude + ); + }, + function (error) { + console.log(error.message); + } + ); + } else { + console.log("浏览器不支持地理定位功能"); + } }, onReachBottom() { if (this.newsPageList.length === this.total) { @@ -213,7 +233,7 @@ }, async hospitalPageApi() { - // const locationInfo = uni.getStorageSync('userLocation'); + const locationInfo = uni.getStorageSync('userLocation'); // if (!Object.keys(locationInfo).length) { // return uni.showToast({ // title: '未允许定位,当前页面功能无法完全体验', @@ -225,8 +245,8 @@ pageNo: 1, pageSize: 10, nearFlag: this.nearFlag, - // posX: locationInfo.split[0], - // posY: locationInfo.split[1] + posX: locationInfo.split[0], + posY: locationInfo.split[1] }; if (this.searchValue) { param.name = this.searchValue; diff --git a/src/pages/life/life.vue b/src/pages/life/life.vue index 1cb1e2d..071a84d 100644 --- a/src/pages/life/life.vue +++ b/src/pages/life/life.vue @@ -2,25 +2,49 @@ - + - + - + {{ item.name }} - - + + @@ -30,16 +54,27 @@ - - + + {{ itemName.name }} - {{ itemName.remark }} + {{ + itemName.remark + }} @@ -50,12 +85,32 @@ 精彩介休 - - - - + + + + {{ item.merchantName }} @@ -82,444 +137,457 @@ --> - + \ No newline at end of file +} + +rich-text { + overflow: hidden; + display: inline-block; + display: -webkit-box; + text-overflow: ellipsis; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; +} + diff --git a/src/pages/people/people.vue b/src/pages/people/people.vue index a1b9137..b7a62d3 100644 --- a/src/pages/people/people.vue +++ b/src/pages/people/people.vue @@ -78,7 +78,9 @@ icon: '', name: '' }, - e: [] + e: [], + latitude:0, + longitude:0 }; } /** @@ -88,6 +90,24 @@ onLoad() { this.getBannerList(); this.recursionApi(); + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition( + function (position) { + console.log(position.coords.latitude); + this.latitude = position.coords.latitude; + this.longitude = position.coords.longitude; + uni.setStorageSync( + "userLocation", + position.coords.longitude + "," + position.coords.latitude + ); + }, + function (error) { + console.log(error.message); + } + ); + } else { + console.log("浏览器不支持地理定位功能"); + } }, methods: { updateQuery(url, name) { diff --git a/vite.config.ts b/vite.config.ts index c97b2d7..d286ff8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,9 +1,20 @@ import { defineConfig } from "vite"; import uni from "@dcloudio/vite-plugin-uni"; +const Timestamp = new Date().getTime() // https://vitejs.dev/config/ export default defineConfig({ plugins: [uni()], + build: { + sourcemap: false, // 输出.map文件,默认是false + rollupOptions: { + output: { + chunkFileNames:`static/js/[name].[hash]${Timestamp}.js`, + entryFileNames: `static/js/[name].[hash]${Timestamp}.js`, + assetFileNames: `assets/[ext]/[name].[hash]${Timestamp}.[ext]`, + }, + } + }, // publicPath: './', // server: { // proxy: {