Ver código fonte

update

- alarmDetails
    - 增加 坐标通过高德逆地理编码解析中文地址
- packageList
    - 修改 微信支付的方式,不使用jssdk,使用微信内置WeixinJSBridge对象

- appId
    - 修改 微信测试环境appId
feat
JinxChen 1 ano atrás
pai
commit
9fe9e2c23f
5 arquivos alterados com 83 adições e 13 exclusões
  1. +2
    -0
      .eslintrc.js
  2. +14
    -2
      README.md
  3. +3
    -3
      src/config/appId.js
  4. +19
    -5
      src/views/alarm/alarm-details.vue
  5. +45
    -3
      src/views/package-list/index.vue

+ 2
- 0
.eslintrc.js Ver arquivo

@@ -15,9 +15,11 @@ module.exports = {
// 关闭eslint语法检测
"no-unused-vars":0,
},
// 添加全局变量过滤
globals: {
"AMap": "true",
"AMapUI": "true",
"WeixinJSBridge": "true"
},
overrides: [
{


+ 14
- 2
README.md Ver arquivo

@@ -1,7 +1,7 @@
<!--
* @Date: 2022-08-17 16:19:13
* @LastEditors: JinxChen
* @LastEditTime: 2023-03-29 10:17:04
* @LastEditTime: 2023-03-30 17:26:11
* @FilePath: \TelpoH5FrontendWeb\README.md
* @description: 项目说明
-->
@@ -293,4 +293,16 @@ feature
update
- alarmDetails
- 修改 标题显示文字
- 修改 弹窗显示文字
- 修改 弹窗显示文字


## v1.0.35
`2023.3.30`
update
- alarmDetails
- 增加 坐标通过高德逆地理编码解析中文地址
- packageList
- 修改 微信支付的方式,不使用jssdk,使用微信内置WeixinJSBridge对象

- appId
- 修改 微信测试环境appId

+ 3
- 3
src/config/appId.js Ver arquivo

@@ -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;

+ 19
- 5
src/views/alarm/alarm-details.vue Ver arquivo

@@ -10,7 +10,7 @@
<div class="bottom">
<div class="address">
<div class="title">
<p>{{ params.address }}</p>
<p>{{ alarm.address }}(附近)</p>
</div>
<div class="time">
<span>{{ params.time }}</span>
@@ -22,7 +22,7 @@
:key="index"
:type="item.type"
:icon="item.icon"
@click="onClick(item.name)"
@click="onErrorReport(item.name)"
>{{ item.text }}</van-button>
</div>
</div>
@@ -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();
}


+ 45
- 3
src/views/package-list/index.vue Ver arquivo

@@ -1,7 +1,7 @@
<!--
* @Date: 2022-03-29 16:57:58
* @LastEditors: JinxChen
* @LastEditTime: 2023-03-23 15:45:04
* @LastEditTime: 2023-03-30 17:09:16
* @FilePath: \TelpoH5FrontendWeb\src\views\package-list\index.vue
* @description: TODO 小台风充值h5
-->
@@ -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);


Carregando…
Cancelar
Salvar