tijian_tieying/web/dccdc/Views/Infection/tjfx.cshtml

178 lines
6.7 KiB
Plaintext
Raw Normal View History

2025-02-20 12:14:39 +08:00
@{Layout = null; }
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>推荐分享</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="../css/mui.min.css" rel="stylesheet" />
<!--css样式-->
<style type="text/css">
body, html {
width: 100%;
height: 100%;
position: relative;
background: #FFFFFF;
font-size: 14px;
}
/*主体*/
.mui-content {
width: 100%;
height: auto;
padding: 18% 5% 15% 5%;
background: #FFFFFF;
}
.mui-input-row {
margin-bottom: 15px;
}
.mui-input-row label {
text-align: right;
width: 37%;
line-height: 20px;
padding: 11px 10px;
}
.mui-input-row label ~ input, .mui-input-row label ~ select, .mui-input-row label ~ textarea {
border: 1px solid rgba(0,0,0,0.2);
padding-left: 8px;
font-size: 14px;
width: 63%;
}
#imgbox {
width: 60%;
height: 100px;
border: 1px solid #EFEFF4;
border-radius: 5px;
text-align: center;
margin: auto;
line-height: 100px;
}
/*按钮*/
.mui-bar {
-webkit-box-shadow: none;
box-shadow: none;
height: 40px;
}
#picture {
width: 100%;
height: 100%;
}
#editBtn, #subBtn {
position: absolute;
/*width: 50%;*/
height: 100%;
border-color: #007aff;
border-radius: 0;
background: #007aff;
color: #FFFFFF;
}
#editBtn {
right: 0;
background: #4cd964;
border-color: #4cd964;
}
#subBtn {
/*right: 50%;*/
background: #8a8cb2;
border-color: #8a8cb2;
}
</style>
</head>
<body>
<!--页面主体-->
<div class="mui-content">
<div class="mui-input-row">
<label>姓名:</label>
<input type="text" class="mui-input-clear" placeholder="姓名" readonly="readonly" id="name" value="@ViewBag.name">
</div>
<div class="mui-input-row">
<label>我的推荐码:</label>
<input type="text" class="mui-input-clear" placeholder="推荐码" name="recommend" readonly="readonly" id="TJM" value="@ViewBag.recommend">
</div>
<div class="mui-input-row">
</div>
</div>
<nav class="mui-bar mui-bar-tab" style="display: block;" id="bottomBox">
<input type="button" class="mui-btn mui-btn-block mui-btn-primary" value="通过右上角分享" id="subBtn" onclick="tjfx();" />
</nav>
<!--js内容-->
<script src="../js/mui.min.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/jquery-2.1.0.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript">
mui.init()
var user = {};
window.onload = function () {
}
wx.config({
debug: false, //是否调试true会弹窗
appId: '@dccdc.Common.Global.InfectionAppId', //得到这个东西首先必须有一个公众号或者企业号如果已经拥有了你可以就知道AppId在哪里了。
timestamp: '@ViewBag.timeStamp',//生成签名的时间戳,随机数,之后会用这个生成一个签名
nonceStr: '@ViewBag.nonceStr',//生成签名的随机串,随机串,之后会用这个生成一个签名
signature: '@ViewBag.signature',//这个就是签名了在步骤4我会详细讲解
jsApiList: [
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
wx.ready(function () {
wx.checkJsApi({
jsApiList: [
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
], // 需要检测的JS接口列表所有JS接口列表见附录2,
success: function (res) {
// 以键值对的形式返回可用的api值true不可用为false
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
}
});
var shareUrl = 'http://oa.dcqcdc.com/dccdc/infection/tjfx2?id=@ViewBag.id&recommend=@ViewBag.recommend&name=@ViewBag.name';
var obj = {//朋友圈
title: '德城健康e路', // 分享标题
desc: '@ViewBag.name 邀请您参与德城区卡车司机健康促进项目!', // 分享描述
link: shareUrl, // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
// 该链接是重定向链接因为需要获取用户code但是该链接又无法直接写微信获取code的链接
// 所以需要点击后重新加载新的页面来实现重定向重新打开获取code的微信链接实现获取用户信息的功能
imgUrl: '@ViewBag.license', // 分享图标
fail: function (res) {
alert(JSON.stringify(res));
},
success: function (res) {
}
};
// 2.1 监听“分享给朋友”,按钮点击、自定义分享内容及分享结果接口
wx.onMenuShareAppMessage(obj);
// 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
wx.onMenuShareTimeline(obj);
// 2.3 监听“分享到QQ”按钮点击、自定义分享内容及分享结果接口
wx.onMenuShareQQ(obj);
// 2.4 监听“分享到微博”按钮点击、自定义分享内容及分享结果接口
wx.onMenuShareWeibo(obj);
// 2.5 监听“分享到QZone”按钮点击、自定义分享内容及分享接口
wx.onMenuShareQZone(obj);
});
function tjfx() {
alert("通过右上角分享")
}
</script>
</body>
</html>