Commit 9f2b12ed authored by Z's avatar Z

Z: Dot: discount 页面和 qrCode 页面的 actionId, voucherId, unionId 做了准备与传递。等获取到数据即可拼接。

parent 18fe2e61
<template> <template>
<div class="qr-code"> <div class="qr-code">
<img id="image" src="" alt=""> <img id="image" src alt />
</div> </div>
</template> </template>
<script> <script>
import axios from 'axios' import axios from "axios";
export default { export default {
name: 'index', name: "index",
data() { data() {
return { return {
accessToken: "" accessToken: "",
} nowUrl: "",
activeId: "",
voucherId: "",
unionId: ""
};
},
mounted() {
this.getAcessToken();
this.createCode();
},
methods: {
cleanUrl() {
const url = this.$route;
this.activeId = url.split("&")[1];
this.voucherId = url.split("&")[2];
this.unionId = url.split("&")[3];
}, },
mounted() { getAcessToken() {
this.getAcessToken() let _this = this;
this.createCode() axios({
url: "http://139.155.48.151:8085/workWx/auth/oauth2/getAccessToken",
method: "get"
}).then(res => {
_this.accessToken = res.data.data;
_this.createCode();
});
}, },
methods: { createCode() {
getAcessToken(){ let pageUrl = `/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=${this.accessToken}`;
let _this = this $.ajax({
axios({ type: "POST",
url: "http://139.155.48.151:8085/workWx/auth/oauth2/getAccessToken", url: pageUrl,
method: "get", data: JSON.stringify({ path: "pages/signIn/signIn" }),
}).then(res=>{ data: JSON.stringify({ path: `pages/coupon/detail/detailid=${this.voucherId}&actionid=${this.activeId}&unionid=${this.unionId}` }),
_this.accessToken = res.data.data xhrFields: { responseType: "arraybuffer" },
_this.createCode() success: function(res) {
}) let imgUrl =
}, "data:image/png;base64," +
createCode() { btoa(
let pageUrl = `/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=${this.accessToken}` new Uint8Array(res).reduce(
$.ajax({ (data, byte) => data + String.fromCharCode(byte),
type: "POST", ""
url: pageUrl, )
data: JSON.stringify({"path": "pages/signIn/signIn"}), );
xhrFields: { responseType: "arraybuffer" }, $("#image").attr("src", imgUrl);
success: function (res) { },
let imgUrl = 'data:image/png;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), '')) error: function(data) {
$('#image').attr('src',imgUrl) console.log(data);
}, }
error: function (data) { });
console.log(data)
}
});
}
} }
} }
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.qr-code{ .qr-code {
text-align: center; text-align: center;
padding-top: 50px; padding-top: 50px;
#image { #image {
display: inline-block; display: inline-block;
width: 60%; width: 60%;
} }
} }
</style> </style>
...@@ -103,7 +103,11 @@ export default { ...@@ -103,7 +103,11 @@ export default {
userId: "", userId: "",
unionId: "", unionId: "",
userInfo: "", userInfo: "",
defaultImgUrl: "/mainSale/test-city.png" defaultImgUrl: "/mainSale/test-city.png",
now: {
activeId: "",
voucherId: "",
}
}, },
zlist: { zlist: {
voucher: [], voucher: [],
...@@ -227,6 +231,9 @@ export default { ...@@ -227,6 +231,9 @@ export default {
}, },
zVoucherPick(inActiveId, inVoucherId) { zVoucherPick(inActiveId, inVoucherId) {
this.zcache.now.activeId = String(inActiveId)
this.zcache.now.voucherId = String(inVoucherId)
this.zVoucherUrlDel(); this.zVoucherUrlDel();
const postData = { const postData = {
...@@ -275,7 +282,7 @@ export default { ...@@ -275,7 +282,7 @@ export default {
msgtype: "text", //消息类型,必填 msgtype: "text", //消息类型,必填
news: { news: {
// link: "http://qywx2.100smartdata.com/voucherInfo", //H5消息页面url 必填 // link: "http://qywx2.100smartdata.com/voucherInfo", //H5消息页面url 必填
link: `http://qywx2.100smartdata.com/qrCode?${inur}`, //H5消息页面url 必填 link: `http://qywx2.100smartdata.com/qrCode?Url=${inur}&activeId=${this.zcache.now.activeId}&voucherId=${this.zcache.now.voucherId}&unionId=${this.zcache.unionId}`, //H5消息页面url 必填
title: "Z: h5消息标题", //H5消息标题 title: "Z: h5消息标题", //H5消息标题
desc: inUrl, //H5消息摘要 desc: inUrl, //H5消息摘要
// imgUrl: "http://qywx2.100smartdata.com/hi.jpg" //H5消息封面图片URL // imgUrl: "http://qywx2.100smartdata.com/hi.jpg" //H5消息封面图片URL
......
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