diff --git a/.eslintrc.js b/.eslintrc.js
index 9e4e46d..907c574 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -15,9 +15,11 @@ module.exports = {
// 关闭eslint语法检测
"no-unused-vars":0,
},
+ // 添加全局变量过滤
globals: {
"AMap": "true",
"AMapUI": "true",
+ "WeixinJSBridge": "true"
},
overrides: [
{
diff --git a/README.md b/README.md
index f5942cd..b88f786 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
@@ -293,4 +293,16 @@ feature
update
- alarmDetails
- 修改 标题显示文字
- - 修改 弹窗显示文字
\ No newline at end of file
+ - 修改 弹窗显示文字
+
+
+## v1.0.35
+`2023.3.30`
+update
+- alarmDetails
+ - 增加 坐标通过高德逆地理编码解析中文地址
+- packageList
+ - 修改 微信支付的方式,不使用jssdk,使用微信内置WeixinJSBridge对象
+
+- appId
+ - 修改 微信测试环境appId
\ No newline at end of file
diff --git a/src/config/appId.js b/src/config/appId.js
index 3dfd823..b8d68ad 100644
--- a/src/config/appId.js
+++ b/src/config/appId.js
@@ -6,8 +6,8 @@
* @description:
*/
const AppId = process.env.NODE_ENV === 'production' ?
- 'wx23f697736154110b' :
+ 'wxd78b83bdb0b4df55' :
process.env.VUE_APP_BASE_API.indexOf('ai.ssjlai.com') > -1 ?
- 'wx23f697736154110b':
- /* 'wx785c95a3e7f46f72' */'wx5e26f0813859e5f6'; //wx5e26f0813859e5f6 2022.10.12 更改测试公众号
+ 'wxd78b83bdb0b4df55':
+ /* 'wx785c95a3e7f46f72' */'wxd78b83bdb0b4df55'; //wx5e26f0813859e5f6 2022.10.12 更改测试公众号
export default AppId;
\ No newline at end of file
diff --git a/src/views/alarm/alarm-details.vue b/src/views/alarm/alarm-details.vue
index 7a1907e..fe798f5 100644
--- a/src/views/alarm/alarm-details.vue
+++ b/src/views/alarm/alarm-details.vue
@@ -10,7 +10,7 @@
-
{{ params.address }}
+
{{ alarm.address }}(附近)
{{ params.time }}
@@ -22,7 +22,7 @@
:key="index"
:type="item.type"
:icon="item.icon"
- @click="onClick(item.name)"
+ @click="onErrorReport(item.name)"
>{{ item.text }}
@@ -51,7 +51,7 @@ export default {
title: '进入涉水区域警报',
alarm: {
message: '你的孩子靠近水域危险区',
- address: '桂城街道深海路25号平洲桂城广东天波教育科技有限公司',
+ address: '',
time: '2023-03-14 14:16:55',
glng: '113.175203274874',
glat: '23.0261293630648'
@@ -105,6 +105,7 @@ export default {
this.$store.commit("gatewayToken", res.data.data);
});
},
+ // 获取路由参数
getParams() {
let params = this.$route.query;
if (isNotNull(params)) {
@@ -125,7 +126,7 @@ export default {
// 初始化地图
initAmap() {
this.$toast.loading('地图加载中');
- MapLoader(false, [ 'AMap.PolyEditor', 'AMap.MouseTool', 'AMap.Geocoder', 'AMap.Geolocation' ]).then(
+ MapLoader(false, [ 'AMap.PolyEditor', 'AMap.MouseTool', 'AMap.Geocoder', 'AMap.Geolocation', 'AMap.ToolBar' ]).then(
AMap => {
this.map.instance = new AMap.Map("details_map", {
center: [this.params.lng, this.params.lat],
@@ -133,11 +134,15 @@ export default {
zoom: this.map.zoom,
zoomEnable: true
});
+ // 构建逆地理编码器
this.map.geocoder = new AMap.Geocoder({
extensions: "all"
});
+ const toolBar = new AMap.ToolBar({ offset: new AMap.Pixel(10, 310), position: 'RB' });
+ this.map.instance.addControl(toolBar);
this.initCenterMarker();
this.$toast.success('地图加载完成');
+ this.geocoder([this.params.lng, this.params.lat]);
},
err => {
this.$toast.clear();
@@ -172,10 +177,13 @@ export default {
});
this.map.instance.add(this.map.centerMarker);
},
+ // 逆地理编码,通过坐标获取详细中文地址
geocoder(lngLat) {
this.map.geocoder.getAddress(lngLat, (status, result) => {
if (status == "complete" && result.info == "OK") {
this.currentAddress.address = result.regeocode.formattedAddress;
+ this.alarm.address = result.regeocode.formattedAddress;
+ console.log("当前地址", this.currentAddress.address);
}
});
},
@@ -216,7 +224,8 @@ export default {
}
})
},
- onClick(name) {
+ // 误报
+ onErrorReport(name) {
if(name === 'goHere') {
// 根据选择的地图跳转不同地图app的url
this.actionSheetShow = true;
@@ -234,6 +243,7 @@ export default {
})
}
},
+ // 误报接口
drownReportFilterAdd() {
this.$toast.loading('设置中');
let reqBody = {
@@ -259,6 +269,7 @@ export default {
},1500)
})
},
+ // 选择打开外部地图app
onSelect(item) {
if(item.number === 0) {
// 高德
@@ -267,11 +278,13 @@ export default {
this.wakeUpTencentMap(item.wakeUpUrl);
}
},
+ // 唤醒高德地图
wakeUpGaodeMap(wakeUpUrl) {
const position = this.params.lng + ',' +this.params.lat;
const name = this.params.address;
window.location.href = `${wakeUpUrl}position=${position}&name=${name}&callnative=1`;
},
+ // 唤醒 腾讯地图
wakeUpTencentMap(wakeUpUrl) {
const position = this.params.lat + ',' + this.params.lng ;
const address = this.params.address;
@@ -279,6 +292,7 @@ export default {
const myAppName = 'ssjlqqmap';
window.location.href = `${wakeUpUrl}type=0&marker=coord:${position};title:${address};addr:${address}&key=${key}&referer=${myAppName}`;
},
+ // 刷新
onRefresh() {
this.reload();
}
diff --git a/src/views/package-list/index.vue b/src/views/package-list/index.vue
index f6a9f6e..bbdc404 100644
--- a/src/views/package-list/index.vue
+++ b/src/views/package-list/index.vue
@@ -1,7 +1,7 @@
@@ -364,7 +364,7 @@ export default {
issue: data.packageIssue
}
}); */
- wx.chooseWXPay({
+ /* wx.chooseWXPay({
timestamp: wxData.timeStamp, // 支付签名时间戳,注意微信 jssdk 中的所有使用 timestamp 字段均为小写。但最新版的支付后台生成签名使用的 timeStamp 字段名需大写其中的 S 字符
nonceStr: wxData.nonceStr, // 支付签名随机串,不长于 32 位
package: wxData.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
@@ -403,7 +403,8 @@ export default {
});
console.log("用户取消了支付::", err);
}
- });
+ }); */
+ this.onWxPay(wxData);
})
.catch(error => {
console.log("error", error);
@@ -412,6 +413,47 @@ export default {
this.$toast.clear();
});
},
+ onWxPay(data) {
+ let that = this;
+ console.log("微信支付开启", data);
+ function onBridgeReady() {
+ WeixinJSBridge.invoke(
+ "getBrandWCPayRequest",
+ {
+ appId: AppId, //公众号ID,由商户传入
+ timeStamp: data.timeStamp, //时间戳,自1970年以来的秒数
+ nonceStr: data.nonceStr, //随机串
+ package: data.package,
+ signType: data.signType, //微信签名方式:
+ paySign: data.paySign //微信签名
+ },
+ function(res) {
+ if (res.err_msg == "get_brand_wcpay_request:ok") {
+ // 使用以上方式判断前端返回,微信团队郑重提示:
+ //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
+ that.$router.replace({
+ name: "payResult",
+ query: {
+ outTradeNo: that.outTradeNo,
+ price: that.price,
+ rechargeUrl: data.rechargeUrl,
+ iccid: that.params.iccid,
+ isAdmin: that.$route.query.isAdmin || false,
+ serialNo: that.params.imei,
+ issue: that.packageIssue
+ }
+ });
+ } else {
+ that.$dialog.confirm({
+ title: "温馨提示",
+ message: "您取消了支付",
+ showCancelButton: false
+ });
+ }
+ }
+ );
+ }
+ },
// 跳转到支付宝花呗外部链接
aliPay(data) {
console.log("选择了支付宝::", data);