合并代码并解决冲突
This commit is contained in:
@@ -6,7 +6,7 @@ try {
|
|||||||
|
|
||||||
switch (envVersion) {
|
switch (envVersion) {
|
||||||
case "develop": // 开发版
|
case "develop": // 开发版
|
||||||
// BASE_URL = "http://localhost:8000/api/shoot";
|
// BASE_URL = "http://192.168.1.30:8000/api/shoot";
|
||||||
BASE_URL = "https://apitest.shelingxingqiu.com/api/shoot";
|
BASE_URL = "https://apitest.shelingxingqiu.com/api/shoot";
|
||||||
break;
|
break;
|
||||||
case "trial": // 体验版
|
case "trial": // 体验版
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ const props = defineProps({
|
|||||||
type: Function,
|
type: Function,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
|
/** 当前用户是否为房主;仅房主可见踢人按钮 */
|
||||||
|
isOwner: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const seats = new Array(props.total).fill(1);
|
const seats = new Array(props.total).fill(1);
|
||||||
</script>
|
</script>
|
||||||
@@ -45,8 +50,9 @@ const seats = new Array(props.total).fill(1);
|
|||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
class="player-bg"
|
class="player-bg"
|
||||||
/> -->
|
/> -->
|
||||||
|
<!-- 仅房主(isOwner=true)且非空座位时展示踢人按钮 -->
|
||||||
<button
|
<button
|
||||||
v-if="index > 0 && players[index]"
|
v-if="index > 0 && players[index] && isOwner"
|
||||||
hover-class="none"
|
hover-class="none"
|
||||||
class="remove-player"
|
class="remove-player"
|
||||||
@click="() => removePlayer(players[index])"
|
@click="() => removePlayer(players[index])"
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ const goBattle = ref(false);
|
|||||||
async function refreshRoomData() {
|
async function refreshRoomData() {
|
||||||
if (!roomNumber.value) return;
|
if (!roomNumber.value) return;
|
||||||
const result = await getRoomAPI(roomNumber.value);
|
const result = await getRoomAPI(roomNumber.value);
|
||||||
|
console.log(result);
|
||||||
if (result.started) return;
|
if (result.started) return;
|
||||||
room.value = result;
|
room.value = result;
|
||||||
// 加入者通过 API 返回的 targetType 字段同步靶纸尺寸,并持久化到本地缓存
|
// 加入者通过 API 返回的 targetType 字段同步靶纸尺寸,并持久化到本地缓存
|
||||||
@@ -276,11 +277,27 @@ const shareTitle = computed(() => {
|
|||||||
return '星球论箭,来一决高下敢否?';
|
return '星球论箭,来一决高下敢否?';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据对战类型动态返回分享封面图路径
|
||||||
|
* battleType === 2(多人乱斗)→ melee_share.jpg
|
||||||
|
* 其余(好友约战 / 组队对战)→ contest_share.jpg
|
||||||
|
*
|
||||||
|
* 网络图片:
|
||||||
|
* https://static.shelingxingqiu.com/shootmini/static/share/melee_share.jpg
|
||||||
|
* https://static.shelingxingqiu.com/shootmini/static/share/contest_share.jpg
|
||||||
|
*/
|
||||||
|
const shareImage = computed(() => {
|
||||||
|
if (room.value.battleType === 2) {
|
||||||
|
return 'https://static.shelingxingqiu.com/shootmini/static/share/melee_share.jpg';
|
||||||
|
}
|
||||||
|
return 'https://static.shelingxingqiu.com/shootmini/static/share/contest_share.jpg';
|
||||||
|
});
|
||||||
|
|
||||||
onShareAppMessage(() => {
|
onShareAppMessage(() => {
|
||||||
return {
|
return {
|
||||||
title: shareTitle.value,
|
title: shareTitle.value,
|
||||||
path: "/pages/friend-battle?roomID=" + roomNumber.value,
|
path: "/pages/friend-battle?roomID=" + roomNumber.value,
|
||||||
imageUrl: "",
|
imageUrl: shareImage.value,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -385,7 +402,8 @@ onBeforeUnmount(() => {
|
|||||||
<view v-for="(item, index) in players" :key="index">
|
<view v-for="(item, index) in players" :key="index">
|
||||||
<Avatar v-if="item.id" :src="item.avatar" :size="36" />
|
<Avatar v-if="item.id" :src="item.avatar" :size="36" />
|
||||||
<text v-if="owner.id === item.id">管理员</text>
|
<text v-if="owner.id === item.id">管理员</text>
|
||||||
<button v-if="owner.id !== item.id && item.id" hover-class="none" class="remove-player"
|
<!-- 仅房主可见踢人按钮,且不能踢自己 -->
|
||||||
|
<button v-if="owner.id !== item.id && item.id && owner.id === user.id" hover-class="none" class="remove-player"
|
||||||
@click="() => removePlayer(item)" :style="{ top: '-10rpx', right: '-10rpx' }">
|
@click="() => removePlayer(item)" :style="{ top: '-10rpx', right: '-10rpx' }">
|
||||||
<image src="../static/close-white.png" mode="widthFix" />
|
<image src="../static/close-white.png" mode="widthFix" />
|
||||||
</button>
|
</button>
|
||||||
@@ -425,8 +443,9 @@ onBeforeUnmount(() => {
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
<!-- isOwner:当前用户是房主时才展示踢人按钮 -->
|
||||||
<PlayerSeats v-if="room.battleType === 2" :total="room.count || 10" :players="players"
|
<PlayerSeats v-if="room.battleType === 2" :total="room.count || 10" :players="players"
|
||||||
:removePlayer="removePlayer" />
|
:removePlayer="removePlayer" :isOwner="owner.id === user.id" />
|
||||||
<view>
|
<view>
|
||||||
<SButton :disabled="!canClick" :onClick="getReady">
|
<SButton :disabled="!canClick" :onClick="getReady">
|
||||||
{{
|
{{
|
||||||
|
|||||||
@@ -23,8 +23,11 @@ function createWebSocket(token, onMessage) {
|
|||||||
const envVersion = accountInfo.miniProgram.envVersion;
|
const envVersion = accountInfo.miniProgram.envVersion;
|
||||||
|
|
||||||
switch (envVersion) {
|
switch (envVersion) {
|
||||||
case "develop":
|
case "develop": // 开发版
|
||||||
// url = "ws://localhost:8000/socket";
|
// url = "ws://192.168.1.30:8000/socket";
|
||||||
|
url = "wss://apitest.shelingxingqiu.com/socket";
|
||||||
|
break;
|
||||||
|
case "trial": // 体验版
|
||||||
url = "wss://apitest.shelingxingqiu.com/socket";
|
url = "wss://apitest.shelingxingqiu.com/socket";
|
||||||
break;
|
break;
|
||||||
case "trial":
|
case "trial":
|
||||||
|
|||||||
Reference in New Issue
Block a user