1 line
17 KiB
JavaScript
1 line
17 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-index-history"],{"0ed4":function(e,t,n){"use strict";n.r(t);var a=n("400a"),i=n.n(a);for(var r in a)["default"].indexOf(r)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(r);t["default"]=i.a},1130:function(e,t,n){"use strict";n.r(t);var a=n("70af"),i=n("dd9f");for(var r in i)["default"].indexOf(r)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(r);n("1b78");var s=n("f0c5"),o=Object(s["a"])(i["default"],a["b"],a["c"],!1,null,"3bfce485",null,!1,a["a"],void 0);t["default"]=o.exports},"18df":function(e,t,n){"use strict";n("7a82");var a=n("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=a(n("53ca"));n("e9c4"),n("99af"),n("14d9");var r=a(n("81b7")),s=a(n("1f61")),o=a(n("3242")),u=getApp(),c={data:function(){return{title:"Hello",baseUrl:getApp().globalData.baseUrl,wsBaseUrl:getApp().globalData.wsBaseUrl,visitors:[],token:"",kefu:null,timer:null,wsOpen:!1,noticeContent:"通知: 无",avatarList:[{url:"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"},{url:"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"},{url:"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png"}],visitor_name:"",visitor_message:"",entTags:[],visitorTag:null,page:1,total:0,pageSize:10,showSearch:!1}},onShow:function(){var e=uni.getStorageSync("app");e&&(this.token=e.token);var t=uni.getStorageSync("domain");t&&(this.baseUrl=t.domain,this.wsBaseUrl=r.default.getWsUrl(t.domain)),this.checkAuth(),this.getTags()},onLoad:function(e){e.client_ip&&(this.visitor_name=e.client_ip)},onPullDownRefresh:function(){console.log("refresh"),this.getNewOnlineUser(1,!0),setTimeout((function(){uni.stopPullDownRefresh()}),1e3)},methods:{initSocket:function(){u.globalData.socketObj?u.globalData.socketObj.isConnect||u.globalData.socketObj.initSocket():(u.globalData.socketObj=new o.default(this.wsBaseUrl+"?token="+this.token,60),u.globalData.socketObj.initSocket())},kefuInfo:function(){var e=this;uni.request({url:e.baseUrl+"/kefu/kefuinfo?token="+e.token,method:"get",header:{"Content-Type":"application/x-www-form-urlencoded"},success:function(t){e.kefu=t.data.result,e.getNewOnlineUser(e.page,!0)}})},onlineIntime:function(){var e=this,t=this,n=null;uni.connectSocket({url:this.wsBaseUrl+"?token="+this.token}),uni.onSocketClose((function(e){clearInterval(n),console.log("WebSocket 连接断开")})),uni.onSocketOpen((function(e){console.log("WebSocket 连接已打开");var t={type:"ping",data:""};n=setInterval((function(){uni.sendSocketMessage({data:JSON.stringify(t)})}),5e3)})),uni.onSocketMessage((function(n){var a=JSON.parse(n.data);switch(a.type){case"userOnline":r.default.playVoice(),t.showNoticeBar(a.data.username+"来了");break;case"userOffline":t.showNoticeBar(a.data.name+"离线");break;case"message":e.recvMessage(a.data);break}}))},recvMessage:function(e){this.visitors=s.default.receiveMessage(this.visitors,e),this.showNoticeBar(e.name+":"+e.content),"yes"!=e.is_kefu&&r.default.playVoice()},getNewOnlineUser:function(e,t){var n=this,a=this.baseUrl,i={page:e,pagesize:15,token:n.token,kefuName:"3"==n.kefu.role_id?n.kefu.name:"",visitorName:n.visitor_name,visitorMessage:n.visitor_message,visitorTag:n.visitorTag};uni.request({url:a+"/kefu/visitorList",method:"GET",data:i,success:function(e){if(e.data.result.list){n.total=e.data.result.count,n.pageSize=e.data.result.pagesize,t&&(n.visitors=[]);for(var a=e.data.result.list,i=0;i<a.length;i++)a[i].avator=r.default.getImageUrl(a[i].avator,n.baseUrl),a[i].last_message=r.default.replaceHtml(a[i].last_message).substr(0,26);0==n.visitors.length?n.visitors=a:n.visitors=n.visitors.concat(n.visitors,a),n.visitors=n.removeRepeat(n.visitors)}}})},changePage:function(e){(e.type="next")&&this.page++,(e.type="prev")&&this.page--,(e.type="current")&&(this.page=e.current),this.getNewOnlineUser(this.page,!0)},chatVisitor:function(e,t){uni.navigateTo({url:"/pages/index/detail?visitor_id="+t})},showNoticeBar:function(e){this.noticeContent=e},checkAuth:function(){var e=this;uni.request({url:e.baseUrl+"/uc/v1/refreshToken?token="+e.token,method:"POST",header:{"Content-Type":"application/x-www-form-urlencoded"},success:function(t){var n=t.data.code;2e4!=n?uni.navigateTo({url:"/pages/index/login"}):(uni.setStorageSync("app",{token:t.data.result.token}),e.token=t.data.result.token,e.initSocket(),e.kefuInfo())}})},removeRepeat:function(e){for(var t,n=0,a=e.length,r={},s=[];n<a;n++)t=e[n].id,t=(0,i.default)(t)+t,r[t]||(r[t]=1,s.push(e[n]));return s},showLastMessage:function(e){return""==e?"无消息":(e=r.default.replaceHtml(e),e)},formatTime:function(e,t){e=Math.round(new Date(e).getTime()/1e3);return r.default.beautifyTime(e)},getTags:function(){var e=this;e.entTags=[],e.visitorTag=null,uni.request({url:this.baseUrl+"/kefu/tags?token="+e.token,method:"GET",success:function(t){var n=t.data.result;for(var a in n){var i={text:n[a].name,value:n[a].id};e.entTags.push(i)}}})},changeTag:function(e){var t=null;e.detail.value[0]&&(t=e.detail.value[0].value),this.visitorTag=t,this.getNewOnlineUser(1,!0)}}};t.default=c},"1b78":function(e,t,n){"use strict";var a=n("8d76"),i=n.n(a);i.a},"1edc":function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,'@charset "UTF-8";\r\n/**\r\n * 这里是uni-app内置的常用样式变量\r\n *\r\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\r\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\r\n *\r\n */\r\n/**\r\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\r\n *\r\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\r\n */\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */\r\n/* 文字基本颜色 */\r\n/* 背景颜色 */\r\n/* 边框颜色 */\r\n/* 尺寸变量 */\r\n/* 文字尺寸 */\r\n/* 图片尺寸 */\r\n/* Border Radius */\r\n/* 水平间距 */\r\n/* 垂直间距 */\r\n/* 透明度 */\r\n/* 文章场景相关 */.uni-pagination[data-v-8af2fadc]{display:flex;position:relative;overflow:hidden;flex-direction:row;justify-content:center;align-items:center}.uni-pagination__total[data-v-8af2fadc]{font-size:14px;color:#999;margin-right:15px}.uni-pagination__btn[data-v-8af2fadc]{display:flex;cursor:pointer;padding:0 8px;line-height:30px;font-size:12px;position:relative;background-color:#f0f0f0;flex-direction:row;justify-content:center;align-items:center;text-align:center;border-radius:5px}.uni-pagination__child-btn[data-v-8af2fadc]{display:flex;font-size:12px;position:relative;flex-direction:row;justify-content:center;align-items:center;text-align:center;color:#666;font-size:12px}.uni-pagination__num[data-v-8af2fadc]{display:flex;flex:1;flex-direction:row;justify-content:center;align-items:center;height:30px;line-height:30px;font-size:12px;color:#666;margin:0 5px}.uni-pagination__num-tag[data-v-8af2fadc]{cursor:pointer;min-width:30px;margin:0 5px;height:30px;text-align:center;line-height:30px;color:#999;border-radius:4px}.uni-pagination__num-current[data-v-8af2fadc]{display:flex;flex-direction:row}.uni-pagination__num-current-text[data-v-8af2fadc]{font-size:15px}.uni-pagination--enabled[data-v-8af2fadc]{color:#333;opacity:1}.uni-pagination--disabled[data-v-8af2fadc]{opacity:.5;cursor:default}.uni-pagination--hover[data-v-8af2fadc]{color:rgba(0,0,0,.6);background-color:#eee}.tag--active[data-v-8af2fadc]:hover{color:#2979ff}.page--active[data-v-8af2fadc]{color:#fff;background-color:#2979ff}.page--active[data-v-8af2fadc]:hover{color:#fff}.is-pc-hide[data-v-8af2fadc]{display:block}.is-phone-hide[data-v-8af2fadc]{display:none}@media screen and (min-width:450px){.is-pc-hide[data-v-8af2fadc]{display:none}.is-phone-hide[data-v-8af2fadc]{display:block}.uni-pagination__num-flex-none[data-v-8af2fadc]{flex:none}}',""]),e.exports=t},"2ffe":function(e,t,n){"use strict";var a=n("c045"),i=n.n(a);i.a},"3cdc":function(e){e.exports=JSON.parse('{"uni-pagination.prevText":"précédente","uni-pagination.nextText":"suivante"}')},"3df7":function(e){e.exports=JSON.parse('{"uni-pagination.prevText":"anterior","uni-pagination.nextText":"próxima"}')},"400a":function(e,t,n){"use strict";n("7a82");var a=n("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n("a9e3"),n("14d9"),n("d3b7"),n("e25e");var i=n("37dc"),r=a(n("4feb")),s=(0,i.initVueI18n)(r.default),o=s.t,u={name:"UniPagination",emits:["update:modelValue","input","change"],props:{value:{type:[Number,String],default:1},modelValue:{type:[Number,String],default:1},prevText:{type:String},nextText:{type:String},current:{type:[Number,String],default:1},total:{type:[Number,String],default:0},pageSize:{type:[Number,String],default:10},showIcon:{type:[Boolean,String],default:!1},pagerCount:{type:Number,default:7}},data:function(){return{currentIndex:1,paperData:[]}},computed:{prevPageText:function(){return this.prevText||o("uni-pagination.prevText")},nextPageText:function(){return this.nextText||o("uni-pagination.nextText")},maxPage:function(){var e=1,t=Number(this.total),n=Number(this.pageSize);return t&&n&&(e=Math.ceil(t/n)),e},paper:function(){for(var e=this.currentIndex,t=this.pagerCount,n=this.total,a=this.pageSize,i=[],r=[],s=Math.ceil(n/a),o=0;o<s;o++)i.push(o+1);r.push(1);var u=i[i.length-(t+1)/2];return i.forEach((function(n,a){(t+1)/2>=e?n<t+1&&n>1&&r.push(n):e+2<=u?n>e-(t+1)/2&&n<e+(t+1)/2&&r.push(n):(n>e-(t+1)/2||s-t<n)&&n<i[i.length-1]&&r.push(n)})),s>t?((t+1)/2>=e?r[r.length-1]="...":e+2<=u?(r[1]="...",r[r.length-1]="..."):r[1]="...",r.push(i[i.length-1])):(t+1)/2>=e||e+2<=u||(r.shift(),r.push(i[i.length-1])),r}},watch:{current:{immediate:!0,handler:function(e,t){this.currentIndex=e<1?1:e}},value:{immediate:!0,handler:function(e){1===Number(this.current)&&(this.currentIndex=e<1?1:e)}}},methods:{selectPage:function(e,t){if(parseInt(e))this.currentIndex=e,this.change("current");else{var n=Math.ceil(this.total/this.pageSize);if(t<=1)return void(this.currentIndex-5>1?this.currentIndex-=5:this.currentIndex=1);if(t>=6)return void(this.currentIndex+5>n?this.currentIndex=n:this.currentIndex+=5)}},clickLeft:function(){1!==Number(this.currentIndex)&&(this.currentIndex-=1,this.change("prev"))},clickRight:function(){Number(this.currentIndex)>=this.maxPage||(this.currentIndex+=1,this.change("next"))},change:function(e){this.$emit("input",this.currentIndex),this.$emit("update:modelValue",this.currentIndex),this.$emit("change",{type:e,current:this.currentIndex})}}};t.default=u},"4feb":function(e,t,n){"use strict";n("7a82");var a=n("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=a(n("bc89")),r=a(n("3df7")),s=a(n("3cdc")),o=a(n("e18a")),u=a(n("e27e")),c={en:i.default,es:r.default,fr:s.default,"zh-Hans":o.default,"zh-Hant":u.default};t.default=c},"538e":function(e,t,n){"use strict";n.r(t);var a=n("89b6"),i=n("0ed4");for(var r in i)["default"].indexOf(r)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(r);n("2ffe");var s=n("f0c5"),o=Object(s["a"])(i["default"],a["b"],a["c"],!1,null,"8af2fadc",null,!1,a["a"],void 0);t["default"]=o.exports},"70af":function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return a}));var a={uniDataPicker:n("dc89").default,uniList:n("99b2").default,uniListChat:n("3764").default,uniPagination:n("538e").default},i=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("v-uni-view",{staticClass:"content"},[a("v-uni-view",{staticStyle:{background:"#fff",padding:"10px"}},[a("v-uni-input",{staticClass:"searchArea",staticStyle:{padding:"5px 0"},attrs:{clearable:!0,placeholder:"搜索名称/visitorId/IP"},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),1==e.showSearch?e.showSearch=!1:e.showSearch=!0},input:function(t){arguments[0]=t=e.$handleEvent(t),e.getNewOnlineUser(1,!0)}},model:{value:e.visitor_name,callback:function(t){e.visitor_name=t},expression:"visitor_name"}}),a("v-uni-input",{directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],staticClass:"searchArea",staticStyle:{"margin-top":"5px",padding:"5px 0"},attrs:{clearable:!0,"confirm-type":"search",placeholder:"搜索消息内容"},on:{confirm:function(t){arguments[0]=t=e.$handleEvent(t),e.getNewOnlineUser(1,!0)}},model:{value:e.visitor_message,callback:function(t){e.visitor_message=t},expression:"visitor_message"}}),a("uni-data-picker",{directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],staticClass:"mt-10",staticStyle:{background:"#fff"},attrs:{localdata:e.entTags,"popup-title":"请选择标签"},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.changeTag.apply(void 0,arguments)}}})],1),a("v-uni-view",{directives:[{name:"show",rawName:"v-show",value:0!=e.visitors.length,expression:"visitors.length!=0"}]},[a("uni-list",{attrs:{border:!0}},e._l(e.visitors,(function(t){return a("uni-list-chat",{key:t.visitor_id,attrs:{"avatar-circle":!0,clickable:!0,title:t.username,avatar:t.avator,note:e.showLastMessage(t.last_message),time:e.formatTime(t.updated_at),"badge-positon":"left","badge-text":t.unread_num},on:{click:function(n){arguments[0]=n=e.$handleEvent(n),e.chatVisitor(n,t.visitor_id)}}})})),1)],1),a("uni-pagination",{directives:[{name:"show",rawName:"v-show",value:0!=e.visitors.length,expression:"visitors.length!=0"}],staticClass:"m10 mb20",attrs:{total:e.total,pageSize:e.pageSize},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.changePage.apply(void 0,arguments)}}}),0==e.visitors.length?a("v-uni-view",{staticClass:"flyNotice"},[a("v-uni-view",[a("v-uni-image",{staticStyle:{width:"135px",height:"132px"},attrs:{src:n("dac7")}})],1),a("v-uni-view",{staticStyle:{color:"#333"}},[e._v("暂无历史访客")]),a("v-uni-view",[e._v("没有历史访客列表,休息一下吧")])],1):e._e()],1)},r=[]},"7b80":function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,"uni-page-body[data-v-3bfce485]{background-color:#eef0f6}body.?%PAGE?%[data-v-3bfce485]{background-color:#eef0f6}",""]),e.exports=t},"89b6":function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return a}));var a={uniIcons:n("416b").default},i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{staticClass:"uni-pagination"},[n("v-uni-view",{staticClass:"uni-pagination__total is-phone-hide"},[e._v("共 "+e._s(e.total)+" 条")]),n("v-uni-view",{staticClass:"uni-pagination__btn",class:1===e.currentIndex?"uni-pagination--disabled":"uni-pagination--enabled",attrs:{"hover-class":1===e.currentIndex?"":"uni-pagination--hover","hover-start-time":20,"hover-stay-time":70},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.clickLeft.apply(void 0,arguments)}}},[!0===e.showIcon||"true"===e.showIcon?[n("uni-icons",{attrs:{color:"#666",size:"16",type:"left"}})]:[n("v-uni-text",{staticClass:"uni-pagination__child-btn"},[e._v(e._s(e.prevPageText))])]],2),n("v-uni-view",{staticClass:"uni-pagination__num uni-pagination__num-flex-none"},[n("v-uni-view",{staticClass:"uni-pagination__num-current"},[n("v-uni-text",{staticClass:"uni-pagination__num-current-text is-pc-hide",staticStyle:{color:"#409EFF"}},[e._v(e._s(e.currentIndex))]),n("v-uni-text",{staticClass:"uni-pagination__num-current-text is-pc-hide"},[e._v("/"+e._s(e.maxPage||0))]),e._l(e.paper,(function(t,a){return n("v-uni-view",{key:a,staticClass:"uni-pagination__num-tag tag--active is-phone-hide",class:{"page--active":t===e.currentIndex},on:{click:function(n){if(!n.type.indexOf("key")&&e._k(n.keyCode,"top",void 0,n.key,void 0))return null;arguments[0]=n=e.$handleEvent(n),e.selectPage(t,a)}}},[n("v-uni-text",[e._v(e._s(t))])],1)}))],2)],1),n("v-uni-view",{staticClass:"uni-pagination__btn",class:e.currentIndex>=e.maxPage?"uni-pagination--disabled":"uni-pagination--enabled",attrs:{"hover-class":e.currentIndex===e.maxPage?"":"uni-pagination--hover","hover-start-time":20,"hover-stay-time":70},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.clickRight.apply(void 0,arguments)}}},[!0===e.showIcon||"true"===e.showIcon?[n("uni-icons",{attrs:{color:"#666",size:"16",type:"right"}})]:[n("v-uni-text",{staticClass:"uni-pagination__child-btn"},[e._v(e._s(e.nextPageText))])]],2)],1)},r=[]},"8d76":function(e,t,n){var a=n("7b80");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var i=n("4f06").default;i("1b7644dc",a,!0,{sourceMap:!1,shadowMode:!1})},bc89:function(e){e.exports=JSON.parse('{"uni-pagination.prevText":"prev","uni-pagination.nextText":"next"}')},c045:function(e,t,n){var a=n("1edc");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var i=n("4f06").default;i("78b8b53a",a,!0,{sourceMap:!1,shadowMode:!1})},dd9f:function(e,t,n){"use strict";n.r(t);var a=n("18df"),i=n.n(a);for(var r in a)["default"].indexOf(r)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(r);t["default"]=i.a},e18a:function(e){e.exports=JSON.parse('{"uni-pagination.prevText":"上一页","uni-pagination.nextText":"下一页"}')},e27e:function(e){e.exports=JSON.parse('{"uni-pagination.prevText":"上一頁","uni-pagination.nextText":"下一頁"}')}}]); |