fix(core): comprehensive fix for state loss across activity, ticket, workspace, favorites and community
这个提交包含在:
@@ -137,12 +137,12 @@
|
||||
<text class="sec-sub">满员即成局</text>
|
||||
</view>
|
||||
<view class="member-list" v-if="activity.participants && activity.participants.length > 0">
|
||||
<view v-for="(p, index) in activity.participants" :key="p.id" class="member-item" :class="{ 'my-member-item': Number(p.userId) === CURRENT_USER_ID }">
|
||||
<view v-for="(p, index) in activity.participants" :key="p.id" class="member-item" :class="{ 'my-member-item': Number(p.userId) === currentUserId }">
|
||||
<image class="member-avatar" :src="p.avatar" mode="aspectFill" />
|
||||
<view class="member-info">
|
||||
<view class="member-top-line">
|
||||
<text class="member-name">{{ p.nickname }}</text>
|
||||
<text class="my-badge" v-if="Number(p.userId) === CURRENT_USER_ID">我的席位</text>
|
||||
<text class="my-badge" v-if="Number(p.userId) === currentUserId">我的席位</text>
|
||||
<text class="member-price-tag" v-if="p.priceAtJoin">
|
||||
出价: ¥{{ p.priceAtJoin }}
|
||||
</text>
|
||||
@@ -158,7 +158,7 @@
|
||||
<view class="checkin-badge" :class="{ checked: p.checkedIn }">
|
||||
{{ p.checkedIn ? '已核销到场' : '待现场核销' }}
|
||||
</view>
|
||||
<text class="btn-micro-leave btn-active" v-if="Number(p.userId) === CURRENT_USER_ID && !p.checkedIn" @click.stop="handleLeave">
|
||||
<text class="btn-micro-leave btn-active" v-if="Number(p.userId) === currentUserId && !p.checkedIn" @click.stop="handleLeave">
|
||||
退席
|
||||
</text>
|
||||
</view>
|
||||
@@ -384,18 +384,26 @@ import {
|
||||
import { ICONS } from '@/common/icons.js';
|
||||
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
|
||||
|
||||
const CURRENT_USER_ID = 1001;
|
||||
const currentUserId = computed(() => {
|
||||
try {
|
||||
return Number(uni.getStorageSync('userId')) || 1001;
|
||||
} catch (_) {
|
||||
return 1001;
|
||||
}
|
||||
});
|
||||
const currentActId = ref('1');
|
||||
const verifyCodeInput = ref('');
|
||||
const currentThemeKey = ref(getCurrentThemeKey());
|
||||
|
||||
const isHost = computed(() => {
|
||||
if (!activity.value) return false;
|
||||
return Number(activity.value.creatorId) === CURRENT_USER_ID;
|
||||
return Number(activity.value.creatorId) === currentUserId.value;
|
||||
});
|
||||
|
||||
const myParticipantInfo = computed(() => {
|
||||
if (!activity.value || !activity.value.participants) return null;
|
||||
return activity.value.participants.find(p => Number(p.userId) === CURRENT_USER_ID || Number(p.id) === CURRENT_USER_ID);
|
||||
const uid = currentUserId.value;
|
||||
return activity.value.participants.find(p => Number(p.userId) === uid || Number(p.id) === uid);
|
||||
});
|
||||
|
||||
const isJoined = computed(() => !!myParticipantInfo.value);
|
||||
@@ -421,6 +429,9 @@ onMounted(() => {
|
||||
onShow(() => {
|
||||
currentThemeKey.value = getCurrentThemeKey();
|
||||
applyThemeToNativeUI(currentThemeKey.value);
|
||||
if (currentActId.value) {
|
||||
loadLiveDetail(currentActId.value);
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
@@ -458,6 +469,7 @@ const loadLiveDetail = async (id) => {
|
||||
|
||||
onLoad((query) => {
|
||||
const targetId = (query && query.id) ? query.id : '1';
|
||||
currentActId.value = targetId;
|
||||
loadLiveDetail(targetId);
|
||||
});
|
||||
|
||||
@@ -639,7 +651,7 @@ const handleHostVerify = async () => {
|
||||
}
|
||||
try {
|
||||
uni.showLoading({ title: '正在核销签到...' });
|
||||
await verifyActivityCheckin(activity.value.id, code, CURRENT_USER_ID);
|
||||
await verifyActivityCheckin(activity.value.id, code, currentUserId.value);
|
||||
uni.hideLoading();
|
||||
verifyCodeInput.value = '';
|
||||
uni.showToast({ title: '核销成功!搭子已签到', icon: 'success' });
|
||||
@@ -675,7 +687,7 @@ const handleHostCancel = () => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({ title: '正在解散并全额退款...' });
|
||||
await cancelActivity(activity.value.id, CURRENT_USER_ID, '局长主动解散组局');
|
||||
await cancelActivity(activity.value.id, currentUserId.value, '局长主动解散组局');
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '组局已成功解散', icon: 'success' });
|
||||
activity.value.status = 'CANCELLED';
|
||||
@@ -703,7 +715,7 @@ const handleLeave = () => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({ title: '正在办理退席...' });
|
||||
await leaveActivity(activity.value.id, CURRENT_USER_ID);
|
||||
await leaveActivity(activity.value.id, currentUserId.value);
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '已退席,款项已退回钱包', icon: 'success' });
|
||||
loadLiveDetail(activity.value.id);
|
||||
|
||||
在新工单中引用
屏蔽一个用户