diff --git a/src/components/pk-mini/PkAppaside.vue b/src/components/pk-mini/PkAppaside.vue index d52516e..56a5a56 100644 --- a/src/components/pk-mini/PkAppaside.vue +++ b/src/components/pk-mini/PkAppaside.vue @@ -22,18 +22,12 @@ - -
- - -
-
{{ userInfo.nickName || '用户' }}
- - -
-
+ +
+
@@ -207,49 +201,37 @@ onMounted(() => { line-height: 18px; } -.avatar-section { +.sign-in-section { margin-top: auto; } -.avatar-img { - width: 50px; - height: 50px; - border-radius: 50%; +.sign-in-btn { + width: 60px; + height: 60px; + border-radius: 12px; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; cursor: pointer; - border: 2px solid white; transition: all 0.3s ease; + background: rgba(255, 255, 255, 0.1); } -.avatar-img:hover { - transform: scale(1.1); - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); +.sign-in-btn:hover { + background: rgba(255, 255, 255, 0.9); + transform: scale(1.05); } -.avatar-menu { - user-select: none; -} - -.avatar-name { - padding: 10px; - text-align: center; - font-weight: bold; - color: #333; - border-bottom: 1px solid #eee; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.menu-item { - padding: 12px; - text-align: center; - color: #666; - cursor: pointer; - transition: background 0.2s; -} - -.menu-item:hover { - background-color: #f5f5f5; +.sign-icon { + font-size: 24px; color: #03aba8; } + +.sign-text { + font-size: 10px; + color: #03aba8; + margin-top: 4px; + font-weight: bold; +} diff --git a/src/components/pk-mini/mine/PointsList.vue b/src/components/pk-mini/mine/PointsList.vue index a554fe3..d5bb950 100644 --- a/src/components/pk-mini/mine/PointsList.vue +++ b/src/components/pk-mini/mine/PointsList.vue @@ -2,7 +2,7 @@
- +
我的积分: {{ currentUser.points || 0 }}
diff --git a/src/config/pk-mini.js b/src/config/pk-mini.js new file mode 100644 index 0000000..fcfbe05 --- /dev/null +++ b/src/config/pk-mini.js @@ -0,0 +1,26 @@ +/** + * PK Mini 模块配置 + * + * GoEasy 续费后,将 GOEASY_ENABLED 改为 true 即可开启消息功能 + */ + +export const PK_MINI_CONFIG = { + // GoEasy 开关 - 续费后改为 true + GOEASY_ENABLED: true, + + // GoEasy 配置 + GOEASY: { + HOST: 'hangzhou.goeasy.io', + APP_KEY: 'BC-a88037e060ed4753bb316ac7239e62d9', + }, + + // API 基础地址 + API_BASE_URL: 'http://192.168.2.22:8086/', + // API_BASE_URL: 'https://pk.hanxiaokj.cn/', + + // 头像 CDN 地址 + AVATAR_CDN_PREFIX: 'https://vv-1317974657.cos.ap-shanghai.myqcloud.com/headerIcon/', +} + +// 快捷访问 +export const isGoEasyEnabled = () => PK_MINI_CONFIG.GOEASY_ENABLED diff --git a/src/utils/pk-mini/goeasy.js b/src/utils/pk-mini/goeasy.js index 4e771b8..e468191 100644 --- a/src/utils/pk-mini/goeasy.js +++ b/src/utils/pk-mini/goeasy.js @@ -1,15 +1,26 @@ +/** + * PK Mini 模块专用 GoEasy 实例 + * + * 使用前请确保在 src/config/pk-mini.js 中将 GOEASY_ENABLED 设为 true + */ import GoEasy from 'goeasy' import { pkIMloginStore } from '@/stores/pk-mini/notice.js' +import { PK_MINI_CONFIG, isGoEasyEnabled } from '@/config/pk-mini.js' // PK Mini 模块专用 GoEasy 实例 let pkGoEasyInstance = null // 获取或创建 PK GoEasy 实例 export function getPkGoEasy() { + if (!isGoEasyEnabled()) { + console.warn('[PK GoEasy] GoEasy 未启用,请在 src/config/pk-mini.js 中设置 GOEASY_ENABLED: true') + return null + } + if (!pkGoEasyInstance) { pkGoEasyInstance = GoEasy.getInstance({ - host: 'hangzhou.goeasy.io', - appkey: 'PC-a88037e060ed4753bb316ac7239e62d9', + host: PK_MINI_CONFIG.GOEASY.HOST, + appkey: PK_MINI_CONFIG.GOEASY.APP_KEY, modules: ['im'] }) } @@ -18,11 +29,19 @@ export function getPkGoEasy() { // 初始化 PK GoEasy (在 PkMiniWorkbench 挂载时调用) export function initPkGoEasy() { + if (!isGoEasyEnabled()) { + console.warn('[PK GoEasy] GoEasy 未启用') + return null + } return getPkGoEasy() } // 链接 IM (登录 IM) export function goEasyLink(data) { + if (!isGoEasyEnabled()) { + return Promise.reject(new Error('GoEasy 未启用')) + } + const goeasy = getPkGoEasy() const counter = pkIMloginStore() return new Promise((resolve, reject) => { @@ -48,6 +67,10 @@ export function goEasyLink(data) { // 断开 IM export function goEasyDisConnect() { + if (!isGoEasyEnabled()) { + return Promise.reject(new Error('GoEasy 未启用')) + } + const goeasy = getPkGoEasy() return new Promise((resolve, reject) => { goeasy.disconnect({ @@ -64,6 +87,10 @@ export function goEasyDisConnect() { // 获取会话列表 export function goEasyGetConversations() { + if (!isGoEasyEnabled()) { + return Promise.reject(new Error('GoEasy 未启用')) + } + const goeasy = getPkGoEasy() const im = goeasy.im return new Promise((resolve, reject) => { @@ -81,6 +108,10 @@ export function goEasyGetConversations() { // 获取指定会话的消息列表 export function goEasyGetMessages(data) { + if (!isGoEasyEnabled()) { + return Promise.reject(new Error('GoEasy 未启用')) + } + const goeasy = getPkGoEasy() const im = goeasy.im return new Promise((resolve, reject) => { @@ -102,6 +133,10 @@ export function goEasyGetMessages(data) { // 发送文本消息 export function goEasySendMessage(data) { + if (!isGoEasyEnabled()) { + return Promise.reject(new Error('GoEasy 未启用')) + } + const goeasy = getPkGoEasy() const im = goeasy.im let textMessage = im.createTextMessage({ @@ -128,6 +163,10 @@ export function goEasySendMessage(data) { // 发送图片消息 export function goEasySendImageMessage(data) { + if (!isGoEasyEnabled()) { + return Promise.reject(new Error('GoEasy 未启用')) + } + const goeasy = getPkGoEasy() const im = goeasy.im const message = im.createImageMessage({ @@ -154,6 +193,10 @@ export function goEasySendImageMessage(data) { // 发送 PK 消息 export function goEasySendPKMessage(data) { + if (!isGoEasyEnabled()) { + return Promise.reject(new Error('GoEasy 未启用')) + } + const goeasy = getPkGoEasy() const im = goeasy.im const customData = { @@ -194,6 +237,10 @@ export function goEasySendPKMessage(data) { // 消息已读 export function goEasyMessageRead(data) { + if (!isGoEasyEnabled()) { + return Promise.reject(new Error('GoEasy 未启用')) + } + const goeasy = getPkGoEasy() const im = goeasy.im return new Promise((resolve, reject) => { @@ -210,3 +257,6 @@ export function goEasyMessageRead(data) { }) }) } + +// 导出 GoEasy 常量(用于事件监听) +export { GoEasy } diff --git a/src/views/pk-mini/Message.vue b/src/views/pk-mini/Message.vue index cd45a81..3f55114 100644 --- a/src/views/pk-mini/Message.vue +++ b/src/views/pk-mini/Message.vue @@ -88,19 +88,19 @@ diff --git a/src/views/pk-mini/PkHall.vue b/src/views/pk-mini/PkHall.vue index 1e0a682..9d1c3c3 100644 --- a/src/views/pk-mini/PkHall.vue +++ b/src/views/pk-mini/PkHall.vue @@ -80,6 +80,7 @@
+ + + +
+
+ 暂无可用主播,请先在"我的"页面添加主播 +
+
+
+ +
+
{{ anchor.anchorId }}
+
+ + {{ anchor.sex === 1 ? '男' : '女' }} + + {{ anchor.coin }}K +
+
PK时间: {{ formatTime(anchor.pkTime * 1000) }}
+
+
+
+
+ +
@@ -862,4 +1055,100 @@ onUnmounted(() => { visibility: hidden; // 仍然占位,但看不见 pointer-events: none; // 不能点击 } + +// 邀请弹窗样式 +.invite-dialog-content { + max-height: 400px; + overflow-y: auto; +} + +.no-anchor-tip { + text-align: center; + padding: 40px; + color: #999; + font-size: 14px; +} + +.anchor-list { + display: flex; + flex-direction: column; + gap: 10px; +} + +.anchor-item { + display: flex; + align-items: center; + padding: 12px; + border: 2px solid #eee; + border-radius: 12px; + cursor: pointer; + transition: all 0.3s; +} + +.anchor-item:hover { + border-color: #4fcacd; + background: #f8ffff; +} + +.anchor-item.selected { + border-color: #03aba8; + background: #e4f9f9; +} + +.anchor-avatar { + width: 50px; + height: 50px; + border-radius: 50%; + object-fit: cover; + margin-right: 12px; +} + +.anchor-info { + flex: 1; +} + +.anchor-name { + font-size: 16px; + font-weight: bold; + color: #333; + margin-bottom: 4px; +} + +.anchor-detail { + display: flex; + align-items: center; + gap: 10px; +} + +.anchor-gender { + padding: 2px 10px; + border-radius: 10px; + font-size: 12px; + color: white; +} + +.anchor-gender.male { + background: #59d8db; +} + +.anchor-gender.female { + background: #f3876f; +} + +.anchor-coin { + font-size: 14px; + color: #666; +} + +.anchor-time { + font-size: 12px; + color: #999; + margin-top: 4px; +} + +.invite-dialog-footer { + display: flex; + justify-content: flex-end; + gap: 10px; +}