Commit 18fe2e61 authored by Z's avatar Z

Merge branch 'master' of gitlabz:xulili/ybf

parents f87e6e63 ee7458d0
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>亿百分</title> <title>亿百分</title>
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
</head> </head>
<body> <body>
......
This diff is collapsed.
...@@ -107,7 +107,7 @@ export default { ...@@ -107,7 +107,7 @@ export default {
); );
if (this.$route.query.code === undefined) { if (this.$route.query.code === undefined) {
this.zTestPreAuthCode(); // this.zTestPreAuthCode();
} else { } else {
this.zTestGetNowUrlInfo() this.zTestGetNowUrlInfo()
// this.zTestGetUserInfoByOldToken() // this.zTestGetUserInfoByOldToken()
......
<template> <template>
<div class="qr-code"> <div class="qr-code">
<canvas id="QRCode_header"></canvas> <img id="image" src="" alt="">
</div> </div>
</template> </template>
<script> <script>
import QRCode from 'qrcode' import axios from 'axios'
export default { export default {
name: 'index', name: 'index',
data(){ data() {
return{ return {
QRCodeMsg:'' accessToken: ""
} }
}, },
mounted(){ mounted() {
this.creatQrCode() this.getAcessToken()
this.createCode()
}, },
methods:{ methods: {
creatQrCode(){ getAcessToken(){
let opts = { let _this = this
errorCorrectionLevel: "H",//容错级别 axios({
type: "image/png",//生成的二维码类型 url: "http://139.155.48.151:8085/workWx/auth/oauth2/getAccessToken",
quality: 0.3,//二维码质量 method: "get",
margin: 12,//二维码留白边距 }).then(res=>{
width: 200,//宽 _this.accessToken = res.data.data
height: 180,//高 _this.createCode()
color: { })
dark: "#333333",//前景色 },
light: "#fff"//背景色 createCode() {
let pageUrl = `/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=${this.accessToken}`
$.ajax({
type: "POST",
url: pageUrl,
data: JSON.stringify({"path": "pages/signIn/signIn"}),
xhrFields: { responseType: "arraybuffer" },
success: function (res) {
let imgUrl = 'data:image/png;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), ''))
$('#image').attr('src',imgUrl)
},
error: function (data) {
console.log(data)
} }
};
// this.QRCodeMsg = window.location.href; //生成的二维码为URL地址js
// this.QRCodeMsg = window.location.href; //生成的二维码为URL地址js
alert(`${window.location.origin}/voucherInfo`)
this.QRCodeMsg = `${window.location.origin}/voucherInfo`; //生成的二维码为URL地址js
let msg = document.getElementById("QRCode_header");
// 将获取到的数据(val)画到msg(canvas)上
QRCode.toCanvas(msg, this.QRCodeMsg, opts, function (error) {
console.log(error)
}); });
}, }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.qr-code{
text-align: center;
padding-top: 50px;
#image {
display: inline-block;
width: 60%;
}
}
</style> </style>
...@@ -22,6 +22,14 @@ module.exports = { ...@@ -22,6 +22,14 @@ module.exports = {
'^/api': '' '^/api': ''
} }
}, },
'/wxx': {
ws: false,
target: 'https://api.weixin.qq.com',
changeOrigin: true,
pathRewrite: {
'^/wxx': ''
}
},
} }
}, },
css: { css: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment