【问题标题】:WebChat in sharepoint getting postback共享点中的 WebChat 获得回发
【发布时间】:2018-03-13 06:31:46
【问题描述】:

Sharepoint 中的 WebChat 得到回发。在 sharepoint 中添加 web 部件并尝试实现 webchat。

每当我点击输入或发送按钮时,它都会回发。当事件发生(例如:按钮点击)时,我们如何避免回发?

<script type="text/javascript"
      src="https://code.jquery.com/jquery-3.3.1.js"
      integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
      crossorigin="anonymous"></script>
    <script src="https://unpkg.com/botframework-webchat/botchat.js"></script>


    <script type="text/javascript">

      var jq = $.noConflict();

      jq(document).ready(function () {

      try {

      BotChat.App({
      directLine: {
      secret: 'Qc--iFxcebI.cwA.poU.XfmiUiUHwK9AjLZXzUoA_ewI3s6fktbN447HI9qVqLE'
      },
      user: {
      id: _spPageContextInfo.userLoginName //_spPageContextInfo.userLoginName
      },
      bot: {
      id: 'botid'
      },
      sendTyping: true,
      resize: 'detect'
      }, document.getElementById("bot"));

      } catch (e) {
      console.log(e.message);
      }

      try {
      jq('.wc-header > span').html('Search Bot');
      jq(".wc-header").click(function () {
      jq(".botcontainer").toggleClass("height");
      });
      } catch (e) {
      debugger;
      console.log(e.message);
      }

      });
    </script>

    <div class="botcontainer ms-dialogHidden ms-fullWidth noindex" id="bot" ></div>

【问题讨论】:

标签: sharepoint botframework


【解决方案1】:

作为一种变通方法,在页面库中创建一个aspx页面,并在页面中添加HTML代码来实现webchat。然后在脚本编辑器 Web 部件中添加 iframe。

<iframe id="botchat" src="/chatbot/Pages/chatbot.aspx?t=<directline secret>" width="320" height="500"></iframe>

类似的线程: Using WebChat in SharePoint Script Editor

【讨论】:

    猜你喜欢
    • 2019-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多