怎么把自己写的js方法和引入的外部链接写在一个js中
外部链接
<script src="https://sales-int.com/ldi/mp.js"></script>
<script src="https://sales-int.com/ldi/mp/tp.js"></script>
自己写的js
// home页
function doShare() {
var is_agent = parseInt(hxcjs.getUrlString("is_agent"));
var data={
"sales_agent":sales_agent,
"mode":mode,
"product_no":product_no,
"page_url":location.href.split('#')[0]
};
var url =
"common/blank.html?mode=" + mode +
"&product_no=" + product_no +
"&is_agent=" + is_agent +
"&sales_channel_detail=" + sales_channel_detail +
"&appid=" + appid +
"&is_self=1&sales_agent=" + sales_agent +
"&special_apply_no=" + special_apply_no +
"&security_sign1=" + security_sign1 +
"&system_source=" + system_source
if (seed_no!="") {
data.is_share=4;
url+="&seed_no="+seed_no;
}else{
data.is_share=1;
}
if (hxcjs.getUrlString("product_no").split("_")[1] == "YINGXIAO" && hxcjs.getUrlString("product_no").split("_")[0] == "CJB3") {
$(".hktshare").show()
} else {
$(".hktshare").hide()
}
var launchBtn = document.getElementById('launch-btn'); //头像
if (is_agent == 1) {
if (product_no.split("_")[1] == "EMT") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProductB&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=salesman&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
} else if (product_no.split("_")[1] == "YINGXIAO") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProduct&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=salesman&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
}
} else {
if (product_no.split("_")[1] == "EMT") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProductB&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=user&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
} else if (product_no.split("_")[1] == "YINGXIAO") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProduct&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=user&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
}
}
hktajax()
}
// 自助页面
function loShare() {
var is_agent = parseInt(hxcjs.getUrlString("is_agent"));
var url =
"blank.html?product_no=" + hxcjs.getUrlString("product_no") +
"&seed_no=" + return_appid.seed_no +
"&sales_agent=" + hxcjs.getUrlString("sales_agent") +
"&mode=" + mini_mode +
"&appid=" + hxcjs.getUrlString("appid") +
"&custid=" + hxcjs.getUrlString("custid") +
"&sales_channel_detail=" + hxcjs.getUrlString("sales_channel_detail") +
"&consult_code=" + hxcjs.getUrlString("consult_code") +
"&special_apply_no=" + special_apply_no +
"&security_sign1=" + security_sign1 +
"&system_source=" + system_source;
if (hxcjs.getUrlString("product_no").split("_")[1] == "YINGXIAO") {
$(".hktshare").show()
} else {
$(".hktshare").hide()
}
var launchBtn = document.getElementById('launch-btn'); //头像
if (is_agent == 1) {
if (product_no.split("_")[1] == "EMT") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProductB&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=salesman&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
} else if (product_no.split("_")[1] == "YINGXIAO") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProduct&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=salesman&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
}
} else if (is_agent == 0) {
if (product_no.split("_")[1] == "EMT") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProductB&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=user&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
} else if (product_no.split("_")[1] == "YINGXIAO") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProduct&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=user&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
}
}
hktajax()
}
// 信息页面
function goShare() {
if (product_code.split("_")[1] == "YINGXIAO" && product_code.split("_")[0] == "CJB3") {
$(".hktshare").show()
} else {
$(".hktshare").hide()
}
var launchBtn = document.getElementById("launch-btn"); //头像
console.log("客户", is_agentg);
console.log("产品", product_code);
var url =
"common/blank.html?order_no=" + order_no +
"&mode=" + mode +
"&sales_agent=" + sales_agent +
"&plan_no=" + plan_no +
"&product_no=" + product_code +
"&appid=" + hxcjs.getUrlString("appid") +
"&sales_channel_detail=" + hxcjs.getUrlString("sales_channel_detail") +
"&zxuserid=" + hxcjs.getUrlString("zxuserid") +
"&seed_no=" + return_appid.seed_no +
"&security_sign1=" + security_sign1 +
"&system_source=" + system_source;
if (is_agentg == "N") {
if (product_code.split("_")[1] == "EMT") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProductB&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=salesman&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
} else if (product_code.split("_")[1] == "YINGXIAO") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProduct&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=salesman&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
}
} else if (is_agentg == "Y") {
if (product_code.split("_")[1] == "EMT") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProductB&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=user&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
} else if (product_code.split("_")[1] == "YINGXIAO") {
launchBtn.setAttribute("path", `pages/index/index?source=wtProduct&to=h5tp&sourceType=wt&agentCode=${sales_agent}&identity=user&linkUrl=${encodeURIComponent(commonurl_front+url)}`);
}
}
hktajax()
}
function hktajax() {
$.ajax({
url: "https://uc-dev-bg.ihxlife.com/api/v1/wechatt",
data: {
pageUrl: location.href.split("#")[0],
},
type: "GET",
success: function (sdata) {
var configData = {
debug: false,
appId: sdata.data.app_id,
timestamp: sdata.data.timestamp,
nonceStr: sdata.data.nonceStr,
signature: sdata.data.signature,
jsApiList: [
"showOptionMenu",
"onMenuShareTimeline",
"onMenuShareAppMessage",
"hideMenuItems",
], // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
openTagList: ["wx-open-launch-weapp"],
};
// 加载微信SDK引入js
wx.config(configData);
wx.ready(function () {
//alert('JS-SDK注册成功!可以使用了');
wx.showOptionMenu();
// console.log('link', link)
});
},
});
}