功能:婚姻系统第12步(前端交互)
chat.js: - 监听婚姻全局广播(MarriageAccepted/Divorced/WeddingCelebration) - initMarriagePrivateChannel() 监听私人频道 (求婚/拒绝/过期/离婚申请/红包领取) frame.blade.php: - chatContext.marriage 注入所有婚姻 API URL - 引入 marriage-modals.blade.php 弹窗组件 marriage-modals.blade.php(新建): - 求婚弹窗(选戒指→求婚) - 收到求婚弹窗(接受/拒绝) - 结婚成功公告弹窗(可跳转婚礼设置) - 婚礼设置弹窗(档位/支付方式/立即OR定时) - 婚礼红包领取弹窗 - 所有 WebSocket 事件处理 user-actions.blade.php: - 名片加「💍 求婚」按钮(对方未婚时) - 名片加「💑 已婚状态」标签(对方已婚时) - fetchUser 同步拉取对方婚姻状态 MarriageController: - targetStatus 返回增加 status/partner_name/marriage_id - myRings 返回增加 status/intimacy_bonus/charm_bonus
This commit is contained in:
@@ -113,6 +113,10 @@
|
||||
showPositionHistory: false, // 职务履历
|
||||
showAdminPanel: false, // 管理操作(管理操作+职务操作合并)
|
||||
|
||||
// 婚姻状态
|
||||
targetMarriage: null, // 对方婚姻状态 { status, partner_name, marriage_id }
|
||||
marriageLoading: false,
|
||||
|
||||
// 自定义弹窗:直接代理到全局 window.chatDialog
|
||||
$alert: (...args) => window.chatDialog.alert(...args),
|
||||
$confirm: (...args) => window.chatDialog.confirm(...args),
|
||||
@@ -193,6 +197,20 @@
|
||||
}).then(r => r.json()).then(s => {
|
||||
this.is_friend = s.is_friend ?? false;
|
||||
});
|
||||
|
||||
// 加载对方婚姻状态
|
||||
this.targetMarriage = null;
|
||||
this.marriageLoading = true;
|
||||
fetch(`/marriage/target?username=${encodeURIComponent(data.data.username)}`, {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
}).then(r => r.json()).then(m => {
|
||||
this.targetMarriage = m.marriage ?? null;
|
||||
}).catch(() => {}).finally(() => {
|
||||
this.marriageLoading = false;
|
||||
});
|
||||
}
|
||||
this.showUserModal = true;
|
||||
this.isMuting = false;
|
||||
@@ -690,6 +708,23 @@
|
||||
x-on:click="openRewardModal(userInfo.username)">
|
||||
🪙 送金币
|
||||
</button>
|
||||
|
||||
{{-- 求婚按钮(对方未婚 且 我也未婚时显示) --}}
|
||||
<button x-show="!marriageLoading && (!targetMarriage || targetMarriage.status === 'none')"
|
||||
style="flex:1; padding: 7px 10px; border-radius: 5px; font-size: 12px; font-weight: bold; cursor: pointer;
|
||||
background: linear-gradient(135deg,#f43f5e,#ec4899); color:#fff; border:none;"
|
||||
x-on:click="showUserModal = false; openProposeModal(userInfo.username)">
|
||||
💍 求婚
|
||||
</button>
|
||||
|
||||
{{-- 对方已婚时显示提示 --}}
|
||||
<div x-show="!marriageLoading && targetMarriage && targetMarriage.status === 'married'"
|
||||
style="flex:1; display:flex; align-items:center; justify-content:center;
|
||||
padding:7px 10px; border-radius:5px; font-size:11px; background:#fff1f2;
|
||||
border:1px solid #fecdd3; color:#f43f5e; font-weight:bold;">
|
||||
💑 <span x-text="'与 ' + (targetMarriage?.partner_name || '—') + ' 已婚'"
|
||||
style="margin-left:3px;"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 内联礼物面板 --}}
|
||||
|
||||
Reference in New Issue
Block a user