<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=0, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> <c:set var="ctx" value="${pageContext.request.contextPath }" /> <link rel="stylesheet" href="${ctx }/jsp/xte/level/static/css/load.css" /> <title>TITLE</title> <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script src="${ctx }/js/hideOptionMenu.js"></script> </head> <body> <input type="hidden" name="userId" id="userId" value="${userId }"> <input type="hidden" id="redirect_uri" name="redirect_uri" value="${redirect_uri}" /> <input type="hidden" id="componentAppId" name="componentAppId" value="${componentAppId }"> <input type="hidden" id="appId" name="appId" value="${appId }" /> <input type="hidden" id="code" name="code" value="${code }" /> <input type="hidden" id="openid" name="openid" value="${openid }" /> <c:forEach var="cardlog" items="${ wxCardPackageCodes}"> <input type="hidden" class="cardId" name="c" value="${cardlog.card_id }" /> </br> <input type="hidden" class="code" name="" value="${cardlog.code }"> </c:forEach> <div id="front" style="display: block; opacity: 1"> <div class="tips"> <div class="icon loading"></div> <p>加载中...</p> </div> </div> </body> <script type="text/javascript" src="${ctx }/js/jquery1.6/jquery-1.6.1.js"></script> <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script type="text/javascript"> $(function() { var code = $("#code").val(); var openid = $("#openid").val(); if (code == ‘‘ && openid == ‘‘) { var appid = $("#appId").val(); var redirect_uri = $("#redirect_uri").val(); var componentAppId = $("#componentAppId").val(); window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_base&state=STATE&component_appid=" + componentAppId + "#wechat_redirect"; } }); $(function() { var cardId = $(".cardId"); var code = $(".code"); var l = {}; var a = []; var b; for ( var i in code) { if (code[i].value !== undefined) { b = new Object(); b = { cardId : "" + cardId[i].value + "", code : "" + code[i].value + "" }; a.push(b) } } var url = location.href.split(‘#‘)[0]; var userId = $("#userId").val(); $.post("http://www.quanqiuyouhui.com/kabao-api/getShareData.do", { ‘url‘ : url, ‘userId‘ : userId }, function(data) { data = eval("(" + data + ")"); wx.config({ debug : false, appId : data.map.appId, timestamp : data.map.timestamp, nonceStr : data.map.nonceStr, signature : data.map.signature, jsApiList : [ ‘checkJsApi‘, ‘onMenuShareTimeline‘, ‘onMenuShareAppMessage‘, ‘openCard‘ ] }); wx.ready(function() { wx.openCard({ cardList : a }); }); wx.hideMenuItems({ menuList : [ ‘menuItem:share:qq‘, ‘menuItem:share:weiboApp‘, ‘menuItem:share:email‘, ‘menuItem:share:facebook‘, ‘menuItem:share:QZone‘ ] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3 }); }) }); </script> </html>