- packageList - 增加 微信授权code调用方式,在缓存的基础上在路由增加一个code - packageHome - 增加 微信授权code调用方式,缓存没有则从路由获取 - appId - 修改 测试环境appIdfeat
@@ -1,7 +1,7 @@ | |||||
<!-- | <!-- | ||||
* @Date: 2022-08-17 16:19:13 | * @Date: 2022-08-17 16:19:13 | ||||
* @LastEditors: JinxChen | * @LastEditors: JinxChen | ||||
* @LastEditTime: 2023-04-06 14:23:25 | |||||
* @LastEditTime: 2023-04-08 15:03:04 | |||||
* @FilePath: \TelpoH5FrontendWeb\README.md | * @FilePath: \TelpoH5FrontendWeb\README.md | ||||
* @description: 项目说明 | * @description: 项目说明 | ||||
--> | --> | ||||
@@ -341,3 +341,16 @@ update | |||||
- 注释 获取微信jssdk接口 | - 注释 获取微信jssdk接口 | ||||
- packageHome | - packageHome | ||||
- 修改 appId获取的方式,本地配置文件固定配置,不再从url路由获取 | - 修改 appId获取的方式,本地配置文件固定配置,不再从url路由获取 | ||||
## v1.0.40 | |||||
`2023.4.8` | |||||
update | |||||
- packageList | |||||
- 增加 微信授权code调用方式,在缓存的基础上在路由增加一个code | |||||
- packageHome | |||||
- 增加 微信授权code调用方式,缓存没有则从路由获取 | |||||
- appId | |||||
- 修改 测试环境appId |
@@ -1,7 +1,7 @@ | |||||
<!-- | <!-- | ||||
* @Date: 2022-01-19 10:08:26 | * @Date: 2022-01-19 10:08:26 | ||||
* @LastEditors: JinxChen | * @LastEditors: JinxChen | ||||
* @LastEditTime: 2023-03-30 18:29:20 | |||||
* @LastEditTime: 2023-04-08 15:01:55 | |||||
* @FilePath: \TelpoH5FrontendWeb\src\App.vue | * @FilePath: \TelpoH5FrontendWeb\src\App.vue | ||||
* @description: | * @description: | ||||
--> | --> | ||||
@@ -37,7 +37,7 @@ export default { | |||||
}); | }); | ||||
}, | }, | ||||
debug() { | debug() { | ||||
if (process.env.NODE_ENV !== 'production') { | |||||
if (process.env.NODE_ENV !== 'development') { | |||||
const script = document.createElement('script'); | const script = document.createElement('script'); | ||||
script.src = "//cdn.jsdelivr.net/npm/eruda"; | script.src = "//cdn.jsdelivr.net/npm/eruda"; | ||||
document.body.appendChild(script); | document.body.appendChild(script); | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* @Date: 2022-03-19 19:57:20 | * @Date: 2022-03-19 19:57:20 | ||||
* @LastEditors: JinxChen | * @LastEditors: JinxChen | ||||
* @LastEditTime: 2023-04-06 09:11:48 | |||||
* @LastEditTime: 2023-04-08 15:02:38 | |||||
* @FilePath: \TelpoH5FrontendWeb\src\config\appId.js | * @FilePath: \TelpoH5FrontendWeb\src\config\appId.js | ||||
* @description: | * @description: | ||||
*/ | */ | ||||
@@ -9,5 +9,5 @@ const AppId = process.env.NODE_ENV === 'production' ? | |||||
'wxd78b83bdb0b4df55' : | 'wxd78b83bdb0b4df55' : | ||||
process.env.VUE_APP_BASE_API.indexOf('ai.ssjlai.com') > -1 ? | process.env.VUE_APP_BASE_API.indexOf('ai.ssjlai.com') > -1 ? | ||||
'wxd78b83bdb0b4df55': | 'wxd78b83bdb0b4df55': | ||||
/* 'wx785c95a3e7f46f72' */'wxd78b83bdb0b4df55'; //wx5e26f0813859e5f6 2022.10.12 更改测试公众号 | |||||
'wx785c95a3e7f46f72'/* 'wxd78b83bdb0b4df55' */; //wx5e26f0813859e5f6 2022.10.12 更改测试公众号 | |||||
export default AppId; | export default AppId; |
@@ -1,11 +1,11 @@ | |||||
/* | /* | ||||
* @Date: 2021-11-20 10:26:39 | * @Date: 2021-11-20 10:26:39 | ||||
* @LastEditors: JinxChen | * @LastEditors: JinxChen | ||||
* @LastEditTime: 2023-04-06 09:13:27 | |||||
* @LastEditTime: 2023-04-08 14:56:13 | |||||
* @FilePath: \TelpoH5FrontendWeb\src\config\models.js | * @FilePath: \TelpoH5FrontendWeb\src\config\models.js | ||||
* @description: | * @description: | ||||
*/ | */ | ||||
export const VERSION_MODEL = '1.0.39F'; //版本号 | |||||
export const VERSION_MODEL = '1.0.40F'; //版本号 | |||||
export const IMAGE_URL = { | export const IMAGE_URL = { | ||||
production: 'http://zfb.ssjlai.com/web/', | production: 'http://zfb.ssjlai.com/web/', | ||||
test: 'http://zfb.ssjlai.com/web/', | test: 'http://zfb.ssjlai.com/web/', | ||||
@@ -1,7 +1,7 @@ | |||||
<!-- | <!-- | ||||
* @Date: 2023-02-24 14:18:25 | * @Date: 2023-02-24 14:18:25 | ||||
* @LastEditors: JinxChen | * @LastEditors: JinxChen | ||||
* @LastEditTime: 2023-04-06 10:11:00 | |||||
* @LastEditTime: 2023-04-08 14:55:56 | |||||
* @FilePath: \TelpoH5FrontendWeb\src\views\package-home\index.vue | * @FilePath: \TelpoH5FrontendWeb\src\views\package-home\index.vue | ||||
* @description: | * @description: | ||||
--> | --> | ||||
@@ -23,6 +23,7 @@ export default { | |||||
return { | return { | ||||
params: {}, //获取路由的参数 | params: {}, //获取路由的参数 | ||||
isRecharge: null, //是否已经支付 | isRecharge: null, //是否已经支付 | ||||
wxAuthCode: '' | |||||
}; | }; | ||||
}, | }, | ||||
created() { | created() { | ||||
@@ -50,6 +51,7 @@ export default { | |||||
// checkBrowser 检查扫码的浏览器内核 | // checkBrowser 检查扫码的浏览器内核 | ||||
checkBrowser() { | checkBrowser() { | ||||
const userAgent = window.navigator.userAgent; | const userAgent = window.navigator.userAgent; | ||||
this.$store.commit("wxAuthCode", ''); | |||||
console.log("浏览器内核", userAgent); | console.log("浏览器内核", userAgent); | ||||
if (/AlipayClient/.test(userAgent)) { | if (/AlipayClient/.test(userAgent)) { | ||||
console.log("支付宝"); | console.log("支付宝"); | ||||
@@ -65,8 +67,11 @@ export default { | |||||
let code = url.split("&")[0]; | let code = url.split("&")[0]; | ||||
if (isNotNull(code)) { | if (isNotNull(code)) { | ||||
this.$store.commit("wxAuthCode", code); | this.$store.commit("wxAuthCode", code); | ||||
/* this.getOpenId(); */ | |||||
this.getWxCode(); | |||||
this.wxAuthCode = code; | |||||
//this.getOpenId(); | |||||
setTimeout(() => { | |||||
this.getWxCode(); | |||||
},1000) | |||||
} | } | ||||
} else { | } else { | ||||
this.getWxCode(); | this.getWxCode(); | ||||
@@ -120,7 +125,7 @@ export default { | |||||
} | } | ||||
}) | }) | ||||
} else { | } else { | ||||
let redUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/${params.routerName}?imei=${params.imei}&appId=${AppId}&iccid=${params.iccid}`); | |||||
let redUrl = encodeURIComponent(`${commonUrl}/h5-frontendweb/#/${params.routerName}?imei=${params.imei}&appId=${AppId}&iccid=${params.iccid}&code=${this.wxAuthCode}`); | |||||
let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${redUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; | let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${AppId}&redirect_uri=${redUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; | ||||
window.location.href = url; | window.location.href = url; | ||||
} | } | ||||
@@ -1,7 +1,7 @@ | |||||
<!-- | <!-- | ||||
* @Date: 2022-03-29 16:57:58 | * @Date: 2022-03-29 16:57:58 | ||||
* @LastEditors: JinxChen | * @LastEditors: JinxChen | ||||
* @LastEditTime: 2023-04-06 14:21:05 | |||||
* @LastEditTime: 2023-04-08 14:57:19 | |||||
* @FilePath: \TelpoH5FrontendWeb\src\views\package-list\index.vue | * @FilePath: \TelpoH5FrontendWeb\src\views\package-list\index.vue | ||||
* @description: TODO 小台风充值h5 | * @description: TODO 小台风充值h5 | ||||
--> | --> | ||||
@@ -107,6 +107,7 @@ import { APIPay } from "@/api/pay"; | |||||
import APICore from "@/api/core"; | import APICore from "@/api/core"; | ||||
let wx = require("weixin-js-sdk"); // TODO 再封装,可拦截错误提示等操作 | let wx = require("weixin-js-sdk"); // TODO 再封装,可拦截错误提示等操作 | ||||
import { isNotNull } from "@/utils/index"; | import { isNotNull } from "@/utils/index"; | ||||
import { VERSION_MODEL } from '@/config/models'; | |||||
export default { | export default { | ||||
name: "packageList", | name: "packageList", | ||||
data() { | data() { | ||||
@@ -139,6 +140,7 @@ export default { | |||||
payProductId: null, //套餐id | payProductId: null, //套餐id | ||||
packageIssue: null, //套餐分期 | packageIssue: null, //套餐分期 | ||||
payType: '1', //支付方式 1 微信, 2 支付宝,支付宝又分为花呗和全额支付,全额支付分期数传0 或者1 ,花呗则传 3 6 12 | payType: '1', //支付方式 1 微信, 2 支付宝,支付宝又分为花呗和全额支付,全额支付分期数传0 或者1 ,花呗则传 3 6 12 | ||||
openId: '' | |||||
}; | }; | ||||
}, | }, | ||||
created() { | created() { | ||||
@@ -147,22 +149,19 @@ export default { | |||||
//this.getWxAutograph(); | //this.getWxAutograph(); | ||||
// 套餐列表 | // 套餐列表 | ||||
this.getDevicePayPackage(); | this.getDevicePayPackage(); | ||||
console.log("当前版本", VERSION_MODEL); | |||||
}, | }, | ||||
methods: { | methods: { | ||||
// 根据code获取openId | // 根据code获取openId | ||||
getOpenId() { | getOpenId() { | ||||
let code = this.$store.getters.wxAuthCode; | |||||
let openId = this.$store.getters.openId; | |||||
if(isNotNull(openId)) { | |||||
console.log("已经存在openId"); | |||||
} else { | |||||
APIPay.getOpenId(code).then(res => { | |||||
let data= res.data; | |||||
if(data.code === 20000) { | |||||
this.$store.commit("openId", data.data.openId); | |||||
} | |||||
}) | |||||
} | |||||
let code = this.$store.getters.wxAuthCode ? this.$store.getters.wxAuthCode : this.params.code; | |||||
APIPay.getOpenId(code).then(res => { | |||||
let data= res.data; | |||||
if(data.code === 20000) { | |||||
this.openId = data.data.openId; | |||||
this.$store.commit("openId", data.data.openId); | |||||
} | |||||
}) | |||||
}, | }, | ||||
// 获取b端接口的token | // 获取b端接口的token | ||||
getAuth() { | getAuth() { | ||||
@@ -175,15 +174,7 @@ export default { | |||||
getParams() { | getParams() { | ||||
let params = this.$route.query; | let params = this.$route.query; | ||||
if (params) { | if (params) { | ||||
let url = window.location.href.split("?code=")[1]; | |||||
if ( isNotNull(url) || window.location.href.indexOf("code") > -1) { | |||||
let timeStamp = new Date().getTime(); | |||||
let code = url.split("&")[0]; | |||||
if (isNotNull(code)) { | |||||
this.$store.commit("wxAuthCode", `${code}`); | |||||
this.getOpenId(); | |||||
} | |||||
} | |||||
this.getOpenId(); | |||||
this.params = {...params}; | this.params = {...params}; | ||||
} | } | ||||
}, | }, | ||||
@@ -319,7 +310,7 @@ export default { | |||||
console.log("微信支付", data); | console.log("微信支付", data); | ||||
let orderData = data; | let orderData = data; | ||||
let reqBody = { | let reqBody = { | ||||
openId: this.$store.getters.openId, //openId | |||||
openId: this.$store.getters.openId || this.openId, //openId | |||||
imei: this.params.imei, //imei | imei: this.params.imei, //imei | ||||
iccid: this.params.iccid, | iccid: this.params.iccid, | ||||
productId: this.payProductId, //套餐id | productId: this.payProductId, //套餐id | ||||