fix: 메인 페이지에 최근 설문을 띄우도록 처리
This commit is contained in:
+14
-4
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace sammo;
|
||||
|
||||
use sammo\DTO\VoteInfo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
@@ -109,6 +111,16 @@ if (!$otherTextInfo) {
|
||||
} else {
|
||||
$otherTextInfo = join(', ', $otherTextInfo);
|
||||
}
|
||||
|
||||
$lastVoteID = $gameStor->lastVote;
|
||||
$lastVote = null;
|
||||
if($lastVoteID){
|
||||
$voteStor = KVStorage::getStorage($db, 'vote');
|
||||
$lastVote = new VoteInfo($voteStor->getValue("vote_{$voteID}"));
|
||||
if($lastVote->endDate && $lastVote->endDate < TimeUtil::now()){
|
||||
$lastVote = null;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -207,13 +219,11 @@ if (!$otherTextInfo) {
|
||||
</div>
|
||||
<div class="s-border-t py-2 col col-6 col-md-4 vote-cell">
|
||||
<?php
|
||||
$vote = $gameStor->vote ?: [''];
|
||||
$vote_title = Tag2Code($gameStor->vote_title ?? '-');
|
||||
?>
|
||||
<?php if ($vote[0] == "") : ?>
|
||||
<?php if ($lastVote === null) : ?>
|
||||
<span style='color:magenta'>진행중 설문 없음</span>
|
||||
<?php else : ?>
|
||||
<span style='color:cyan'>설문 진행중</span> : <span><?= $vote_title ?></span>
|
||||
<span style='color:cyan'>설문 진행중</span> : <span><?= $lastVote->title ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<BContainer id="container" :toast="{ root: true }" class="pageVote bg0">
|
||||
<TopBackBar :reloadable="true" title="" @reload="reloadVote" />
|
||||
<div id="vote-title" class="bg2">설문 조사({{ voteReward }}금과 추첨으로 유니크템 증정!</div>
|
||||
<div id="vote-title" class="bg2">설문 조사({{ voteReward }}금과 추첨으로 유니크템 증정!)</div>
|
||||
<table v-if="currentVote" id="vote-result">
|
||||
<colgroup>
|
||||
<col class="vote-idx" />
|
||||
@@ -167,6 +167,7 @@ declare const staticValues: {
|
||||
serverID: string;
|
||||
isGameLoggedIn: boolean;
|
||||
isVoteAdmin: boolean;
|
||||
voteReward: number;
|
||||
};
|
||||
</script>
|
||||
<script lang="ts" setup>
|
||||
@@ -182,10 +183,9 @@ import { formatTime } from "@/util/formatTime";
|
||||
import { isBrightColor } from "@/util/isBrightColor";
|
||||
import { formatVoteColor } from "@/utilGame/formatVoteColor";
|
||||
|
||||
const { isVoteAdmin, isGameLoggedIn } = staticValues;
|
||||
const { isVoteAdmin, isGameLoggedIn, voteReward } = staticValues;
|
||||
const voteList = ref(new Map<number, VoteInfo>());
|
||||
|
||||
const voteReward = 10;
|
||||
const toasts = unwrap(useToast());
|
||||
|
||||
const showNewVote = ref(false);
|
||||
@@ -409,7 +409,7 @@ async function submitNewVote() {
|
||||
@import "@scss/common/break_500px.scss";
|
||||
|
||||
#vote-title {
|
||||
font-size: 2em;
|
||||
font-size: 1.8em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ $session = Session::requireLogin()->loginGame()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()] ?? []);
|
||||
$isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5;
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$develcost = $gameStor->getValue('develcost');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -23,6 +26,7 @@ $isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5;
|
||||
'serverID' => UniqueConst::$serverID,
|
||||
'isGameLoggedIn' => $session->isGameLoggedIn(),
|
||||
'isVoteAdmin' => $isVoteAdmin,
|
||||
'voteReward' => $develcost * 5,
|
||||
]]) ?>
|
||||
<?= WebUtil::printJS('../d_shared/common_path.js', true) ?>
|
||||
<?= WebUtil::printDist('vue', ['v_vote'], true) ?>
|
||||
|
||||
Reference in New Issue
Block a user