Commit 9d83bf0f authored by Z's avatar Z

Z: Dot: Wx: QRCode can send and scan. But Jump to wrong page. Now: Edit QRCode page Version 2.0

parent 49c1e490
<!DOCTYPE html>
<html>
<head>
<meta lang="zh-cn">
<title>QRCode</title>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src='https://code.jquery.com/jquery-3.2.1.min.js'></script>
<style>
.qr-code {
text-align: center;
padding-top: 50px;
}
.qr-code>#image {
display: inline-block;
width: 60%;
}
</style>
</head>
<body>
<div class="qr-code">
<img id="image" src="" alt />
</div>
<!--<h1>Hola qrCode.</h1>-->
<!-- <img src="./3.png"> -->
<script>
const cleanUrlAndPostQRInfo = () => {
// alert(`--->qrCode: cleanUrlAndPostQRInfo: IN.`)
let nowUrl = ''
let id = ''
let actionid = ''
let activeId = ''
let voucherId = ''
let unionId = ''
nowUrl = document.location.toString().slice(42);
// alert(`--->nowUrl =${nowUrl}`)
id = String(nowUrl.split("?")[1].slice(3).split("&")[0]);
actionid = String(nowUrl.split("?")[1].slice(3).split("&")[1].split("=")[1]);
activeId = String(nowUrl.split("?")[1].slice(3).split("&")[2].split("=")[1]);
voucherId = String(nowUrl.split("?")[1].slice(3).split("&")[3].split("=")[1]);
unionId = String(nowUrl.split("?")[1].slice(3).split("&")[4].split("=")[1]);
// let pageUri = `${nowUrl}&detailid=${voucherId}&actionid=${activeId}&unionid=${unionId}`;
let pageUri = `${nowUrl}`;
let pageUrl = `http://139.155.48.151:8085/workWx/auth/oauth2/wxMiniQrCode?pageUri=${pageUri}`;
// alert(`--->qrCode: Ajax: POST: pageUrl = ${pageUrl}`)
// document.location = pageUri
$.ajax({
type: "POST",
url: pageUrl,
// data: JSON.stringify({ path: "pages/signIn/signIn" }),
data: {},
success: function (res) {
// alert(`--->qrCode: ajax: res.`)
// alert(`--->qrCode: ajax: res: res =${JSON.stringify(res)}`)
console.log(res)
$('#image').attr('src', res.data)
// $('#image').attr('src', 'http://qywx2.100smartdata.com/qrCode/1584512690487.jpeg')
},
error: function (data) {
alert(`--->qrCode: ajax: err.`)
alert(`--->qrCode: ajax: err: err =${JSON.stringify(err)}`)
alert('error' + JSON.stringify(data))
console.log(data);
}
});
}
const __main = () => {
cleanUrlAndPostQRInfo()
}
__main()
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>长按扫描二维码</title>
<link rel="stylesheet" href="main.css">
<script src="main.js"></script>
<style>
body {
background-color: rgba(15, 106, 184, 0.99);
font-size: 10px;
margin: 0;
padding: 0;
}
.main {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
overflow: hidden;
}
.titles {
border: 1px solid yellow;
width: 100%;
height: 40%;
font-size: 4rem;
color: white;
text-align: center;
}
.cards {
background-color: whitesmoke;
width: 100%;
height: auto;
}
.cards>.card02>.tips>.qrcodes>.qrcode {
width: 50%;
}
</style>
</head>
<body>
<div class="main">
<div class="titles">优惠券详情</div>
<div class="cards">
<div class="card card01" id="card01">
<div class="titles">
<div class="title">惊喜折上折</div>
<div class="discount">0.5 元</div>
<div class="description">满9999元可用</div>
</div>
<ul class="rules">
<li class="rule">满9999元可用</li>
<li class="rule">有效期 2019-10-15 04:00:00 至 2019-10-15 04:01:00</li>
</ul>
</div>
<div class="card card02" id="card02">
<div class="tips">
<div class="tip">使用说明</div>
<ul class="rules">
<li class="rule">单次结算时候仅能使用半张优惠券折扣</li>
<li class="rule">单张优惠券不可叠加、找零、续用、残缺</li>
<li class="rule">该优惠券有效时间为 2019-10-15 04:00:00 至 2019-10-15 04:01:00 ,过期/提前均不可使用</li>
</ul>
<div class="qrcodes">
<img class="qrcode" src="qrcodeBuy.png" alt />
<div class="qrcodeTip">按得越久,折扣越高!反正我信了!</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
.main {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
overflow: unset;
}
.title {
}
\ No newline at end of file
......@@ -20,25 +20,25 @@
</div>
<!-- <button class="testButton" @click="zTestPreAuthCode">preAuthCodeUrl</button>
<div class="fkwindow">{{zcache.preAuthCodeUrl}}</div> -->
<!--
<div class="fkwindow">{{zcache.preAuthCodeUrl}}</div>-->
<!--
<button class="testButton" @click="zTestGetNowUrlInfo">nowUrlInfo</button>
<div class="fkwindow">{{zcache.nowUrl}}</div> -->
<div class="fkwindow">{{zcache.nowUrl}}</div>-->
<!-- <button class="testButton" @click="zTestGetUserInfoByOldToken">GetUserInfoByOldToken</button>
<div class="fkwindow">{{zcache.userInfoResOld}}</div> -->
<div class="fkwindow">{{zcache.userInfoResOld}}</div>-->
<!-- <button class="testButton" @click="zTestGetUserInfoByNewToken">GetUserInfoByNewToken</button> -->
<!-- <button class="testButton" @click="zTestGetUserInfoByNewToken">RES</button> -->
<!-- <div
style="border:1px solid limegreen;padding:4px;height: 100px; width: 100%; overflow: auto; font-size:14px;word-wrap:break-word;"
>{{zcache.userInfoResNew}}</div> -->
>{{zcache.userInfoResNew}}</div>-->
</div>
<!-- <div class="menus">
<div class="menu" @click="buttonMainMarketingClick">精准营销</div>
<div class="menu activeMenu" @click="buttonSingleMarketingClick">一对一营销侧边栏</div>
</div> -->
</div>-->
</div>
</template>
......@@ -89,7 +89,7 @@ export default {
};
},
mounted() {
this.zReadyUserId()
this.zReadyUserId();
// this.zTestGetNowUrlInfo();
},
created() {
......@@ -105,12 +105,12 @@ export default {
"color: orange;",
this.$route.query.code
);
if (this.$route.query.code === undefined) {
this.zTestPreAuthCode();
} else {
this.zTestGetNowUrlInfo()
this.zTestGetUserInfoByOldToken()
this.zTestGetNowUrlInfo();
this.zTestGetUserInfoByOldToken();
}
// if(this.zcache.code === "") {
......@@ -129,7 +129,7 @@ export default {
zlog("%c--->zTestGetNowUrlInfo: ", "color: orange;", this.zcache.nowUrl);
},
// 测试-获取预授权码
// redirectUrI: encodeURIComponent(location.href.split('#')[0]),
// redirectUrI: encodeURIComponent(location.href.split('#')[0]),
zTestPreAuthCode() {
// alert(`--->home: zTestPreAuthCode: IN.`)
const basicInfo = {
......@@ -168,7 +168,7 @@ export default {
};
let headerData = {
agentId: "1000015",
corpId: "wwd1cdbca7b8b2b6c4",
corpId: "wwd1cdbca7b8b2b6c4"
// agentId: "1000032",
// corpId: "ww4df265003b43fa0d"
};
......@@ -187,8 +187,8 @@ export default {
.then(res => {
// this.zcache.userInfoResNew = "RESOK:" + JSON.stringify(res.data);
this.zcache.userInfoResNew = "RESOK:" + res.data.data.userId;
sessionStorage.setItem('userId', String(res.data.data.userId))
this.zcache.userId = String(res.data.data.userId)
sessionStorage.setItem("userId", String(res.data.data.userId));
this.zcache.userId = String(res.data.data.userId);
})
.catch(res => {
this.zcache.userInfoResNew = "RESERR.";
......@@ -230,7 +230,10 @@ export default {
// this.$router.push({name: inData, transData: {userId: this.zcache.code}})
// alert(`--->listClick: IN.`)
// alert(`--->listClick: indata =${inData}. userId =${this.zcache.userId}`)
this.$router.push({name: inData, params: {userId: this.zcache.userId}})
this.$router.push({
name: inData,
params: { userId: this.zcache.userId }
});
// this.$router.push({name: inData, params: {userId: 'SEGA'}})
},
buttonSingleMarketingClick() {
......
......@@ -18,12 +18,14 @@ export default {
};
},
mounted() {
// alert('--->arCode: mounted: IN.')
this.cleanUrl()
// this.getAcessToken();
this.createCode();
},
methods: {
cleanUrl() {
// alert('--->arCode: cleanUrl: IN.')
this.nowUrl = this.$route.query.Url
this.activeId = this.$route.query.activeId
this.voucherId = this.$route.query.voucherId
......
......@@ -65,7 +65,7 @@
<div>小程序Url:{{ String(zlist.voucherUrl).slice(-2) }}</div>
<div
v-if="String(zlist.voucherUrl).slice(-2) === '97'"
@click="zpick('text', String(zlist.voucherUrl))"
@click="zpick('h5', String(zlist.voucherUrl))"
>{{ zlist.voucherUrl }}</div>
<div
v-if="String(zlist.voucherUrl).slice(-2) !== '97'"
......@@ -277,13 +277,25 @@ export default {
);
break;
case "h5":
// alert(`--->discount: zpick: sendChatMessage: news =${JSON.stringify(
// {
// // link: "http://qywx2.100smartdata.com/voucherInfo", //H5消息页面url 必填
// link: `http://qywx2.100smartdata.com/qrCode?Url=${inUrl}&activeId=${this.zcache.now.activeId}&voucherId=${this.zcache.now.voucherId}&unionId=1234`, //H5消息页面url 必填
// title: "Z: h5消息标题", //H5消息标题
// desc: inUrl, //H5消息摘要
// // imgUrl: "http://qywx2.100smartdata.com/hi.jpg" //H5消息封面图片URL
// imgUrl: inUrl //H5消息封面图片URL
// }
// )}`)
wx.invoke(
"sendChatMessage",
{
msgtype: "text", //消息类型,必填
news: {
// link: "http://qywx2.100smartdata.com/voucherInfo", //H5消息页面url 必填
link: `http://qywx2.100smartdata.com/qrCode?Url=${inUrl}&activeId=${this.zcache.now.activeId}&voucherId=${this.zcache.now.voucherId}&unionId=${this.zcache.unionId}`, //H5消息页面url 必填
// link: `http://qywx2.100smartdata.com/qrCode?Url=${inUrl}&activeId=${this.zcache.now.activeId}&voucherId=${this.zcache.now.voucherId}&unionId=${this.zcache.unionId}`, //H5消息页面url 必填
link: `http://qywx2.100smartdata.com/qrCode?Url=${inUrl}&activeId=${this.zcache.now.activeId}&voucherId=${this.zcache.now.voucherId}&unionId=1234`, //H5消息页面url 必填
title: "Z: h5消息标题", //H5消息标题
desc: inUrl, //H5消息摘要
// imgUrl: "http://qywx2.100smartdata.com/hi.jpg" //H5消息封面图片URL
......@@ -630,7 +642,6 @@ export default {
justify-content: space-around;
align-items: flex-start;
font-size: 14px;
text-wrap: none;
}
.zListActive > .lists > .voucherUrl {
......
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