This commit is contained in:
2025-11-24 16:00:42 +08:00
parent 375b1b449b
commit 0520603957
43 changed files with 1318 additions and 940 deletions

View File

@@ -62,6 +62,10 @@
</view>
</view>
</view>
<view class="">
{{roomData}}
</view>
</view>
</view>
</template>
@@ -69,8 +73,47 @@
<script setup>
import { ref, onMounted } from 'vue'
import { getOpenId } from '@/utils/wxutils.js'
import { GET, POST } from '../../utils/request'
import StaticValue from '@/utils/StaticValue.js';
const loading = ref(false);
//定义承接本地用户信息对象
const roomData = ref([]);
const gotoNewPage = () => {
onMounted(() => {
const getUserInfo = StaticValue.getUserInfo;
roomData.value = getUserInfo();
})
const gotoNewPage = async () => {
//判断有无历史房间记录
const response = await GET('/system/room/createUser/'+ roomData.value.userId);
//检查是否请求成功
if (response.code = 200) {
//检查数组是否有对象
const dataArray = response.data;
if (dataArray && dataArray.length > 0) {
console.log(`查询到 ${dataArray.length} 条房间记录`);
} else {
// 数据条数为0执行B方法
console.log('未查询到房间记录,新建个人房间');
//创建新房间
POST('/system/room', {
createUser: roomData.value.userId,
odds: 1,
roomStatus: 1,
bossId: roomData.value.userId,
roomName: `${roomData.value.nickName}的房间`,
});
}
} else {
console.error('接口请求失败:', response.msg);
uni.showToast({
title: '查询失败',
icon: 'none'
});
}
wx.navigateTo({
url: '/pages/single/single'
})