hui.zhou
ihzero 2024-06-24 08:00:00 +08:00
parent 4947f5707d
commit 035ed7a28d
7 changed files with 149 additions and 6 deletions

View File

@ -150,4 +150,8 @@ export const submitUploadAvatar = (params, config = {}) => {
// 用户-更新个人资料
export const submitUploadUserInfo = (params, config = {}) => {
return http.post(`/api/miniprogram/user/update-info`, params, { ...config });
}
// 最新竞猜记录
export const getLatestGameLogs = () => {
return http.get(`/api/miniprogram/latest-game-logs`);
}

View File

@ -0,0 +1,56 @@
<template>
<view>
<view class="flex items-center py-2" @click="$goToPage({url:'pages/quiz/logs', params: { activity_id: data.activity_id,user_id: data.user_id}})">
<view class="w-84rpx h-84rpx rounded-full flex-none">
<up-avatar size="84rpx" mode="aspectFit" :src="data.avatar"></up-avatar>
</view>
<view class="ml-10rpx flex-1">
<view class="flex-1 flex justify-between items-center">
<view class="text-28rpx text-primary">{{ data.nick_name }}</view>
<view class="text-xs text-hex-999">{{ data.history }}</view>
</view>
<view class="flex items-center text-sm">
<view class="flex items-center flex-1">
<view></view>
<view class="px-3">
{{ data.game_home_field }} VS {{ data.game_away }}
</view>
<view>{{ data.score }}</view>
</view>
<view :style="{color:currentStatus.color}">{{ currentStatus.label }}</view>
</view>
</view>
</view>
<up-line dashed></up-line>
</view>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
data: {
item: Object,
},
})
const status = [
{
value: 0,
label: '未公布',
color: '#1b2f85',
},
{
value: 1,
label: '猜中了',
color: '#e91f35',
},
{
value: 2,
label: '未猜中',
color: '#808080',
},
]
const currentStatus = computed(() =>
status.find((e) => e.value == props.data.status)
)
</script>

View File

@ -43,6 +43,11 @@
"style": {
"navigationBarTitleText": ""
}
},{
"path":"pages/quiz/logs",
"style": {
"navigationBarTitleText": "活动详情"
}
}
],
"subPackages": [

View File

@ -9,7 +9,7 @@
<up-swiper class="bg" :radius="0" height="200" :list="homeBannerList"
:displayMultipleItems="displayMultipleItems" keyName="url" @click="clickHomeBanner"></up-swiper>
</view>
<view class="home-content" v-if="gameInfo || articleList.length">
<view class="home-content" v-if="gameInfo || articleList.length || gameLogs.length">
<image class="bg" mode="widthFix" :src="`${config.baseUrl}/images/mini-bg.jpg`"></image>
<view class="today-guess-box" v-if="gameInfo">
@ -75,6 +75,17 @@
</view>
</view>
</view>
<view class="news-box">
<view class="news-title-box">
<text class="title">最新竞猜</text>
<!-- <text class="more" @click="$goToPage('pages/news/news', true)">查看更多</text> -->
</view>
<view v-for="(item,i) in gameLogs" :key="i">
<QuizItem :data="item"></QuizItem>
</view>
</view>
</view>
<view class="guess-model" v-if="gameInfo">
@ -203,9 +214,10 @@
<script setup>
import { ref, getCurrentInstance } from 'vue';
import config from '@/common/config'
import { queryAds, queryLatestgame, queryRecommendArticles, submitGuess } from '@/api/xinjiang_guess';
import { queryAds, queryLatestgame, queryRecommendArticles, submitGuess ,getLatestGameLogs} from '@/api/xinjiang_guess';
import useAuthUser from '@/utils/hooks/useAuthUser';
import jumpFun from '@/utils/jump.js'
import QuizItem from '@/components/quiz/item-new.vue'
const vm = getCurrentInstance();
const loading = ref(false);
@ -224,6 +236,8 @@ const submitGuessLoading = ref(false);
const articleListLoading = ref(false);
const articleList = ref([]);
const gameLogs = ref([])
function clickHomeBanner(index) {
// if (!homeBannerList.value.length) {
// return;
@ -334,6 +348,15 @@ async function getRecommendArticles(params) {
}
}
async function getNewQuiz(){
try {
const resData = await getLatestGameLogs()
gameLogs.value = resData.data?.list || [];
} catch (error) {
console.error(error);
}
}
async function submitGuessResult() {
try {
uni.showLoading({
@ -370,7 +393,8 @@ function getData(page = 1, per_page = 10) {
setTimeout(async () => {
await getHomeBanner();
await getLatestGuess();
await getRecommendArticles();
// await getRecommendArticles();
getNewQuiz()
resolve();
}, 1500);
} catch (err) {

View File

@ -1,3 +0,0 @@
<template>
<view></view>
</template>

View File

@ -0,0 +1,57 @@
<template>
<view class="">
<mescroll-body
@init="mescrollInit"
@down="downCallback"
@up="upCallback"
:up="{
empty: {
use: false,
},
}"
>
<view>
<view class="h-188px w-full" v-if="detail.cover">
<image class="w-full" mode="aspectFill" :src="detail.cover" />
</view>
<view class="min-h-screen relative bg-hex-1b2f85 p-3">
<image class="absolute left-0 w-full top-0" mode="widthFix" :src="`${config.baseUrl}/images/mini-bg.jpg`"></image>
<view class="bg-white rounded-12px relative">
1111
</view>
</view>
</view>
</mescroll-body>
</view>
</template>
<script setup>
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js'
import { queryActivitiesDetail } from '@/api/xinjiang_guess'
import config from '@/common/config'
import { ref } from 'vue'
const activityId = ref(null)
const userId = ref(null)
const detail = ref({})
const { mescrollInit, downCallback, getMescroll } = useMescroll(
onPageScroll,
onReachBottom
)
onLoad((query) => {
activityId.value = query.activity_id
userId.value = query.user_id
})
const upCallback = (mescroll) => {
const { size, num } = mescroll
if (num === 1) getActiveDetail()
}
const getActiveDetail = async () => {
try {
const resData = await queryActivitiesDetail({ id: activityId.value })
detail.value = resData.data
} catch (error) {}
}
</script>