@@ -1,7 +1,7 @@ | |||
<!-- | |||
* @Date: 2022-08-17 16:19:13 | |||
* @LastEditors: JinxChen | |||
* @LastEditTime: 2023-04-06 14:23:25 | |||
* @LastEditTime: 2023-04-08 15:03:04 | |||
* @FilePath: \TelpoH5FrontendWeb\README.md | |||
* @description: 项目说明 | |||
--> | |||
@@ -341,3 +341,16 @@ update | |||
- 注释 获取微信jssdk接口 | |||
- packageHome | |||
- 修改 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 | |||
* @LastEditors: JinxChen | |||
* @LastEditTime: 2023-04-06 10:30:46 | |||
* @LastEditTime: 2023-04-08 16:46:23 | |||
* @FilePath: \TelpoH5FrontendWeb\src\App.vue | |||
* @description: | |||
--> | |||
@@ -37,7 +37,7 @@ export default { | |||
}); | |||
}, | |||
debug() { | |||
if (process.env.NODE_ENV !== 'production') { | |||
if (process.env.NODE_ENV !== 'development') { | |||
const script = document.createElement('script'); | |||
script.src = "//cdn.jsdelivr.net/npm/eruda"; | |||
document.body.appendChild(script); | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* @Date: 2022-03-19 19:57:20 | |||
* @LastEditors: JinxChen | |||
* @LastEditTime: 2023-04-06 09:17:15 | |||
* @LastEditTime: 2023-04-08 16:46:06 | |||
* @FilePath: \TelpoH5FrontendWeb\src\config\appId.js | |||
* @description: | |||
*/ | |||
@@ -9,5 +9,5 @@ const AppId = process.env.NODE_ENV === 'production' ? | |||
'wxd78b83bdb0b4df55' : | |||
process.env.VUE_APP_BASE_API.indexOf('ai.ssjlai.com') > -1 ? | |||
'wxd78b83bdb0b4df55': | |||
/* 'wx785c95a3e7f46f72' */'wxd78b83bdb0b4df55'; //wx5e26f0813859e5f6 2022.10.12 更改测试公众号 | |||
'wx5e26f0813859e5f6'/* 'wxd78b83bdb0b4df55' */; //wx5e26f0813859e5f6 2022.10.12 更改测试公众号 | |||
export default AppId; |
@@ -1,11 +1,11 @@ | |||
/* | |||
* @Date: 2021-11-20 10:26:39 | |||
* @LastEditors: JinxChen | |||
* @LastEditTime: 2023-04-06 09:13:27 | |||
* @LastEditTime: 2023-04-08 14:56:13 | |||
* @FilePath: \TelpoH5FrontendWeb\src\config\models.js | |||
* @description: | |||
*/ | |||
export const VERSION_MODEL = '1.0.39F'; //版本号 | |||
export const VERSION_MODEL = '1.0.40F'; //版本号 | |||
export const IMAGE_URL = { | |||
production: 'http://zfb.ssjlai.com/web/', | |||
test: 'http://zfb.ssjlai.com/web/', | |||
@@ -1,7 +1,7 @@ | |||
<!-- | |||
* @Date: 2023-02-24 14:18:25 | |||
* @LastEditors: JinxChen | |||
* @LastEditTime: 2023-04-06 10:11:00 | |||
* @LastEditTime: 2023-04-08 16:35:10 | |||
* @FilePath: \TelpoH5FrontendWeb\src\views\package-home\index.vue | |||
* @description: | |||
--> | |||
@@ -63,9 +63,8 @@ export default { | |||
) { | |||
let timeStamp = new Date().getTime(); | |||
let code = url.split("&")[0]; | |||
console.log("code", code); | |||
if (isNotNull(code)) { | |||
this.$store.commit("wxAuthCode", code); | |||
/* this.getOpenId(); */ | |||
this.getWxCode(); | |||
} | |||
} else { | |||
@@ -96,8 +95,8 @@ export default { | |||
}) | |||
}, | |||
// 根据code获取openId | |||
getOpenId() { | |||
let code = this.$store.getters.wxAuthCode; | |||
getOpenId(code) { | |||
//let code = this.$store.getters.wxAuthCode; | |||
APIPay.getOpenId(code).then(res => { | |||
let data= res.data; | |||
if(data.code === 20000) { | |||
@@ -120,7 +119,7 @@ export default { | |||
} | |||
}) | |||
} 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}&iccid=${params.iccid}`); | |||
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; | |||
} | |||
@@ -1,7 +1,7 @@ | |||
<!-- | |||
* @Date: 2022-03-29 16:57:58 | |||
* @LastEditors: JinxChen | |||
* @LastEditTime: 2023-04-06 14:21:05 | |||
* @LastEditTime: 2023-04-08 14:57:19 | |||
* @FilePath: \TelpoH5FrontendWeb\src\views\package-list\index.vue | |||
* @description: TODO 小台风充值h5 | |||
--> | |||
@@ -107,6 +107,7 @@ import { APIPay } from "@/api/pay"; | |||
import APICore from "@/api/core"; | |||
let wx = require("weixin-js-sdk"); // TODO 再封装,可拦截错误提示等操作 | |||
import { isNotNull } from "@/utils/index"; | |||
import { VERSION_MODEL } from '@/config/models'; | |||
export default { | |||
name: "packageList", | |||
data() { | |||
@@ -139,30 +140,28 @@ export default { | |||
payProductId: null, //套餐id | |||
packageIssue: null, //套餐分期 | |||
payType: '1', //支付方式 1 微信, 2 支付宝,支付宝又分为花呗和全额支付,全额支付分期数传0 或者1 ,花呗则传 3 6 12 | |||
openId: '' | |||
}; | |||
}, | |||
created() { | |||
this.getAuth(); | |||
this.getParams(); | |||
this.getCode(); | |||
//this.getWxAutograph(); | |||
// 套餐列表 | |||
this.getDevicePayPackage(); | |||
console.log("当前版本", VERSION_MODEL); | |||
}, | |||
methods: { | |||
// 根据code获取openId | |||
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); | |||
} | |||
}) | |||
} | |||
getOpenId(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 | |||
getAuth() { | |||
@@ -171,19 +170,21 @@ export default { | |||
this.$store.commit("gatewayToken", res.data.data); | |||
}); | |||
}, | |||
getCode() { | |||
let url = window.location.href.split("?code=")[1]; | |||
console.log("url", url); | |||
if (isNotNull(url) ||window.location.href.indexOf("code") > -1) { | |||
let code = url.split("&")[0]; | |||
if (isNotNull(code)) { | |||
this.getOpenId(code); | |||
} | |||
} | |||
}, | |||
// 获取url传过来的参数 | |||
getParams() { | |||
let params = this.$route.query; | |||
console.log("params", 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.params = {...params}; | |||
} | |||
}, | |||
@@ -295,7 +296,7 @@ export default { | |||
this.aliPay(data); | |||
} else { | |||
// 微信 | |||
let openId = this.$store.getters.openId; | |||
let openId = this.openId; | |||
this.payProductId = payTypeToPackAgeId.filter(item => { | |||
return item.payType === '1' || item.payType === 1 | |||
})[0].productId; | |||
@@ -319,7 +320,7 @@ export default { | |||
console.log("微信支付", data); | |||
let orderData = data; | |||
let reqBody = { | |||
openId: this.$store.getters.openId, //openId | |||
openId: this.openId, //openId | |||
imei: this.params.imei, //imei | |||
iccid: this.params.iccid, | |||
productId: this.payProductId, //套餐id | |||
@@ -472,7 +473,7 @@ export default { | |||
}); | |||
let orderData = data; | |||
let reqBody = { | |||
openId: this.$store.getters.openId, //openId | |||
openId: this.openId, //openId | |||
imei: this.params.imei, //imei | |||
iccid: this.params.iccid, | |||
productId: this.payProductId, //套餐id | |||