diff --git a/miniprogram/app.json b/miniprogram/app.json index ba16689..06cdb34 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -12,20 +12,7 @@ "pages/live/registration/registration", "pages/live/red-history/red-history", "pages/live/report/report", - "pages/common/red/red", - "pages/live/room/room", - "pages/live/h5Room/index", - "pages/live/wxroom/index" - ], - "subPackages": [ - { - "root": "package-live", - "pages": [ - "wxroom/index", - "login/login", - "red-history/red-history" - ] - } + "pages/common/red/red" ], "tabBar": { "custom": true, diff --git a/miniprogram/app.ts b/miniprogram/app.ts index 5ffdd8c..e180283 100644 --- a/miniprogram/app.ts +++ b/miniprogram/app.ts @@ -1,36 +1,55 @@ // app.ts -import { startSSE, stopSSE } from './utils/server-sent-events' import { checkUpdate } from './utils/updateManager' import { BASE_URL } from './env' -// @ts-ignore -const systemInfo = wx.getWindowInfo(); // 域名包含 .test. 则为测试环境,不拦截登录 const isTestDomain = (): boolean => BASE_URL.includes('.test.'); -// 判断是否在 PC/Windows 环境运行 +// 判断是否在 PC/Mac 环境运行 const isPCEnvironment = (): boolean => { const sysInfo = wx.getSystemInfoSync(); return ['windows', 'mac'].includes(sysInfo.platform); }; + +// 需要随登录态一起清理的 storage key +const LOGIN_STORAGE_KEYS = [ + 'mbuId', 'userName', 'openId', 'unionId', 'addressId', 'defualtAddress' +] as const; + +// 获取安全区域信息(延迟初始化,避免模块加载时调用 wx API) +function getSafeArea() { + // @ts-ignore + const info = wx.getWindowInfo(); + return { + safeBottom: info.safeArea.bottom - info.safeArea.height, + safeTop: info.safeArea.top * 2, + }; +} + export { }; + App({ globalData: { - isLogin: false, // - wasLogin: false, // 之前是否登录过,用来判断是不是 登录状态失效 - safeBottom: systemInfo.safeArea.bottom - systemInfo.safeArea.height, - safeTop: systemInfo.safeArea.top * 2, + isLogin: false, + wasLogin: false, + safeBottom: 0, + safeTop: 0, store: {}, - joinedArray: [], //加入的频道,加入了就不会重复加入 + joinedArray: [], sseStore: { chat: [], system: [], product: [] }, - isModalShowing: false, //防止有多个登录弹窗打开 + isModalShowing: false, }, async onLaunch(props: any) { - // 非测试环境在 PC 端打开时提示无法使用 + // 初始化安全区域 + const { safeBottom, safeTop } = getSafeArea(); + this.globalData.safeBottom = safeBottom; + this.globalData.safeTop = safeTop; + + // PC/Mac 环境拦截(测试域名不拦截) if (!isTestDomain() && isPCEnvironment()) { wx.showModal({ title: "提示", @@ -41,43 +60,38 @@ App({ return; } - wx.removeStorageSync("state"); - if (props.query.state) { - wx.setStorageSync("state", props.query.state) + // 处理 OAuth state + const state = props.query?.state; + if (state) { + wx.setStorageSync('state', state); } else { - wx.removeStorageSync("state") + wx.removeStorageSync('state'); } + // 检查小程序版本更新 checkUpdate(); - this.checkLoginState(); - startSSE(); }, onHide() { - stopSSE(); }, checkLoginState() { - const openId = wx.getStorageSync("openId"); - const unionId = wx.getStorageSync("unionId"); - const userId = wx.getStorageSync("userId"); + const openId = wx.getStorageSync('openId'); + const unionId = wx.getStorageSync('unionId'); + const userId = wx.getStorageSync('userId'); - const ok = openId && unionId && userId; + const isLoggedIn = !!(openId && unionId && userId); - if (!ok) { - // 清理 - wx.removeStorageSync("mbuId"); - wx.removeStorageSync("userName"); - wx.removeStorageSync("openId"); - wx.removeStorageSync("unionId"); - wx.removeStorageSync("addressId"); - wx.removeStorageSync("defualtAddress"); + if (!isLoggedIn) { + // 清理登录相关缓存 + LOGIN_STORAGE_KEYS.forEach(key => wx.removeStorageSync(key)); } - // 保存上一次的登录状态,用来判断是否从 已登录 变成 未登录 + // 记录上一次登录状态,用于判断是否从已登录变为未登录 const prev = this.globalData.isLogin; - this.globalData.isLogin = !!ok; + this.globalData.isLogin = isLoggedIn; this.globalData.wasLogin = prev; - return this.globalData.isLogin; + + return isLoggedIn; }, login(value: string) { if (!this.checkLoginState()) { @@ -87,35 +101,35 @@ App({ return true; }, redirectLogin() { - if (!this.checkLoginState()) { - //已有modal在展示,就不展示了 - if (this.globalData.isModalShowing) { - return false; - } - - this.globalData.isModalShowing = true; - - const content = this.globalData.wasLogin - ? "登录状态失效,请重新登录!" - : "请登录获取完整服务!"; - - wx.showModal({ - title: "登录提示", - content, - confirmText: "去登录", - success: (options) => { - if (options.confirm) { - wx.navigateTo({ url: "/pages/login/login" }); - } - }, - complete: () => { - this.globalData.isModalShowing = false; - } - }); + if (this.checkLoginState()) { + return true; + } + // 已有 modal 在展示,避免重复弹窗 + if (this.globalData.isModalShowing) { return false; } - return true; + this.globalData.isModalShowing = true; + + const content = this.globalData.wasLogin + ? '登录状态失效,请重新登录!' + : '请登录获取完整服务!'; + + wx.showModal({ + title: '登录提示', + content, + confirmText: '去登录', + success: (options) => { + if (options.confirm) { + wx.navigateTo({ url: '/pages/login/login' }); + } + }, + complete: () => { + this.globalData.isModalShowing = false; + } + }); + + return false; } }); diff --git a/miniprogram/package-live/login/login.json b/miniprogram/package-live/login/login.json deleted file mode 100644 index 66cea29..0000000 --- a/miniprogram/package-live/login/login.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "backgroundTextStyle": "light", - "backgroundColor": "#ffffff", - "navigationBarShareAppMessage": false, - "navigationBarShareTimeline": false, - "usingComponents": { - "popup": "/components/popup/popup", - "navigation-bar": "/components/navigation-bar/navigation-bar" - } -} diff --git a/miniprogram/package-live/login/login.scss b/miniprogram/package-live/login/login.scss deleted file mode 100644 index fe422ad..0000000 --- a/miniprogram/package-live/login/login.scss +++ /dev/null @@ -1,288 +0,0 @@ -@import "../../variables"; -page { - display: flex; - flex-direction: column; - height: 100vh; -} -.login { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - height: 100vh; - background-color: #fff; - padding: 0 60rpx; - - .login-header { - align-self: flex-start; - position: absolute; - top: 100rpx; - left: 30rpx; - - .login-back { - font-size: 38rpx; - color: #333; - padding: 16rpx 24rpx; - } - } - - .login-logo { - display: flex; - flex-direction: column; - align-items: center; - margin-bottom: 80rpx; - - .login-title { - font-size: 40rpx; - font-weight: 700; - color: #333; - margin-bottom: 16rpx; - } - - .login-desc { - font-size: $defualt-font-size; - color: #999; - } - } - - .login-btn { - width: 100%; - height: 96rpx; - line-height: 96rpx; - background: linear-gradient(90deg, #005bea 0%, #00c6fb 99%); - color: #fff; - font-size: 34rpx; - border-radius: 48rpx; - border: none; - &::after { - border: none; - } - } -} - -/* ============================================ - 已登录页 — 用户信息展示 - ============================================ */ -.body { - display: flex; - flex-direction: column; - align-items: center; - flex: 1; - background: linear-gradient(180deg, #f8f9fe 0%, #eef0f7 100%); - - .body-header { - align-self: flex-start; - z-index: 10; - padding: 30rpx; - background: linear-gradient(180deg, #f8f9fe 0%, rgba(248, 249, 254, 0) 100%); - - .body-back { - font-size: 34rpx; - color: #333; - padding: 16rpx 24rpx; - font-weight: 500; - } - } - .body-content{ - width: 100%; - margin-top: 15vh; - display: flex; - align-items: center; - justify-content: center; - } - - .userinfo { - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - gap: 30rpx; - padding: 40rpx 50rpx; - border: none; - border-radius: 32rpx; - background: #fff; - box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.06); - width: calc(100% - 80rpx); - max-width: 600rpx; - box-sizing: border-box; - margin-bottom: 40rpx; - - .choose-avatar { - flex-shrink: 0; - padding: 0; - margin: 0; - border: none; - background: none; - width: 96rpx; - height: 96rpx; - border-radius: 50%; - overflow: hidden; - &::after { - border: none; - } - - .avatar { - width: 96rpx; - height: 96rpx; - border-radius: 50%; - border: 3rpx solid $primary-color; - box-shadow: 0 4rpx 12rpx rgba($primary-color, 0.2); - } - } - - .nickname { - font-size: 32rpx; - font-weight: 700; - color: #222; - max-width: 280rpx; - text-align: center; - flex-shrink: 1; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - .refresh { - flex-shrink: 0; - padding: 12rpx 32rpx; - font-size: $small-font-size; - color: $primary-color; - background: rgba($primary-color, 0.06); - border: 1.5rpx solid $primary-color; - border-radius: 28rpx; - line-height: 1.5; - transition: all 0.2s ease; - &:active { - background: rgba($primary-color, 0.12); - transform: scale(0.96); - } - } - - button::after { - border: none; - } - } - - .msg { - font-size: $defualt-font-size; - color: #888; - text-align: center; - padding: 24rpx 60rpx; - margin: 0 60rpx 40rpx; - white-space: pre-wrap; - background: rgba(255, 255, 255, 0.6); - border-radius: 20rpx; - line-height: 1.6; - width: calc(100% - 120rpx); - max-width: 600rpx; - box-sizing: border-box; - } -} - -/* ============================================ - 弹窗 — 设置头像和昵称 - ============================================ */ -.login-container { - .popup-title { - display: block; - font-size: 35rpx; - font-weight: 600; - color: #000; - text-align: center; - margin-bottom: 10rpx; - } - - .popup-content { - display: flex; - flex-direction: column; - padding: 40rpx; - - // 左右布局:左头像 + 右按钮组 - .form-row { - display: flex; - align-items: center; - gap: 36rpx; - margin-bottom: 50rpx; - - // 左侧:头像选择器 - .avatar-picker { - flex-shrink: 0; - width: 140rpx; - height: 140rpx; - padding: 0; - background: transparent; - border: none; - display: flex; - align-items: center; - justify-content: center; - &::after { - border: none; - } - - .popup-avatar { - width: 140rpx; - height: 140rpx; - border-radius: 50%; - border: 3rpx solid $primary-color; - } - } - - // 右侧:按钮组(上下排列) - .btn-group { - flex: 1; - display: flex; - flex-direction: column; - gap: 20rpx; - - .form-btn { - width: 100%; - height: 72rpx; - line-height: 72rpx; - font-size: 26rpx; - color: #fff; - background: linear-gradient(90deg, #005bea 0%, #00c6fb 99%); - border-radius: 36rpx; - border: none; - &::after { - border: none; - } - - } - - // 昵称输入:外观伪装成按钮,click 唤起微信昵称弹层 - .form-input--nickname { - width: 100%; - height: 72rpx; - line-height: 72rpx; - font-size: 26rpx; - color: $primary-color; - background: transparent; - border: 2rpx solid $primary-color; - border-radius: 36rpx; - text-align: center; - padding: 0 20rpx; - box-sizing: border-box; - } - } - } - - // 提交按钮 - .form-submit { - width: 100%; - - .submit-btn { - width: 100%; - height: 96rpx; - line-height: 96rpx; - background: linear-gradient(90deg, #005bea 0%, #00c6fb 99%); - color: #fff; - font-size: 34rpx; - border-radius: 48rpx; - border: none; - &::after { - border: none; - } - } - } - } -} diff --git a/miniprogram/package-live/login/login.ts b/miniprogram/package-live/login/login.ts deleted file mode 100644 index 7bf9d13..0000000 --- a/miniprogram/package-live/login/login.ts +++ /dev/null @@ -1,289 +0,0 @@ -import { request } from "../../utils/request"; -import { LoginRes } from "../../components/login/login.d"; -import { appId, BASE_URL } from "../../env"; -import { wxLogin, wxRequest } from "../../utils/wx-api"; - -// package-live/login/login.ts -const app = getApp(); -const defaultAvatarUrl = - 'https://oss.rsjk.org.cn/ruo-shan/image/425663f8-55eb-4aa9-b3dc-dcae6a963b71.png' -Page({ - - /** - * 页面的初始数据 - */ - data: { - showPopup: false, - avatarUrl: defaultAvatarUrl, - nickname: '', - userId: null, - activityId: null, - show: null, - msg: '' - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options: any) { - if (options) { - this.setData({ - userId: options.userId, - activityId: options.activityId, - show: options.show, - msg: options.msg - }) - if (options.show) { - this.setData({ - avatarUrl: wx.getStorageSync('avatarUrl') || defaultAvatarUrl, - nickname: wx.getStorageSync('userName') || '', - }) - } - } - }, - - - goBack() { - const pages = getCurrentPages(); - if (pages.length > 1) { - wx.navigateBack({ - delta: 1, - }); - return; - } - wx.switchTab({ - url: "/pages/tab-bar/medicine-box/index", - }); - }, - async handOpen() { - try { - wx.showLoading({ title: "登录中" }); - const loginRes = await wxLogin(); - if (!loginRes.code) throw new Error(loginRes.errMsg); - - let loginResult: LoginRes; - - const reqData: Record = { - state: loginRes.code, - }; - - loginResult = await wxRequest({ - url: `${BASE_URL}/api/auth/app-auth?appId=${appId}&code=${loginRes.code}`, - method: "POST", - data: reqData, - }); - - if (loginResult?.statusCode !== 200) { - throw new Error(loginResult?.data?.msg || "登录失败"); - } - - // 判断方式 1:仅判断是否存在(当前逻辑) - if (loginResult.data.avatarUrl !== defaultAvatarUrl) { - const storageData = { - openId: loginResult.data.openId, - userId: loginResult.data.mpUserId, - mbuId: loginResult.data.id, - unionId: loginResult.data.unionId, - userName: loginResult.data.nickName, - avatarUrl: loginResult.data.avatarUrl, - }; - Object.entries(storageData).forEach(([key, value]) => { - wx.setStorageSync(key, value); - }); - - app.globalData.isLogin = true; - - wx.showToast({ - title: "登录成功", - duration: 2000, - }); - // 跳转到直播页面 - const { userId, activityId } = this.data; - wx.redirectTo({ - url: `/package-live/wxroom/index?userId=${userId}&activityId=${activityId}` - }) - } else { - wx.hideToast() - this.setData({ - showPopup: true - }) - } - - } catch (err: any) { - app.globalData.isLogin = false; - wx.showToast({ - title: `登录失败:${err.message || err.errMsg}`, - icon: "none", - }); - } finally { - setTimeout(() => wx.hideToast(), 3000); - } - - }, - closePopup() { - this.setData({ - showPopup: false - }) - }, - - // 获取头像 - onChooseAvatar(e: any) { - const { avatarUrl } = e.detail; - this.setData({ - avatarUrl - }); - }, - - // 获取昵称(微信系统填入后失焦触发 bindblur) - onNicknameInput(e: any) { - const { value } = e.detail; - this.setData({ - nickname: value - }); - }, - - - // 提交登录 - async submitLogin() { - const { avatarUrl, nickname } = this.data; - if (!avatarUrl) { - wx.showToast({ - title: '请选择头像', - icon: 'none' - }); - return; - } - if (!nickname) { - wx.showToast({ - title: '请选择昵称', - icon: 'none' - }); - return; - } - try { - wx.showLoading({ title: "登录中" }); - const loginRes = await wxLogin(); - if (!loginRes.code) throw new Error(loginRes.errMsg); - - let loginResult: LoginRes; - - const reqData: Record = { - state: loginRes.code, - avatarUrl, - nickName: nickname - }; - - loginResult = await wxRequest({ - url: `${BASE_URL}/api/auth/app-auth?appId=${appId}&code=${loginRes.code}`, - method: "POST", - data: reqData, - }); - - if (loginResult?.statusCode !== 200) { - throw new Error(loginResult?.data?.msg || "登录失败"); - } - - const storageData = { - openId: loginResult.data.openId, - userId: loginResult.data.mpUserId, - mbuId: loginResult.data.id, - unionId: loginResult.data.unionId, - userName: loginResult.data.nickName, - avatarUrl: loginResult.data.avatarUrl, - }; - - Object.entries(storageData).forEach(([key, value]) => { - wx.setStorageSync(key, value); - }); - - app.globalData.isLogin = true; - - wx.showToast({ - title: "登录成功", - duration: 2000, - }); - // 跳转到直播页面 - const { userId, activityId } = this.data; - wx.redirectTo({ - url: `/package-live/wxroom/index?userId=${userId}&activityId=${activityId}` - }) - - } catch (err: any) { - app.globalData.isLogin = false; - wx.showToast({ - title: `登录失败:${err.message || err.errMsg}`, - icon: "none", - }); - } finally { - setTimeout(() => wx.hideToast(), 3000); - } - - // 关闭弹窗 - this.closePopup(); - }, - async refresh() { - const { userId, activityId } = this.data; - const params = userId ? { mpUserId: wx.getStorageSync("userId"), userId } : { mpUserId: wx.getStorageSync("userId") }; - const dataRes = await request({ - options: { - url: "/app/saas/refresh", - method: "GET", - data: params - }, - isLoading: false, - }); - if (dataRes.pass) { - wx.redirectTo({ - url: `/package-live/wxroom/index?userId=${userId}&activityId=${activityId}` - }) - } - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - - } -}) \ No newline at end of file diff --git a/miniprogram/package-live/login/login.wxml b/miniprogram/package-live/login/login.wxml deleted file mode 100644 index b2e05a3..0000000 --- a/miniprogram/package-live/login/login.wxml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - ← 返回 - - - - - {{nickname}} - 刷新 - - - {{msg}} - - - - - \ No newline at end of file diff --git a/miniprogram/package-live/red-history/assets/red.svg b/miniprogram/package-live/red-history/assets/red.svg deleted file mode 100644 index a1605c5..0000000 --- a/miniprogram/package-live/red-history/assets/red.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/miniprogram/package-live/red-history/red-history.json b/miniprogram/package-live/red-history/red-history.json deleted file mode 100644 index a5fb473..0000000 --- a/miniprogram/package-live/red-history/red-history.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "usingComponents": { - "navigation-bar": "/components/navigation-bar/navigation-bar", - "van-tabs": "@vant/weapp/tabs/index", - "van-tab": "@vant/weapp/tab/index" - } -} diff --git a/miniprogram/package-live/red-history/red-history.scss b/miniprogram/package-live/red-history/red-history.scss deleted file mode 100644 index b60c1d8..0000000 --- a/miniprogram/package-live/red-history/red-history.scss +++ /dev/null @@ -1,185 +0,0 @@ -.page-wrap { - box-sizing: border-box; - background: #f5f5f5; - height: calc(100vh - 162rpx); - display: flex; - flex-direction: column; - padding: 28rpx 20rpx; - -} - -/* ===== 汇总卡片 ===== */ -// .summary-section { -// padding: 24rpx 24rpx 0; -// } - -.summary-card { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - padding: 20rpx; - border-radius: 16rpx; -} - -.total-card { - background: linear-gradient(135deg, #ff4d4f 0%, #ff7875 100%); - margin-bottom: 16rpx; -} - -.total-card .card-label { - color: rgba(255, 255, 255, 0.85); - font-size: 26rpx; -} - -.total-amount { - color: #fff !important; - font-size: 48rpx !important; -} - -.summary-row { - display: flex; - gap: 16rpx; -} - -.sub-card { - flex: 1; - background: #fff; - box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06); - padding: 24rpx 10rpx; -} - -.card-label { - font-size: 22rpx; - color: #999; - margin-bottom: 10rpx; -} - -.card-amount { - font-size: 30rpx; - font-weight: 700; -} - -.card-amount.received { - color: #52c41a; -} - -.card-amount.pending { - color: #fa8c16; -} - -.card-amount.expired { - color: #999; -} - -.tabs-wrap { - margin-top: 16rpx; -} - -/* ===== 红包列表 ===== */ -.red-history { - flex: 1; - background: #f5f5f5; - margin-top: 16rpx; - overflow: hidden; -} - -.list-scroll { - height: 100%; - overflow: auto; -} - -.record { - display: flex; - align-items: center; - padding: 24rpx 30rpx; - background: #fff; - border-bottom: 1px solid #eee; - margin: 0; - border-radius: 12rpx; - margin-bottom: 12rpx; -} - -.record:first-child { - margin-top: 12rpx; -} - -.red-icon { - width: 70rpx; - height: 140rpx; - flex-shrink: 0; -} - -.content { - flex: 1; - margin-left: 20rpx; - min-width: 0; -} - -.name { - font-size: 28rpx; - color: #333; - display: block; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.time { - font-size: 24rpx; - color: #999; - display: block; - margin-top: 8rpx; -} - -.right { - display: flex; - flex-direction: column; - align-items: flex-end; - flex-shrink: 0; -} - -.amount { - font-size: 32rpx; - color: #ff4d4f; - font-weight: 600; -} - -.state-text { - font-size: 24rpx; - color: #999; - margin-top: 8rpx; -} - -.receive-btn { - margin-top: 12rpx; - padding: 8rpx 28rpx; - font-size: 24rpx; - color: #fff; - background: #ff4d4f; - border-radius: 24rpx; - line-height: 1.4; -} - -.no-more { - text-align: center; - padding: 30rpx 0; - font-size: 24rpx; - color: #999; -} - -.loading-tip { - text-align: center; - padding: 20rpx 0; - font-size: 24rpx; - color: #999; -} - -.no-data { - display: flex; - justify-content: center; - align-items: center; - flex: 0.9; - font-size: 32rpx; - color: #999; -} diff --git a/miniprogram/package-live/red-history/red-history.ts b/miniprogram/package-live/red-history/red-history.ts deleted file mode 100644 index 568dae5..0000000 --- a/miniprogram/package-live/red-history/red-history.ts +++ /dev/null @@ -1,206 +0,0 @@ -import { request } from "../../utils/request"; -import { appId } from "../../env"; -import { receiveRedPacket } from "../../utils/util"; - -const app = getApp(); -const formatDate = (isoString: string): string => { - const date = new Date(isoString); - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, "0"); - const day = String(date.getDate()).padStart(2, "0"); - const hours = String(date.getHours()).padStart(2, "0"); - const minutes = String(date.getMinutes()).padStart(2, "0"); - return `${year}-${month}-${day} ${hours}:${minutes}`; -}; - -const RED_STATE_MAP: Record = { - 10: "未发送", - 11: "等待领取", - 20: "正在发送", - 21: "等待确认", - 30: "发送失败", - 31: "个数不够", - 32: "账户余额不足", - 33: "客户未实名", - 34: "其它原因", - 40: "已领取", - 50: "已过期", -}; - -const getStateText = (state: number) => { - return RED_STATE_MAP[state] || "发放中"; -}; - -const FAILED_STATES = [30, 31, 32, 33, 34]; - -const canReceive = (state: number) => { - return state === 11 || state === 21 || FAILED_STATES.includes(state); -}; - -const isRetry = (state: number) => { - return FAILED_STATES.includes(state); -}; - -Page({ - data: { - list: [] as any[], - loading: false, - hasMore: true, - current: 1, - pageSize: 15, - activeTab: 0, - tabs: [ - { label: '待领取', value: 0, type: 1 }, - { label: '已领取', value: 1, type: 2 }, - { label: '已过期', value: 2, type: 3 }, - ], - summary: { - totalAmount: '0.00', - receivedAmount: '0.00', - pendingAmount: '0.00', - expiredAmount: '0.00', - }, - store: {}, - safeBottom: app.globalData.safeBottom, - safeTop: app.globalData.safeTop, - }, - - async onLoad() { - await this.fetchRecords(1, false, this.data.tabs[0].type); - }, - - onReachBottom() { - if (this.data.loading || !this.data.hasMore) return; - const nextPage = this.data.current + 1; - this.fetchRecords(nextPage, true, this.data.tabs[this.data.activeTab].type); - }, - - onTabChange(e: any) { - const index = e.detail.index; - const tab = this.data.tabs[index]; - this.setData({ activeTab: index }); - this.fetchRecords(1, false, tab.type); - }, - - async handleReceive(e: any) { - const { id, outrewardsid } = e.currentTarget.dataset; - const params: Record = { - appId: appId, - outRewardsId: outrewardsid, - openId: wx.getStorageSync("openId"), - }; - if (outrewardsid) params.outRewardsId = outrewardsid; - if (id) params.redId = id; - - try { - await receiveRedPacket( - params, - '/app/general/receive-red', - appId - ); - - // 乐观更新:先立即更新本地数据,避免后端状态同步延迟导致展示不友好 - const { list, summary, activeTab, tabs } = this.data; - const targetItem = list.find((item: any) => item.id === id); - - if (targetItem) { - const amount = targetItem.amount || 0; - const amountYuan = amount / 100; - - const updatedList = list.map((item: any) => - item.id === id - ? { ...item, state: 40, stateText: getStateText(40), canReceive: false, isRetry: false } - : item - ); - - const updatedSummary = { - ...summary, - pendingAmount: Math.max(0, parseFloat(summary.pendingAmount) - amountYuan).toFixed(2), - receivedAmount: (parseFloat(summary.receivedAmount) + amountYuan).toFixed(2), - }; - - this.setData({ list: updatedList, summary: updatedSummary }); - } - - // 确保后端有足够时间同步,直接刷新 - setTimeout(() => { - this.fetchRecords(1, false, tabs[activeTab].type); - }, 3000); - } catch (err) { - console.error('领取红包失败:', err); - } - }, - - async fetchRecords(page: number, append = false, type: number) { - const openId = wx.getStorageSync("openId"); - - this.setData({ - store: app.globalData.store, - }); - if (!openId) { - wx.showToast({ title: "请先登录", icon: "none" }); - return; - } - - if (append) { - this.setData({ loading: true }); - } else { - wx.showLoading({ title: "加载中" }); - } - - try { - const params: Record = {}; - params.openId = openId; - params.appId = appId; - params.current = page; - params.pageSize = 15; - params.type = type; - - const res = await request({ - options: { - url: "/app/saas/query-red", - data: params, - }, - isLoading: !append, - // needLogin: false, - }); - - const records = res.data?.records || res.records || []; - const items = records.map((item: any) => ({ - ...item, - date: formatDate(item.createdTime), - stateText: getStateText(item.state), - amountText: `${(item.amount / 100).toFixed(2)}`, - canReceive: canReceive(item.state), - isRetry: isRetry(item.state), - })); - - this.setData({ - list: append ? [...this.data.list, ...items] : items, - current: page, - hasMore: records.length >= this.data.pageSize, - }); - - // 汇总数据在 res.data 根层级,单位是分,转为元 - const d = res.data; - if (d && d.totalAmount !== undefined) { - this.setData({ - summary: { - totalAmount: (d.totalAmount / 100).toFixed(2), - receivedAmount: (d.receivedAmount / 100).toFixed(2), - pendingAmount: (d.pendingAmount / 100).toFixed(2), - expiredAmount: (d.expiredAmount / 100).toFixed(2), - }, - }); - } - } catch (err) { - console.error("加载红包记录失败:", err); - } finally { - if (append) { - this.setData({ loading: false }); - } else { - wx.hideLoading(); - } - } - }, -}); diff --git a/miniprogram/package-live/red-history/red-history.wxml b/miniprogram/package-live/red-history/red-history.wxml deleted file mode 100644 index 2591a85..0000000 --- a/miniprogram/package-live/red-history/red-history.wxml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - 总领取金额 - ¥{{summary.totalAmount}} - - - - 待领取金额 - ¥{{summary.pendingAmount}} - - - 已领取金额 - ¥{{summary.receivedAmount}} - - - 已过期金额 - ¥{{summary.expiredAmount}} - - - - - - - - - - - - - - - - {{item.description}} - {{item.date}} - - - ¥{{item.amountText}} - {{item.isRetry ? '重试' : '领取'}} - {{item.stateText}} - - - - 没有更多数据了 - 加载中... - - - - 暂无记录 - diff --git a/miniprogram/package-live/volc-mini-sdk/assets/Subtract.png b/miniprogram/package-live/volc-mini-sdk/assets/Subtract.png deleted file mode 100644 index 4729592..0000000 Binary files a/miniprogram/package-live/volc-mini-sdk/assets/Subtract.png and /dev/null differ diff --git a/miniprogram/package-live/volc-mini-sdk/assets/alarm.svg b/miniprogram/package-live/volc-mini-sdk/assets/alarm.svg deleted file mode 100644 index ec52ca6..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/alarm.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/alarmWarn.svg b/miniprogram/package-live/volc-mini-sdk/assets/alarmWarn.svg deleted file mode 100644 index a191ea4..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/alarmWarn.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/arrowDoubleDown.svg b/miniprogram/package-live/volc-mini-sdk/assets/arrowDoubleDown.svg deleted file mode 100644 index a9a3a23..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/arrowDoubleDown.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/banTips.png b/miniprogram/package-live/volc-mini-sdk/assets/banTips.png deleted file mode 100644 index 276f8ea..0000000 Binary files a/miniprogram/package-live/volc-mini-sdk/assets/banTips.png and /dev/null differ diff --git a/miniprogram/package-live/volc-mini-sdk/assets/banTipsRed.png b/miniprogram/package-live/volc-mini-sdk/assets/banTipsRed.png deleted file mode 100644 index 27df31b..0000000 Binary files a/miniprogram/package-live/volc-mini-sdk/assets/banTipsRed.png and /dev/null differ diff --git a/miniprogram/package-live/volc-mini-sdk/assets/card_check_in.svg b/miniprogram/package-live/volc-mini-sdk/assets/card_check_in.svg deleted file mode 100644 index a31974b..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/card_check_in.svg +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/assets/card_lottery.svg b/miniprogram/package-live/volc-mini-sdk/assets/card_lottery.svg deleted file mode 100644 index 8459126..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/card_lottery.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/card_question.svg b/miniprogram/package-live/volc-mini-sdk/assets/card_question.svg deleted file mode 100644 index 42fa691..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/card_question.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/assets/common_close.png b/miniprogram/package-live/volc-mini-sdk/assets/common_close.png deleted file mode 100644 index 0e66e86..0000000 Binary files a/miniprogram/package-live/volc-mini-sdk/assets/common_close.png and /dev/null differ diff --git a/miniprogram/package-live/volc-mini-sdk/assets/coupon.svg b/miniprogram/package-live/volc-mini-sdk/assets/coupon.svg deleted file mode 100644 index 7259cd8..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/coupon.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/edit.svg b/miniprogram/package-live/volc-mini-sdk/assets/edit.svg deleted file mode 100644 index 97d07bb..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/edit.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/edit_dark.svg b/miniprogram/package-live/volc-mini-sdk/assets/edit_dark.svg deleted file mode 100644 index 021e5f6..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/edit_dark.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/fire_icon.svg b/miniprogram/package-live/volc-mini-sdk/assets/fire_icon.svg deleted file mode 100644 index 5556501..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/fire_icon.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/assets/icon_close_btn.svg b/miniprogram/package-live/volc-mini-sdk/assets/icon_close_btn.svg deleted file mode 100644 index 224154f..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/icon_close_btn.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/assets/mobilePause.svg b/miniprogram/package-live/volc-mini-sdk/assets/mobilePause.svg deleted file mode 100644 index b7333da..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/mobilePause.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/assets/mobilePlay.svg b/miniprogram/package-live/volc-mini-sdk/assets/mobilePlay.svg deleted file mode 100644 index f9f1aa1..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/mobilePlay.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/miniprogram/package-live/volc-mini-sdk/assets/no_content.svg b/miniprogram/package-live/volc-mini-sdk/assets/no_content.svg deleted file mode 100644 index a7576ef..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/no_content.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/no_content_dark.svg b/miniprogram/package-live/volc-mini-sdk/assets/no_content_dark.svg deleted file mode 100644 index ef4ffd9..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/no_content_dark.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/program_playing.svg b/miniprogram/package-live/volc-mini-sdk/assets/program_playing.svg deleted file mode 100644 index d14ef95..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/program_playing.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/miniprogram/package-live/volc-mini-sdk/assets/success.svg b/miniprogram/package-live/volc-mini-sdk/assets/success.svg deleted file mode 100644 index 6f80058..0000000 --- a/miniprogram/package-live/volc-mini-sdk/assets/success.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/assets/thumb.png b/miniprogram/package-live/volc-mini-sdk/assets/thumb.png deleted file mode 100644 index 7310521..0000000 Binary files a/miniprogram/package-live/volc-mini-sdk/assets/thumb.png and /dev/null differ diff --git a/miniprogram/package-live/volc-mini-sdk/components/ad-floating/ad-floating.js b/miniprogram/package-live/volc-mini-sdk/components/ad-floating/ad-floating.js deleted file mode 100644 index afd77ec..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/ad-floating/ad-floating.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var _constant=require("../../utils/constant"),_jump=require("../../utils/jump");function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function _objectSpread(e){for(var t=1;t - - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/components/ad-floating/ad-floating.wxss b/miniprogram/package-live/volc-mini-sdk/components/ad-floating/ad-floating.wxss deleted file mode 100644 index b5c57e4..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/ad-floating/ad-floating.wxss +++ /dev/null @@ -1 +0,0 @@ -page{--radius--:8rpx}.adFloating{box-sizing:border-box;position:relative;border-radius:var(--radius--);overflow:hidden;width:142rpx;height:142rpx;box-shadow:rgba(0,0,0,.12) 4rpx 4rpx 10rpx 1rpx;background-color:#fff}.adImage{width:100%;height:100%}.closeIcon{position:absolute;top:0;right:0;z-index:2;background-color:rgba(0,0,0,.4);border-top-right-radius:var(--radius--);border-bottom-left-radius:var(--radius--)}.icon-mp{display:flex;align-items:center;justify-content:center} \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.js b/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.js deleted file mode 100644 index 74fe2c1..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var _DEFAULT_COPY,_constant=require("../../utils/constant"),_theme=require("../../utils/theme"),_utils=require("../../utils/utils");function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _defineProperty(e,t,i){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var DetectionType={BeforeWatching:1,CutScreen:2,MutedChange:3,NotInteraction:4,NotInteractionKickOut:5},DEFAULT_COPY=(_defineProperty(_DEFAULT_COPY={},DetectionType.BeforeWatching,"请认真观看直播内容"),_defineProperty(_DEFAULT_COPY,DetectionType.CutScreen,"请保持在当前直播间观看"),_defineProperty(_DEFAULT_COPY,DetectionType.MutedChange,"当前播放已暂停,请继续观看"),_defineProperty(_DEFAULT_COPY,DetectionType.NotInteraction,"请继续参与直播互动"),_defineProperty(_DEFAULT_COPY,DetectionType.NotInteractionKickOut,"长时间未互动,请点击继续观看"),_DEFAULT_COPY),PLAYER_CREATED_VIDEO_TYPES=["live","vod"],isOpen=function(e){return e&&1===Number(e.IsOpen)},isPlayerCreatedVideoType=function(e){return PLAYER_CREATED_VIDEO_TYPES.includes(e)},getConfigType=function(e){return Number(null==e?void 0:e.AttentionDetectionType)},getConfigCopy=function(e,t){return(null==e?void 0:e.ReminderCopy)||DEFAULT_COPY[t]},getConfigSignature=function(e){return JSON.stringify(Object.keys(e).sort().map(function(t){var i,n,o,a=e[t]||{};return{type:t,isOpen:1===Number(a.IsOpen),copy:a.ReminderCopy||"",minTime:Number(null!==(i=null!==(n=null==a||null===(o=a.DetectionRule)||void 0===o?void 0:o.MinTime)&&void 0!==n?n:null==a?void 0:a.MinTime)&&void 0!==i?i:0)}}))},getMinTimeMs=function(e){var t,i,n,o=Number(null!==(t=null!==(i=null==e||null===(n=e.DetectionRule)||void 0===n?void 0:n.MinTime)&&void 0!==i?i:null==e?void 0:e.MinTime)&&void 0!==t?t:0);return!Number.isFinite(o)||o<=0?0:1e3*o};Component({properties:{sdkInstance:{type:Object,value:null}},data:{dialogVisible:!1,dialogTitle:"温馨提示",dialogContent:"",useDarkTheme:!1},observers:{sdkInstance:function(e){var t=this;e&&(this.sdkInstance=e,this.store=e.store,"function"==typeof this.unsub&&this.unsub(),this.unsub=null,this.unsub=this.store.get({liveInfo:function(e){var i,n,o=(e||{}).Basic,a=void 0===o?{}:o,r=a.ActivityId||(null===(i=t.store)||void 0===i||null===(n=i.get)||void 0===n?void 0:n.call(i,"mainInfo.activityId"))||"";r&&r!==t.activityId&&(t.activityId=r,t.configSignature="",t.beforeWatchingShown=!1,t.hasPlayStarted=!1,t.activeDialogType=null,t.beforeWatchingPending=!1,t.noInteractionKickOutActive=!1,t.clearAllTimers());var s=(0,_theme.isUseDarkTheme)(a);(0,_utils.setDataIfChanged)(t,{useDarkTheme:s}),t.syncConfigs(a.AttentionDetectionConfigArray||[])},"reportInfo.isPlay":function(e){t.handlePlayStateChange(!!e)},"reportInfo.videoType":function(e){t.handlePlayerVideoTypeChange(e)},"ui.commentInitialRendered":function(e){t.handleCommentInitialRendered(!!e)}}))}},lifetimes:{attached:function(){var e,t,i;this.configMap={},this.configSignature="",this.beforeWatchingShown=!1,this.hasPlayStarted=!1,this.activeDialogType=null,this.beforeWatchingPending=!1,this.noInteractionKickOutActive=!1,this.timers={},this.isAppHidden=!1,this.isKeyboardVisible=!1,this.isPlayerCreated=!1,this.playerVideoType="",this._boundHandleAppHide=this.handleAppHide.bind(this),this._boundHandleAppShow=this.handleAppShow.bind(this),this._boundHandleKeyboardHeightChange=this.handleKeyboardHeightChange.bind(this),"function"==typeof(null===(e=wx)||void 0===e?void 0:e.onAppHide)&&wx.onAppHide(this._boundHandleAppHide),"function"==typeof(null===(t=wx)||void 0===t?void 0:t.onAppShow)&&wx.onAppShow(this._boundHandleAppShow),"function"==typeof(null===(i=wx)||void 0===i?void 0:i.onKeyboardHeightChange)&&wx.onKeyboardHeightChange(this._boundHandleKeyboardHeightChange)},detached:function(){var e,t,i;"function"==typeof this.unsub&&this.unsub(),this.unsub=null,"function"==typeof(null===(e=wx)||void 0===e?void 0:e.offAppHide)&&this._boundHandleAppHide&&wx.offAppHide(this._boundHandleAppHide),"function"==typeof(null===(t=wx)||void 0===t?void 0:t.offAppShow)&&this._boundHandleAppShow&&wx.offAppShow(this._boundHandleAppShow),"function"==typeof(null===(i=wx)||void 0===i?void 0:i.offKeyboardHeightChange)&&this._boundHandleKeyboardHeightChange&&wx.offKeyboardHeightChange(this._boundHandleKeyboardHeightChange),this.clearAllTimers()}},methods:{syncConfigs:function(e){var t,i,n={};e.forEach(function(e){var t=getConfigType(e);t&&(n[t]=e)});var o=getConfigSignature(n);o!==this.configSignature&&(this.configSignature=o,this.configMap=n,isOpen(n[DetectionType.BeforeWatching])||(this.beforeWatchingShown=!1,this.beforeWatchingPending=!1),isOpen(n[DetectionType.BeforeWatching])&&!this.beforeWatchingShown&&(this.beforeWatchingShown=!0,this.scheduleBeforeWatchingDialog()),this.resetInteractionTimer(),this.handlePlayStateChange(!(null===(t=this.store)||void 0===t||null===(i=t.get)||void 0===i||!i.call(t,"reportInfo.isPlay"))),this.syncKickOutStateWithConfig())},recordInteraction:function(){this.isPlayerCreated&&!this.isAppHidden&&this.hasPlayStarted&&this.resetInteractionTimer()},resetDetectionForPlayerDestroy:function(){this.hasPlayStarted=!1,this.pauseCausedByAppHide=!1,this.clearAllTimers(),this.data.dialogVisible&&this.activeDialogType!==DetectionType.BeforeWatching&&((0,_utils.setDataIfChanged)(this,{dialogVisible:!1}),this.activeDialogType=null)},handlePlayerVideoTypeChange:function(e){var t,i,n=e||"",o=isPlayerCreatedVideoType(n),a=this.isPlayerCreated,r=n!==this.playerVideoType;(r||a!==o)&&(a&&r&&this.resetDetectionForPlayerDestroy(),this.playerVideoType=n,this.isPlayerCreated=o,o?this.handlePlayStateChange(!(null===(t=this.store)||void 0===t||null===(i=t.get)||void 0===i||!i.call(t,"reportInfo.isPlay"))):a||this.clearAllTimers())},handlePlayStateChange:function(e){var t,i,n=this;if(!this.isPlayerCreated)return this.clearTimer("mutedChange"),this.clearTimer("notInteraction"),void this.clearTimer("notInteractionKickOut");if(e)return this.clearTimer("mutedChange"),this.hasPlayStarted=!0,this.pauseCausedByAppHide=!1,void this.resetInteractionTimer();var o=null===(t=this.configMap)||void 0===t?void 0:t[DetectionType.MutedChange];if(this.isAppHidden||this.pauseCausedByAppHide||!this.hasPlayStarted||!isOpen(o))return this.clearTimer("mutedChange"),void(this.mutedChangeTimerKey="");var a=getMinTimeMs(o);if(a){var r="".concat(a,"_").concat(getConfigCopy(o,DetectionType.MutedChange));null!==(i=this.timers)&&void 0!==i&&i.mutedChange&&this.mutedChangeTimerKey===r||(this.clearTimer("mutedChange"),this.mutedChangeTimerKey=r,this.startTimer("mutedChange",a,function(){n.mutedChangeTimerKey="",n.showDetectionDialog(DetectionType.MutedChange)}))}else this.clearTimer("mutedChange")},resetInteractionTimer:function(){var e,t,i=this;if(this.clearTimer("notInteraction"),this.clearTimer("notInteractionKickOut"),!this.isAppHidden&&!this.isKeyboardVisible&&this.hasPlayStarted){var n=null===(e=this.configMap)||void 0===e?void 0:e[DetectionType.NotInteraction],o=null===(t=this.configMap)||void 0===t?void 0:t[DetectionType.NotInteractionKickOut];isOpen(o)?this.startTimer("notInteractionKickOut",getMinTimeMs(o),function(){i.kickOutForNoInteraction()}):isOpen(n)&&this.startTimer("notInteraction",getMinTimeMs(n),function(){i.showDetectionDialog(DetectionType.NotInteraction)})}},startTimer:function(e,t,i){t&&(this.timers[e]=setTimeout(i,t))},clearTimer:function(e){var t;null!==(t=this.timers)&&void 0!==t&&t[e]&&(clearTimeout(this.timers[e]),this.timers[e]=null),"mutedChange"===e&&(this.mutedChangeTimerKey="")},clearAllTimers:function(){var e=this;Object.keys(this.timers||{}).forEach(function(t){return e.clearTimer(t)})},scheduleBeforeWatchingDialog:function(){var e,t;null!==(e=this.store)&&void 0!==e&&null!==(t=e.get)&&void 0!==t&&t.call(e,"ui.commentInitialRendered")?(this.beforeWatchingPending=!1,this.data.dialogVisible||this.showDetectionDialog(DetectionType.BeforeWatching)):this.beforeWatchingPending=!0},handleCommentInitialRendered:function(e){e&&this.beforeWatchingPending&&this.scheduleBeforeWatchingDialog()},handleAppHide:function(){var e,t;this.isAppHidden||(this.isAppHidden=!0,this.pauseCausedByAppHide=!(null===(e=this.store)||void 0===e||null===(t=e.get)||void 0===t||!t.call(e,"reportInfo.isPlay")),this.clearTimer("mutedChange"),this.clearTimer("notInteraction"),this.clearTimer("notInteractionKickOut"))},handleKeyboardHeightChange:function(){var e=Number((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).height||0)>0;if(this.isKeyboardVisible!==e){if(this.isKeyboardVisible=e,e)return this.clearTimer("notInteraction"),void this.clearTimer("notInteractionKickOut");this.resetInteractionTimer()}},handleAppShow:function(){var e,t;this.isAppHidden&&(this.isAppHidden=!1,this.isPlayerCreated&&this.hasPlayStarted&&this.showDetectionDialog(DetectionType.CutScreen),this.resetInteractionTimer(),this.handlePlayStateChange(!(null===(e=this.store)||void 0===e||null===(t=e.get)||void 0===t||!t.call(e,"reportInfo.isPlay"))))},syncKickOutStateWithConfig:function(){var e,t,i,n=null===(e=this.configMap)||void 0===e?void 0:e[DetectionType.NotInteractionKickOut];if(!isOpen(n)){var o,a,r=(null===(t=this.store)||void 0===t||null===(i=t.get)||void 0===i?void 0:i.call(t,"banStatus"))||{};this.noInteractionKickOutActive&&r.isSoftBan&&r.banType===_constant.BAN_TYPE.KICK_OUT&&"noInteraction"===r._attentionDetectionSource&&(this.noInteractionKickOutActive=!1,null===(o=this.store)||void 0===o||null===(a=o.set)||void 0===a||a.call(o,"banStatus",{isBanned:!1,isSoftBan:!1,banType:_constant.BAN_TYPE.NONE,banTips:""}))}},showDetectionDialog:function(e){var t;if(e===DetectionType.BeforeWatching||this.isPlayerCreated){var i=null===(t=this.configMap)||void 0===t?void 0:t[e];isOpen(i)&&(this.activeDialogType=e,this.setData({dialogVisible:!0,dialogContent:getConfigCopy(i,e)}))}},onDialogButtonTap:function(){var e,t,i=this.activeDialogType;this.setData({dialogVisible:!1}),this.activeDialogType=null,this.resetInteractionTimer(),i===DetectionType.MutedChange&&this.handlePlayStateChange(!(null===(e=this.store)||void 0===e||null===(t=e.get)||void 0===t||!t.call(e,"reportInfo.isPlay")))},kickOutForNoInteraction:function(){var e,t,i,n=null===(e=this.configMap)||void 0===e?void 0:e[DetectionType.NotInteractionKickOut];isOpen(n)&&(this.noInteractionKickOutActive=!0,null===(t=this.store)||void 0===t||null===(i=t.set)||void 0===i||i.call(t,"banStatus",{isBanned:!0,isSoftBan:!0,banType:_constant.BAN_TYPE.KICK_OUT,banTips:n.ReminderCopy||DEFAULT_COPY[DetectionType.NotInteractionKickOut],_attentionDetectionSource:"noInteraction"}))}}}); \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.json b/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.json deleted file mode 100644 index a591b83..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.json +++ /dev/null @@ -1 +0,0 @@ -{"component":true,"usingComponents":{"mp-dialog":"../../pubComponents/dialog/dialog"}} \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.wxml b/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.wxml deleted file mode 100644 index 2d3e37b..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.wxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - i - {{dialogTitle}} - - - {{dialogContent}} - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.wxss b/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.wxss deleted file mode 100644 index 1019eef..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/attention-detection/attention-detection.wxss +++ /dev/null @@ -1 +0,0 @@ -.attention-dialog-header{position:relative;height:150rpx;padding:40rpx;box-sizing:border-box;overflow:hidden;background:linear-gradient(180deg,#e7edff 0,rgba(231,237,255,0) 100%)}.attention-dialog-header-dark{background:linear-gradient(180deg,#1b202f 0,#26262a 100%)}.attention-dialog-header::before{content:'';position:absolute;left:-120rpx;top:-138rpx;width:268rpx;height:268rpx;border-radius:50%;background:radial-gradient(circle,rgba(255,255,255,.69) 0,rgba(255,255,255,0) 68%)}.attention-dialog-header::after{content:'';position:absolute;left:-46rpx;top:74rpx;width:210rpx;height:40rpx;border-radius:999rpx;background:linear-gradient(180deg,rgba(0,177,255,.76) 0,rgba(0,177,255,0) 100%);filter:blur(18rpx);opacity:.54}.attention-dialog-header-dark::before{opacity:.35}.attention-dialog-header-dark::after{background:#06f;opacity:.3}.attention-dialog-title{position:relative;z-index:1;display:flex;align-items:center;color:#1f2329;font-size:calc(32rpx + .5 * (1rem - 16px));font-weight:500;line-height:calc(44rpx + .5 * (1rem - 16px))}.attention-dialog-title-dark{color:#f2f3f5}.attention-dialog-tips-icon{width:calc(32rpx + .5 * (1rem - 16px));height:calc(32rpx + .5 * (1rem - 16px));margin-right:16rpx;border-radius:50%;background:#f5b433;border:2rpx solid #f2a200;box-sizing:border-box;color:#fff;font-size:calc(24rpx + .5 * (1rem - 16px));font-weight:700;line-height:calc(28rpx + .5 * (1rem - 16px));text-align:center}.attention-dialog-content{position:relative;z-index:1;min-height:calc(84rpx + .5 * (1rem - 16px));margin:-40rpx 40rpx 40rpx;color:#4e5969;font-size:calc(28rpx + .5 * (1rem - 16px));line-height:calc(42rpx + .5 * (1rem - 16px));text-align:left;word-break:break-word;overflow-wrap:anywhere}.attention-dialog-content-dark{color:#c9cdd4}.attention-dialog-footer{padding:0 40rpx 40rpx}.attention-dialog-button{width:100%;height:calc(64rpx + .5 * (1rem - 16px));display:flex;align-items:center;justify-content:center;padding:0;border:0;border-radius:8rpx;background:#fe2c55;color:#fff;font-size:calc(28rpx + .5 * (1rem - 16px));font-weight:500;line-height:calc(64rpx + .5 * (1rem - 16px))}.attention-dialog-button::after{border:0}.attention-dialog-button:active{background:rgba(254,44,85,.85)} \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.js b/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.js deleted file mode 100644 index 6fe480d..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var _constant=require("../../utils/constant"),_singleLogin=require("../../utils/singleLogin"),NORMAL_ICON="../../assets/banTips.png",ERROR_ICON="../../assets/banTipsRed.png";Component({properties:{sdkInstance:{type:Object,value:null}},data:{isBanned:!1,banType:_constant.BAN_TYPE.NONE,banTips:"",isSoftBan:!1,canContinue:!1,displayTips:"",normalIcon:NORMAL_ICON,errorIcon:ERROR_ICON},observers:{sdkInstance:function(n){if(n){var s=n.store,t=this;console.log("[BanPage] sdkInstance initialized"),"function"==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null,this._unsubscribe=s.get({banStatus:function(n){if(console.log("[BanPage] banStatus changed:",n),n){var s=n.isBanned,e=void 0!==s&&s,i=n.banType,a=void 0===i?_constant.BAN_TYPE.NONE:i,o=n.banTips,c=void 0===o?"":o,u=n.isSoftBan,r=void 0!==u&&u,l=a===_constant.BAN_TYPE.CHECK_IN||r,b=c||(0,_singleLogin.getBanTipsText)(a);t.setData({isBanned:e,banType:a,banTips:c,isSoftBan:r,canContinue:l,displayTips:b})}}})}else console.log("[BanPage] sdkInstance is null")}},lifetimes:{detached:function(){"function"==typeof this._unsubscribe&&this._unsubscribe(),this._unsubscribe=null}},methods:{onContinueWatch:function(){var n=this.properties.sdkInstance,s={banType:this.data.banType,isSoftBan:this.data.isSoftBan};n&&n.store?(console.log("[BanPage] User clicked continue watch"),(0,_singleLogin.updateBanStatus)(n.store,{isBanned:!1,banType:_constant.BAN_TYPE.NONE,banTips:"",isSoftBan:!1}),this.triggerEvent("continue",s)):console.warn("[BanPage] sdkInstance or store is null")}}}); \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.json b/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.json deleted file mode 100644 index 1450e2e..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.json +++ /dev/null @@ -1 +0,0 @@ -{"component":true,"usingComponents":{}} \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.wxml b/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.wxml deleted file mode 100644 index 6f7bd16..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.wxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - {{displayTips}} - - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.wxss b/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.wxss deleted file mode 100644 index d83fc0b..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/ban-page/ban-page.wxss +++ /dev/null @@ -1 +0,0 @@ -.ban-page{position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;background-image:url("https://p1-live.byteimg.com/tos-cn-i-gjr78lqtd0/123342ac439a4ef587c3ca584078a5dc~tplv-gjr78lqtd0-z75.image");background-size:cover;background-position:center;z-index:30000;display:flex;align-items:center;justify-content:center}.ban-modal{display:flex;flex-direction:column;align-items:center;width:280px;min-height:168px;background-color:#fff;border-radius:16px;padding:20px;padding-bottom:25px;box-shadow:0 4px 16px rgba(0,0,0,.1);box-sizing:border-box}.ban-icon{width:80px;height:80px;margin-bottom:12px}.ban-text{font-size:calc(17px + .5 * (1rem - 16px));color:#161823;line-height:1.5;text-align:center;font-weight:500;word-break:break-all}.ban-actions{margin-top:12px;width:100%;display:flex;justify-content:center}.continue-button{width:240px;height:calc(44px + .5 * (1rem - 16px));line-height:calc(44px + .5 * (1rem - 16px));background-color:#ff4050;color:#fff;border-radius:8px;font-size:calc(15px + .5 * (1rem - 16px));font-weight:500;border:none;padding:0;text-align:center}.continue-button::after{border:none}.continue-button:active{opacity:.6} \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.js b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.js deleted file mode 100644 index 5a2af18..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var _constant=require("../../../utils/constant"),_comment=require("../../../utils/comment"),_dynamicEmoji=require("../../../utils/dynamic-emoji"),_imageUpload=require("../../../utils/image-upload"),_notification=require("../../../utils/notification"),_theme=require("../../../utils/theme"),_autoReply=require("../../../utils/autoReply"),_constants=require("./constants"),_icons=require("./icons"),_utils=require("./utils"),_featureProcess=require("../../../utils/feature-process"),_excluded=["TextContent","ContentType","source"];function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=0;--r){var a=this.tryEntries[r],i=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--o){var r=this.tryEntries[o];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var r=o.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:j(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),m}},e}function asyncGeneratorStep(e,t,n,o,r,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(o,r)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var a=e.apply(t,n);function i(e){asyncGeneratorStep(a,o,r,i,s,"next",e)}function s(e){asyncGeneratorStep(a,o,r,i,s,"throw",e)}i(void 0)})}}function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function _objectSpread(e){for(var t=1;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o=0||(r[n]=e[n]);return r}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!==_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var DEFAULT_PANEL_HEIGHT=300,KEYBOARD_HEIGHT_STORAGE_KEY="volc_live_mini_chat_keyboard_height";Component({properties:{sdkInstance:{type:Object,value:null},isLandscape:{type:Boolean,value:!1},externalEditorCloseSignal:{type:Number,value:0}},data:{CommentConfig:{},chatValue:"",chatLength:0,IsSendCommentEnable:void 0,sendChatTime:0,InvalidToken:!0,entering:!1,lastKeyboardHeight:0,panelHeight:DEFAULT_PANEL_HEIGHT,backgroundColor:"",safeAreaInsetBottom:0,platform:"",system:"",emojiPanelSections:[],showEmojiPanel:!1,focusInput:!1,showEmojiEntry:!1,showImageEntry:!1,showCloseEntry:!1,emojiTriggerIcon:_icons.EMOJI_TRIGGER_ICON,emojiTriggerIconDark:_icons.EMOJI_TRIGGER_ICON_DARK,keyboardTriggerIcon:_icons.KEYBOARD_TRIGGER_ICON,keyboardTriggerIconDark:_icons.KEYBOARD_TRIGGER_ICON_DARK,imageTriggerIcon:_icons.IMAGE_TRIGGER_ICON,imageTriggerIconDark:_icons.IMAGE_TRIGGER_ICON_DARK},lifetimes:{created:function(){this._emojiSets=[]},attached:function(){try{var e=wx.getSystemInfoSync(),t=Number(wx.getStorageSync(KEYBOARD_HEIGHT_STORAGE_KEY)||0);this.setData({safeAreaInsetBottom:e.screenHeight-e.safeArea.bottom,platform:e.platform,lastKeyboardHeight:t>0?t:0,panelHeight:t>0?t:DEFAULT_PANEL_HEIGHT})}catch(e){console.error("getSystemInfoSync failed",e)}},detached:function(){"function"==typeof this.unsub&&this.unsub(),this.unsub=null}},observers:{sdkInstance:function(e){if(e){this.sdkInstance=e,this.store=e.store;var t=this,n=!1;"function"==typeof this.unsub&&this.unsub(),this.unsub=null,this.unsub=this.store.get({liveInfo:function(e){var o,r,a=t.data.IsSendCommentEnable,i=null!==(o=null==e?void 0:e.CommentConfig)&&void 0!==o?o:{},s=i.IsSendCommentEnable,c=i.IsWelcomeMessageEnable,l=i.WelcomeMessageContent,u=i.WelcomeMessageTitle;if(void 0!==s){void 0!==a&&a!==s&&t.showMockComment(_constants.CommentType.MuteAll,{IsSendCommentEnable:1===s}),(0,_notification.isOpenSwitch)(c)&&l&&u&&!n&&(t.showMockComment(_constants.CommentType.Welcome,{WelcomeContent:l,WelcomeTitle:u}),n=!0);var m=((null==e?void 0:e.Basic)||{}).ColorThemeIndex;t.setData({CommentConfig:(null==e?void 0:e.CommentConfig)||{},IsSendCommentEnable:s,backgroundColor:(0,_theme.getThemeColor)(m).Fill_7,showImageEntry:1===Number((null==e||null===(r=e.CommentConfig)||void 0===r?void 0:r.IsImageCommentEnable)||0)})}},mainInfo:function(e){var n;t.setData({InvalidToken:2!==(null==e?void 0:e.mode),showCloseEntry:!0===(null==e||null===(n=e.options)||void 0===n?void 0:n.showChatInputCloseButton)})},"chat.emojiSets":function(e){t.updateEmojiSets(e||[])}})}},entering:function(e){this.triggerEvent("editorstatechange",{entering:e})},externalEditorCloseSignal:function(e){e&&this.data.entering&&this.handleOutsideTap()}},methods:{activateTextEditor:function(){var e=this;this.setData({entering:!0,showEmojiPanel:!1,focusInput:!1},function(){e.setData({focusInput:!0})})},getCommentTypeLabel:function(e){var t;return(_defineProperty(t={},_comment.MessageContentType.Text,"text"),_defineProperty(t,_comment.MessageContentType.Emoji,"emoji"),_defineProperty(t,_comment.MessageContentType.BigEmoji,"bigEmoji"),_defineProperty(t,_comment.MessageContentType.Photo,"photo"),t)[e]||"unknown"},buildCommentTeaPayload:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.TextContent,n=void 0===t?"":t,o=e.ContentType,r=void 0===o?_comment.MessageContentType.Text:o,a=e.source,i=void 0===a?"unknown":a,s=_objectWithoutProperties(e,_excluded);return _objectSpread({source:i,textContent:String(n||""),contentType:r,contentTypeLabel:this.getCommentTypeLabel(r)},s)},reportCommentTea:function(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null===(t=this.sdkInstance)||void 0===t||null===(n=t.reportTea)||void 0===n||n.call(t,e,o)},getKeyboardHeight:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.data,n=t.platform,o=t.safeAreaInsetBottom;return e<=0?0:"ios"===n?Math.max(0,e-o):e},getPanelHeight:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e>0?e:this.data.lastKeyboardHeight||this.data.panelHeight||DEFAULT_PANEL_HEIGHT},updateEmojiSets:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._emojiSets=t,t.length?this.data.showEmojiPanel?this.setData({emojiPanelSections:(0,_utils.buildEmojiPanelSections)(t),showEmojiEntry:!0,showEmojiPanel:!0}):null!==(e=this.data.emojiPanelSections)&&void 0!==e&&e.length?this.setData({emojiPanelSections:[],showEmojiEntry:!0}):this.data.showEmojiEntry||this.setData({showEmojiEntry:!0}):this.disableEmojiEntry()},disableEmojiEntry:function(){var e;(this.data.showEmojiPanel||this.data.showEmojiEntry||null!==(e=this.data.emojiPanelSections)&&void 0!==e&&e.length)&&this.setData({entering:!1,panelHeight:DEFAULT_PANEL_HEIGHT,showEmojiPanel:!1,focusInput:!1,emojiPanelSections:[],showEmojiEntry:!1})},closeEditor:function(e){this.setData({entering:!1,panelHeight:DEFAULT_PANEL_HEIGHT,showEmojiPanel:!1,focusInput:!1},e)},chatInputChange:function(e){var t,n=(null===(t=e.detail)||void 0===t?void 0:t.value)||"";this.setData({chatValue:n,chatLength:n.length})},triggerCommentCheck:function(){2!==this.store.get("mainInfo").mode&&this.triggerEvent("commentCheck")},handleInputActivatorTap:function(){(0,_featureProcess.lockFeatureProcess)(this.sdkInstance,_featureProcess.LockFeatureMap.Comment)||(2!==this.data.IsSendCommentEnable?this.canSendComment()?this.activateTextEditor():this.triggerCommentCheck():wx.showToast({title:"互动聊天未开启",icon:"none"}))},handleInputTap:function(){this.data.entering&&!this.data.focusInput&&this.setData({focusInput:!0})},handleInputFocus:function(){this.setData({showEmojiPanel:!1}),this.data.focusInput||this.setData({focusInput:!0})},bindblur:function(){},handleKeyboardHeightChange:function(e){var t,n=this.getKeyboardHeight((null==e||null===(t=e.detail)||void 0===t?void 0:t.height)||0),o=n>0?n:this.data.lastKeyboardHeight;if(n>0&&n!==this.data.lastKeyboardHeight)try{wx.setStorageSync(KEYBOARD_HEIGHT_STORAGE_KEY,n)}catch(e){console.error("persist keyboard height failed",e)}this.setData({lastKeyboardHeight:o,panelHeight:this.getPanelHeight(o)})},handleOutsideTap:function(){this.closeEditor()},handleCloseTap:function(){this.closeEditor()},canSendComment:function(){return 1===this.data.IsSendCommentEnable&&!this.data.InvalidToken},checkSendInterval:function(){var e=this.data.CommentConfig.VoiceInterval,t=void 0===e?3:e;return!(Date.now()-this.data.sendChatTime<1e3*t&&(wx.showToast({title:"评论过于频繁,请稍后再试",icon:"none"}),1))},createSendCommentParams:function(e){var t=e.TextContent,n=e.ContentType,o=e.md5,r=e.LocalId,a=this.store.get("mainInfo").activityId,i=this.store.get("userInfo"),s=i.userId,c=i.levelId;return{ActivityId:a,Comment:_objectSpread(_objectSpread({TextContent:t,UserId:parseInt(s),LevelId:c,ContentType:n},o?{md5:o}:{}),r?{LocalId:r}:{})}},requestSendCommentSafely:function(e){var t=this;return _asyncToGenerator(_regeneratorRuntime().mark(function n(){var o,r,a,i,s,c,l;return _regeneratorRuntime().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.TextContent,a=e.ContentType,i=e.md5,s=e.LocalId,c="function"==typeof(null===(o=t.sdkInstance)||void 0===o?void 0:o.requestStrict)?t.sdkInstance.requestStrict.bind(t.sdkInstance):t.sdkInstance.request.bind(t.sdkInstance),n.prev=2,n.next=5,c(_constant.REQUEST_URL_MAP.SEND_COMMENT,{method:"POST",data:t.createSendCommentParams({TextContent:r,ContentType:a,md5:i,LocalId:s})});case 5:return l=n.sent,n.abrupt("return",[l,null]);case 9:return n.prev=9,n.t0=n.catch(2),n.abrupt("return",[null,n.t0]);case 12:case"end":return n.stop()}},n,null,[[2,9]])}))()},sendComment:function(e){var t=this;return _asyncToGenerator(_regeneratorRuntime().mark(function n(){var o,r,a,i,s,c,l,u,m,d,h,p,f,g,y,v,_,I,C,T,b,E,S;return _regeneratorRuntime().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return o=e.TextContent,r=e.ContentType,a=void 0===r?_comment.MessageContentType.Text:r,i=e.md5,s=e.LocalId,c=t.store.get("userInfo"),l=c.userId,u=c.username,m=c.levelId,d=c.avatarUrl,h=t.buildCommentTeaPayload({TextContent:o,ContentType:a,LocalId:s,md5:i,source:"sendComment"}),t.reportCommentTea("mini_sdk_comment_send",_objectSpread(_objectSpread({},h),{},{stage:"start"})),n.next=6,t.requestSendCommentSafely({TextContent:o,ContentType:a,md5:i,LocalId:s});case 6:return p=n.sent,f=_slicedToArray(p,2),g=f[0],y=f[1],v=(null==g?void 0:g.H5MsgId)||Date.now(),y?t.reportCommentTea("mini_sdk_comment_send",_objectSpread(_objectSpread({},h),{},{stage:"fail",errorMessage:(null==y?void 0:y.message)||"发送失败",errorCode:(null==y?void 0:y.code)||""})):((0,_autoReply.addH5MsgIdToCache)(g.H5MsgId),t.sdkInstance.countSendCommentNumber(),null===(_=t.sdkInstance)||void 0===_||null===(I=_.reportBusiness)||void 0===I||I.call(_,"send_comment",{Count:1}),t.reportCommentTea("mini_sdk_comment_send",_objectSpread(_objectSpread({},h),{},{stage:"success",h5MsgId:v}))),C=(null==g?void 0:g.AvatarUrl)||d||"",T=(null==g?void 0:g.Nickname)||u||"",s?t.finalizeMockComment(s,{H5MsgId:v,username:T,userId:l,levelId:m,avatarUrl:C,TextContent:o,ContentType:a,md5:i,AutoReply:null==g?void 0:g.AutoReply}):(S=t.store.get("chat.chatList")||[],t.showMockComment(_constants.CommentType.Mock,{H5MsgId:v,_formerMsgId_:null===(b=S[S.length-1])||void 0===b||null===(E=b.Common)||void 0===E?void 0:E.MsgId,username:T,userId:l,levelId:m,avatarUrl:C,TextContent:o,ContentType:a,LocalId:s,md5:i,AutoReply:null==g?void 0:g.AutoReply})),t.setData({sendChatTime:Date.now()}),n.abrupt("return",y?{H5MsgId:v,Nickname:u||"",localOnly:!0}:g);case 17:case"end":return n.stop()}},n)}))()},bindconfirm:function(e){var t=this;return _asyncToGenerator(_regeneratorRuntime().mark(function n(){var o,r,a,i,s,c,l,u,m,d,h;return _regeneratorRuntime().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(r=((null===(o=e.detail)||void 0===o?void 0:o.value)||t.data.chatValue||"").trim()){n.next=4;break}return wx.showToast({title:"内容不可为空",icon:"none"}),n.abrupt("return");case 4:if(t.checkSendInterval()){n.next=6;break}return n.abrupt("return");case 6:return n.prev=6,s=(0,_comment.normalizeOutgoingEmojiText)(r,t._emojiSets||[]),c=/\[[^\]]+\]/.test(s),n.next=11,t.sendComment({TextContent:s,ContentType:c?_comment.MessageContentType.Emoji:_comment.MessageContentType.Text});case 11:l=(0,_dynamicEmoji.getSingleDynamicEmojiToken)(r),u=(null===(a=t.store)||void 0===a?void 0:a.get("liveInfo.MessageSwitch"))||{},m=(0,_notification.isNotificationSendTypeEnabled)(u,_notification.NOTIFICATION_SEND_TYPE.DYNAMIC_EMOJI),d=!1!==(null===(i=t.store)||void 0===i?void 0:i.get("notification.isNotificationOpen")),t.store&&l&&m&&d&&(h=t.store.get("notification.queueDynamicEmojiArea")||[],t.store.set("notification.queueDynamicEmojiArea",h.concat({__id:"local-dynamic-emoji-".concat(Date.now(),"-").concat(l),token:l}))),t.setData({chatValue:"",chatLength:0}),t.closeEditor(),n.next=24;break;case 20:n.prev=20,n.t0=n.catch(6),console.error("send text comment error",n.t0),wx.showToast({title:(null===n.t0||void 0===n.t0?void 0:n.t0.message)||"发送失败",icon:"none"});case 24:case"end":return n.stop()}},n,null,[[6,20]])}))()},handleSendTap:function(){this.data.chatLength&&this.bindconfirm({detail:{value:this.data.chatValue}})},handleEmojiTrigger:function(){var e;(0,_featureProcess.lockFeatureProcess)(this.sdkInstance,_featureProcess.LockFeatureMap.Comment)||(this.canSendComment()?null!==(e=this.data.emojiPanelSections)&&void 0!==e&&e.length?this.setData({showEmojiPanel:!0,entering:!0,panelHeight:this.getPanelHeight(),focusInput:!1}):this.setData({emojiPanelSections:(0,_utils.buildEmojiPanelSections)(this._emojiSets||[]),showEmojiPanel:!0,entering:!0,panelHeight:this.getPanelHeight(),focusInput:!1}):this.triggerCommentCheck())},handleKeyboardTrigger:function(){(0,_featureProcess.lockFeatureProcess)(this.sdkInstance,_featureProcess.LockFeatureMap.Comment)||this.setData({focusInput:!0,showEmojiPanel:!1,entering:!0,panelHeight:this.getPanelHeight()})},catchNone:function(){},handleChooseImage:function(){var e=this;return _asyncToGenerator(_regeneratorRuntime().mark(function t(){var n,o,r,a,i,s,c,l,u,m,d,h,p;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(0,_featureProcess.lockFeatureProcess)(e.sdkInstance,_featureProcess.LockFeatureMap.Comment)){t.next=2;break}return t.abrupt("return");case 2:if(e.canSendComment()){t.next=5;break}return e.triggerCommentCheck(),t.abrupt("return");case 5:return n="",t.prev=6,t.next=9,new Promise(function(e,t){wx.chooseMedia({count:1,mediaType:["image"],sourceType:["album","camera"],success:e,fail:t})});case 9:if(r=t.sent,null!=(a=null==r||null===(o=r.tempFiles)||void 0===o?void 0:o[0])&&a.tempFilePath){t.next=13;break}return t.abrupt("return");case 13:if(i=a.fileType&&a.fileType.includes("/")?a.fileType:(0,_utils.getImageMimeType)(a.tempFilePath),_comment.IMAGE_COMMENT_LIMIT.mimeTypes.includes(i)){t.next=17;break}return wx.showToast({title:"仅支持 PNG/JPG/JPEG 图片",icon:"none"}),t.abrupt("return");case 17:if(!(a.size>_comment.IMAGE_COMMENT_LIMIT.size)){t.next=20;break}return wx.showToast({title:"请选择大小小于8M的图片",icon:"none"}),t.abrupt("return");case 20:if(e.checkSendInterval()){t.next=22;break}return t.abrupt("return");case 22:return n="image_".concat(Date.now()),s=e.store.get("userInfo"),c=s.userId,l=s.username,u=s.levelId,m=e.buildCommentTeaPayload({TextContent:a.tempFilePath,ContentType:_comment.MessageContentType.Photo,LocalId:n,source:"imageUpload",fileSize:a.size,mimeType:i}),e.showMockComment(_constants.CommentType.Mock,{TextContent:a.tempFilePath,ContentType:_comment.MessageContentType.Photo,LocalId:n,username:l,userId:c,levelId:u,uploadStatus:_constants.UploadStatus.Uploading,TextContentExtra:[a.tempFilePath]}),e.closeEditor(),d=e.store.get("mainInfo"),h=d.activityId,e.reportCommentTea("mini_sdk_comment_image_upload",_objectSpread(_objectSpread({},m),{},{stage:"start"})),t.next=31,(0,_imageUpload.uploadCommentImage)({sdkInstance:e.sdkInstance,activityId:h,filePath:a.tempFilePath,fileName:a.tempFilePath.split("/").pop()||"comment-image.png",userId:c});case 31:return p=t.sent,e.updateMockComment(n,{TextContent:p.uri,TextContentExtra:[a.tempFilePath],_uploadStatus_:_constants.UploadStatus.Success}),e.reportCommentTea("mini_sdk_comment_image_upload",_objectSpread(_objectSpread({},m),{},{stage:"success"})),t.next=36,e.sendComment({TextContent:p.uri,ContentType:_comment.MessageContentType.Photo,md5:p.md5,LocalId:n});case 36:t.next=46;break;case 38:if(t.prev=38,t.t0=t.catch(6),!(0,_utils.isChooseImageCancelled)(t.t0)){t.next=42;break}return t.abrupt("return");case 42:n&&e.updateMockComment(n,{_uploadStatus_:_constants.UploadStatus.Failed}),e.reportCommentTea("mini_sdk_comment_image_upload",_objectSpread(_objectSpread({},e.buildCommentTeaPayload({TextContent:"",ContentType:_comment.MessageContentType.Photo,LocalId:n,source:"imageUpload"})),{},{stage:"fail",errorMessage:(null===t.t0||void 0===t.t0?void 0:t.t0.message)||"图片发送失败",errorCode:(null===t.t0||void 0===t.t0?void 0:t.t0.code)||""})),console.error("upload image comment error",t.t0),wx.showToast({title:(null===t.t0||void 0===t.t0?void 0:t.t0.message)||"图片发送失败",icon:"none"});case 46:case"end":return t.stop()}},t,null,[[6,38]])}))()},selectEmoji:function(e){var t,n,o=this,r=e.currentTarget.dataset,a=r.setIndex,i=r.emojiIndex,s=null===(t=this._emojiSets)||void 0===t?void 0:t[a],c=null==s||null===(n=s.Emojis)||void 0===n?void 0:n[i];if(s&&c&&2!==c.EmojiStatus){var l=(0,_utils.getDisplayName)(c.EmojiName),u=(0,_utils.getDisplayName)(s.EmojiSetName),m=1===s.IsSystemEmojiSet?"[".concat(l,"]"):"[".concat(u,":").concat(l,"]");if(c.EmojiType!==_comment.EMOJI_TYPE.BIG&&s.EmojiSetType!==_comment.EMOJI_TYPE.BIG){var d="".concat(this.data.chatValue||"").concat(m);d.length>200||this.setData({chatValue:d,chatLength:d.length})}else{if(!this.checkSendInterval())return;this.sendComment({TextContent:String(c.EmojiId),ContentType:_comment.MessageContentType.BigEmoji}).then(function(){o.closeEditor()}).catch(function(e){console.error("send big emoji error",e),wx.showToast({title:(null==e?void 0:e.message)||"发送失败",icon:"none"})})}}},updateMockComment:function(e,t){var n=(this.store.get("chat.chatList")||[]).map(function(n){var o;return(null==n||null===(o=n.Extra)||void 0===o?void 0:o.LocalId)!==e?n:_objectSpread(_objectSpread({},n),{},{Extra:_objectSpread(_objectSpread({},n.Extra),t)})});this.store.set("chat.chatList",n)},finalizeMockComment:function(e,t){var n,o,r=this.store.get("chat.chatList")||[],a=null,i=r.map(function(n){var o,r,i,s,c,l;return(null==n||null===(o=n.Extra)||void 0===o?void 0:o.LocalId)!==e?n:a=_objectSpread(_objectSpread({},n),{},{isMock:!0,Common:_objectSpread(_objectSpread({},n.Common),{},{H5MsgId:null!==(r=null!==(i=t.H5MsgId)&&void 0!==i?i:null===(s=n.Common)||void 0===s?void 0:s.H5MsgId)&&void 0!==r?r:0,MsgId:t.H5MsgId?Number(t.H5MsgId):null===(c=n.Common)||void 0===c?void 0:c.MsgId}),Extra:_objectSpread(_objectSpread({},n.Extra),{},{TextContent:t.TextContent,ContentType:t.ContentType,md5:t.md5,IsOwn:1,_uploadStatus_:_constants.UploadStatus.Success,User:_objectSpread(_objectSpread({},(null===(l=n.Extra)||void 0===l?void 0:l.User)||{}),{},{Nickname:t.username,UserId:t.userId,LevelId:t.levelId,AvatarUrl:t.avatarUrl||""})})})});this.store.set("chat.chatList",i),a&&this.store.set("chat.addComment",{data:[a],isSend:!0});var s=(0,_autoReply.normalizeAutoReplyInfo)(t.AutoReply,null===(n=a)||void 0===n||null===(o=n.Common)||void 0===o?void 0:o.MsgId);s&&a&&(0,_autoReply.scheduleAutoReplyFallback)(this.store,s,a)},showMockComment:function(e,t){var n,o,r,a=Date.now(),i={isMock:!0,Common:{MsgId:a,CreateTime:a,H5MsgId:String(a)},Extra:{ContentType:null!==(n=t.ContentType)&&void 0!==n?n:_comment.MessageContentType.Text,TextContent:t.TextContent,TextContentExtra:t.TextContentExtra||[],LocalId:t.LocalId,md5:t.md5,User:{Nickname:"",Email:""},IsDelete:!1,TextContentCn:"",IsSilence:0,TextContentEn:"",TextContentJp:"",TextContentKo:"",IsSelfLike:!1,LikeCount:0,IsPresenter:!0,_operationInfo_:null,_uploadStatus_:t.uploadStatus||_constants.UploadStatus.Success}};e===_constants.CommentType.MuteAll&&(i.Extra.TextContent=t.IsSendCommentEnable?"主持人已开启互动聊天":"主持人已关闭互动聊天",i.Extra._operationInfo_={IsSendCommentEnable:t.IsSendCommentEnable}),e===_constants.CommentType.Welcome&&(i.Extra.TextContent=t.WelcomeContent,i.Extra.User.Nickname=t.WelcomeTitle,i.Extra._welcomeInfo_={IsWelcomeEnable:!0}),e===_constants.CommentType.Mock&&(i.Common.H5MsgId=null!==(o=t.H5MsgId)&&void 0!==o?o:0,i.Common._formerMsgId_=null!==(r=t._formerMsgId_)&&void 0!==r?r:0,i.Common.MsgId=t.H5MsgId?Number(t.H5MsgId):a,i.Extra.IsPresenter=!1,i.Extra.IsOwn=1,i.Extra.User={Nickname:t.username,UserId:t.userId,LevelId:t.levelId,AvatarUrl:t.avatarUrl||""});var s={Data:[i],HotData:null,ImageFileDownloadInfo:null};this.sdkInstance.updateComment(s,!0);var c=(0,_autoReply.normalizeAutoReplyInfo)(t.AutoReply,i.Common.MsgId);c&&(0,_autoReply.scheduleAutoReplyFallback)(this.store,c,i)}}}); \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.json b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.json deleted file mode 100644 index 53b2673..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.json +++ /dev/null @@ -1 +0,0 @@ -{"component":true,"usingComponents":{"thumb-button":"../../thumb/thumb-button/index"}} \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.wxml b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.wxml deleted file mode 100644 index ba399a4..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.wxml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - {{chatLength}}/200 - - - - - - - - - - - - - 关闭 - 发送 - - - - - - - - {{section.title}} - - - - - - - - - - - - - - - - - - - - {{chatValue || (IsSendCommentEnable === 2 ? '主持人暂未开启互动聊天' : CommentConfig.InputBoxPrompt)}} - - - - - - - - - - - - - - - - - diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.wxss b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.wxss deleted file mode 100644 index 5bfab8f..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/chat-edit.wxss +++ /dev/null @@ -1 +0,0 @@ -.comment-wrapper{margin:0 28rpx 10rpx 28rpx;position:relative;z-index:1103}.chat-edit-drawer-mask{position:fixed;inset:0;background:rgba(0,0,0,.24);z-index:1100}.comment-wrapper-landscape,.comment-wrapper-portrait{width:auto}.chat-edit-drawer{width:100%}.chat-edit-drawer-open{position:fixed;left:0;right:0;bottom:0;z-index:1103;background:#fff;padding:18rpx 16rpx 0;box-sizing:border-box;padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom)}.chat-edit-row{display:flex;align-items:flex-end;margin-top:12rpx}.comment-wrapper-large{margin-bottom:16rpx}.chat-edit-shell{flex:1;border-radius:46rpx;background:rgba(0,0,0,.14);padding:0 16rpx 0 28rpx;box-sizing:border-box;overflow:hidden}.chat-edit-shell-open{border-radius:20rpx;background:#f3f4f6;padding:18rpx 18rpx 16rpx}.chat-edit-shell-active{min-height:224rpx;box-shadow:0 -4rpx 18rpx rgba(29,33,41,.06)}.chat-edit-main{display:flex;align-items:center;min-height:72rpx;min-width:0;width:100%;overflow:hidden}.chat-edit-input-wrap{flex:1;min-width:0;position:relative;overflow:hidden}.chat-edit-input{width:100%;height:calc(72rpx + .5 * (1rem - 16px));min-height:calc(72rpx + .5 * (1rem - 16px));min-width:0;color:#fff;font-size:calc(28rpx + .5 * (1rem - 16px));line-height:calc(40rpx + .5 * (1rem - 16px));padding:16rpx 0;box-sizing:border-box;background:0 0;overflow:hidden}.chat-edit-input-preview{display:flex;align-items:center;flex:1;height:calc(72rpx + .5 * (1rem - 16px));min-height:calc(72rpx + .5 * (1rem - 16px));min-width:0;color:#fff;font-size:calc(28rpx + .5 * (1rem - 16px));line-height:calc(40rpx + .5 * (1rem - 16px));padding:16rpx 0;box-sizing:border-box;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.chat-edit-input-preview-placeholder{color:rgba(255,255,255,.72)}.chat-edit-shell-active .chat-edit-main{align-items:flex-start;min-height:112rpx}.chat-edit-shell-active .chat-edit-input{height:calc(112rpx + .5 * (1rem - 16px));min-height:calc(112rpx + .5 * (1rem - 16px));color:#1d2129;font-size:calc(32rpx + .5 * (1rem - 16px));line-height:calc(46rpx + .5 * (1rem - 16px));padding:14rpx 0 0}.chat-edit-input-large{font-size:calc(34rpx + .5 * (1rem - 16px))}.chat-edit-input-placeholder{color:rgba(255,255,255,.72)}.chat-edit-input-placeholder-active{color:#d0d4dc;font-size:calc(32rpx + .5 * (1rem - 16px));line-height:calc(46rpx + .5 * (1rem - 16px))}.chat-edit-actions{display:flex;align-items:center;margin-left:12rpx}.chat-edit-icon{width:56rpx;height:56rpx;display:flex;align-items:center;justify-content:center;margin-left:12rpx}.chat-edit-icon-image{width:calc(40rpx + .5 * (1rem - 16px));height:calc(40rpx + .5 * (1rem - 16px))}.chat-edit-toolbar{display:flex;align-items:flex-end;flex:0 0 auto;margin-left:12rpx}.chat-edit-footer{display:flex;align-items:flex-end;justify-content:space-between;margin-top:14rpx;min-height:60rpx;padding-top:10rpx}.chat-edit-counter{color:#4e5969;font-size:calc(20rpx + .5 * (1rem - 16px));line-height:calc(28rpx + .5 * (1rem - 16px));padding-bottom:10rpx}.chat-edit-footer-actions{display:flex;align-items:flex-end}.chat-edit-action-btn{width:60rpx;height:60rpx;border-radius:30rpx;background:#fff;display:flex;align-items:center;justify-content:center;margin-left:12rpx}.chat-edit-action-icon{width:calc(36rpx + .5 * (1rem - 16px));height:calc(36rpx + .5 * (1rem - 16px))}.chat-edit-close-btn{min-width:112rpx;height:calc(64rpx + .5 * (1rem - 16px));padding:0 28rpx;border-radius:40rpx;margin-left:12rpx;background:rgba(254,44,85,.08);color:#fe2c55;font-size:calc(28rpx + .5 * (1rem - 16px));font-weight:500;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.chat-edit-send-btn{min-width:112rpx;height:calc(64rpx + .5 * (1rem - 16px));padding:0 28rpx;border-radius:40rpx;margin-left:12rpx;background:#f7a3b3;color:#fff;font-size:calc(28rpx + .5 * (1rem - 16px));font-weight:500;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.chat-edit-send-btn-active{background:#ff3158;opacity:1}.chat-edit-send-btn-disabled{opacity:.55}.emoji-panel{margin-top:16rpx;border-radius:0;background:#fff;padding:8rpx 0 12rpx 0;box-sizing:border-box;position:relative;z-index:1102;overflow:hidden;flex:0 0 auto}.emoji-panel-active{margin-top:0}.keyboard-spacer{flex:0 0 auto;width:100%}.emoji-section{padding:8rpx 14rpx 18rpx 14rpx}.emoji-section-title{color:#1d2129;font-size:calc(22rpx + .5 * (1rem - 16px));line-height:calc(32rpx + .5 * (1rem - 16px));margin-bottom:12rpx;font-weight:600}.emoji-grid{display:flex;flex-wrap:wrap;margin:0 -2rpx}.emoji-item{width:12.5%;height:76rpx;display:flex;align-items:center;justify-content:center;margin-bottom:8rpx}.emoji-item-big{width:20%;height:88rpx}.emoji-item-dynamic{width:16.66%;height:92rpx}.emoji-image{width:56rpx;height:56rpx}.emoji-image-big{width:76rpx;height:76rpx}.emoji-image-dynamic{width:76rpx;height:76rpx} \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/constants.js b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/constants.js deleted file mode 100644 index f89e7e2..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/constants.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var CommentType={MuteAll:0,Welcome:2,Mock:3},UploadStatus={Uploading:"uploading",Failed:"failed",Success:"success"};module.exports={CommentType:CommentType,UploadStatus:UploadStatus}; \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/icons.js b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/icons.js deleted file mode 100644 index 6552ce4..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/icons.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var buildTriggerIcon=function(C){return"data:image/svg+xml;utf8,"+encodeURIComponent(C)},buildFilledTriggerIcon=function(C,_){return buildTriggerIcon(C.replace(/__FILL__/g,_))},EMOJI_TRIGGER_ICON_SVG='',KEYBOARD_TRIGGER_ICON_SVG='',IMAGE_TRIGGER_ICON_SVG='',EMOJI_TRIGGER_ICON=buildFilledTriggerIcon(EMOJI_TRIGGER_ICON_SVG,"rgba(255,255,255,0.92)"),EMOJI_TRIGGER_ICON_DARK=buildFilledTriggerIcon(EMOJI_TRIGGER_ICON_SVG,"rgba(29,33,41,0.72)"),KEYBOARD_TRIGGER_ICON=buildFilledTriggerIcon(KEYBOARD_TRIGGER_ICON_SVG,"rgba(255,255,255,0.92)"),KEYBOARD_TRIGGER_ICON_DARK=buildFilledTriggerIcon(KEYBOARD_TRIGGER_ICON_SVG,"rgba(29,33,41,0.72)"),IMAGE_TRIGGER_ICON=buildFilledTriggerIcon(IMAGE_TRIGGER_ICON_SVG,"rgba(255,255,255,0.92)"),IMAGE_TRIGGER_ICON_DARK=buildFilledTriggerIcon(IMAGE_TRIGGER_ICON_SVG,"rgba(29,33,41,0.72)");module.exports={EMOJI_TRIGGER_ICON:EMOJI_TRIGGER_ICON,EMOJI_TRIGGER_ICON_DARK:EMOJI_TRIGGER_ICON_DARK,KEYBOARD_TRIGGER_ICON:KEYBOARD_TRIGGER_ICON,KEYBOARD_TRIGGER_ICON_DARK:KEYBOARD_TRIGGER_ICON_DARK,IMAGE_TRIGGER_ICON:IMAGE_TRIGGER_ICON,IMAGE_TRIGGER_ICON_DARK:IMAGE_TRIGGER_ICON_DARK}; \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/utils.js b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/utils.js deleted file mode 100644 index 3c9b4c1..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-edit/utils.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function ownKeys(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,i)}return o}function _objectSpread(e){for(var t=1;t0&&r.push({key:"system-dynamic-".concat(n.EmojiSetId||0),title:"动态",type:"system-dynamic",isDynamic:!0,emojis:s}),m.length>0&&r.push({key:"system-all-".concat(n.EmojiSetId||0),title:"全部",type:"system-default",emojis:m})}return i.forEach(function(e){var t=e.emojiSet,o=e.setIndex,i=(t.Emojis||[]).map(function(e,t){return _objectSpread(_objectSpread({},e),{},{_setIndex_:o,_emojiIndex_:t})}).filter(function(e){return 2!==(null==e?void 0:e.EmojiStatus)});i.length&&r.push({key:"custom-".concat(t.EmojiSetId||o),title:getDisplayName(t.EmojiSetName),type:t.EmojiSetType===EMOJI_TYPE.BIG?"custom-big":"custom-small",emojis:i})}),r},getImageMimeType=function(e){var t=String(e||"").toLowerCase();return t.endsWith(".png")?"image/png":t.endsWith(".jpg")?"image/jpg":t.endsWith(".jpeg")?"image/jpeg":""},isChooseImageCancelled=function(e){return String((null==e?void 0:e.errMsg)||(null==e?void 0:e.message)||"").toLowerCase().includes("cancel")};module.exports={getDisplayName:getDisplayName,buildEmojiPanelSections:buildEmojiPanelSections,getImageMimeType:getImageMimeType,isChooseImageCancelled:isChooseImageCancelled}; \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.js b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.js deleted file mode 100644 index 592bfa2..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var _constant=require("../../../utils/constant"),_comment=require("../../../utils/comment"),_autoReply=require("../../../utils/autoReply"),_notification=require("../../../utils/notification"),_theme=require("../../../utils/theme"),_utils=_interopRequireDefault(require("../../../utils/utils"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return t};var t={},e=Object.prototype,o=e.hasOwnProperty,r=Object.defineProperty||function(t,e,o){t[e]=o.value},n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",l=n.toStringTag||"@@toStringTag";function s(t,e,o){return Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,o){return t[e]=o}}function u(t,e,o,n){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype),l=new A(n||[]);return r(a,"_invoke",{value:I(t,o,l)}),a}function c(t,e,o){try{return{type:"normal",arg:t.call(e,o)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var d={};function h(){}function f(){}function m(){}var p={};s(p,i,function(){return this});var v=Object.getPrototypeOf,_=v&&v(v(L([])));_&&_!==e&&o.call(_,i)&&(p=_);var y=m.prototype=h.prototype=Object.create(p);function g(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function C(t,e){function n(r,i,a,l){var s=c(t[r],t,i);if("throw"!==s.type){var u=s.arg,d=u.value;return d&&"object"==_typeof(d)&&o.call(d,"__await")?e.resolve(d.__await).then(function(t){n("next",t,a,l)},function(t){n("throw",t,a,l)}):e.resolve(d).then(function(t){u.value=t,a(u)},function(t){return n("throw",t,a,l)})}l(s.arg)}var i;r(this,"_invoke",{value:function(t,o){function r(){return new e(function(e,r){n(t,o,e,r)})}return i=i?i.then(r,r):r()}})}function I(t,e,o){var r="suspendedStart";return function(n,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===n)throw i;return{value:void 0,done:!0}}for(o.method=n,o.arg=i;;){var a=o.delegate;if(a){var l=R(a,o);if(l){if(l===d)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===r)throw r="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);r="executing";var s=c(t,e,o);if("normal"===s.type){if(r=o.done?"completed":"suspendedYield",s.arg===d)continue;return{value:s.arg,done:o.done}}"throw"===s.type&&(r="completed",o.method="throw",o.arg=s.arg)}}}function R(t,e){var o=e.method,r=t.iterator[o];if(void 0===r)return e.delegate=null,"throw"===o&&t.iterator.return&&(e.method="return",e.arg=void 0,R(t,e),"throw"===e.method)||"return"!==o&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+o+"' method")),d;var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var i=n.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,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function E(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 b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function L(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),s=o.call(i,"finallyLoc");if(l&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--e){var o=this.tryEntries[e];if(o.finallyLoc===t)return this.complete(o.completion,o.afterLoc),b(o),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc===t){var r=o.completion;if("throw"===r.type){var n=r.arg;b(o)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,o){return this.delegate={iterator:L(t),resultName:e,nextLoc:o},"next"===this.method&&(this.arg=void 0),d}},t}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,r=new Array(e);o40){var a=n.filter(_autoReply.shouldCountAddCommentForUnread);if(!a.length)return;o.setData({newCount:o.data.newCount+a.length,isShowMoreNote:!0})}},liveInfo:function(t){if(null!=t&&t.CommentConfig){var e=t.CommentConfig.PresenterName||DEFAULT_PRESENTER_NAME;_utils.default.setDataIfChanged(o,{PresenterName:e},function(){var t=o.store.get("chat.topComment")||[];o._refreshRenderedChatList(o.store.get("chat.chatList")||[],t),o.setData({topComment:o._getProcessedTopComment(t)})})}if(null!=t&&t.Basic){var r,n=null!==(r=null==t?void 0:t.Basic)&&void 0!==r?r:{},i=n.ViewerLevelConfig,a=n.IsAvatarShowEnable,l=(0,_theme.resolveLiveThemeConfig)(t.Basic),s=o.data.isLandscape||1===Number(t.Basic.IsColorSync),u=(0,_theme.resolveLiveThemeConfig)({ColorThemeIndex:"dark"}),c=s?l.PresenterChatColor:DEFAULT_PRESENTER_TAG_BACKGROUND_COLOR,d=s?l:_objectSpread(_objectSpread({},l),{},{MobileChatBackgroundColor:"#000000",FontColor:"#FFFFFF",PresenterChatColor:u.PresenterChatColor}),h={MobileChatBackgroundColor:_utils.default.hexToRGBA(d.MobileChatBackgroundColor,"24"),PresenterChatColor:d.PresenterChatColor,PresenterTagBackgroundColor:c,FontColor:d.FontColor,InteractionColor:l.InteractionColor,ColorThemeIndex:l.ColorThemeIndex,IsUseDarkTheme:(0,_theme.isUseDarkTheme)(t.Basic)};(0,_theme.isThemeStateChanged)(h,o.data,_theme.CHAT_THEME_STATE_KEYS)&&o.setData(h);var f=1===(null==i?void 0:i.IsViewerLevelEnable),m=(null==i?void 0:i.ViewerLevelMetas)||[];(o.data.isViewerLevelEnable!==f||JSON.stringify(o.data.viewerLevelMetas)!==JSON.stringify(m))&&o.setData({isViewerLevelEnable:f,viewerLevelMetas:m},function(){o._refreshRenderedChatList(o.store.get("chat.chatList")||[])});var p=(0,_notification.isOpenSwitch)(a);_utils.default.setDataIfChanged(o,{showAvatar:p},function(){o._refreshRenderedChatList(o.store.get("chat.chatList")||[])}),(0,_notification.syncNotificationState)(o.store,t)}},"notification.isNotificationOpen":function(t){_utils.default.setDataIfChanged(o,{systemNoticeVisible:!!t})}})}},chatList:function(t){}},methods:{_capChatList:function(t){return t.length>_constant.MAX_CHAT_COUNT?t.slice(-_constant.MAX_CHAT_COUNT):t},_getProcessedTopComment:function(t){var e=this._processChatListWithLevel(t||[]);return this._normalizeRenderedChatList(e)},_getDeletedMsgIdSet:function(){return new Set((this.store.get("chat.deletedMsgIds")||[]).map(this._normalizeMsgId).filter(Boolean))},_filterVisibleChatItems:function(t,e){var o=this,r=this._getDeletedMsgIdSet();return(t||[]).filter(function(n){var i,a,l;return!(null!==(i=n.Extra)&&void 0!==i&&i.IsDelete||(null==n||null===(a=n.Common)||void 0===a?void 0:a.MsgId)===e||!(null!==(l=n.Extra)&&void 0!==l&&l.TextContent||(0,_autoReply.isAutoReplyComment)(n))||!(0,_autoReply.isAutoReplyAnchorVisible)(n,t)||o._getItemMsgIds(n).some(function(t){return r.has(t)}))})},_getDerivedListState:function(t,e){var o=this._capChatList(this._filterVisibleChatItems(t,e));return{chatList:this._normalizeRenderedChatList(this._processChatListWithLevel(o)),filterListCount:this._capChatList(o.filter(function(t){var e,o;return!(null!==(e=t.Extra)&&void 0!==e&&e._welcomeInfo_||null!==(o=t.Extra)&&void 0!==o&&o._operationInfo_)})).length}},_getProcessedChatList:function(t){var e,o,r,n,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.store.get("chat.topComment")||[],l=(null===(e=this.data.topComment)||void 0===e||null===(o=e[0])||void 0===o||null===(r=o.Common)||void 0===r?void 0:r.MsgId)||(null==a||null===(n=a[0])||void 0===n||null===(i=n.Common)||void 0===i?void 0:i.MsgId),s=this._capChatList(this._filterVisibleChatItems(t,l));return this._normalizeRenderedChatList(this._processChatListWithLevel(s))},updateEmojiMap:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.keys(this._emojiMap||{}).length>0,o=Object.keys(t).length>0;this._emojiMap=t,(e||o)&&this._refreshChatState()},_getDerivedChatState:function(t,e){var o,r,n=this._getProcessedTopComment(e),i=null===(o=n[0])||void 0===o||null===(r=o.Common)||void 0===r?void 0:r.MsgId,a=this._getDerivedListState(t,i);return{topComment:n,chatList:a.chatList,filterListCount:a.filterListCount}},_refreshChatListState:function(t){var e,o,r,n,i,a=this,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.store.get("chat.topComment")||[],s=(null===(e=this.data.topComment)||void 0===e||null===(o=e[0])||void 0===o||null===(r=o.Common)||void 0===r?void 0:r.MsgId)||(null==l||null===(n=l[0])||void 0===n||null===(i=n.Common)||void 0===i?void 0:i.MsgId),u=this._getDerivedListState(t,s);return this.setData(u,function(){a._markInitialCommentRendered()}),u},_markInitialCommentRendered:function(){var t,e,o,r;null===(t=this.store)||void 0===t||null===(e=t.get)||void 0===e||!e.call(t,"ui.commentInitialDataLoaded")||null!==(o=this.store)&&void 0!==o&&null!==(r=o.get)&&void 0!==r&&r.call(o,"ui.commentInitialRendered")||this.store.set("ui.commentInitialRendered",!0)},_refreshRenderedChatList:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.store.get("chat.topComment")||[],o=this._getProcessedChatList(t,e);return this.setData({chatList:o}),o},_refreshImageRenderState:function(){var t,e,o=(null===(t=this.store)||void 0===t?void 0:t.get("chat.chatList"))||[],r=(null===(e=this.store)||void 0===e?void 0:e.get("chat.topComment"))||[];this.setData({chatList:this._getProcessedChatList(o,r),topComment:this._getProcessedTopComment(r)})},_refreshChatState:function(){var t,e,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this._getDerivedChatState(null!==(t=o.chatList)&&void 0!==t?t:this.store.get("chat.chatList")||[],null!==(e=o.topComment)&&void 0!==e?e:this.store.get("chat.topComment")||[]);return this.setData(r),r},handleTopCommentTap:function(){var t,e,o=null===(t=this.data.topComment)||void 0===t?void 0:t[0],r=null==o||null===(e=o.Extra)||void 0===e?void 0:e._renderType_;o&&"photo"!==r&&"big-emoji"!==r&&this.setData({topCommentPopupVisible:!0})},closeTopCommentPopup:function(){this.data.topCommentPopupVisible&&this.setData({topCommentPopupVisible:!1})},catchNone:function(){},onTopCommentDrawerClose:function(){this.closeTopCommentPopup()},newCountClick:function(){this.scrollToBottom(),this.setData({newCount:0,isShowMoreNote:!1})},scrollToBottom:function(){var t=this;setTimeout(function(){var e,o,r,n=null===(e=t.data.chatList)||void 0===e?void 0:e.length;_utils.default.setDataIfChanged(t,{scrollIntoViewId:"view"+(null===(o=t.data.chatList[n-1])||void 0===o||null===(r=o.Common)||void 0===r?void 0:r.MsgId)})},500)},getHistoryList:function(){var t=this;return _asyncToGenerator(_regeneratorRuntime().mark(function e(){var o,r,n,i,a,l,s,u,c,d,h,f,m,p,v,_,y,g,C,I,R,E,b;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=t.data,i=n.hasHistory,a=n.loading,l=t.store.get("mainInfo"),(s=l.activityId)&&i&&!a){e.next=5;break}return e.abrupt("return");case 5:if(!((null==(u=t.store.get("chat.chatList")||[])?void 0:u.length)>=_constant.MAX_CHAT_COUNT)){e.next=9;break}return t.setData({loading:!1,hasHistory:!1}),e.abrupt("return");case 9:return c=t.store.get("userInfo"),d=c.userId,h={ActivityId:s,Id:t.store.get("chat.commentStartId"),UserId:d,Count:25,Status:2,Context:""},t.setData({loading:!0}),e.next=14,t.sdkInstance.request(_constant.REQUEST_URL_MAP.SEARCH_COMMENT,{method:"GET",data:h});case 14:f=e.sent,(m=(null==f?void 0:f.Data)||[]).reverse(),p=new Set((t.store.get("chat.deletedMsgIds")||[]).map(t._normalizeMsgId).filter(Boolean)),v=m.filter(function(e){return!u.some(function(o){var r,n;return t._normalizeMsgId(null===(r=o.Common)||void 0===r?void 0:r.MsgId)===t._normalizeMsgId(null===(n=e.Common)||void 0===n?void 0:n.MsgId)})&&!t._getItemMsgIds(e).some(function(t){return p.has(t)})}),m.length&&(g=t.store.get("userInfo.userId"),C=(0,_autoReply.suppressAutoReplyPanelOnInit)((0,_autoReply.expandAutoReplyComments)(v,g,u,!0),!0),I=C.filter(function(t){return!(0,_autoReply.isAutoReplyComment)(t)}),R=C.filter(_autoReply.isAutoReplyComment),E=(0,_autoReply.mergeAutoReplyByAnchor)([].concat(_toConsumableArray(I),_toConsumableArray(u)),R),b=E.length>_constant.MAX_CHAT_COUNT?E.slice(-_constant.MAX_CHAT_COUNT):E,t.store.set("chat.chatList",b),t.store.set("chat.commentStartId",null===(_=m[0])||void 0===_||null===(y=_.Common)||void 0===y?void 0:y.MsgId)),t.setData({loading:!1,hasHistory:m.length>=25,scrollIntoViewId:"view"+((null===(o=v[v.length-1])||void 0===o||null===(r=o.Common)||void 0===r?void 0:r.MsgId)||"")}),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(0),console.error("error",e.t0),t.setData({loading:!1});case 27:case"end":return e.stop()}},e,null,[[0,23]])}))()},bindscroll:function(t){var e=t.detail||{},o=e.scrollHeight,r=e.scrollTop;this.data.scrollHeight=o-r-this.data.scrollViewHeight,this.data.scrollHeight<40&&this.data.newCount&&this.setData({newCount:0,isShowMoreNote:!1})},getLevelMeta:function(t){if(!this.data.isViewerLevelEnable||!t)return null;var e=String(t);return this.data.viewerLevelMetas.find(function(t){return String(t.LevelId)===e})||null},previewCommentImage:function(t){var e=t.currentTarget.dataset.src;e&&this.triggerEvent("previewimage",{src:e})},handleCommentImageLoad:function(t){var e=this,o=t.detail||{},r=o.width,n=o.height,i=t.currentTarget.dataset||{},a=i.msgId,l=i.src;if(r&&n&&(a||l)){var s=this.buildImageStyle(r,n),u=_objectSpread(_objectSpread(_objectSpread({},this.data.imageStyleMap),a?_defineProperty({},"msg_".concat(a),s):{}),l?_defineProperty({},"src_".concat(l),s):{});(this.data.imageStyleMap["msg_".concat(a)]||this.data.imageStyleMap["src_".concat(l)])!==s&&this.setData({imageStyleMap:u},function(){e._refreshImageRenderState()})}},buildImageStyle:function(t,e){if(!t||!e)return DEFAULT_IMAGE_STYLE;var o=t/e,r=MAX_IMAGE_WIDTH_RPX,n=Math.round(r/o);return n>MAX_IMAGE_HEIGHT_RPX&&(n=MAX_IMAGE_HEIGHT_RPX,r=Math.round(n*o)),r=Math.max(MIN_IMAGE_SIZE_RPX,r),n=Math.max(MIN_IMAGE_SIZE_RPX,n),"width: ".concat(r,"rpx; height: ").concat(n,"rpx;")},handleAvatarError:function(t){var e=this,o=t.currentTarget.dataset||{},r=o.msgId,n=o.src;if(r||n){var i=_objectSpread(_objectSpread(_objectSpread({},this.data.avatarErrorMap),r?_defineProperty({},"msg_".concat(r),!0):{}),n?_defineProperty({},"src_".concat(n),!0):{});r&&this.data.avatarErrorMap["msg_".concat(r)]||n&&this.data.avatarErrorMap["src_".concat(n)]||this.setData({avatarErrorMap:i},function(){var t;e._refreshRenderedChatList((null===(t=e.store)||void 0===t?void 0:t.get("chat.chatList"))||[])})}},_normalizeRenderedChatList:function(t){var e=this;return(t||[]).map(function(t){return e._normalizeRenderedChatItem(t)})},_normalizeRenderedChatItem:function(t){var e,o,r,n,i,a,l,s,u,c,d=(0,_comment.normalizeCommentItem)(t,{emojiMap:this._emojiMap||{}}),h=null==d||null===(e=d.Extra)||void 0===e?void 0:e._previewSrc_,f=this.data.imageStyleMap["msg_".concat(null==d||null===(o=d.Common)||void 0===o?void 0:o.MsgId)]||this.data.imageStyleMap["src_".concat(h)]||("photo"===(null==d||null===(r=d.Extra)||void 0===r?void 0:r._renderType_)?DEFAULT_IMAGE_STYLE:""),m=(0,_autoReply.buildAutoReplyDisplayMeta)(d),p=(null==d||null===(n=d.Extra)||void 0===n||null===(i=n.User)||void 0===i?void 0:i.AvatarUrl)||"",v=this.data.avatarErrorMap["msg_".concat(null==d||null===(a=d.Common)||void 0===a?void 0:a.MsgId)]||this.data.avatarErrorMap["src_".concat(p)],_=null!=d&&null!==(l=d.Extra)&&void 0!==l&&l.IsPresenter?DEFAULT_PRESENTER_AVATAR_URL:DEFAULT_AUDIENCE_AVATAR_URL,y=null!=d&&null!==(s=d.Extra)&&void 0!==s&&s.IsPresenter?this.data.PresenterName||DEFAULT_PRESENTER_NAME:"";return _objectSpread(_objectSpread({},d),{},{id:(null==d||null===(u=d.Common)||void 0===u?void 0:u.MsgId)||(null==d||null===(c=d.Common)||void 0===c?void 0:c.H5MsgId)||(null==d?void 0:d.id),Extra:_objectSpread(_objectSpread({},d.Extra),{},{_imageStyle_:f,_avatarUrl_:p,_avatarLoadFailed_:!!v,_avatarDefaultUrl_:_,_presenterNickname_:y,_systemNoticeInfo_:this.isSystemNoticeItem(d)},m?{_autoReplyDisplay_:m}:{})})},_clearAutoReplyNoticeTimer:function(){null!=this._autoReplyNoticeTimer&&(clearTimeout(this._autoReplyNoticeTimer),this._autoReplyNoticeTimer=null)},_dismissAutoReplyNotice:function(t){this._clearAutoReplyNoticeTimer(),this.setData({autoReplyNoticeVisible:!1,autoReplyNoticeItem:null,dismissedAutoReplyId:t||this.data.dismissedAutoReplyId})},_tryShowAutoReplyNotice:function(t){for(var e,o=this,r=this.store.get("chat.chatList")||[],n=function(){var e,n=t[i],a=null==n||null===(e=n.Extra)||void 0===e?void 0:e._autoReplyInfo_;if(null==a||!a.IsAutoReply||!a.AutoShowPanel)return 0;if(!(0,_autoReply.isAutoReplyAnchorVisible)(n,r))return 0;var l=a.AutoReplyId;if(!l||o.data.dismissedAutoReplyId===l)return{v:void 0};var s=o._normalizeRenderedChatItem(n);return o._clearAutoReplyNoticeTimer(),o.setData({autoReplyNoticeVisible:!0,autoReplyNoticeItem:s,autoReplyPanelVisible:!1,autoReplyPanelItem:null}),o._autoReplyNoticeTimer=setTimeout(function(){o._dismissAutoReplyNotice(l)},1e3*_autoReply.AUTO_REPLY_DISPLAY.AUTO_DISMISS_SECONDS),{v:void 0}},i=t.length-1;i>=0;i-=1)if(0!==(e=n())&&e)return e.v},_openAutoReplyPanel:function(t){var e,o;null!=t&&null!==(e=t.Extra)&&void 0!==e&&null!==(o=e._autoReplyInfo_)&&void 0!==o&&o.IsAutoReply&&this.setData({autoReplyPanelVisible:!0,autoReplyPanelItem:t})},onAutoReplyTap:function(t){var e,o,r=t.currentTarget.dataset.item;if(null!=r&&null!==(e=r.Extra)&&void 0!==e&&null!==(o=e._autoReplyInfo_)&&void 0!==o&&o.IsAutoReply){var n=this._normalizeRenderedChatItem(r);this._openAutoReplyPanel(n)}},onAutoReplyNoticeView:function(){var t,e,o=this.data.autoReplyNoticeItem;if(o){var r=null==o||null===(t=o.Extra)||void 0===t||null===(e=t._autoReplyInfo_)||void 0===e?void 0:e.AutoReplyId;this._dismissAutoReplyNotice(r),this._openAutoReplyPanel(o)}},closeAutoReplyNotice:function(){var t,e,o,r=null===(t=this.data.autoReplyNoticeItem)||void 0===t||null===(e=t.Extra)||void 0===e||null===(o=e._autoReplyInfo_)||void 0===o?void 0:o.AutoReplyId;this._dismissAutoReplyNotice(r)},closeAutoReplyPanel:function(){this.data.autoReplyPanelVisible&&this.setData({autoReplyPanelVisible:!1,autoReplyPanelItem:null})},isSystemNoticeItem:function(t){var e=(null==t?void 0:t.Extra)||{};if(e._welcomeInfo_||e._operationInfo_)return!1;var o=String(e.MessageType||e.MsgType||e.NoticeType||e.SystemType||"").toLowerCase();return 1===e.IsSystemNotice||1===e.IsSystemNotification||o.includes("systemnotice")||o.includes("notification")},_processChatListWithLevel:function(t){var e,o=this;if(!this.data.isViewerLevelEnable||!t||!t.length)return t;var r=null===(e=this.store)||void 0===e?void 0:e.get("userInfo.levelId");return t.map(function(t){var e,n,i,a=1===(null==t||null===(e=t.Extra)||void 0===e?void 0:e.IsOwn),l=null==t||null===(n=t.Extra)||void 0===n||null===(i=n.User)||void 0===i?void 0:i.LevelId,s=a&&!l?r:l;if(!s)return t;var u=o.getLevelMeta(s);return u?_objectSpread(_objectSpread({},t),{},{Extra:_objectSpread(_objectSpread({},t.Extra),{},{_levelMeta_:u})}):t})}}}); \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.json b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.json deleted file mode 100644 index 4e80c32..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.json +++ /dev/null @@ -1 +0,0 @@ -{"component":true,"usingComponents":{"mp-icon":"weui-miniprogram/icon/icon","product-message":"../../product-message/product-message"}} \ No newline at end of file diff --git a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.wxml b/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.wxml deleted file mode 100644 index 4181d75..0000000 --- a/miniprogram/package-live/volc-mini-sdk/components/chat/chat-list/chat-list.wxml +++ /dev/null @@ -1,449 +0,0 @@ - - -