Keine Beschreibung

searchreplace.js 4.3KB

    /** * Created with JetBrains PhpStorm. * User: xuheng * Date: 12-9-26 * Time: 下午12:29 * To change this template use File | Settings | File Templates. */ //清空上次查选的痕迹 editor.firstForSR = 0; editor.currentRangeForSR = null; //给tab注册切换事件 /** * tab点击处理事件 * @param tabHeads * @param tabBodys * @param obj */ function clickHandler( tabHeads,tabBodys,obj ) { //head样式更改 for ( var k = 0, len = tabHeads.length; k < len; k++ ) { tabHeads[k].className = ""; } obj.className = "focus"; //body显隐 var tabSrc = obj.getAttribute( "tabSrc" ); for ( var j = 0, length = tabBodys.length; j < length; j++ ) { var body = tabBodys[j], id = body.getAttribute( "id" ); if ( id != tabSrc ) { body.style.zIndex = 1; } else { body.style.zIndex = 200; } } } /** * TAB切换 * @param tabParentId tab的父节点ID或者对象本身 */ function switchTab( tabParentId ) { var tabElements = $G( tabParentId ).children, tabHeads = tabElements[0].children, tabBodys = tabElements[1].children; for ( var i = 0, length = tabHeads.length; i < length; i++ ) { var head = tabHeads[i]; if ( head.className === "focus" )clickHandler(tabHeads,tabBodys, head ); head.onclick = function () { clickHandler(tabHeads,tabBodys,this); } } } $G('searchtab').onmousedown = function(){ $G('search-msg').innerHTML = ''; $G('replace-msg').innerHTML = '' } //是否区分大小写 function getMatchCase(id) { return $G(id).checked ? true : false; } //查找 $G("nextFindBtn").onclick = function (txt, dir, mcase) { var findtxt = $G("findtxt").value, obj; if (!findtxt) { return false; } obj = { searchStr:findtxt, dir:1, casesensitive:getMatchCase("matchCase") }; if (!frCommond(obj)) { var bk = editor.selection.getRange().createBookmark(); $G('search-msg').innerHTML = lang.getEnd; editor.selection.getRange().moveToBookmark(bk).select(); } }; $G("nextReplaceBtn").onclick = function (txt, dir, mcase) { var findtxt = $G("findtxt1").value, obj; if (!findtxt) { return false; } obj = { searchStr:findtxt, dir:1, casesensitive:getMatchCase("matchCase1") }; frCommond(obj); }; $G("preFindBtn").onclick = function (txt, dir, mcase) { var findtxt = $G("findtxt").value, obj; if (!findtxt) { return false; } obj = { searchStr:findtxt, dir:-1, casesensitive:getMatchCase("matchCase") }; if (!frCommond(obj)) { $G('search-msg').innerHTML = lang.getStart; } }; $G("preReplaceBtn").onclick = function (txt, dir, mcase) { var findtxt = $G("findtxt1").value, obj; if (!findtxt) { return false; } obj = { searchStr:findtxt, dir:-1, casesensitive:getMatchCase("matchCase1") }; frCommond(obj); }; //替换 $G("repalceBtn").onclick = function () { var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj, replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, ""); if (!findtxt) { return false; } if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) { return false; } obj = { searchStr:findtxt, dir:1, casesensitive:getMatchCase("matchCase1"), replaceStr:replacetxt }; frCommond(obj); }; //全部替换 $G("repalceAllBtn").onclick = function () { var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj, replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, ""); if (!findtxt) { return false; } if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) { return false; } obj = { searchStr:findtxt, casesensitive:getMatchCase("matchCase1"), replaceStr:replacetxt, all:true }; var num = frCommond(obj); if (num) { $G('replace-msg').innerHTML = lang.countMsg.replace("{#count}", num); } }; //执行 var frCommond = function (obj) { return editor.execCommand("searchreplace", obj); }; switchTab("searchtab");
portal-front - Gogs: Go Git Service

portal html css js resource

