feat: 添加租房模块图标和功能优化
fix: 修复投票状态显示逻辑 refactor: 重命名ajaxget为ajaxGet style: 优化CSS样式和布局 docs: 更新组件文档和注释
This commit is contained in:
@@ -5,17 +5,35 @@ const { defineComponent, ref, onMounted, nextTick } = Vue;
|
||||
// 定义组件(直接使用模板)
|
||||
export const headTop = defineComponent({
|
||||
name: "headTop",
|
||||
props: {
|
||||
itemdata: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
props: {},
|
||||
|
||||
setup(props) {
|
||||
onMounted(() => {});
|
||||
|
||||
let signInAlreadyState = ref(false);
|
||||
let state = ref(0); // 是否已经签到
|
||||
|
||||
let userInfoWinTimerCount = 0;
|
||||
const userInfoWinTimer = setInterval(() => {
|
||||
if (todaysignedState) {
|
||||
state.value = todaysigned;
|
||||
clearInterval(userInfoWinTimer);
|
||||
}
|
||||
userInfoWinTimerCount++;
|
||||
if (userInfoWinTimerCount >= 3000) clearInterval(userInfoWinTimer);
|
||||
}, 50);
|
||||
|
||||
const signIn = () => {
|
||||
ajax("/v2/api/forum/sign").then((res) => {
|
||||
if (res.code != 200) {
|
||||
creationAlertBox("error", res.message);
|
||||
return;
|
||||
}
|
||||
|
||||
let data = res.data;
|
||||
state.value = 1;
|
||||
creationAlertBox("success", res.message || "签到成功");
|
||||
});
|
||||
};
|
||||
|
||||
let input = ref("");
|
||||
let defaultSearchText = ref("屯特");
|
||||
@@ -23,8 +41,9 @@ export const headTop = defineComponent({
|
||||
const searchText = input.value || defaultSearchText.value;
|
||||
redirectToExternalWebsite("/search/" + searchText);
|
||||
};
|
||||
return { input, defaultSearchText, goSearch, signInAlreadyState };
|
||||
|
||||
return { state, signIn, input, defaultSearchText, goSearch };
|
||||
},
|
||||
|
||||
template: `<div class="head-top flexacenter"> <a href="/" class="flexacenter" target="_blank"> <img class="logo" src="https://oss.gter.net/logo" alt="" /> </a> <div class="flex1"></div> <div class="input-box flexacenter"> <input class="input flex1" type="text" :placeholder="'大家都在搜:' + defaultSearchText" @keyup.enter="goSearch" v-model="input" /> <img class="icon" src="/img/search-icon.svg" @click="goSearch" /> </div> <div class="sign-in sign-in-already flexcenter" v-if="signInAlreadyState" v-cloak onclick="showWindow('dsu_paulsign', 'https://bbs.gter.net/plugin.php?id=dsu_paulsign:sign&show=sign')"> <img class="sign-icon" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-icon.png" /> <span>已签到,明天再来</span> </div> <div class="sign-in sign-in-no flexacenter" v-else onclick="showWindow('dsu_paulsign', 'https://bbs.gter.net/plugin.php?id=dsu_paulsign:sign&show=sign')" v-cloak> <img class="sign-in-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-in-bj.svg" /> <img class="coin-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/coin-bj.svg" /> <img class="coin-icon" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/coin-icon.png" /> <span class="text flex1">签到领寄托币</span> <div class="sign-go flexcenter"> <img class="sign-go-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-go.svg" /> GO </div> <img class="petal1" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal1.png" /> <img class="petal2" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal2.png" /> <img class="petal3" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal3.png" /> </div></div>`,
|
||||
template: `<div class="head-top flexacenter"> <a href="/" class="flexacenter" target="_blank"> <img class="logo" src="https://oss.gter.net/logo" alt="" /> </a> <div class="flex1"></div> <div class="input-box flexacenter"> <input class="input flex1" type="text" :placeholder="'大家都在搜:' + defaultSearchText" @keyup.enter="goSearch" v-model="input" /> <img class="icon" src="/img/search-icon.svg" @click="goSearch" /> </div> <div class="sign-in sign-in-no flexacenter" v-if="state == 0" @click="signIn()" v-cloak> <img class="sign-in-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-in-bj.svg" /> <img class="coin-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/coin-bj.svg" /> <img class="coin-icon" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/coin-icon.png" /> <span class="text flex1">签到领寄托币</span> <div class="sign-go flexcenter"> <img class="sign-go-bj" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-go.svg" /> GO </div> <img class="petal1" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal1.png" /> <img class="petal2" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal2.png" /> <img class="petal3" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/petal3.png" /> </div> <div class="sign-in sign-in-already flexcenter" v-else> <img class="sign-icon" src="//framework.x-php.com/gter/image/gter/forum/assets/forum/sign-icon.png" /> <span>已签到,明天再来</span> </div></div>`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user