MeiRiYiCheng_1_old/YBDevice.NApi/Views/Qr/f.cshtml

94 lines
3.0 KiB
Plaintext

@model Senparc.Weixin.MP.Helpers.JsSdkUiPackage
@{
var data = ViewData["orderinfo"] as YBDevice.Entity.OrderInfo;
ViewData["Title"] = data.NickName;
Layout = "~/Views/Shared/_LayoutQr1.cshtml";
}
@if (data.type == YBDevice.Entity.OrderType.Mini)
{
<div class="content">
<div style="width:100%;text-align:center;">
<div>
<img src="@data.HeadImg" class="logo" />
</div>
@*<div class="name">@data.NickName</div>*@
</div>
<div>
<wx-open-launch-weapp id="launch-btn"
username="@data.appid"
path="@data.content"
style="top:30%;right:15px; bottom: 0; left: 15px; z-index: 10; overflow: hidden; position: absolute">
<script type="text/wxtag-template">
<button style="width:100%;height:38px;border:none;color:#fff;line-height: 38px;background:#04BE02;border-radius: 5px;margin-top: 100px;">进入小程序</button>
</script>
</wx-open-launch-weapp>
</div>
</div>
}
else if (data.isbind)
{
<div style="width:100%;text-align:center;height:100vh;">
<div style="padding-top:50%;">
<img src="@data.content" class="ercode" />
</div>
<div>
<span>长按二维码关注公众号绑定设备</span>
</div>
</div>
}
else
{
<div class="content">
<div style="width:100%;text-align:center;">
<div>
<img src="@data.content" class="ercode" />
</div>
<div>
<span>长按二维码关注公众号查看健康报告</span>
</div>
</div>
</div>
}
@section css
{
<style>
body {
background-color: #fff;
background:url(/images/bg.png) no-repeat;
background-size:100% 100%;
}
.ercode {
height: 13vh;
width: 13vh;
min-width: 23vh;
min-height: 23vh;
margin: 3vh;
}
</style>
}
@section Scripts
{
<script type="text/javascript">
wx.config({
debug: false,
appId: '@Model.AppId',
timestamp: '@Model.Timestamp', // 必填,生成签名的时间戳
nonceStr: '@Model.NonceStr', // 必填,生成签名的随机串
signature: '@Model.Signature',// 必填,签名
jsApiList: ['getNetworkType'],
openTagList: ['wx-open-launch-weapp']
});
wx.error(function (res) {
console.log(res);
alert('验证失败');
});
var btn = document.getElementById('launch-btn');
btn.addEventListener('launch', function (e) {
console.log('success');
});
btn.addEventListener('error', function (e) {
console.log('fail', e.detail);
});
</script>
}