c.html 23KB

    <!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 rel="stylesheet" href="../css/reset.css" /> <link rel="stylesheet" href="../css/common.css" /> <link rel="stylesheet" href="../css/share.css" /> <style> html,body{margin:0;padding:0px;background: #F4F6F8;} .showCardI{background-image: url(../images/enterprise_img_bg_nor@3x.png)} .infocontit:before{background: #28b8fa;} .establishments{display: none;} </style> <script type="text/javascript" src="../js/jquery-1.11.1.js"></script> <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script> <script type="text/javascript" src="../js/public/baseUtil.js"></script> <script type="text/javascript" src="../js/public/shareCom.js"></script> <script type="text/javascript" src="../js/public/openApp.js"></script> </head> <body> <div class="contentBody2"> <div class="showCardI"> <div class="cardTop"> <div class="cardImg cmpCard"> <div class="boxBlock"><img class="boxBlockimg companyImg" id="oimg" src="../images/default-icon.jpg"></div> </div> <div class="cardInfo"> <p><span class="h1Font" id="companyName"></span><em class="authiconNew" id="authFlag"></em></p> <p class="ellipsisSty h2Font" id="industryShow"></p> <p class="h3Font" id="address"></p> </div> </div> </div> <div class="mainbox displayNone"> <div class="infocon madiaBlock needList" style="border:none"> <ul class="mui-table-view" id="demandShow"> </ul> </div> </div> <div class="establishments"> <div class="mainbox displayNone"> <div class="infocontit">可提供服务</div> <div class="infocon infoconM madiaBlock"> <ul class="mui-table-view" id="serviceShow"> </ul> </div> <div class="seeMore displayNone" id="seeMoreService"><em>查看全部 <span id="serviceNum">0</span>个</em></div> </div> <div class="mainbox displayNone"> <div class="infocontit">可共享资源</div> <div class="infocon infoconM madiaBlock"> <ul class="mui-table-view" id="resourceShow"> </ul> </div> <div class="seeMore displayNone" id="seeMoreResource"><em>查看全部 <span id="resourceNum">0</span>个</em></div> </div> </div> <div class="productions"> <div class="mainbox displayNone"> <div class="infocontit">我们的产品</div> <div class="infocon infoconM madiaBlock"> <ul class="mui-table-view" id="productShow"> </ul> </div> <div class="seeMore displayNone" id="seeMoreProduct"><em>查看全部 <span id="productNum">0</span>个</em></div> </div> </div> <div class="mainbox" style="cursor: pointer;" id="goCmpBrief"> <div class="infocontit clearfix">企业介绍 <em></em></div> <div class="infocon"> <span class="breifinfo" id="breifinfo"> </span> </div> </div> <div class="mainbox"> <div class="infocontit">专注领域</div> <div class="infocon listArea"> <ul id="subjectShow"> </ul> </div> </div> <!-- <div class="mainbox displayNone"> <div class="infocontit">文章</div> <div class="infocon madiaBlock"> <ul class="mui-table-view" id="articelShow"> </ul> </div> <div class="seeMore displayNone" id="seeMoreArtical"><em>查看全部 <span id="articalNum">0</span>篇</em></div> </div> --> <!--相关文章--> <!-- <div class="mainbox displayNone"> <div class="infocontit">相关文章</div> <div class="infocon madiaBlock"> <ul class="mui-table-view" id="relateArt"> </ul> </div> </div> --> <!--您可能感兴趣的qiye--> <div class="mainbox displayNone"> <div class="infocontit">您可能感兴趣的企业</div> <div class="infocon madiaBlock"> <ul class="mui-table-view" id="likePro"> </ul> </div> </div> <div class="shareEcode"> <img class="Ecodecon" src="../images/ecordCard.jpg" /> <div class="Ecodeinfo"> <a href="http://a.app.qq.com/o/simple.jsp?pkgname=com.ekexiu.app"><button class="frmbtn frmactive">下载移动客户端</button></a> </div> </div> </div> <script type="text/javascript"> $(document).ready(function() { var imgUrl = "http://www.ekexiu.com/images/logo180.png"; var lineLink = document.location.href; var descContent; var shareTitle; var appid = ''; var orgId = GetQueryString("id"); var rows = 1 var oAjax = function(url, dataS, otype, oFun) { $.ajax({ url:url, dataType: 'json', type: otype, data: dataS, traditional: true, success: function(res) { if(res.success) { oFun(res) } } }); }, demandListVal = function(par) { var aimId = "demandShow" oAjax("/ajax/demand/pq/org", { "state": [1], 'oname':par, "pageSize": 5 }, "get", function(res) { var obj = res.data.data; if(obj.length > 0) { document.getElementById(aimId).parentNode.parentNode.classList.remove("displayNone"); for(var i = 0; i < obj.length; i++) { var li = document.createElement("li"); li.setAttribute("data-id", obj[i].id); var needDate = obj[i].invalidDay; var lastDate = TimeTr(needDate); li.className = "mui-table-view-cell"; var oString = '<div class="madiaInfo">' oString += '<p class="h1Font ellipsisSty-2">' + obj[i].title + '</p>'; oString += '<p class="h2Font ellipsisSty-5">' + obj[i].descp + '</p>' oString += '<div class="showli ellipsisSty h3Font">' oString += '<span>' + obj[i].province + '</span>' if(obj[i].duration != 0) { oString += '<span>预期 ' + demandDuration[obj[i].duration] + '</span>' } if(obj[i].cost != 0) { oString += '<span>预算 ' + demandCost[obj[i].cost] + '</span>' } oString += '<span>有效期至' + lastDate + ' </span>' oString += '</div>' oString += '</div>' li.innerHTML = oString document.getElementById(aimId).appendChild(li); } } }) }, articalListVal = function() { var aimId = "articelShow" oAjax("/ajax/article/publish", { "category": "2", "owner": orgId, "rows": rows }, "get", function(res) { var obj = res.data; if(obj.length > 0) { document.getElementById(aimId).parentNode.parentNode.classList.remove("displayNone"); for(var i = 0; i < obj.length; i++) { var hasImg = "../images/default-artical.jpg" if(obj[i].articleImg) { hasImg ="/data/article/" + obj[i].articleImg } var li = document.createElement("li"); li.setAttribute("data-id", obj[i].articleId); li.className = "mui-table-view-cell"; li.innerHTML = '<div class="flexCenter OflexCenter mui-clearfix">' + '<div class="madiaHead resouseHead" style="background-image:url(' + hasImg + ')"></div>' + '<div class="madiaInfo OmadiaInfo">' + '<p class="ellipsisSty-2 h1Font">' + obj[i].articleTitle + '</p>' + '<p class="h2Font ellipsisSty"><span class="time">' + commenTime(obj[i].publishTime) + '</span></p>' + '</div>' + '</div>' document.getElementById(aimId).appendChild(li); } } }) }, resourceListVal = function() { var aimId = "resourceShow" oAjax("/ajax/resource/publish", { "category": "2", "owner": orgId, "rows": rows }, "get", function(res) { var obj = res.data; if(obj.length > 0) { document.getElementById(aimId).parentNode.parentNode.classList.remove("displayNone"); for(var i = 0; i < obj.length; i++) { var cnt = "", hasImg = "../images/default-resource.jpg" if(obj[i].images.length) { hasImg ='/data/resource/' + obj[i].images[0].imageSrc } if(obj[i].supportedServices) { cnt = "用途:" + obj[i].supportedServices } var li = document.createElement("li"); li.setAttribute("data-id", obj[i].resourceId); li.className = "mui-table-view-cell"; li.innerHTML = '<div class="flexCenter OflexCenter mui-clearfix">' + '<div class="madiaHead resouseHead" style="background-image:url(' + hasImg + ')"></div>' + '<div class="madiaInfo OmadiaInfo">' + '<p class="ellipsisSty-2 h1Font">' + obj[i].resourceName + '</p>' + '<p class="ellipsisSty h2Font">' + cnt + '</p>' + '</div>' + '</div>' document.getElementById(aimId).appendChild(li); } } }) }, serviceListVal = function() { var aimId = "serviceShow" oAjax("/ajax/ware/publish", { "category": "2", "owner": orgId, "rows": rows }, "get", function(res) { var obj = res.data; if(obj.length > 0) { document.getElementById(aimId).parentNode.parentNode.classList.remove("displayNone"); for(var i = 0; i < obj.length; i++) { var cnt = "", hasImg = "../images/default-service.jpg" if(obj[i].images) { var subs = strToAry(obj[i].images) if(subs.length > 0) { hasImg = "/data/ware" + subs[0] } } if(obj[i].cnt) { cnt = "内容:" + obj[i].cnt } var li = document.createElement("li"); li.setAttribute("data-id", obj[i].id); li.className = "mui-table-view-cell"; li.innerHTML = '<div class="flexCenter OflexCenter mui-clearfix">' + '<div class="madiaHead resouseHead" style="background-image:url(' + hasImg + ')"></div>' + '<div class="madiaInfo OmadiaInfo">' + '<p class="ellipsisSty-2 h1Font">' + obj[i].name + '</p>' + '<p class="ellipsisSty h2Font">' + cnt + '</p>' + '</div>' + '</div>' document.getElementById(aimId).appendChild(li); } } }) }, productListVal = function() { var aimId = "productShow" oAjax("/ajax/product/publish", { "owner":orgId, "rows": rows }, "get", function(res) { var obj = res.data; if(obj.length > 0) { document.getElementById(aimId).parentNode.parentNode.classList.remove("displayNone"); for(var i = 0; i < obj.length; i++) { var cnt = "", hasImg = "../images/default-product.jpg" if(obj[i].images) { var subs = strToAry(obj[i].images) if(subs.length > 0) { hasImg = "/data/product" + subs[0] } } if(obj[i].cnt) { cnt = "简介:" + obj[i].cnt } var li = document.createElement("li"); li.setAttribute("data-id", obj[i].id); li.className = "mui-table-view-cell"; li.innerHTML = '<div class="flexCenter OflexCenter mui-clearfix">' + '<div class="madiaHead resouseHead" style="background-image:url(' + hasImg + ')"></div>' + '<div class="madiaInfo OmadiaInfo">' + '<p class="mui-ellipsis-2 h1Font">' + obj[i].name + '</p>' + '<p class="mui-ellipsis h2Font">' + cnt + '</p>' + '</div>' + '</div>' document.getElementById(aimId).appendChild(li); } } }) }, queryPubCount = function() { oAjax("/ajax/article/count/publish", { //文章总数 "owner": orgId, "category": "2" }, "GET", function(data) { if(data.data > rows) { $("#seeMoreArtical").removeClass("displayNone") $("#articalNum").text(data.data); } }); oAjax("/ajax/resource/count/publish", { //资源总数 "owner": orgId, "category": "2" }, "GET", function(data) { if(data.data > rows) { $("#seeMoreResource").removeClass("displayNone") $("#resourceNum").text(data.data); } }); oAjax("/ajax/ware/count/publish", { //服务总数 "owner": orgId, "category": "2" }, "GET", function(data) { if(data.data > rows) { $("#seeMoreService").removeClass("displayNone") $("#serviceNum").text(data.data); } }); oAjax("/ajax/product/count/publish", { //产品总数 "owner": orgId }, "GET", function(data) { if(data.data > rows) { $("#seeMoreProduct").removeClass("displayNone") $("#productNum").text(data.data); } }); }, bindClickFun = function() { var this_="../html/cmpInforShow.html?cmpId="+orgId; wcFresh(this_); $("body").on("click",".seeMore,#goCmpBrief",function(){ isInstalled(this_,true); $(this).addClass("activeThis"); }) $('#articelShow,#relateArt').on('click', 'li', function() { var id = this.getAttribute("data-id"); location.href="http://" + window.location.host + "/e/a.html?id=" + id; }) $('#resourceShow').on('click', 'li', function() { var id = this.getAttribute("data-id"); location.href="http://" + window.location.host + "/e/r.html?id=" + id; }) $('#demandShow').on('click', 'li', function() { var id = this.getAttribute("data-id"); location.href="http://" + window.location.host + "/e/d.html?id=" + id; $(this).addClass("activeThis"); }) $('#serviceShow').on('click', 'li', function() { var id = this.getAttribute("data-id"); location.href="http://" + window.location.host + "/e/s.html?id=" + id; $(this).addClass("activeThis"); }) $('#productShow').on('click', 'li', function() { var id = this.getAttribute("data-id"); location.href="http://" + window.location.host + "/e/pr.html?id=" + id; $(this).addClass("activeThis"); }) } pageViewLog(orgId,6) companyMessage(orgId); // relevantarticalList(); //相关文章 likeExperts(); //感兴趣企业 // articalListVal() bindClickFun() queryPubCount(); function companyMessage(id) { $.ajax({ url: "../ajax/org/" + id, dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 timeout: 10000, //超时设置 success: function(data) { if(data.success) { var $data = data.data; if($data.resMgr){ resourceListVal(); serviceListVal(); document.getElementsByClassName("establishments")[0].style.display="block" } if(!$data.colMgr && !$data.resMgr){ productListVal(); document.getElementsByClassName("productions")[0].style.display="block" } if($data.forShort){ document.getElementById("companyName").innerText = $data.forShort; }else{ document.getElementById("companyName").innerText = $data.name; } demandListVal($data.name); if($data.hasOrgLogo) { document.getElementById("oimg").src = "/images/org/" + $data.id + ".jpg"; } else { document.getElementById("oimg").src = "../images/default-icon.jpg"; } /*企业标识*/ if($data.authStatus == 3) { document.getElementById("authFlag").classList.add("authicon-com-ok"); } /*所在城市*/ if($data.city){ document.getElementById("address").innerHTML ='<em class="iconfontnew icon-address"></em> ' + $data.city; } else { document.getElementById("address").style.display = "none"; } /*企业简介*/ if($data.descp) { document.getElementById("breifinfo").innerText = $data.descp; }else{ document.getElementById("breifinfo").parentNode.style.display = "none"; } /*应用行业*/ var proOther = ""; if($data.industry) { proOther = $data.industry.replace(/,/gi, " | "); } document.getElementById("industryShow").innerText = proOther; /*专注领域*/ if($data.subject) { indu($data.subject, 'subjectShow') } else { document.getElementById("subjectShow").parentNode.parentNode.style.display = "none"; } document.title=$data.name + "-" + proOther; //微信再次分享 shareTitle = document.getElementById("companyName").innerText; descContent = document.getElementById("industryShow").innerText.substring(0,70); if(document.getElementById("oimg").src !="../images/default-icon.jpg"){ imgUrl= document.getElementById("oimg").src; } } }, error: function() { } }); } /*应用行业及领域及企业资质*/ function indu(oString, oSelector) { var arr = oString.split(","); var oArr = new Array(); var i; for(i in arr) { oArr.push('<li>' + arr[i] + '</li>'); } document.getElementById(oSelector).innerHTML = oArr.join(""); } //相关文章信息 function relevantarticalList(){ $.ajax({ url:"/ajax/article/byAssOrg", "type" : "GET" , "dataType" : "json", "data" :{"id":orgId}, "async":"false", "traditional": true, //传数组必须加这个 "success" : function(data) { if (data.success && data.data!=""){ document.getElementById("relateArt").parentNode.parentNode.classList.remove("displayNone"); document.getElementById("relateArt").innerHTML=""; var StrData = data.data var lengthT; if(data.data.length>5){ lengthT=5; }else{ lengthT=data.data.length } for(var i = 0; i < lengthT; i++) { (function(n) { var imgL="../images/default-artical.jpg"; if(StrData[i].articleImg){ imgL='/data/article/' + StrData[i].articleImg } var oURL; if(StrData[i].articleType==1) { oURL="/ajax/professor/baseInfo/"+StrData[i].ownerId; }else if(StrData[i].articleType==2){ oURL="/ajax/org/" + StrData[i].ownerId; }else if(StrData[i].articleType==3){ oURL="/ajax/platform/info"; } $.ajax({ url:oURL, "data": {id:StrData[i].ownerId}, "type": "GET", 'dataType': "json", "success": function(data) { if(data.success) { var add = document.createElement("li"); add.className = "mui-table-view-cell"; add.setAttribute("data-id",StrData[n].articleId); var thisName,userType,thisAuth,thisTitle if(data.data.forShort){ thisName=data.data.forShort; }else{ thisName=data.data.name; } if(StrData[n].articleType==1) { userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus); thisTitle = userType.title; thisAuth = userType.sty; add.setAttribute("owner-id", data.data.id); add.setAttribute("data-type", 1); }else if(StrData[n].articleType==2){ add.setAttribute("owner-id", data.data.id); add.setAttribute("data-type", 2); if(data.data.authStatus==3) { thisTitle = "科袖认证企业"; thisAuth = "authicon-com-ok"; } }else if(StrData[n].articleType==3){ add.setAttribute("owner-id", data.data.id); add.setAttribute("data-type", 3); } var itemlist = '<div class="flexCenter OflexCenter clearfix"><div class="madiaHead artHead" style="background-image:url('+imgL+')"></div>'; itemlist += '<div class="madiaInfo OmadiaInfo">'; itemlist += '<p class="ellipsisSty-2 h1Font" id="usertitle">'+StrData[n].articleTitle+'</p>'; itemlist += '<p><span class="h2Font" style="margin-right:10px">'+thisName+'</span><span class="time">'+commenTime(StrData[n].publishTime)+'</span></p>'; itemlist += '</div></div>'; add.innerHTML=itemlist; document.getElementById("relateArt").appendChild(add); } }, error: function() { } }); })(i); } } }, error: function() { } }); } //感兴趣 function likeExperts(){ $.ajax({ url:"/ajax/org/ralateOrgs", "type": "get", "dataType" : "json", "data" :{"orgId":orgId}, "success": function(data) { if(data.success && data.data) { var lengthT; if(data.data.length>5){ lengthT=5; }else{ lengthT=data.data.length } for(var i = 0; i < lengthT; i++) { var ExpId = data.data[i].id; likeExpertsList(ExpId); } } }, error: function() { } }); } //感兴趣 function likeExpertsList(ExpId){ $.ajax({ url: "/ajax/org/"+ExpId, "type" : "GET" , "dataType" : "json", "success" : function(data) { if (data.success && data.data!=""){ document.getElementById("likePro").parentNode.parentNode.classList.remove("displayNone"); var add = document.createElement("li"); add.setAttribute("data-id",data.data.id); add.className = "mui-table-view-cell"; add.style.minHeight="68px"; var imgL,thisName,thisAuth,thisTitle,otherI=""; if(data.data.hasOrgLogo == 1) { imgL="/images/org/" + data.data.id + ".jpg"; }else{ imgL='../images/default-icon.jpg' } if(data.data.forShort){ thisName=data.data.forShort }else{ thisName=data.data.name } if(data.data.industry){ otherI=data.data.industry.replace(/,/gi, " | "); } if(data.data.authStatus==3){ thisAuth="authicon-com-ok" thisTitle="科袖认证企业" } var itemlist = '<a href="c.html?id='+data.data.id+'" class="flexCenter OflexCenter clearfix"><div class="madiaHead cmpHead"><div class="boxBlock"><img class="boxBlockimg" src="'+imgL+'" /></div></div>'; itemlist += '<div class="madiaInfo OmadiaInfo">'; itemlist += '<p class="ellipsisSty"><span class="h1Font">'+thisName+'</span><em class="authiconNew '+thisAuth+'" title="'+thisTitle+'"></em></p>'; itemlist += '<p class="ellipsisSty h2Font">'+otherI+'</p>'; itemlist += '</div></a>'; add.innerHTML=itemlist; document.getElementById("likePro").appendChild(add); } }, error: function() { } }); } /*微信分享*/ $.ajax({ url: "../ajax/weixin/jsapiTicket", type: 'get', dataType: 'json', contentType: "application/x-www-form-urlencoded; charset=utf-8", data: { 'url': location.href.split('#')[0] }, success: function(data) { if(data.data) { wx.config({ debug: false, //调试模式好犀利 appId: data.data.appId, timestamp: data.data.timestamp, nonceStr: data.data.nonceStr, signature: data.data.signature, jsApiList: [ // 所有要调用的 API 都要加到这个列表中 "onMenuShareAppMessage", "onMenuShareTimeline", "onMenuShareQQ", "onMenuShareQZone", "scanQRCode", ] }); wx.ready(function() { // 在这里调用 API wx.onMenuShareAppMessage({ //分享给朋友 title: shareTitle, // 分享标题 desc: descContent, // 分享描述 link: lineLink, // 分享链接 imgUrl: imgUrl, // 分享图标 success: share_success_callback, cancel: share_cancel_callback }); wx.onMenuShareTimeline({ //分享到朋友圈 title: shareTitle, // 分享标题 desc: descContent, // 分享描述 link: lineLink, // 分享链接 imgUrl: imgUrl, // 分享图标 success: share_success_callback, cancel: share_cancel_callback }); wx.onMenuShareQQ({ //分享到QQ title: shareTitle, // 分享标题 desc: descContent, // 分享描述 link: lineLink, // 分享链接 imgUrl: imgUrl, // 分享图标 success: share_success_callback, cancel: share_cancel_callback }); wx.onMenuShareQZone({ //分享到QQ空间 title: shareTitle, // 分享标题 desc: descContent, // 分享描述 link: lineLink, // 分享链接 imgUrl: imgUrl, // 分享图标 success: share_success_callback, cancel: share_cancel_callback }); }); //分享成功后的回调函数 function share_success_callback() {} //用户取消分享后执行的回调函数 function share_cancel_callback() {} } } }); }) </script> </body> </html>