Compare commits

..

11 Commits

Author SHA1 Message Date
周辉 ab4b6a3e91 咨询修改成推荐 2024-08-20 16:51:40 +08:00
ihzero 578b79604a 竞猜头像异常 2024-07-14 18:39:23 +08:00
ihzero b2897bdc82 竞猜样式 2024-07-09 22:08:20 +08:00
ihzero 29554cec1f 修改竞猜 2024-07-09 21:42:19 +08:00
ihzero b054a90371 封装竞猜组件 2024-07-09 02:18:57 +08:00
ihzero cffddd124c 添加竞猜记录 2024-06-25 00:08:38 +08:00
ihzero e7331af0e8 修改 2024-06-24 22:12:09 +08:00
ihzero 035ed7a28d 记录 2024-06-24 08:00:00 +08:00
unknown 4947f5707d 修改 2024-06-24 03:37:45 +08:00
unknown 1ed3b84887 修改基础样式 2024-06-23 19:43:10 +08:00
ihzero e275e1ca7e 接入基础方法 2024-06-23 02:23:04 +08:00
24 changed files with 3436 additions and 1648 deletions

View File

@ -16,6 +16,7 @@
"dev:mp-qq": "uni -p mp-qq",
"dev:mp-toutiao": "uni -p mp-toutiao",
"dev:mp-weixin": "uni -p mp-weixin",
"dev:mp-weixin:pro": "uni -p mp-weixin --mode production",
"dev:mp-xhs": "uni -p mp-xhs",
"dev:quickapp-webview": "uni -p quickapp-webview",
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
@ -34,6 +35,7 @@
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin",
"build:mp-weixin:dev": "uni build -p mp-weixin --mode development",
"build:mp-xhs": "uni build -p mp-xhs",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
@ -56,8 +58,10 @@
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4010520240507001",
"clipboard": "^2.0.11",
"dayjs": "^1.11.11",
"pinia": "2.0.33",
"pinia-plugin-persistedstate": "^3.2.1",
"tiny-emitter": "^2.1.0",
"uview-plus": "^3.1.41",
"uview-plus": "^3.3.4",
"vue": "^3.4.21",
"vue-i18n": "^9.1.9",
"vue3-eventbus": "^2.0.0"
@ -71,6 +75,8 @@
"@vue/runtime-core": "^3.4.21",
"sass": "^1.69.7",
"sass-loader": "10",
"unocss": "^0.58.5",
"unocss-applet": "^0.8.2",
"vite": "5.2.8"
}
}

View File

