Browse Source

优化代码

ms
zhoujie 2 years ago
parent
commit
1e17cd2c3c

+ 19
- 41
pages/payment/payment.vue View File

@@ -133,29 +133,25 @@
setTimeout(() => {
uni.hideLoading()
contractTesting(qdOrderVal.value.qdOrderNo, jumpPage)
// uni.navigateTo({
// url: '/' + jumpPage,
// animationType: 'pop-in',
// animationDuration: 500
// })

}, 1000)

// 根据公网ip获取支付地址
myJsonp({
url: 'https://www.taobao.com/help/getip.php',
success(res) {
console.log(res)
const data = {
fee: 1,
spbillCreateIp: res.ip,
}
OrdinaryRequest({
data,
}).then(res => {
if (res.code === 200) {
console.log(res.data)
// myJsonp({
// url: 'https://www.taobao.com/help/getip.php',
// success(res) {
// console.log(res)
// const data = {
// fee: 1,
// spbillCreateIp: res.ip,
// }
// OrdinaryRequest({
// data,
// }).then(res => {
// if (res.code === 200) {
// console.log(res.data)
// window.location.href = res.data.h5Url
window.open(res.data.h5Url, '_blank')
// window.open(res.data.h5Url, '_blank')
// 在当前窗口中打开一个新窗口
// const newWindow = window.open('', '_self'); // 给 URL 添加自定义请求头信息
// const url = res.data.h5Url;
@@ -168,10 +164,10 @@
// const h5Url = res.data.h5Url.substring(21)

// toWeixin(h5Url)
}
})
}
})
// }
// })
// }
// })


// const data = {
@@ -193,15 +189,6 @@
}).then((res) => {
if (res.statusCode === 0) {
const data = JSON.parse(res.bizContent)
if (data.status !== 0) {
// 后台调用它方接口报错
uni.showModal({
title: '警告',
content: data.msg,
success: function(res) {}
});
return
}
if (data.signStatus === 1 && data.accountStatus === 1 && data.bindStatus === 1) {
// 上面三值都为1才进行下一步,否则进行签约初始化
if (!jumpPage) return
@@ -230,15 +217,6 @@
}).then((res) => {
if (res.statusCode === 0) {
const data = JSON.parse(res.bizContent)
if (data.status !== 0) {
// 后台调用它方接口报错
uni.showModal({
title: '警告',
content: data.msg,
success: function(res) {}
});
return
}
if (data.returnType === 0) {
// 0-无需跳转,关闭H5即可 1-需跳转至返回url
// const opened = window.open('about:blank', '_self');

+ 10
- 10
pages/payment/paymentSucess.vue View File

@@ -23,17 +23,17 @@
import {
request
} from '@/utils/network/request'
const {
initData, //初始化数据
qdOrderVal //qdOrder中数据 ref
} = unifyTemplate() //初始化数据
// const {
// initData, //初始化数据
// qdOrderVal //qdOrder中数据 ref
// } = unifyTemplate() //初始化数据
//获取页面配置
onLoad((opin) => {
initData(opin, 5).then(data => {
// contractTesting(data.qdOrder.qdOrderNo, data.config.jumpPage)
// contractQuery(data.qdOrder.qdOrderNo, data.config.jumpPage)
})
})
// onLoad((opin) => {
// initData(opin, 5).then(data => {
// // contractTesting(data.qdOrder.qdOrderNo, data.config.jumpPage)
// // contractQuery(data.qdOrder.qdOrderNo, data.config.jumpPage)
// })
// })

</script>
<style lang="scss" scoped>

+ 2
- 2
unpackage/dist/build/h5/index.html View File

@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="./assets/uni.669187af.css">
<link rel="stylesheet" href="./assets/uni.46d46b2a.css">

<meta charset="UTF-8" />
<script>
@@ -12,7 +12,7 @@
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title>ETC申办</title>
<script type="module" crossorigin src="./assets/index-d1352248.js"></script>
<script type="module" crossorigin src="./assets/index-c445796f.js"></script>
<link rel="stylesheet" href="./assets/index-e4b572a5.css">
</head>
<body>

+ 11
- 11
utils/network/encryption.js View File

@@ -174,7 +174,7 @@ export function encryption(ifCode, subdata, type) {
// requestData["bizContent"] = s4.encryptData_CBC(subdata, sm4Key)
requestData["bizContent"] = JSON.stringify(subdata)

if (import.meta.env.MODE === 'production') {
// if (import.meta.env.MODE === 'production') {
// 生产环境
requestData['signType'] = 'SM3';
let sm3Data = 'appId=' + requestData['appId'] +
@@ -185,16 +185,16 @@ export function encryption(ifCode, subdata, type) {
'&ifCode=' + ifCode +
'&reqId=' + requestData['reqId']
requestData['sign'] = sm3(sm3Data, sm3Key);
} else {
requestData['signType'] = 'MD5';
requestData["sign"] = md5(
"bizContent=" + requestData["bizContent"] +
"&signType=" + requestData["signType"] +
"&encryptType=" + requestData["encryptType"] +
"&timestamp=" + requestData["timestamp"] +
"&ifCode=" + requestData["ifCode"]
);
}
// } else {
// requestData['signType'] = 'MD5';
// requestData["sign"] = md5(
// "bizContent=" + requestData["bizContent"] +
// "&signType=" + requestData["signType"] +
// "&encryptType=" + requestData["encryptType"] +
// "&timestamp=" + requestData["timestamp"] +
// "&ifCode=" + requestData["ifCode"]
// );
// }
let endData = arrayToJson(requestData);
return endData;
}

+ 2
- 2
vite.config.js View File

@@ -18,8 +18,8 @@ export default defineConfig({
// "pathRewrite": {
// "^": ""
// },
target: 'http://192.168.100.63:8087/ifzt', // 目标服务
// target: 'https://qtzl.etcjz.cn/', // 目标服务
// target: 'http://192.168.100.63:8087/ifzt', // 目标服务
target: 'https://qtzl.etcjz.cn/', // 目标服务
changeOrigin: true,
// rewrite: path => path.replace(/^\/api/, ''),
}

Loading…
Cancel
Save