加入点击发布 点赞 评论等打开弹窗

This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-06-23 16:36:35 +08:00
parent 4cd9163422
commit 05a71799cf
59 changed files with 616 additions and 542 deletions

View File

@@ -4,12 +4,13 @@
<div class="content flexflex">
<div class="name">{{ item["school"] }}</div>
<div class="list flexflex">
<!-- 项目/专业 -->
<div class="item flexacenter" v-if="item['profession']">
<div class="item-name">专业</div>
<div class="item-name">{{ item["project"] ? "" : "项目/" }}专业</div>
<div class="item-value ellipsis">{{ item["profession"] }}</div>
</div>
<div class="item flexacenter" v-if="item['project']">
<div class="item-name">项目</div>
<div class="item-name">项目{{ item["profession"] ? "" : "/专业" }}</div>
<div class="item-value ellipsis">{{ item["project"] }}</div>
</div>
<div class="item flexacenter" v-if="item['interviewtime']">
@@ -48,41 +49,52 @@
<script setup>
let props = defineProps({
item: Object,
})
import { ElMessage } from "element-plus"
});
import { ElMessage } from "element-plus";
const emit = defineEmits(["childEvent"])
const emit = defineEmits(["childEvent"]);
const userInfo = inject("userInfo");
let openAttest = inject("openAttest");
const realname = inject("realname");
// 处理点赞
const handleLike = (uniqid, token, islike) => {
if (islike == 1) {
ElMessage.error("不可取消点赞")
return
console.log(realname.value == 0 , userInfo.value.uin > 0);
if (realname.value == 0 && userInfo.value.uin > 0) {
openAttest();
return;
}
emit("handleLike", token)
}
if (islike == 1) {
ElMessage.error("不可取消点赞");
return;
}
emit("handleLike", token);
};
// 将浏览量换算为k
const formatNumberWithCommas = number => {
const formatNumberWithCommas = (number) => {
// number = 1000000
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
if (number >= 1000) {
const units = ["K", "M", "B", "T"]
const unitIndex = Math.floor(Math.log10(number) / 3)
const unitName = units[unitIndex - 1]
const formattedNumber = (number / Math.pow(1000, unitIndex)).toFixed(2)
const decimalPart = formattedNumber.split(".")[1]
const units = ["K", "M", "B", "T"];
const unitIndex = Math.floor(Math.log10(number) / 3);
const unitName = units[unitIndex - 1];
const formattedNumber = (number / Math.pow(1000, unitIndex)).toFixed(2);
const decimalPart = formattedNumber.split(".")[1];
if (decimalPart === "00") {
return formattedNumber.split(".")[0] + unitName
return formattedNumber.split(".")[0] + unitName;
} else {
return formattedNumber + unitName
return formattedNumber + unitName;
}
} else {
return number.toString()
return number.toString();
}
}
};
</script>
<style lang="less" scoped>
.box {
@@ -152,7 +164,8 @@ const formatNumberWithCommas = number => {
.item-value {
font-size: 14px;
color: #333333;
width: 255px;
// width: 255px;
width: 242px;
}
}
}

View File

@@ -83,8 +83,18 @@ watchEffect(() => {
// const goIndex = () => {
// // router.push(`/index.html`)
// }
let openAttest = inject("openAttest");
const realname = inject("realname");
let user = inject("userInfo");
// 点击发布
const goPublish = () => {
if (realname.value == 0 && user.value.uin > 0) {
openAttest();
return;
}
if (isNeedLogin.value) {
goLogin()
return