Browse Source

优化代码

ms
zhoujie 2 years ago
parent
commit
1e17cd2c3c

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

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

}, 1000) }, 1000)


// 根据公网ip获取支付地址 // 根据公网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.location.href = res.data.h5Url
window.open(res.data.h5Url, '_blank')
// window.open(res.data.h5Url, '_blank')
// 在当前窗口中打开一个新窗口 // 在当前窗口中打开一个新窗口
// const newWindow = window.open('', '_self'); // 给 URL 添加自定义请求头信息 // const newWindow = window.open('', '_self'); // 给 URL 添加自定义请求头信息
// const url = res.data.h5Url; // const url = res.data.h5Url;
// const h5Url = res.data.h5Url.substring(21) // const h5Url = res.data.h5Url.substring(21)


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




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

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

import { import {
request request
} from '@/utils/network/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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

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

<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="./assets/uni.669187af.css">
<link rel="stylesheet" href="./assets/uni.46d46b2a.css">


<meta charset="UTF-8" /> <meta charset="UTF-8" />
<script> <script>
(coverSupport ? ', viewport-fit=cover' : '') + '" />') (coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script> </script>
<title>ETC申办</title> <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"> <link rel="stylesheet" href="./assets/index-e4b572a5.css">
</head> </head>
<body> <body>

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

// requestData["bizContent"] = s4.encryptData_CBC(subdata, sm4Key) // requestData["bizContent"] = s4.encryptData_CBC(subdata, sm4Key)
requestData["bizContent"] = JSON.stringify(subdata) requestData["bizContent"] = JSON.stringify(subdata)


if (import.meta.env.MODE === 'production') {
// if (import.meta.env.MODE === 'production') {
// 生产环境 // 生产环境
requestData['signType'] = 'SM3'; requestData['signType'] = 'SM3';
let sm3Data = 'appId=' + requestData['appId'] + let sm3Data = 'appId=' + requestData['appId'] +
'&ifCode=' + ifCode + '&ifCode=' + ifCode +
'&reqId=' + requestData['reqId'] '&reqId=' + requestData['reqId']
requestData['sign'] = sm3(sm3Data, sm3Key); 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); let endData = arrayToJson(requestData);
return endData; return endData;
} }

+ 2
- 2
vite.config.js View File

// "pathRewrite": { // "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, changeOrigin: true,
// rewrite: path => path.replace(/^\/api/, ''), // rewrite: path => path.replace(/^\/api/, ''),
} }

Loading…
Cancel
Save