Files
PC-vote/app.vue
DESKTOP-RQ919RC\Pc 68000d7e43 feat(Details): 新增投票详情页管理功能和评论优化
- 添加投票详情页的管理功能,包括隐藏、推荐、精华和删除操作
- 优化评论组件,支持多图上传和显示
- 新增投币功能组件
- 更新API接口调用方式,适配新后端接口
- 完善用户权限管理逻辑
- 修复样式问题和交互体验
2025-11-11 19:05:46 +08:00

297 lines
7.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- red_cjs_prodExports.has -->
<!--
首页搜索不行
我发起的投票不能修改 匿名状态
我发起的投票不确定能下拉加载
-->
<template>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<RouterView></RouterView>
</template>
<script setup>
const route = useRoute();
// 是否是 生产环境
const isProduction = process.env.NODE_ENV === "production";
// console.log(process.env.NODE_ENV, "NODE_ENV")
onMounted(() => {
// isNeedLogin.value = false
// if (!isProduction) {
// isNeedLogin.value = false;
// // setTimeout(() => (isGetLoginState.value = false), 10000)
// userInfoWin.value = {
// username: "",
// uid: 256624,
// uin: 4171117,
// avatar: "https://oss.x-php.com/avatar/97K4EWIMLrsbGTWXslC1XFxTFauOikN42jDKLNjtax7HLtRjKcKMSdU9oWFhY2E~/small?random=1739160957",
// messagenum: 0,
// newprompt: 1,
// todaysigned: 0,
// };
// } else determineIsLogin();
// window["userInfoWin"] = {
// "username": "",
// "uid": 256624,
// "uin": 4171117,
// "avatar": "https://oss.gter.net/avatar/97KwEWQHYuMQGDnFqkimXF9SHKuGwVV5zW-tYWFjYQ~~?istype=1&random=HHfurzyTXnzb",
// "messagenum": 0,
// "newprompt": 0,
// "todaysigned": 0,
// }
// determineIsLogin();
getUserInfoWin();
});
let isNeedLogin = ref(true); // 是否需要登录状态
let isGetLoginState = ref(true); // 在获取登录状态 false 代表没有已经确定了
let realname = ref(1); // 是否已经实名
let userInfoWin = ref({});
let permissions = ref([]);
let ismanager = ref(false);
provide("userInfoWin", userInfoWin);
// 判断是否登录状态
const determineIsLogin = () => {
let count = 0;
let timer = setInterval(() => {
if (Object.keys(window["userInfoWin"]).length !== 0) {
clearInterval(timer);
isGetLoginState.value = false;
if (window["userInfoWin"]["uid"] || window["userInfoWin"]["uin"]) isNeedLogin.value = false;
userInfoWin.value = window["userInfoWin"];
}
count++;
if (count >= 10) {
clearInterval(timer);
isGetLoginState.value = false;
}
}, 100);
};
// 跳转登录
const goLogin = () => {
if (typeof window === "undefined") return;
if (window["userInfoWin"] && Object.keys(window["userInfoWin"]).length !== 0) {
if (window["userInfoWin"]["uid"]) isNeedLogin.value = false;
else ajax_login();
} else ajax_login();
};
const getUserInfoWin = () => {
const checkUser = () => {
const user = window.userInfoWin;
if (!user) return;
document.removeEventListener("getUser", checkUser);
realname.value = user.realname;
userInfoWin.value = user;
if (user?.uin > 0 || user?.uid > 0) isNeedLogin.value = false;
permissions.value = user?.authority || [];
ismanager.value = permissions.value.indexOf("topic:manager") >= 0;
};
document.addEventListener("getUser", checkUser);
};
const openAttest = () => {
const handleAttestClose = () => {
document.removeEventListener("closeAttest", handleAttestClose);
realname.value = window.userInfoWin?.realname || 0;
};
// 启动认证流程时添加监听
document.addEventListener("closeAttest", handleAttestClose);
loadAttest(2);
};
provide("isNeedLogin", isNeedLogin);
provide("goLogin", goLogin);
provide("isGetLoginState", isGetLoginState);
provide("realname", realname);
provide("openAttest", openAttest);
provide("permissions", permissions);
provide("ismanager", ismanager);
</script>
<style lang="less">
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "PingFangSC-Regular", "PingFang SC", sans-serif !important;
}
.flexflex {
display: flex;
}
.flex1 {
flex: 1;
}
.flexcenter {
display: flex;
justify-content: center;
align-items: center;
}
.flexacenter {
display: flex;
align-items: center;
}
.flexjcenter {
display: flex;
justify-content: center;
}
/* // 一行显示 */
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
body {
background-color: rgba(238, 242, 245, 1);
}
a {
text-decoration: none !important;
}
/* Webkit浏览器Chrome、Safari等 */
*::-webkit-scrollbar {
width: 8px;
background-color: transparent;
}
*::-webkit-scrollbar-thumb {
background-color: #d7d7d7;
border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
background-color: #666;
}
/* Firefox浏览器 */
/* 注意Firefox浏览器不支持修改滚动条的宽度 */
/* 若要修改滚动条的宽度,可以使用一些特殊的插件或者自定义滚动条的替代方案 */
/* 以下代码只是修改滚动条的颜色和背景色 */
* {
scrollbar-width: thin;
scrollbar-color: #d7d7d7 transparent;
}
*::-moz-scrollbar-thumb {
background-color: #d7d7d7;
}
*::-moz-scrollbar-thumb:hover {
background-color: #666;
}
header.page-header .box .tab-list .item.pitch {
color: #72db86 !important;
}
header.page-header .box .tab-list .item.pitch:after {
background-color: #72db86 !important;
}
.avatar-box {
flex-direction: column;
height: 101px;
background-color: rgba(244, 248, 255, 1);
border: 1px solid rgba(220, 224, 234, 1);
border-radius: 10px;
z-index: 100;
.avatar-mask {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: -1;
cursor: auto;
}
.avatar-item {
font-size: 14px;
color: #333;
height: 50px;
cursor: pointer;
&:not(:last-of-type) {
border-bottom: 1px dotted #d7d7d7;
}
}
.avatar-icon {
width: 16px;
height: 16px;
margin-right: 5px;
}
}
.el-popover.el-popper.avatar-box-popper {
min-width: 140px;
padding: 0;
border-radius: 10px;
border: none;
}
// 禁止safari的填充
input:focus::-webkit-contacts-auto-fill-button {
opacity: 0 !important;
width: 0 !important;
height: 0 !important;
}
input::-webkit-contacts-auto-fill-button {
display: none !important;
}
.options-popup {
border-radius: 10px !important;
padding: 44px 74px !important;
.options-popup-text {
font-size: 14px;
color: #333333;
text-align: center;
margin-bottom: 71px;
}
.options-popup-btn {
justify-content: space-between;
.options-popup-item {
font-size: 13px;
width: 160px;
height: 40px;
border-radius: 150px;
border: 1px solid;
cursor: pointer;
&.options-yes {
background-color: rgba(249, 93, 93, 1);
border-color: rgba(249, 93, 93, 1);
color: #fff;
margin-left: 20px;
}
&.options-no {
background-color: #fff;
border-color: rgba(170, 170, 170, 1);
color: #333;
}
}
}
}
</style>