Commit 89fa64fb authored by xulili's avatar xulili

推送

parent 6aed2285
......@@ -19,22 +19,15 @@ export default {
},
mounted() {
this.cleanUrl()
this.getAcessToken();
// this.getAcessToken();
this.createCode();
},
methods: {
cleanUrl() {
// alert(`!-->cleanUrl: IN.`)
// alert(`!-->cleanUrl: url =${JSON.stringify(this.$route)}`)
// alert(`!-->cleanUrl: url =${JSON.stringify(this.$route.params)}`)
const url = this.$route;
this.nowUrl = url.split("&")[0].slice(41);
this.activeId = url.split("&")[1].split("=")[1];
this.voucherId = url.split("&")[2].split("=")[1];
this.unionId = url.split("&")[3].split("=")[1];
this.nowUrl = this.$route.query.Url
this.activeId = this.$route.query.activeId
this.voucherId = this.$route.query.voucherId
this.unionId = this.$route.query.unionId
},
getAcessToken() {
let _this = this;
......@@ -46,28 +39,52 @@ export default {
_this.createCode();
});
},
// createCode() {
// let _this = this;
// let pageUrl = `/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=${_this.accessToken}`;
// $.ajax({
// type: "POST",
// url: pageUrl,
// data: JSON.stringify({ path: "pages/signIn/signIn" }),
// // data: JSON.stringify({ path: `${_this.nowUrl}&detailid=${_this.voucherId}&actionid=${_this.activeId}&unionid=${_this.unionId}` }),
// xhrFields: { responseType: "arraybuffer" },
// success: function(res) {
// alert('success' + JSON.stringify(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) {
// alert('error' + JSON.stringify(data))
// console.log(data);
// }
// });
// },
createCode() {
let _this = this;
let pageUrl = `/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=${_this.accessToken}`;
// alert(`!-->createCode: data: path: ${_this.nowUrl}&detailid=${_this.voucherId}&actionid=${_this.activeId}&unionid=${_this.unionId}`)
let nowUrl = _this.nowUrl? _this.nowUrl : ""
let voucherId = _this.voucherId? _this.voucherId : ""
let activeId = _this.activeId? _this.activeId : ""
let unionId = _this.unionId? _this.unionId : ""
let pageUri = `${nowUrl}&detailid=${voucherId}&actionid=${activeId}&unionid=${unionId}`;
let pageUrl = `http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=${pageUri}`;
$.ajax({
type: "POST",
url: pageUrl,
// data: JSON.stringify({ path: "pages/signIn/signIn" }),
data: JSON.stringify({ path: `${_this.nowUrl}&detailid=${_this.voucherId}&actionid=${_this.activeId}&unionid=${_this.unionId}` }),
xhrFields: { responseType: "arraybuffer" },
data: {},
success: function(res) {
let imgUrl =
"data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte),
""
)
);
$("#image").attr("src", imgUrl);
console.log(res)
$('#image').attr('src',res.data)
},
error: function(data) {
alert('error' + JSON.stringify(data))
console.log(data);
}
});
......
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