(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5d49da85"],{"0215":function(t,e,n){var a=n("24fb");e=a(!1),e.push([t.i,".content[data-v-1f096c97]{background:#fff}",""]),t.exports=e},"17a0":function(t,e,n){var a=n("0215");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[t.i,a,""]]),a.locals&&(t.exports=a.locals);var i=n("499e").default;i("32c854a8",a,!0,{sourceMap:!1,shadowMode:!1})},"1da1":function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));n("d3b7");function a(t,e,n,a,i,r,o){try{var c=t[r](o),s=c.value}catch(l){return void n(l)}c.done?e(s):Promise.resolve(s).then(a,i)}function i(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function c(t){a(o,i,r,c,s,"next",t)}function s(t){a(o,i,r,c,s,"throw",t)}c(void 0)}))}}},"5ff5":function(t,e,n){"use strict";n("17a0")},aab3:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("d-title",[t._v("会话列表")]),t.isEmployee?a("van-tabs",{model:{value:t.pageTabActiveIndex,callback:function(e){t.pageTabActiveIndex=e},expression:"pageTabActiveIndex"}},[a("van-tab",{attrs:{title:"客户聊天"}},[t.chatListPagination.finished&&0==t.employeeChatList.length?a("div",{staticClass:"blank"},[a("img",{attrs:{src:n("22af")}}),a("span",[t._v("还没有记录哦")])]):t._e(),a("div",{staticClass:"content"},[a("van-list",{attrs:{finished:t.employeeChatPagination.finished,showStatusText:!1,"immediate-check":!1},on:{load:t.getEmployeeChatData},model:{value:t.employeeChatPagination.loading,callback:function(e){t.$set(t.employeeChatPagination,"loading",e)},expression:"employeeChatPagination.loading"}},t._l(t.employeeChatList,(function(e){return a("div",{key:e.id,on:{click:function(n){return t.enterEmployeeChatPage(e)}}},[a("ChatListItem",{attrs:{item:e}})],1)})),0)],1)]),a("van-tab",{attrs:{title:"我的聊天"}})],1):t._e(),1==t.pageTabActiveIndex||0==t.isEmployee?[a("div",[t.chatListPagination.finished&&0==t.chatList.length?a("div",{staticClass:"blank"},[a("img",{attrs:{src:n("22af")}}),a("span",[t._v("还没有记录哦")])]):t._e(),a("div",{staticClass:"content"},[a("van-list",{attrs:{finished:t.chatListPagination.finished,showStatusText:!1,"immediate-check":!1},on:{load:t.getChatData},model:{value:t.chatListPagination.loading,callback:function(e){t.$set(t.chatListPagination,"loading",e)},expression:"chatListPagination.loading"}},t._l(t.chatList,(function(e){return a("div",{key:e.id,on:{click:function(n){return t.enterChatPage(e)}}},[a("ChatListItem",{attrs:{item:e}})],1)})),0)],1)])]:t._e()],2)},i=[],r=n("2909"),o=(n("e7e5"),n("d399")),c=n("c7eb"),s=(n("9a83"),n("f564")),l=n("1da1"),u=(n("99af"),n("d3b7"),n("159b"),n("4de4"),n("e9c4"),n("640b")),h=n("f773"),f=null,d=!1,p=0,g=!1,v="plugin.yun-chat.frontend.h5.chat.get-list",y=null,m=null,b={},L=0,w=null,_=11,C=null,x=!1,P={data:function(){return{isLoading:!1,pageTabActiveIndex:0,chatListSets:null,chatList:[],chatListPagination:{pages:1,finished:!1,loading:!1},isEmployee:!1,employeeChatList:[],employeeChatPagination:{pages:1,finished:!1,loading:!1}}},activated:function(){var t=this;return Object(l["a"])(Object(c["a"])().mark((function e(){return Object(c["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.getSetData();case 2:return t.getWebscoketConfig(),t.employeeChatPagination={pages:1,finished:!1,loading:!1},t.getEmployeeChatData(),t.chatListPagination["finished"]=!1,t.chatListPagination["loading"]=!1,t.chatListPagination["pages"]=1,d=!1,e.next=11,t.getChatData();case 11:t.loopGetChatData(),window.onoffline=function(){clearInterval(f),y&&(y.close(),y=null),f=null,x=!0,Object(s["a"])("网络连接异常")},window.ononline=function(){!0===x&&(Object(s["a"])({type:"primary",message:"网络连接恢复"}),t.loopGetChatData(),t.socketInit())};case 14:case"end":return e.stop()}}),e)})))()},deactivated:function(){clearInterval(C),C=null,clearInterval(w),w=null,clearInterval(f),f=null,this.chatList=[],this.chatListPagination={pages:1,finished:!1,loading:!1},this.employeeChatPagination={pages:1,finished:!1,loading:!1},this.employeeChatList=[],y&&(y.close(),y=null)},destroyed:function(){clearInterval(C),C=null,clearInterval(w),w=null,clearInterval(f),f=null,y&&(y.close(),y=null)},methods:{getWebscoketConfig:function(){var t=this;this.isEmployee&&$http.get("plugin.yun-chat.frontend.chat.get-ws-setting").then((function(e){var n=e.data,a=e.result,i=e.msg;a?(b=n.wss_params,m="".concat(b.host,"?appId=").concat(b.appId,"&signature=").concat(b.signature,"&nonceStr=").concat(b.nonceStr,"×tamp=").concat(b.timestamp,"&clientid=").concat(b.clientid,"&agent_id=").concat(b.agent_id),t.socketInit()):Object(o["a"])(i)}))},getSetData:function(){var t=this;return Object(l["a"])(Object(c["a"])().mark((function e(){return Object(c["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,n){$http.get("plugin.yun-chat.frontend.h5.chat.get-list-setting",{},"加载中").then((function(a){a.result?(t.chatListSets=a.data,a.data.employee_id>0&&(t.isEmployee=!0),e(a.data)):n(a)})).catch((function(t){return t}))}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()},getChatData:function(){var t=arguments,e=this;return Object(l["a"])(Object(c["a"])().mark((function n(){var a,i;return Object(c["a"])().wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(a=t.length>0&&void 0!==t[0]&&t[0],d){n.next=4;break}if(!e.chatListPagination.finished&&!e.chatListPagination.loading){n.next=4;break}return n.abrupt("return");case 4:return i=e.chatListPagination.pages,d?i=1:e.chatListPagination.loading=!0,n.next=8,$http.get(v,{page:i}).then((function(t){var n=t.data,i=n.data,c=n.per_page,s=n.current_page,l=n.last_page,u=t.msg,h=t.result;if(e.chatListPagination.loading=!1,e.chatListPagination.finished=!0,0!==h){var f;if(e.chatList.length>0)if(a)i.forEach((function(t){for(var n=!0,a=0;a=100&&(clearInterval(f),f=null))}),8e3):p=0},getEmployeeChatData:function(){var t=this;!1===this.isEmployee||this.employeeChatPagination.finished||this.isLoading||(this.isLoading=!0,this.employeeChatPagination.loading=!0,$http.get("plugin.yun-chat.frontend.chat.get-list",{page:this.employeeChatPagination.pages}).then((function(e){var n,a=e.data,i=a.data,c=a.per_page,s=a.current_page,l=a.last_page,u=e.msg,h=e.result;t.employeeChatPagination.loading=!1,t.isLoading=!1,0===h&&Object(o["a"])(u),(i.length0){switch(a=a[0],n["content_type"]){case 0:a["last_chat_content"]=n["data"];break;case 1:a["last_chat_content"]="[图片]";break;case 2:a["last_chat_content"]="[商品]";break;case 3:a["last_chat_content"]="[订单]";break}a["un_read_num"]++,a["updated_at"]=n["time"];for(var i=!0,r=0;r=_?(clearInterval(w),w=null,Object(s["a"])("网路连接不可用")):t.socketReconnet()},y.onopen=function(){t.checkSocketConnectState()},y.close=function(){clearInterval(C),C=null})},socketReconnet:function(){var t=this;if(null===w)return L>=_?(clearInterval(w),w=null,void Object(s["a"])("网路连接不可用")):void(w=setInterval((function(){L++,t.socketInit()}),5e3))},checkSocketConnectState:function(){var t=this;null===C&&(C=setInterval((function(){y?1==y.readyState?(y.send(JSON.stringify({type:"ping"})),L=0):(clearInterval(C),C=null,y.close(),t.socketReconnet()):(clearInterval(C),C=null)}),5e3))}},components:{DTitle:h["a"],ChatListItem:u["f"]}},k=P,I=(n("5ff5"),n("2877")),E=Object(I["a"])(k,a,i,!1,null,"1f096c97",null);e["default"]=E.exports},c7eb:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));n("a4d3"),n("e01a"),n("d3b7"),n("d28b"),n("3ca3"),n("ddb0"),n("b636"),n("944a"),n("0c47"),n("23dc"),n("d9e2"),n("3410"),n("159b"),n("b0c0"),n("131a"),n("fb6a");var a=n("53ca");function i(){ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ i=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",c=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(E){l=function(t,e,n){return t[e]=n}}function u(t,e,n,a){var i=e&&e.prototype instanceof d?e:d,r=Object.create(i.prototype),o=new P(a||[]);return r._invoke=function(t,e,n){var a="suspendedStart";return function(i,r){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===i)throw r;return I()}for(n.method=i,n.arg=r;;){var o=n.delegate;if(o){var c=_(o,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===a)throw a="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a="executing";var s=h(t,e,n);if("normal"===s.type){if(a=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(a="completed",n.method="throw",n.arg=s.arg)}}}(t,n,o),r}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(E){return{type:"throw",arg:E}}}t.wrap=u;var f={};function d(){}function p(){}function g(){}var v={};l(v,o,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(k([])));m&&m!==e&&n.call(m,o)&&(v=m);var b=g.prototype=d.prototype=Object.create(v);function L(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(r,o,c,s){var l=h(t[r],t,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==Object(a["a"])(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,c,s)}),(function(t){i("throw",t,c,s)})):e.resolve(f).then((function(t){u.value=t,c(u)}),(function(t){return i("throw",t,c,s)}))}s(l.arg)}var r;this._invoke=function(t,n){function a(){return new e((function(e,a){i(t,n,e,a)}))}return r=r?r.then(a,a):a()}}function _(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator["return"]&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var a=h(n,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,f;var i=a.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function k(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function e(){for(;++a=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return a("end");if(r.tryLoc<=this.prev){var c=n.call(r,"catchLoc"),s=n.call(r,"finallyLoc");if(c&&s){if(this.prev=0;--a){var i=this.tryEntries[a];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),x(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var a=n.completion;if("throw"===a.type){var i=a.arg;x(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}}}]);