@ -1,7 +1,7 @@
<script>
import dayjs from 'dayjs';
import useAuthUser from '@/utils/hooks/useAuthUser';
import { submitCode2Session } from '@/api/xinjiang_guess';
import dayjs from 'dayjs'
import useAuthUser from '@/utils/hooks/useAuthUser'
import { submitCode2Session } from '@/api/xinjiang_guess'
export default {
globalData: {},
@ -12,7 +12,7 @@ export default {
console.log('App Show')
if (uni.canIUse('getUpdateManager')) {
const updateManager = uni.getUpdateManager();
const updateManager = uni.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
//
if (res.hasUpdate) {
@ -26,98 +26,99 @@ export default {
// applyUpdate
updateManager.applyUpdate()
}
}
},
})
})
});
updateManager.onUpdateFailed(function () {
//
uni.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
});
});
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
})
})
}
})
}
console.log('checkSession', this.checkSession());
console.log('checkSession', this.checkSession())
if (!this.checkSession()) {
await this.login(true);
await this.login(true)
}
console.log('App globalData', this.globalData);
console.log('App globalData', this.globalData)
},
onHide: function () {
console.log('App Hide')
},
methods: {
checkSession() {
const expire_in = this.globalData.expire_in;
const expire_in = this.globalData.expire_in
if (!expire_in) {
return false;
return false
}
if (expire_in) {
let isExpired = dayjs().isAfter(dayjs(expire_in))
console.log('isExpired', isExpired);
console.log('isExpired', isExpired)
if (isExpired) {
return false;
return false
}
let willExpired = dayjs().add(6, 'hour').isAfter(dayjs(expire_in))
console.log('willExpired', willExpired);
console.log('willExpired', willExpired)
if (willExpired) {
return false;
return false
}
}
return true;
return true
},
login() {
return new Promise(async (resolve, reject) => {
try {
const codeResp = await wx.login()
const wxLoginResp = await submitCode2Session({ code: codeResp.code });
const data = wxLoginResp.data;
const wxLoginResp = await submitCode2Session({ code: codeResp.code })
const data = wxLoginResp.data
this.globalData.api_token = data?.api_token;
this.globalData.expire_in = data?.expire_in;
this.globalData.user = data?.user;
this.globalData.isLogin = !!this.globalData.api_token;
this.globalData.isNeedBindPhone = !!this.globalData.user?.is_need_bind_phone;
this.globalData.api_token = data?.api_token
this.globalData.expire_in = data?.expire_in
this.globalData.user = data?.user
this.globalData.isLogin = !!this.globalData.api_token
this.globalData.isNeedBindPhone =
!!this.globalData.user?.is_need_bind_phone
const pages = getCurrentPages();
const page = pages[pages.length - 1];
const pages = getCurrentPages()
const page = pages[pages.length - 1]
if (page.$page) {
console.log('current page: ', page.$page.fullPath);
console.log('current page: ', page.$page.fullPath)
} else {
console.log('current page: ', page.route);
console.log('current page: ', page.route)
}
resolve();
resolve()
} catch (err) {
console.error(err);
reject();
}
});
}
console.error(err)
reject()
}
})
},
},
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "uview-plus/index.scss";
@import 'uview-plus/index.scss';
page {
background-color: #f3f3f3;
}
button,
button[type=primary],
button[type='primary'],
button[plain],
button[type=primary][plain],
button[type='primary'][plain],
button::after {
border: none;
background: transparent;
@ -125,100 +126,18 @@ button::after {
//
.p-16 {
padding: 16px;
}
.pt-24 {
padding-top: 20px;
}
.m-16 {
margin: 16px;
}
.text-white {
color: #fff;
}
.text-red {
color: #e91f35;
}
.text-4e {
color: #4e4e4e;
}
.text-primary {
color: #525252;
}
.text-black {
color: #000;
}
.text-bold {
font-weight: bold;
}
.mb-10 {
margin-bottom: 10px;
}
.flex {
display: flex;
}
.flex-col {
flex-direction: column;
}
.flex-1 {
flex: 1;
}
.justify-between {
justify-content: space-between;
}
.items-center {
align-items: center;
}
.text-base {
font-size: 16px;
}
.text-sm {
font-size: 14px;
}
.text-xs {
font-size: 12px;
}
.text-center {
text-align: center;
}
.bg-white {
background-color: #fff;
}
.rounded {
border-radius: 4px;
}
.rounded-lg {
border-radius: 8px;
}
.block-box {
padding: 12px;
box-shadow: 0.5px 0.5px 1px rgba(0, 0, 0, 0.1);
margin-bottom: 16px;
}
.card-shadow {
background: #ffffff;
box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.04);
border-radius: 20rpx;
}
//
.board {
border-radius: 6px;
@ -269,14 +188,6 @@ button::after {
overflow: hidden;
}
//
.ellipsis {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
.nodata {
margin-top: 40px;
display: flex;
@ -284,8 +195,4 @@ button::after {
align-items: center;
color: #999999;
}
.fixed{
position: fixed;
}
</style>

View File

@ -151,3 +151,11 @@ 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`);
}
// 最新竞猜记录
export const activityGameLogs = (params) => {
return http.get(`/api/miniprogram/activity-game-logs`,{ params });
}

View File

@ -0,0 +1,19 @@
<template>
<view class="relative h-46rpx flex items-center">
<view
class="absolute left-0 w-4px h-[80%] transform top-[50%] translate-y-[-50%]"
:style="{ background: '#D8524C' }"
></view>
<view class="ml-16px font-bold text-base">{{ title }}</view>
</view>
</template>
<script setup>
const props = defineProps({
title: {
type: String,
default: '标题',
},
color: '#D8524C',
})
</script>

View File

@ -0,0 +1,51 @@
<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 },
})
"
>
<up-avatar
:size="`70rpx`"
mode="aspectFit"
:src="data.avatar"
></up-avatar>
<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-2">
<text class="font-medium">{{ data.game_home_field }}</text> vs <text class="font-medium">{{ data.game_away }}</text>
</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'
import { status } from './status'
const props = defineProps({
data: {
item: Object,
},
})
const currentStatus = computed(() =>
status.find((e) => e.value == props.data.status)
)
</script>

View File

@ -0,0 +1,42 @@
<template>
<view class="text-sm text-hex-333">
<view class="p-3">
<view>{{ data.game_day }} {{ data.game_name }}</view>
<view class="flex mt-2">
<view class="flex-1">
<view class="flex">
<!-- <view >{{ data.game_home_field }}</view>
<view class="text-center mx-10rpx">vs</view>
<view class="text-right">{{ data.game_away }}</view> -->
<view class="flex-1 text-center">{{ data.game_home_field }}</view>
<view class="text-center mx-10rpx">vs</view>
<view class="flex-1 text-center">{{ data.game_away }}</view>
</view>
</view>
<view class="w-200rpx flex ml-20rpx">
<view class="w-100rpx text-center">{{ data.score }}</view>
<view
:style="{ color: currentStatus.color }"
class="text-right flex-1"
>{{ currentStatus.label }}</view
>
</view>
</view>
</view>
<up-line color="#EEEEEE"></up-line>
</view>
</template>
<script setup>
import { computed } from 'vue'
import { status } from './status'
const props = defineProps({
data: {
type: Object,
default: () => {},
},
})
const currentStatus = computed(() =>
status.find((e) => e.value == props.data.status)
)
</script>

View File

@ -0,0 +1,644 @@
<template>
<up-modal
:show="showGuessModalVisible"
:width="335"
:closeOnClickOverlay="true"
:showConfirmButton="false"
:showCancelButton="false"
@close="hideGuessModal"
>
<view class="guess-model w-full" v-if="gameInfo">
<view class="slot-content">
<view class="guess-title">
<view class="flex-1 flex-center">{{ gameInfo.home_field }}</view>
<view class="w-170rpx text-center">VS</view>
<view class="flex-1 flex-center">{{ gameInfo.away }}</view>
</view>
<view
:class="[successGuessClass, readonly ? 'pointer-events-none' : '']"
>
<template v-if="gameInfo.score_type == 1">
<view class="guess-table">
<view class="row herder-title">
<view class="table-td col-12"></view>
</view>
<view class="table-tr row row-3">
<view class="row-title table-td row-3 col-10"></view>
<view class="row-content">
<view class="row-1 col-10">
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '1:0',
active: userGuess === '1:0',
}"
@click="userGuessChange('1:0')"
>1:0</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '2:0',
active: userGuess === '2:0',
}"
@click="userGuessChange('2:0')"
>2:0</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '2:1',
active: userGuess === '2:1',
}"
@click="userGuessChange('2:1')"
>2:1</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '3:0',
active: userGuess === '3:0',
}"
@click="userGuessChange('3:0')"
>3:0</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '3:1',
active: userGuess === '3:1',
}"
@click="userGuessChange('3:1')"
>3:1</view
>
</view>
<view class="row-1 col-10">
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '3:2',
active: userGuess === '3:2',
}"
@click="userGuessChange('3:2')"
>3:2</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '4:0',
active: userGuess === '4:0',
}"
@click="userGuessChange('4:0')"
>4:0</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '4:1',
active: userGuess === '4:1',
}"
@click="userGuessChange('4:1')"
>4:1</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '4:2',
active: userGuess === '4:2',
}"
@click="userGuessChange('4:2')"
>4:2</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '5:0',
active: userGuess === '5:0',
}"
@click="userGuessChange('5:0')"
>5:0</view
>
</view>
<view class="row-1 col-10">
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '5:1',
active: userGuess === '5:1',
}"
@click="userGuessChange('5:1')"
>5:1</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '5:2',
active: userGuess === '5:2',
}"
@click="userGuessChange('5:2')"
>5:2</view
>
<view
class="table-td col-6"
:class="{
'result-active': gameScore === '胜其他',
active: userGuess === '胜其他',
}"
@click="userGuessChange('胜其他')"
>胜其他</view
>
</view>
</view>
</view>
<view class="table-tr row row-1">
<view class="row-title table-td row-1 col-10"></view>
<view class="row-content">
<view class="row-1 col-10">
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '0:0',
active: userGuess === '0:0',
}"
@click="userGuessChange('0:0')"
>0:0</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '1:1',
active: userGuess === '1:1',
}"
@click="userGuessChange('1:1')"
>1:1</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '2:2',
active: userGuess === '2:2',
}"
@click="userGuessChange('2:2')"
>2:2</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '3:3',
active: userGuess === '3:3',
}"
@click="userGuessChange('3:3')"
>3:3</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '平其他',
active: userGuess === '平其他',
}"
@click="userGuessChange('平其他')"
>平其他</view
>
</view>
</view>
</view>
<view class="table-tr row row-3">
<view class="row-title table-td row-3 col-10"></view>
<view class="row-content">
<view class="row-1 col-10">
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '0:1',
active: userGuess === '0:1',
}"
@click="userGuessChange('0:1')"
>0:1</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '0:2',
active: userGuess === '0:2',
}"
@click="userGuessChange('0:2')"
>0:2</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '0:3',
active: userGuess === '0:3',
}"
@click="userGuessChange('0:3')"
>0:3</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '0:4',
active: userGuess === '0:4',
}"
@click="userGuessChange('0:4')"
>0:4</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '0:5',
active: userGuess === '0:5',
}"
@click="userGuessChange('0:5')"
>0:5</view
>
</view>
<view class="row-1 col-10">
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '1:2',
active: userGuess === '1:2',
}"
@click="userGuessChange('1:2')"
>1:2</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '1:3',
active: userGuess === '1:3',
}"
@click="userGuessChange('1:3')"
>1:3</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '1:4',
active: userGuess === '1:4',
}"
@click="userGuessChange('1:4')"
>1:4</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '1:5',
active: userGuess === '1:5',
}"
@click="userGuessChange('1:5')"
>1:5</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '2:3',
active: userGuess === '2:3',
}"
@click="userGuessChange('2:3')"
>2:3</view
>
</view>
<view class="row-1 col-10">
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '2:4',
active: userGuess === '2:4',
}"
@click="userGuessChange('2:4')"
>2:4</view
>
<view
class="table-td col-2"
:class="{
'result-active': gameScore === '2:5',
active: userGuess === '2:5',
}"
@click="userGuessChange('2:5')"
>2:5</view
>
<view
class="table-td col-6"
:class="{
'result-active': gameScore === '负其他',
active: userGuess === '负其他',
}"
@click="userGuessChange('负其他')"
>负其他</view
>
</view>
</view>
</view>
</view>
</template>
<template v-if="gameInfo.score_type == 2">
<view class="flex">
<view class="flex-1 flex-center">
<up-avatar
size="48"
mode="aspectFit"
:src="gameInfo.home_logo"
></up-avatar>
</view>
<view class="text-center w-170rpx text-12px text-hex-999">
<view>{{ gameInfo.game_day }}</view>
<view>{{ gameInfo.little_game_at }}</view>
</view>
<view class="flex-1 flex-center">
<up-avatar
size="48"
mode="aspectFit"
:src="gameInfo.away_logo"
></up-avatar>
</view>
</view>
<view class="type2 my-30px flex-center">
<view
class="h-44px flex bg-hex-eeeeef rounded-8px text-hex-303133"
>
<view
class="text-12px rounded-4px h-full flex"
:class="{
'active-a': gameScore === item,
active: userGuess === item,
}"
@click="userGuessChange(item)"
v-for="(item,index) in subsectionList"
:key="item"
>
<view class="w-80px flex-center h-full">
{{ item }}
</view>
<up-line v-if="index!=subsectionList.length-1" direction="col"></up-line>
</view>
</view>
</view>
</template>
</view>
<view class="guess-btns" v-if="!readonly">
<up-button
class="more-btn"
:customStyle="{
margin: 0,
width: '120px',
backgroundColor: '#D9D9D9',
color: '#000',
}"
shape="circle"
text="取消"
@click="hideGuessModal"
></up-button>
<up-button
class="more-btn"
:customStyle="{
margin: 0,
width: '120px',
backgroundColor: '#5fb358',
color: '#fff',
}"
shape="circle"
text="确定"
@click="submitGuessResult"
></up-button>
</view>
</view>
</view>
</up-modal>
</template>
<script setup>
import { computed } from 'vue'
import { ref, watch, watchEffect } from 'vue'
const props = defineProps({
show: {
type: Boolean,
default: false,
},
gameInfo: {
type: Object,
default: () => ({}),
},
showResult: {
type: Boolean,
default: false,
},
})
const showGuessModalVisible = ref(props.show)
const subsectionList = ref(['胜', '平', '负'])
const userGuess = ref('')
const readonly = computed(() => {
if (props.gameInfo?.has_guess || props.gameInfo?.game_at_comparison_now) {
return true
}
return false
})
const gameScore = computed(() => props.gameInfo?.game_score)
// const gameScore = computed(() => '')
const isGuess = computed(() => !!props.gameInfo?.has_guess)
const isResult = computed(() => !!props.gameInfo?.game_score)
const successGuess = computed(
() => gameScore.value === props.gameInfo?.has_guess
)
const successGuessClass = computed(() => {
if (!isGuess.value) {
return ''
}
if (!isResult.value) {
return ''
}
return successGuess.value ? 'success' : 'fail'
})
watchEffect(
() => {
userGuess.value = props.gameInfo?.has_guess || ''
},
{
deep: true,
}
)
watchEffect(() => {
showGuessModalVisible.value = props.show
})
const emit = defineEmits([
'update:show',
'hideGuessModal',
'submitGuessResult',
'userGuessChange',
])
const hideGuessModal = () => {
emit('hideGuessModal')
}
const submitGuessResult = () => {
if (userGuess.value === '' || !userGuess.value) {
return uni.showToast({
title: '请选择竞猜结果',
icon: 'none',
})
}
emit('submitGuessResult', userGuess.value)
}
const userGuessChange = (score) => {
userGuess.value = score
}
watch(
() => showGuessModalVisible.value,
(val) => {
emit('update:show', val)
}
)
</script>
<style lang="scss" scoped>
.type2 {
.active {
background-color: #1d2b5c;
color: white;
}
}
.success {
.active {
background-color: red !important;
color: white;
}
}
.fail {
.active {
background-color: #1d2b5c !important;
color: white;
}
}
.active-a {
background-color: red !important;
color: white;
}
.guess-model {
.slot-content {
display: flex;
flex-direction: column;
gap: 12px;
}
.guess-title {
width: 100%;
display: flex;
// justify-content: center;
// align-items: center;
// gap: 58px;
}
.guess-table {
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 12px;
.table-td {
border: 1px solid #bbb;
width: 48px !important;
}
.table-td.result-active {
background-color: red;
color: #fff;
}
.table-td.active {
background-color: #1d2b5c;
color: #fff;
}
.row-1 {
height: calc(30px * 1 - 2px) !important;
line-height: calc(30px * 1 - 2px) !important;
}
.row-2 {
height: calc(30px * 2 - 2px) !important;
line-height: calc(30px * 2 - 2px) !important;
}
.row-3 {
height: calc(30px * 3 - 8px) !important;
line-height: calc(30px * 3 - 8px) !important;
}
.row {
width: 300px;
height: 30px;
line-height: 30px;
flex-shrink: 0;
display: flex;
text-align: center;
.col-1 {
width: calc(292px / 12 * 1);
}
.col-2 {
width: calc(292px / 12 * 2);
}
.col-10 {
display: flex;
justify-content: flex-start;
align-self: flex-start;
flex-grow: 1;
.table-td {
width: 47.7px !important;
border: 1px solid #bbb;
}
.col-6 {
width: calc(47.7px * 3 + 4px) !important;
}
}
.col-12 {
width: 292px;
}
}
.herder-title {
background-color: #1d2b5c;
color: #fff;
.table-td {
width: 100% !important;
}
}
.row-title {
background-color: #d9d9d9;
width: 48px !important;
justify-content: center !important;
}
.row-content {
display: flex;
flex-wrap: wrap;
width: calc(300px - 48px - 3px) !important;
}
}
.guess-btns {
display: flex;
justify-content: space-around;
width: 300px;
flex-shrink: 0;
}
}
</style>

View File

@ -0,0 +1,17 @@
export const status = [
{
value: 0,
label: '未公布',
color: '#1b2f85'
},
{
value: 1,
label: '猜中了',
color: '#e91f35'
},
{
value: 2,
label: '未猜中',
color: '#808080'
},
]

View File

@ -12,6 +12,7 @@ dayjs.locale('zh-cn');
import mpShare from 'uview-plus/libs/mixin/mpShare'
import mixin_common, { goToPage } from '@/utils/mixins/mixin_common';
import 'uno.css'
export function createApp() {
const app = createSSRApp(App);

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<template>
<view class="bg-white wrap">
<view class="image mb-10" v-if="data.cover">
<view class="image mb-2.5" v-if="data.cover">
<image class="image" :src="data.cover" mode="aspectFill" />
</view>
<view class="p-16 title-bar flex-1" v-if="data">

View File

@ -1,7 +1,7 @@
<template>
<view class="page-setting">
<view class="setting-box">
<view class="block-box bg-white rounded">
<view class="block-box bg-white rounded-4px">
<view class="flex text-primary items-center cell text-base">
<text class="text">头像</text>
<button class="menu-item-btn" openType="chooseAvatar" @chooseavatar="handleChooseAvatar">

View File

@ -29,7 +29,7 @@
{
"path": "pages/news/news",
"style": {
"navigationBarTitleText": "资讯"
"navigationBarTitleText": "推荐"
}
},
{
@ -43,6 +43,11 @@
"style": {
"navigationBarTitleText": ""
}
},{
"path":"pages/quiz/logs",
"style": {
"navigationBarTitleText": "竞猜记录"
}
}
],
"subPackages": [
@ -130,7 +135,7 @@
"selectedIconPath": "static/icons/charts-1.png"
},
{
"text": "资讯",
"text": "推荐",
"pagePath": "pages/news/news",
"iconPath": "static/icons/earth.png",
"selectedIconPath": "static/icons/earth-1.png"

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
<image class="icon" src="../../static//images/error.png" />
</view>
</view>
<view class="p-16 text-xs text-4e text-center ">
<view class="p-base text-xs text-4e text-center ">
{{ props.rules }}
</view>
<view class="flex items-center">

View File

@ -1,23 +1,46 @@
<template>
<view class="home-page">
<mescroll-body @init="mescrollInit" @down="downCallback" @up="upCallback" :up="{
<mescroll-body
@init="mescrollInit"
@down="downCallback"
@up="upCallback"
:up="{
empty: {
use: false,
}
}">
},
}"
>
<view class="home-banner" v-if="homeBannerList.length">
<up-swiper class="bg" :radius="0" height="200" :list="homeBannerList"
:displayMultipleItems="displayMultipleItems" keyName="url" @click="clickHomeBanner"></up-swiper>
<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">
<image class="bg" mode="widthFix" :src="`${config.baseUrl}/images/mini-bg.jpg`"></image>
<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">
<view class="title">今日竞猜</view>
<view class="vs-box">
<view class="left">
<up-avatar class="item-box" size="48" mode="aspectFit"
:src="gameInfo.home_logo"></up-avatar>
<up-avatar
class="item-box"
size="48"
mode="aspectFit"
:src="gameInfo.home_logo"
></up-avatar>
<view class="item-text">{{ gameInfo.home_field }}</view>
</view>
<view class="middle">
@ -25,204 +48,183 @@
<view class="item-text">{{ gameInfo.little_game_at }}</view>
</view>
<view class="right">
<up-avatar class="item-box" size="48" mode="aspectFit"
:src="gameInfo.away_logo"></up-avatar>
<up-avatar
class="item-box"
size="48"
mode="aspectFit"
:src="gameInfo.away_logo"
></up-avatar>
<view class="item-text">{{ gameInfo.away }}</view>
</view>
</view>
<view class="operation-box">
<up-button class="guess-btn" :disabled="false" shape="circle" @click="showGuessModal(gameInfo)"
:customStyle="{ margin: 0, width: '132px', backgroundColor: '#1D2B5C', color: '#fff', opacity: 1 }"
v-if="!gameInfo.game_at_comparison_now && !gameInfo.has_guess">立即竞猜</up-button>
<up-button class="guess-btn disabled" :disabled="false" shape="circle"
<up-button
class="guess-btn"
:disabled="false"
shape="circle"
@click="showGuessModal(gameInfo)"
:customStyle="{ margin: 0, width: '132px', backgroundColor: '#1D2B5C', color: '#fff', opacity: 0.7 }"
v-if="gameInfo.has_guess">已竞猜</up-button>
:customStyle="{
margin: 0,
width: '132px',
backgroundColor: '#1D2B5C',
color: '#fff',
opacity: 1,
}"
v-if="!gameInfo.game_at_comparison_now && !gameInfo.has_guess"
>立即竞猜</up-button
>
<up-button class="guess-btn disabled" :disabled="true" shape="circle"
<up-button
class="guess-btn disabled"
:disabled="false"
shape="circle"
@click="showGuessModal(gameInfo)"
:customStyle="{ margin: 0, width: '132px', backgroundColor: '#1D2B5C', color: '#fff', opacity: 0.7 }"
v-if="gameInfo.game_at_comparison_now && !gameInfo.has_guess">已结束</up-button>
:customStyle="{
margin: 0,
width: '132px',
backgroundColor: '#1D2B5C',
color: '#fff',
opacity: 0.7,
}"
v-if="gameInfo.has_guess"
>已竞猜</up-button
>
<up-button class="more-btn" :disabled="false" shape="circle" @click="goToActivateDetailPage"
:customStyle="{ margin: 0, width: '75px', backgroundColor: '#f0f0f0', color: '#000', opacity: 1 }">更多</up-button>
<up-button
class="guess-btn disabled"
:disabled="true"
shape="circle"
@click="showGuessModal(gameInfo)"
:customStyle="{
margin: 0,
width: '132px',
backgroundColor: '#1D2B5C',
color: '#fff',
opacity: 0.7,
}"
v-if="gameInfo.game_at_comparison_now && !gameInfo.has_guess"
>已结束</up-button
>
<up-button
class="more-btn"
:disabled="false"
shape="circle"
@click="goToActivateDetailPage"
:customStyle="{
margin: 0,
width: '75px',
backgroundColor: '#f0f0f0',
color: '#000',
opacity: 1,
}"
>更多</up-button
>
</view>
</view>
<view class="news-box" v-if="articleList.length">
<view class="news-title-box">
<text class="title">体彩资讯</text>
<text class="more" @click="$goToPage('pages/news/news', true)">查看更多</text>
<text class="more" @click="$goToPage('pages/news/news', true)"
>查看更多</text
>
</view>
<view v-for="(item, index) in articleList" :key="index"
@click="$goToPage({ url: 'packages/pages/news/newDetail/newDetail', params: { id: item.id } })">
<view class="news-image-box" :class="{ 'last': index === articleList.length - 1 }"
v-if="item.cover">
<view
v-for="(item, index) in articleList"
:key="index"
@click="
$goToPage({
url: 'packages/pages/news/newDetail/newDetail',
params: { id: item.id },
})
"
>
<view
class="news-image-box"
:class="{ last: index === articleList.length - 1 }"
v-if="item.cover"
>
<image class="news-image" :src="item.cover"></image>
<view class="news-info">
<view class="news-info-title">{{ item.title }}</view>
<view class="news-info-publish_time">{{ item.published_at }}</view>
<view class="news-info-publish_time">{{
item.published_at
}}</view>
</view>
</view>
<view class="news-content-box" :class="{ 'last': index === articleList.length - 1 }" v-else>
<view
class="news-content-box"
:class="{ last: index === articleList.length - 1 }"
v-else
>
<view class="news-info">
<view class="news-info-title">{{ item.title }}</view>
<view class="news-info-publish_time">{{ item.published_at }}</view>
</view>
</view>
</view>
</view>
</view>
<view class="guess-model" v-if="gameInfo">
<up-modal :show="showGuessModalVisible" :width="335" :closeOnClickOverlay="true"
:showConfirmButton="false" :showCancelButton="false" @close="hideGuessModal">
<view class="slot-content">
<view class="guess-title">
<view>{{ gameInfo.home_field }}</view>
<view>VS</view>
<view>{{ gameInfo.away }}</view>
</view>
<view class="guess-table">
<view class="row herder-title">
<view class="table-td col-12"></view>
</view>
<view class="table-tr row row-3">
<view class="row-title table-td row-3 col-10"></view>
<view class="row-content">
<view class="row-1 col-10">
<view class="table-td col-2" :class="{ 'active': userGuess === '1:0' }"
@click="userGuessChange('1:0')">1:0</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '2:0' }"
@click="userGuessChange('2:0')">2:0</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '2:1' }"
@click="userGuessChange('2:1')">2:1</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '3:0' }"
@click="userGuessChange('3:0')">3:0</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '3:1' }"
@click="userGuessChange('3:1')">3:1</view>
</view>
<view class="row-1 col-10">
<view class="table-td col-2" :class="{ 'active': userGuess === '3:2' }"
@click="userGuessChange('3:2')">3:2</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '4:0' }"
@click="userGuessChange('4:0')">4:0</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '4:1' }"
@click="userGuessChange('4:1')">4:1</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '4:2' }"
@click="userGuessChange('4:2')">4:2</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '5:0' }"
@click="userGuessChange('5:0')">5:0</view>
</view>
<view class="row-1 col-10">
<view class="table-td col-2" :class="{ 'active': userGuess === '5:1' }"
@click="userGuessChange('5:1')">5:1</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '5:2' }"
@click="userGuessChange('5:2')">5:2</view>
<view class="table-td col-6" :class="{ 'active': userGuess === '胜其他' }"
@click="userGuessChange('胜其他')">胜其他</view>
</view>
</view>
</view>
<view class="table-tr row row-1">
<view class="row-title table-td row-1 col-10"></view>
<view class="row-content">
<view class="row-1 col-10">
<view class="table-td col-2" :class="{ 'active': userGuess === '0:0' }"
@click="userGuessChange('0:0')">0:0</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '1:1' }"
@click="userGuessChange('1:1')">1:1</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '2:2' }"
@click="userGuessChange('2:2')">2:2</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '3:3' }"
@click="userGuessChange('3:3')">3:3</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '平其他' }"
@click="userGuessChange('平其他')">平其他</view>
</view>
</view>
</view>
<view class="table-tr row row-3">
<view class="row-title table-td row-3 col-10"></view>
<view class="row-content">
<view class="row-1 col-10">
<view class="table-td col-2" :class="{ 'active': userGuess === '0:1' }"
@click="userGuessChange('0:1')">0:1</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '0:2' }"
@click="userGuessChange('0:2')">0:2</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '0:3' }"
@click="userGuessChange('0:3')">0:3</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '0:4' }"
@click="userGuessChange('0:4')">0:4</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '0:5' }"
@click="userGuessChange('0:5')">0:5</view>
</view>
<view class="row-1 col-10">
<view class="table-td col-2" :class="{ 'active': userGuess === '1:2' }"
@click="userGuessChange('1:2')">1:2</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '1:3' }"
@click="userGuessChange('1:3')">1:3</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '1:4' }"
@click="userGuessChange('1:4')">1:4</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '1:5' }"
@click="userGuessChange('1:5')">1:5</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '2:3' }"
@click="userGuessChange('2:3')">2:3</view>
</view>
<view class="row-1 col-10">
<view class="table-td col-2" :class="{ 'active': userGuess === '2:4' }"
@click="userGuessChange('2:4')">2:4</view>
<view class="table-td col-2" :class="{ 'active': userGuess === '2:5' }"
@click="userGuessChange('2:5')">2:5</view>
<view class="table-td col-6" :class="{ 'active': userGuess === '负其他' }"
@click="userGuessChange('负其他')">负其他</view>
<view class="news-info-publish_time">{{
item.published_at
}}</view>
</view>
</view>
</view>
</view>
<view class="guess-btns" v-if="!readonly">
<up-button class="more-btn"
:customStyle="{ margin: 0, width: '120px', backgroundColor: '#D9D9D9', color: '#000', }"
shape="circle" text="取消" @click="hideGuessModal"></up-button>
<up-button class="more-btn"
:customStyle="{ margin: 0, width: '120px', backgroundColor: '#5fb358', color: '#fff', }"
shape="circle" text="确定" @click="submitGuessResult"></up-button>
<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>
</up-modal>
</view>
</mescroll-body>
<QuizModal
:gameInfo="gameInfo"
:readonly="readonly"
@hideGuessModal="hideGuessModal"
@submitGuessResult="submitGuessResult"
@userGuessChange="userGuessChange"
v-model:show="showGuessModalVisible"
></QuizModal>
</view>
</template>
<script setup>
import { ref, getCurrentInstance } from 'vue';
import QuizModal from '@/components/quiz/modal.vue'
import { ref, getCurrentInstance } from 'vue'
import config from '@/common/config'
import { queryAds, queryLatestgame, queryRecommendArticles, submitGuess } from '@/api/xinjiang_guess';
import useAuthUser from '@/utils/hooks/useAuthUser';
import {
queryAds,
queryLatestgame,
queryRecommendArticles,
submitGuess,
getLatestGameLogs,
} from '@/api/xinjiang_guess'
import useAuthUser from '@/utils/hooks/useAuthUser'
import jumpFun from '@/utils/jump.js'
const vm = getCurrentInstance();
import QuizItem from '@/components/quiz/item-new.vue'
const vm = getCurrentInstance()
const loading = ref(false);
const homeBannerLoading = ref(false);
const homeBannerInfo = ref(null);
const homeBannerList = ref([]);
const displayMultipleItems = ref(0);
const loading = ref(false)
const homeBannerLoading = ref(false)
const homeBannerInfo = ref(null)
const homeBannerList = ref([])
const displayMultipleItems = ref(0)
const showGuessModalVisible = ref(false);
const gameInfoLoading = ref(false);
const gameInfo = ref(null);
const readonly = ref(false);
const userGuess = ref('0:0');
const submitGuessLoading = ref(false);
const showGuessModalVisible = ref(false)
const gameInfoLoading = ref(false)
const gameInfo = ref(null)
const readonly = ref(false)
const userGuess = ref('0:0')
const submitGuessLoading = ref(false)
const articleListLoading = ref(false);
const articleList = ref([]);
const articleListLoading = ref(false)
const articleList = ref([])
const gameLogs = ref([])
function clickHomeBanner(index) {
// if (!homeBannerList.value.length) {
@ -233,40 +235,41 @@ function clickHomeBanner(index) {
}
function userGuessChange(score) {
userGuess.value = score
if (readonly.value) {
return;
return
}
userGuess.value = score;
userGuess.value = score
}
function showGuessModal(item) {
const { user } = useAuthUser();
const { user } = useAuthUser()
if (user.is_need_bind_phone) {
vm.proxy.$goToPage('packages/pages/login/login?previous=index');
return;
vm.proxy.$goToPage('packages/pages/login/login?previous=index')
return
}
gameInfo.value = item;
gameInfo.value = item
if (gameInfo.value.has_guess) {
readonly.value = true;
readonly.value = true
}
if (gameInfo.value.game_at_comparison_now) {
readonly.value = true;
readonly.value = true
}
if (readonly.value) {
userGuess.value = item.has_guess;
userGuess.value = item.has_guess
} else {
userGuess.value = '0:0';
userGuess.value = '0:0'
}
showGuessModalVisible.value = true;
showGuessModalVisible.value = true
}
function hideGuessModal() {
showGuessModalVisible.value = false;
showGuessModalVisible.value = false
setTimeout(() => {
userGuess.value = '0:0';
}, 300);
userGuess.value = '0:0'
}, 300)
}
function goToActivateDetailPage() {
@ -274,127 +277,153 @@ function goToActivateDetailPage() {
url: 'packages/pages/activeDetail/activeDetail',
params: {
id: gameInfo.value.activity_id,
}
},
})
}
async function getHomeBanner() {
try {
homeBannerLoading.value = true;
homeBannerLoading.value = true
const resp = await queryAds({
address: "index-top",
});
homeBannerInfo.value = resp.data;
address: 'index-top',
})
homeBannerInfo.value = resp.data
homeBannerList.value = resp.data?.ads.map(item => {
homeBannerList.value =
resp.data?.ads.map((item) => {
return {
url: item.resource,
title: "",
poster: "",
title: '',
poster: '',
jump_type: item.jump_type,
jump_config: item.jump_config,
}
}) || [];
}) || []
displayMultipleItems.value = 1;
displayMultipleItems.value = 1
if (homeBannerList.value.length > 3) {
displayMultipleItems.value = 3;
displayMultipleItems.value = 3
}
} catch (err) {
console.error(err);
console.error(err)
} finally {
homeBannerLoading.value = false;
homeBannerLoading.value = false
}
}
async function getLatestGuess() {
try {
gameInfoLoading.value = true;
gameInfoLoading.value = true
const resp = await queryLatestgame()
gameInfo.value = resp.data;
gameInfo.value = resp.data
if (gameInfo.value && gameInfo.value.has_guess) {
userGuess.value = gameInfo.value.has_guess;
userGuess.value = gameInfo.value.has_guess
}
} catch (err) {
console.error(err);
console.error(err)
} finally {
gameInfoLoading.value = false;
gameInfoLoading.value = false
}
}
async function getRecommendArticles(params) {
try {
articleListLoading.value = true;
articleListLoading.value = true
const resp = await queryRecommendArticles(params)
articleList.value = resp.data?.articles || [];
articleList.value = resp.data?.articles || []
} catch (err) {
console.error(err);
console.error(err)
} finally {
articleListLoading.value = false;
articleListLoading.value = false
}
}
async function submitGuessResult() {
async function getNewQuiz() {
try {
const resData = await getLatestGameLogs()
gameLogs.value = resData.data?.list || []
} catch (error) {
console.error(error)
}
}
async function submitGuessResult(e) {
if(e){
userGuess.value = e
}
try {
uni.showLoading({
title: "加载中..."
});
title: '加载中...',
})
const params = {
game: gameInfo.value.id,
score: userGuess.value,
};
submitGuessLoading.value = true;
const res = await submitGuess(params, { custom: { catch: true } });
}
submitGuessLoading.value = true
const res = await submitGuess(params, { custom: { catch: true } })
console.log('submitGuess', res);
console.log('submitGuess', res)
uni.showToast({
title: res.message,
icon: "none",
});
icon: 'none',
})
getLatestGuess();
setTimeout(hideGuessModal, 0);
getLatestGuess()
setTimeout(hideGuessModal, 0)
} catch (err) {
console.error(err);
console.error(err)
} finally {
submitGuessLoading.value = false;
submitGuessLoading.value = false
}
}
function getData(page = 1, per_page = 10) {
return new Promise(async (resolve, reject) => {
try {
loading.value = true;
loading.value = true
setTimeout(async () => {
await getHomeBanner();
await getLatestGuess();
await getRecommendArticles();
resolve();
}, 1500);
await getHomeBanner()
await getLatestGuess()
// await getRecommendArticles();
getNewQuiz()
resolve()
}, 1500)
} catch (err) {
console.log('getData index', err);
reject();
console.log('getData index', err)
reject()
} finally {
loading.value = false;
loading.value = false
}
});
})
}
import { onShow, onLoad, onPullDownRefresh, onPageScroll, onReachBottom, onShareAppMessage } from "@dcloudio/uni-app";
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js";
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom)
import {
onShow,
onLoad,
onPullDownRefresh,
onPageScroll,
onReachBottom,
onShareAppMessage,
} from '@dcloudio/uni-app'
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js'
const { mescrollInit, downCallback, getMescroll } = useMescroll(
onPageScroll,
onReachBottom
)
const list = ref([]);
const list = ref([])
const upCallback = (mescroll) => {
typeof getData === 'function' && getData(mescroll.num, mescroll.size).then(data => {
typeof getData === 'function' &&
getData(mescroll.num, mescroll.size)
.then((data) => {
let curPageData = [] //
if (Array.isArray(data)) {
curPageData = data;
curPageData = data
}
if (mescroll.num == 1) list.value = []; //
list.value = list.value.concat(curPageData); //
if (mescroll.num == 1) list.value = [] //
list.value = list.value.concat(curPageData) //
//,;
//mescroll,,;,;
@ -408,12 +437,13 @@ const upCallback = (mescroll) => {
//mescroll.endSuccess(curPageData.length, hasNext); //(, true/false)
// (),:20,10,2.,.
mescroll.endSuccess(curPageData.length); // ,
}).catch((err) => {
console.error(err);
mescroll.endErr(); // ,
mescroll.endSuccess(curPageData.length) // ,
})
};
.catch((err) => {
console.error(err)
mescroll.endErr() // ,
})
}
</script>
<style lang="scss">
@ -494,7 +524,7 @@ const upCallback = (mescroll) => {
.guess-btn {
margin: 0;
width: 132px;
background-color: #1D2B5C;
background-color: #1d2b5c;
color: #fff;
border-radius: 50px;
height: 36px;
@ -502,7 +532,7 @@ const upCallback = (mescroll) => {
}
.guess-btn.disabled {
opacity: .5;
opacity: 0.5;
}
.more-btn {
@ -526,7 +556,7 @@ const upCallback = (mescroll) => {
.news-title-box {
padding-left: 12px;
border-left: 4px solid #D8524C;
border-left: 4px solid #d8524c;
font-weight: bold;
font-size: 16px;
@ -594,120 +624,120 @@ const upCallback = (mescroll) => {
}
}
.guess-model {
.slot-content {
display: flex;
flex-direction: column;
gap: 12px;
}
// .guess-model {
// .slot-content {
// display: flex;
// flex-direction: column;
// gap: 12px;
// }
.guess-title {
width: 100%;
// .guess-title {
// width: 100%;
display: flex;
justify-content: center;
align-items: center;
gap: 58px;
}
// display: flex;
// justify-content: center;
// align-items: center;
// gap: 58px;
// }
.guess-table {
width: 100%;
// .guess-table {
// width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 12px;
// display: flex;
// flex-direction: column;
// justify-content: center;
// align-items: center;
// font-size: 12px;
.table-td {
border: 1px solid #bbb;
width: 48px !important;
}
// .table-td {
// border: 1px solid #bbb;
// width: 48px !important;
// }
.table-td.active {
background-color: #1D2B5C;
color: #fff;
}
// .table-td.active {
// background-color: #1d2b5c;
// color: #fff;
// }
.row-1 {
height: calc(30px * 1 - 2px) !important;
line-height: calc(30px * 1 - 2px) !important;
}
// .row-1 {
// height: calc(30px * 1 - 2px) !important;
// line-height: calc(30px * 1 - 2px) !important;
// }
.row-2 {
height: calc(30px * 2 - 2px) !important;
line-height: calc(30px * 2 - 2px) !important;
}
// .row-2 {
// height: calc(30px * 2 - 2px) !important;
// line-height: calc(30px * 2 - 2px) !important;
// }
.row-3 {
height: calc(30px * 3 - 8px) !important;
line-height: calc(30px * 3 - 8px) !important;
}
// .row-3 {
// height: calc(30px * 3 - 8px) !important;
// line-height: calc(30px * 3 - 8px) !important;
// }
.row {
width: 300px;
height: 30px;
line-height: 30px;
flex-shrink: 0;
display: flex;
text-align: center;
// .row {
// width: 300px;
// height: 30px;
// line-height: 30px;
// flex-shrink: 0;
// display: flex;
// text-align: center;
.col-1 {
width: calc(292px / 12 * 1);
}
// .col-1 {
// width: calc(292px / 12 * 1);
// }
.col-2 {
width: calc(292px / 12 * 2);
}
// .col-2 {
// width: calc(292px / 12 * 2);
// }
.col-10 {
display: flex;
justify-content: flex-start;
align-self: flex-start;
flex-grow: 1;
// .col-10 {
// display: flex;
// justify-content: flex-start;
// align-self: flex-start;
// flex-grow: 1;
.table-td {
width: 47.7px !important;
border: 1px solid #bbb;
}
// .table-td {
// width: 47.7px !important;
// border: 1px solid #bbb;
// }
.col-6 {
width: calc(47.7px * 3 + 4px) !important;
}
}
// .col-6 {
// width: calc(47.7px * 3 + 4px) !important;
// }
// }
.col-12 {
width: 292px;
}
}
// .col-12 {
// width: 292px;
// }
// }
.herder-title {
background-color: #1D2B5C;
color: #fff;
// .herder-title {
// background-color: #1d2b5c;
// color: #fff;
.table-td {
width: 100% !important;
}
}
// .table-td {
// width: 100% !important;
// }
// }
.row-title {
background-color: #D9D9D9;
width: 48px !important;
justify-content: center !important;
}
// .row-title {
// background-color: #d9d9d9;
// width: 48px !important;
// justify-content: center !important;
// }
.row-content {
display: flex;
flex-wrap: wrap;
width: calc(300px - 48px - 3px) !important;
}
}
// .row-content {
// display: flex;
// flex-wrap: wrap;
// width: calc(300px - 48px - 3px) !important;
// }
// }
.guess-btns {
display: flex;
justify-content: space-around;
width: 300px;
flex-shrink: 0;
}
}
// .guess-btns {
// display: flex;
// justify-content: space-around;
// width: 300px;
// flex-shrink: 0;
// }
// }
</style>

View File

@ -18,7 +18,7 @@
}"
>
<view class="mine-page">
<view class="p-16">
<view class="p-base">
<view class="userinfo-box">
<view class="userinfo" @click="handleClickUserInfo">
<up-avatar
@ -42,27 +42,34 @@
/>
</div>
</view>
<view v-for="(block, index) in menus" :key="index">
<view class="block-box bg-white rounded">
<view class="space-y-3">
<view
v-for="(block, index) in menus"
:key="index"
class="card-shadow overflow-hidden px-30rpx"
>
<view v-for="(item, index) in block" :key="index">
<view
class="flex text-primary items-center cell text-base"
@click="goToMenuPage(item)"
v-if="!item.openType"
>
<image class="icon mr-12" :src="item.icon" />
<image class="icon mr-12px" :src="item.icon" />
<view class="menu-item" :openType="item.openType">
<text class="text">{{ item.text }}</text>
<text class="extra" v-if="item.extra">{{ item.extra }}</text>
</view>
<image class="icon" src="@/static/icons/arrow.svg" />
<image
class="w-30rpx h-30rpx opacity-50"
src="@/static/icons/arrow.svg"
/>
</view>
<view
class="flex text-primary items-center cell text-base"
v-if="item.openType"
>
<image class="icon mr-12" :src="item.icon" />
<image class="icon mr-12px" :src="item.icon" />
<up-button class="menu-item-btn" :openType="item.openType">
<text class="text">{{ item.text }}</text>
<text class="extra" v-if="item.extra">{{ item.extra }}</text>
@ -217,20 +224,22 @@ const upCallback = (mescroll) => {
<style lang="scss">
.phone {
position: fixed;
// #ifdef MP-WEIXIN
bottom: 50rpx;
// #endif
// #ifdef H5
bottom: 180rpx;
// #endif
z-index: 9999;
left: 0;
width: 100%;
&-warp{
&-warp {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
}
.mr-12 {
margin-right: 12px;
}
.icon {
width: 20px;

View File

@ -105,9 +105,7 @@ const upCallback = (mescroll) => {
</script>
<style lang="scss">
.mt-8 {
margin-top: 8px;
}
.m-title {
margin: 8px 0 10px;

View File

@ -0,0 +1,178 @@
<template>
<view class="bg-hex-1b2f85">
<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="relative text-white">
<view class="flex justify-between">
<view class="text-base font-medium">{{ detail.name }}</view>
<view class="text-xs" @click="showRuleModal"></view>
</view>
<view class="text-sm mt-3 font-medium"
>{{ dayjs(detail.start_at).format('YYYY-MM-DD') }}{{
dayjs(detail.end_at).format('YYYY-MM-DD')
}}
</view>
</view>
<view class="bg-white rounded-12px relative mt-4 min-h-40vh">
<view class="px-3 pt-16rpx">
<CTitle title="他的竞猜"></CTitle>
</view>
<view class="">
<Item v-for="(item, i) in list" :key="i" :data="item"></Item>
<mescroll-empty v-if="!list.length"></mescroll-empty>
<view class="flex-center py-30rpx" v-else> </view>
</view>
</view>
</view>
</view>
</mescroll-body>
<view class="h-160rpx">
<view
class="fixed bottom-50rpx h-100rpx flex left-0 w-full justify-center items-center box-content"
>
<up-button
class="guess-btn"
:disabled="false"
shape="circle"
:customStyle="{
margin: 0,
width: '132px',
backgroundColor: '#1D2B5C',
color: '#fff',
opacity: 1,
}"
@click="goActiveDetail"
>立即参与竞猜</up-button
>
</view>
</view>
<up-modal
:show="showRuleModalVisible"
:width="335"
:closeOnClickOverlay="true"
:showConfirmButton="false"
:showCancelButton="false"
@close="hideRuleModal"
>
<view class="slot-content-rule">
<view class="title">活动规则</view>
<view class="content">{{ detail.rules }}</view>
</view>
</up-modal>
</view>
</template>
<script setup>
import dayjs from 'dayjs'
import { onPageScroll, onReachBottom, onLoad } from '@dcloudio/uni-app'
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js'
import { queryActivitiesDetail, activityGameLogs } from '@/api/xinjiang_guess'
import Item from '@/components/quiz/item.vue'
import CTitle from '@/components/c-title/index.vue'
import config from '@/common/config'
import { ref, getCurrentInstance } from 'vue';
import useAuthUser from '@/utils/hooks/useAuthUser';
const vm = getCurrentInstance();
const activityId = ref(null)
const userId = ref(null)
const detail = ref({})
const list = ref([])
const showRuleModalVisible = ref(false)
const { mescrollInit, downCallback, getMescroll } = useMescroll(
onPageScroll,
onReachBottom
)
onLoad((query) => {
activityId.value = query.activity_id
userId.value = query.user_id
})
const upCallback = async (mescroll) => {
const { size, num } = mescroll
if (num === 1) getActiveDetail()
try {
const resData = await activityGameLogs({
user_id: userId.value,
activity_id: activityId.value,
per_page: size,
page: num,
})
const arr = resData.data.list || [] //
if (num == 1) list.value = [] //
list.value = list.value.concat(arr) //
mescroll.endSuccess(arr.length) // ,
} catch (error) {
mescroll.endErr()
console.log(error)
}
}
const getActiveDetail = async () => {
try {
const resData = await queryActivitiesDetail({ id: activityId.value })
detail.value = resData.data
} catch (error) {}
}
const showRuleModal = async () => {
showRuleModalVisible.value = true
}
const hideRuleModal = async () => {
showRuleModalVisible.value = false
}
function goActiveDetail() {
const { user } = useAuthUser();
if (user.is_need_bind_phone) {
vm.proxy.$goToPage('packages/pages/login/login?previous=index');
return;
}
vm.proxy.$goToPage({
url: 'packages/pages/activeDetail/activeDetail',
params: {
id: activityId.value
}
})
}
</script>
<style lang="scss" scoped>
.slot-content-rule {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 12px;
.title {
font-size: 16px;
font-weight: 500;
}
.content {
font-size: 12px;
font-weight: 400;
white-space: pre-wrap;
}
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -39,7 +39,7 @@ const GlobalOption = {
textLoading: '加载中 ...', // 加载中的提示文本
textNoMore: '-- END --', // 没有更多数据的提示文本
empty: {
tip: '~ 空空如也 ~' // 空提示
tip: '' // 空提示
}
}
},

58
uno.config.js 100644
View File

@ -0,0 +1,58 @@
import { defineConfig, presetAttributify } from 'unocss'
import {
presetApplet,
presetRemRpx,
transformerAttributify,
} from 'unocss-applet'
// uni-app
const isApplet = process.env?.UNI_PLATFORM?.startsWith('mp-') ?? false
const presets = []
const transformers = []
if (isApplet) {
presets.push(presetApplet())
presets.push(presetRemRpx())
transformers.push(transformerAttributify({ ignoreAttributes: ['block'] }))
}
else {
presets.push(presetApplet())
presets.push(presetAttributify())
presets.push(presetRemRpx({ mode: 'rpx2rem' }))
}
export default defineConfig({
shortcuts: {
'flex-center': 'flex items-center justify-center',
},
theme: {
colors: {
'4e': '#4e4e4e',
primary: '#525252',
black: '#000000',
},
spacing: {
'base': '30rpx',
}
},
rules: [
[
'p-safe',
{
padding: 'env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)',
},
],
['pt-safe', { 'padding-top': 'env(safe-area-inset-top)' }],
['pb-safe', { 'padding-bottom': 'env(safe-area-inset-bottom)' }],
],
presets: [
...presets,
],
transformers: [
...transformers,
],
})

View File

@ -1,8 +1,10 @@
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import UnoCSS from 'unocss/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
uni(),
UnoCSS()
],
})

780
yarn.lock

File diff suppressed because it is too large Load Diff