diff --git a/miniprogram_npm/dayjs/index.js b/miniprogram_npm/dayjs/index.js index 3fa8603..1cf4e5e 100644 --- a/miniprogram_npm/dayjs/index.js +++ b/miniprogram_npm/dayjs/index.js @@ -4,10 +4,10 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; -__DEFINE__(1731653753936, function(require, module, exports) { +__DEFINE__(1732151585865, function(require, module, exports) { !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t) item.isRoom).length, }) }, + 'footerList.**': function (footerList) { + const footerListTemplate = [...footerList]; + footerListTemplate[3].show = !footerListTemplate[6].active + this.setData({ + footerList: footerListTemplate + }) + }, 'isClicked': function (isClicked) { if (isClicked) { let timer = setTimeout(() => { @@ -99,6 +121,8 @@ Page({ channelId: option.roomNum, user: await getStorage('user') }) + }, + async onReady() { await this.joinChannel() await this.getRoomUser() await this.getShowUser() @@ -117,6 +141,7 @@ Page({ noViewChatList: this.data.noViewChatList += 1 }) } + item.timestamp = dayjs(item.timestamp).format('HH:mm:ss') this.setData({ chatList: [...this.data.chatList, item] }) @@ -128,12 +153,12 @@ Page({ // 全员离开房间 case 'AllLeave': this.message('管理员已结束会议!').success() - this.back() + wx.navigateBack() break; // 移出会议 case 'ForceExitRoom': this.message('管理员已将你移出会议!').success() - this.back() + wx.navigateBack() break; // 更新视图模式 case 'RefreshView': @@ -498,9 +523,6 @@ Page({ case '翻转': await this.getUserRoomInfo().then(async (res) => { if (res) { - this.setData({ - devicePosition: !this.data.devicePosition - }) wx.createLivePusherContext().switchCamera() } else { this.message('暂无权限').error(); @@ -552,13 +574,13 @@ Page({ this.message('操作成功').success() } }, - closeDialog(e) { + async closeDialog(e) { const { type } = e.currentTarget.dataset; switch (e.type) { case "confirm": switch (type) { case "applySpeakDialog": - GetApplySpeak(this.data.channelId).then(res => { + await GetApplySpeak(this.data.channelId).then(res => { if (res.code === 200) { this.setData({ isClicked: true, @@ -568,6 +590,9 @@ Page({ } }) break; + case "leaveDialog": + wx.navigateBack() + break; } break; case "cancel": @@ -639,8 +664,10 @@ Page({ } }); }, - back() { - wx.navigateBack() + async back() { + this.setData({ + leaveDialog: true + }) }, onVisibleChange() { this.setData({ @@ -653,18 +680,28 @@ Page({ messageStr: e.detail.value }) }, - async sendMeg() { - await onInvoke('sendChannelMsg', { - roomNum: this.data.channelId, - msg: this.data.messageStr - }) + async sendMeg(e) { + if (this.data.messageStr || e.target.dataset.item) { + await onInvoke('sendChannelMsg', { + roomNum: this.data.channelId, + msg: e.target.dataset.item || this.data.messageStr + }) + this.setData({ + chatList: [...this.data.chatList, { + userName: this.data.user.userName, + message: e.target.dataset.item || this.data.messageStr, + timestamp: dayjs(+new Date()).format('HH:mm:ss'), + me: true + }], + messageStr: '' + }) + } else { + this.message('请输入文字!').error() + } + }, + changeFullscreen() { this.setData({ - chatList: [...this.data.chatList, { - userName: this.data.user.userName, - message: this.data.messageStr, - me: true - }], - messageStr: '' + isFullscreen: !this.data.isFullscreen }) } }) \ No newline at end of file diff --git a/pages/meeting/index.wxml b/pages/meeting/index.wxml index 38c1925..ece14ef 100644 --- a/pages/meeting/index.wxml +++ b/pages/meeting/index.wxml @@ -1,18 +1,22 @@ - + - + {{currentUser.avatarName}} + + + + - + @@ -23,14 +27,16 @@ {{currentUser.userName}} - - + + - - {{item.avatarName}} + + + {{item.avatarName}} + - - + + @@ -47,12 +53,12 @@ - + - + {{item.title}}({{userNumer}}) - {{item.title}}({{devicePosition ? '前置' : '后置'}}) + {{item.title}} {{item.title}}{{noViewChatList ? '('+noViewChatList+')' : '' }} {{item.active ? item.title : item.titleActive}} @@ -65,31 +71,45 @@ + + + 聊天 + {{item.avatarName}} {{item.userName}} - - + + + + 聊天 + - {{item.me ? item.message : item.userName}} - - {{item.me ? item.userName : item.message}} + ({{item.timestamp}}) + {{item.me ? item.message : item.userName}} + + {{item.me ? item.userName : item.message}} + ({{item.timestamp}}) + + + + + {{item}} - + 发送 diff --git a/project.private.config.json b/project.private.config.json index 7fc66f3..d03c56f 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -4,5 +4,6 @@ "setting": { "compileHotReLoad": true, "urlCheck": true - } + }, + "libVersion": "3.6.5" } \ No newline at end of file diff --git a/utils/agora.ts b/utils/agora.ts index e0000e9..f3e1917 100644 --- a/utils/agora.ts +++ b/utils/agora.ts @@ -17,6 +17,7 @@ export const agora = { // 销毁 destroy: async () => { if (client) { + await client.leave() await client.destroy() client = ''; } @@ -46,6 +47,7 @@ export const agora = { agora.setRole(false) }) }, + // 监听 clientEvent: ({ streamAdded, streamRemoved }) => { client.on("stream-added", async e => { await agora.subscribe(e.uid, (url: string, uid: number | string) => { @@ -56,14 +58,17 @@ export const agora = { streamRemoved(e.uid) }); }, + // 订阅远端音视频流 subscribe: async (uid: number | string, callBack: Function) => { const { url, rotation } = await client.subscribe(uid) callBack(url, uid) }, + // 停止发送本地音视频流 muteLocal: async (target: string) => { - client.muteLocal(target) + await client.muteLocal(target) }, + // 恢复发送本地音视频流 unmuteLocal: async (target: string) => { - client.unmuteLocal(target) + await client.unmuteLocal(target) }, } \ No newline at end of file