Commit 9f2b12ed authored by Z's avatar Z

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

parent 18fe2e61
<template>
<div class="qr-code">
<img id="image" src="" alt="">
<img id="image" src alt />
</div>
</template>
<script>
import axios from 'axios'
export default {
name: 'index',
import axios from "axios";
export default {
name: "index",
data() {
return {
accessToken: ""
}
accessToken: "",
nowUrl: "",
activeId: "",
voucherId: "",
unionId: ""
};
},
mounted() {
this.getAcessToken()
this.createCode()
this.getAcessToken();
this.createCode();
},
methods: {
getAcessToken(){
let _this = this
cleanUrl() {
const url = this.$route;
this.activeId = url.split("&")[1];
this.voucherId = url.split("&")[2];
this.unionId = url.split("&")[3];
},
getAcessToken() {
let _this = this;
axios({
url: "http://139.155.48.151:8085/workWx/auth/oauth2/getAccessToken",
method: "get",
}).then(res=>{
_this.accessToken = res.data.data
_this.createCode()
})
method: "get"
}).then(res => {
_this.accessToken = res.data.data;
_this.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({
type: "POST",
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" },
success: function (res) {
let imgUrl = 'data:image/png;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), ''))
$('#image').attr('src',imgUrl)
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)
error: function(data) {
console.log(data);
}
});
}
}
}
};
</script>
<style scoped lang="scss">
.qr-code{
.qr-code {
text-align: center;
padding-top: 50px;
#image {
display: inline-block;
width: 60%;
}
}
}
</style>
......@@ -103,7 +103,11 @@ export default {
userId: "",
unionId: "",
userInfo: "",
defaultImgUrl: "/mainSale/test-city.png"
defaultImgUrl: "/mainSale/test-city.png",
now: {
activeId: "",
voucherId: "",
}
},
zlist: {
voucher: [],
......@@ -227,6 +231,9 @@ export default {
},
zVoucherPick(inActiveId, inVoucherId) {
this.zcache.now.activeId = String(inActiveId)
this.zcache.now.voucherId = String(inVoucherId)
this.zVoucherUrlDel();
const postData = {
......@@ -275,7 +282,7 @@ export default {
msgtype: "text", //消息类型,必填
news: {
// 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消息标题
desc: inUrl, //H5消息摘要
// 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