You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
8.7 KiB
1 line
8.7 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-chat-index"],{"26b1":function(n,t,e){"use strict";var a=e("f36ab"),i=e.n(a);i.a},"3a61":function(n,t,e){"use strict";e.d(t,"b",(function(){return a})),e.d(t,"c",(function(){return i})),e.d(t,"a",(function(){}));var a=function(){var n=this,t=n.$createElement,e=n._self._c||t;return e("v-uni-view",{staticClass:"chat_index_page"},[e("v-uni-view",{staticClass:"page_content padding-bottom-safe"},n._l(n.roomList,(function(t,a){return e("v-uni-view",{key:a,staticClass:"position-relative",on:{click:function(e){arguments[0]=e=n.$handleEvent(e),n.click(t.room_id)}}},[e("v-uni-view",{staticClass:"position-relative flex align-center bg-ff",style:t.style,attrs:{"data-index":a},on:{touchstart:function(t){arguments[0]=t=n.$handleEvent(t),n.touchStart.apply(void 0,arguments)},touchmove:function(t){arguments[0]=t=n.$handleEvent(t),n.touchMove.apply(void 0,arguments)},touchend:function(t){arguments[0]=t=n.$handleEvent(t),n.touchEnd.apply(void 0,arguments)}}},[e("v-uni-view",{staticClass:"width-100p flex align-center"},[e("v-uni-view",{staticClass:"position-relative padding-left-30"},[e("v-uni-image",{staticClass:"jc-image-80 radius-10",attrs:{src:t.to_user_head_img}}),t.unread_number>0?e("v-uni-view",{staticClass:"unread-red-dot"}):n._e()],1),e("v-uni-view",{staticClass:"padding-tb-25 flex-one padding-lr-30 flex flex-direction align-start"},[e("v-uni-view",{staticClass:"width-100p line-height-40 flex align-center justify-between"},[e("v-uni-view",{staticClass:"text-cut-one text-30"},[n._v(n._s(t.to_user_nick_name))]),e("v-uni-view",{staticClass:"text-22 text-98"},[n._v(n._s(t.show_time))])],1),e("v-uni-view",{staticClass:"margin-top-10 line-height-30 text-cut-one text-24 text-98"},[n._v(n._s(t.show_message_text))])],1)],1),e("v-uni-view",{staticClass:"move bg-main text-center text-26 text-ff"},[e("v-uni-view",{on:{click:function(e){e.stopPropagation(),e.preventDefault(),arguments[0]=e=n.$handleEvent(e),n.remove(a,t.room_id)}}},[n._v("删除")])],1)],1),e("v-uni-view",{class:{"border-line":a<n.roomList.length-1}})],1)})),1)],1)},i=[]},"4b34":function(n,t,e){var a=e("24fb");t=a(!1),t.push([n.i,"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* 未读红点 */.unread-red-dot[data-v-4b3051b5]{position:absolute;top:%?-10?%;right:%?-10?%;width:%?18?%;height:%?18?%;border-radius:50%;background-color:var(--main)}\n/* 分割线 */.border-line[data-v-4b3051b5]{position:absolute;bottom:0;right:0;width:calc(100vw - %?30?% - %?80?% - %?10?%);height:%?2?%;background-color:#ededed}\n/* 删除按钮 */.move[data-v-4b3051b5]{position:absolute;top:0;right:%?-100?%;width:%?100?%;height:%?130?%;line-height:%?130?%}",""]),n.exports=t},9680:function(n,t,e){"use strict";(function(n){e("7a82");var a=e("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,e("d3b7"),e("159b"),e("a434"),e("3c65"),e("14d9");var i=a(e("798d")),o={curPage:3,curRoomId:"",that:{},listChatRoom:function(){return new Promise((function(n,t){i.default.getData("chat/api/FriendsChat/listChatRoom").then((function(t){n(t)})).catch((function(n){t(n)}))}))},bindUser:function(n,t){return new Promise((function(e,a){i.default.getData("chat/api/FriendsChat/bindUser",{room_id:n,client_id:t}).then((function(n){e(n)})).catch((function(n){a(n)}))}))},getChatRoomDetail:function(n){return new Promise((function(t,e){i.default.getData("chat/api/FriendsChat/getChatRoomDetail",{room_id:n}).then((function(n){t(n)})).catch((function(n){e(n)}))}))},updateUserOnlineStatus:function(n,t){return new Promise((function(e,a){i.default.getData("chat/api/FriendsChat/updateUserOnlineStatus",{room_id:n,is_online:t}).then((function(n){e(n)})).catch((function(n){a(n)}))}))},listChatRoomMessage:function(n,t,e,a){return new Promise((function(o,s){i.default.getUpList("chat/api/FriendsChat/listChatRoomMessage",{room_id:n,cur_first_message_id:t},{that:a,first_page:e}).then((function(n){o(n)})).catch((function(n){s(n)}))}))},insertChatMessage:function(n,t,e){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o={room_id:n,type:t,content:e};return 2==t&&(o.record_seconds=a.recordSeconds),4==t&&(o.name=a.name,o.address=a.address,o.lat=a.lat,o.lng=a.lng),new Promise((function(n,t){i.default.getData("chat/api/FriendsChat/insertChatMessage",o).then((function(t){n(t)})).catch((function(n){t(n)}))}))},onMessage:function(){var t=this;uni.onSocketMessage((function(e){var a=JSON.parse(e.data);switch(n("log","onSocketMessage",a," at pages/chat/api/chat.js:149"),a.type){case"init":i.default.getData("chat/api/FriendsChat/bindUser",{client_id:a.to_client}).then((function(n){}));break;case"heart_beat":break;case"chat_friend_message":switch(t.curPage){case 1:var o=t.that.roomList,s={},r=!1;o.forEach((function(n,t){n.room_id==a.to_group&&(r=!0,s=n,s.unread_number=n.unread_number+1,s.last_message_type=a.data.type,s.show_message_text=a.data.show_message_text,s.show_time=a.data.list_time_show,o.splice(t,1))})),r||(s.room_id=a.data.room_id,s.to_user_id=a.data.to_user_id,s.to_user_nick_name=a.data.to_user_nick_name,s.to_user_head_img=a.data.to_user_head_img,s.unread_number=1,s.last_message_type=a.data.type,s.show_message_text=a.data.show_message_text,s.show_time=a.data.list_time_show),o.unshift(s),t.that.roomList=o;break;case 2:a.to_group==t.curRoomId&&(delete a.data.show_message_text,delete a.data.list_time_show,delete a.data.to_user_nick_name,delete a.data.to_user_head_img,t.that.up_list.push(a.data),setTimeout((function(){t.that.scrollToId="scroll"+a.data.id}),100));break;case 3:break;default:break}break;default:break}}))}},s=o;t.default=s}).call(this,e("0de9")["log"])},b1a6:function(n,t,e){"use strict";e.r(t);var a=e("3a61"),i=e("beeb");for(var o in i)["default"].indexOf(o)<0&&function(n){e.d(t,n,(function(){return i[n]}))}(o);e("26b1");var s=e("f0c5"),r=Object(s["a"])(i["default"],a["b"],a["c"],!1,null,"4b3051b5",null,!1,a["a"],void 0);t["default"]=r.exports},beeb:function(n,t,e){"use strict";e.r(t);var a=e("ed2e"),i=e.n(a);for(var o in a)["default"].indexOf(o)<0&&function(n){e.d(t,n,(function(){return a[n]}))}(o);t["default"]=i.a},ed2e:function(n,t,e){"use strict";(function(n){e("7a82");var a=e("4ea4").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,e("d3b7"),e("159b"),e("a434");var i=a(e("9680")),o={data:function(){return{roomList:[],touchStartX:0,touchEndX:0}},onReady:function(){},onShow:function(){var t=this;i.default.curPage=1,i.default.that=this,n("log","列表页 websocket是否打开",this.websocket.isSocketOpen," at pages/chat/index.vue:70"),this.websocket.isSocketOpen?this.listChatRoom():(this.websocket.init().then((function(n){t.listChatRoom()})),i.default.onMessage())},onUnload:function(){i.default.curPage=3,i.default.that={}},methods:{click:function(n){this.resetAll(),uni.navigateTo({url:"/pages/chat/message?room_id="+n})},touchStart:function(n){this.touchStartX=n.touches[0].pageX,this.touchEndX=n.touches[0].pageX},touchMove:function(n){this.touchEndX=n.touches[0].pageX;var t=n.currentTarget.dataset.index,e=this.touchStartX-this.touchEndX;if(e>5){this.resetAll();var a=this.cn.px2rpx(e)<100?this.cn.px2rpx(e):100;this.roomList[t].style="left: -"+a+"rpx;"}else{if(0==this.roomList[t].is_moving)return!1;var i=this.cn.px2rpx(-e)<100?this.cn.px2rpx(-e)-100:0;this.roomList[t].style="left: "+i+"rpx;"}},touchEnd:function(n){var t=n.currentTarget.dataset.index,e=this.touchStartX-this.touchEndX;e>0?e>50?(this.roomList[t].is_moving=1,this.roomList[t].style="left: -100rpx;"):this.resetAll():e<0&&this.resetAll()},resetAll:function(){var n=this.roomList;n.forEach((function(n,t){n.style&&(n.style="",n.is_moving=0)})),this.roomList=n},remove:function(n,t){var e=this;this.cn.confirm("是否确定删除?").then((function(n){n.confirm&&e.rq.getData("chat/api/FriendsChat/deleteChatRoom",{room_id:t}).then((function(n){if(0==n.code){var a=e.roomList;a.forEach((function(n,e){n.room_id==t&&a.splice(e,1)})),e.roomList=a}}))}))},listChatRoom:function(){var n=this;i.default.listChatRoom().then((function(t){var e=t.data.room_list;e.forEach((function(n,t){n.hasOwnProperty("style")||(n.style="",n.is_moving=0)})),n.roomList=t.data.room_list}))}}};t.default=o}).call(this,e("0de9")["log"])},f36ab:function(n,t,e){var a=e("4b34");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[n.i,a,""]]),a.locals&&(n.exports=a.locals);var i=e("4f06").default;i("426ef88a",a,!0,{sourceMap:!1,shadowMode:!1})}}]); |