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() { mounted() {
this.getAcessToken() this.getAcessToken();
this.createCode() this.createCode();
}, },
methods: { methods: {
getAcessToken(){ cleanUrl() {
let _this = this const url = this.$route;
this.activeId = url.split("&")[1];
this.voucherId = url.split("&")[2];
this.unionId = url.split("&")[3];
},
getAcessToken() {
let _this = this;
axios({ axios({
url: "http://139.155.48.151:8085/workWx/auth/oauth2/getAccessToken", url: "http://139.155.48.151:8085/workWx/auth/oauth2/getAccessToken",
method: "get", method: "get"
}).then(res=>{ }).then(res => {
_this.accessToken = res.data.data _this.accessToken = res.data.data;
_this.createCode() _this.createCode();
}) });
}, },
createCode() { createCode() {
let pageUrl = `/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=${this.accessToken}` let pageUrl = `/wxx/cgi-bin/wxaapp/createwxaqrcode?access_token=${this.accessToken}`;
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: pageUrl, url: pageUrl,
data: JSON.stringify({"path": "pages/signIn/signIn"}), data: JSON.stringify({ path: "pages/signIn/signIn" }),
data: JSON.stringify({ path: `pages/coupon/detail/detailid=${this.voucherId}&actionid=${this.activeId}&unionid=${this.unionId}` }),
xhrFields: { responseType: "arraybuffer" }, xhrFields: { responseType: "arraybuffer" },
success: function (res) { success: function(res) {
let imgUrl = 'data:image/png;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), '')) let imgUrl =
$('#image').attr('src',imgUrl) "data:image/png;base64," +
btoa(
new Uint8Array(res).reduce(
(data, byte) => data + String.fromCharCode(byte),
""
)
);
$("#image").attr("src", imgUrl);
}, },
error: function (data) { error: function(data) {
console.log(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