diff --git a/yt_suishijiang/pages/index/index.vue b/yt_suishijiang/pages/index/index.vue index 06ec8f7..2c029df 100644 --- a/yt_suishijiang/pages/index/index.vue +++ b/yt_suishijiang/pages/index/index.vue @@ -386,10 +386,26 @@ export default { ? "https://lantu.ytyanhuo.com" : ""; console.log("sdfsf"); + let timeoutFlag = false; + let timeoutId = setTimeout(() => { + if (!timeoutFlag) { + timeoutFlag = true; + console.log("获取位置超时"); + uni.hideLoading(); + uni.showModal({ + title: "温馨提示", + content: "获取位置超时,请打开手机定位", + confirmText: "确定", + showCancel: false, + }); + } + + }, 10000); // 设置超时时间为3秒 uni.getLocation({ type: "gcj02", geocode: true, success(res) { + clearTimeout(timeoutId); _this.setData({ curAddress: res.address, locations: { @@ -417,24 +433,25 @@ export default { }); }, fail() { - uni.showModal({ - title: "温馨提示", - content: "提交随手拍需要获取您的位置信息", - confirmText: "确定", - success: (result) => { - if (result.confirm) { - console.log(this); - console.log(_this); - _this.getLocation(); - } - }, - fail() { - uni.hideLoading(); - uni.alert({ - title: "事件上报需要您的位置,请打开定位。", - }); - }, - }); + clearTimeout(timeoutId); + // uni.showModal({ + // title: "温馨提示", + // content: "提交随手拍需要获取您的位置信息", + // confirmText: "确定", + // success: (result) => { + // if (result.confirm) { + // console.log(this); + // console.log(_this); + // _this.getLocation(); + // } + // }, + // fail() { + // uni.hideLoading(); + // uni.alert({ + // title: "事件上报需要您的位置,请打开定位。", + // }); + // }, + // }); }, }); // uni.showLoading(); diff --git a/yt_suishijiang/unpackage/dist/build/.automator/h5/.automator.json b/yt_suishijiang/unpackage/dist/build/.automator/h5/.automator.json deleted file mode 100644 index e69de29..0000000 diff --git a/yt_suishijiang/unpackage/dist/build/h5-suishijiang/index.html b/yt_suishijiang/unpackage/dist/build/h5-suishijiang/index.html index a2572c5..c566c4c 100644 --- a/yt_suishijiang/unpackage/dist/build/h5-suishijiang/index.html +++ b/yt_suishijiang/unpackage/dist/build/h5-suishijiang/index.html @@ -1,2 +1,2 @@ yantai
\ No newline at end of file + document.write('')
\ No newline at end of file diff --git a/yt_suishoupai/manifest.json b/yt_suishoupai/manifest.json index 101764b..58403ca 100644 --- a/yt_suishoupai/manifest.json +++ b/yt_suishoupai/manifest.json @@ -58,7 +58,7 @@ "usingComponents" : true }, "h5" : { - "appid" : "h5-suishijiang", + "appid" : "h5-suishoupai", "devServer" : { "port" : 8080, "proxy" : { @@ -66,11 +66,11 @@ "target" : "https://apis.map.qq.com", "changeOrigin" : true }, - "/h5-suishijiang" : { + "/h5-suishoupai" : { "target" : "https://lantu.ytyanhuo.com", "changeOrigin" : true, "pathRewrite" : { - "^/h5-suishijiang" : "" + "^/h5-suishoupai" : "" } }, "https://lantu.ytyanhuo.com" : { @@ -96,7 +96,7 @@ } }, "router" : { - "base" : "/h5-suishijiang/" + "base" : "/h5-suishoupai/" } }, "mp-baidu" : { diff --git a/yt_suishoupai/pages/index/index.vue b/yt_suishoupai/pages/index/index.vue index cbe1a89..03f440e 100644 --- a/yt_suishoupai/pages/index/index.vue +++ b/yt_suishoupai/pages/index/index.vue @@ -422,10 +422,27 @@ export default { process.env.NODE_ENV !== "development" ? "https://lantu.ytyanhuo.com" : ""; + let timeoutFlag = false; + let timeoutId = setTimeout(() => { + if (!timeoutFlag) { + timeoutFlag = true; + console.log("获取位置超时"); + uni.hideLoading(); + uni.showModal({ + title: "温馨提示", + content: "获取位置超时,请打开手机定位", + confirmText: "确定", + showCancel: false, + }); + } + + }, 10000); + uni.getLocation({ type: "gcj02", geocode: true, success(res) { + clearTimeout(timeoutId); _this.setData({ curAddress: res.address, locations: { @@ -453,16 +470,8 @@ export default { }); }, fail() { - uni.showModal({ - title: "温馨提示", - content: "提交随手拍需要获取您的位置信息", - confirmText: "确定", - success: (result) => { - if (result.confirm) { - _this.getLocation(); - } - }, - }); + clearTimeout(timeoutId); + }, }); },