我妈已经三天没打我了 2023-04-06 15:39 采纳率: 85.4%
浏览 30
已结题

怎么把自己写的js方法和引入的外部链接写在一个js中

怎么把自己写的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)
         });
      },
   });
}

  • 写回答

2条回答 默认 最新

  • 简效 2023-04-06 16:02
    关注

    你把外部链接的js复制进来就好了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月18日
  • 已采纳回答 4月10日
  • 创建了问题 4月6日

悬赏问题

  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来