no message

This commit is contained in:
A1300399510 2024-11-26 16:00:10 +08:00
parent e1f17ebd2f
commit d139c43938
6 changed files with 172 additions and 169 deletions

View File

@ -63,8 +63,7 @@ body {
border-radius: 153px; border-radius: 153px;
position: sticky; position: sticky;
bottom: 15px; bottom: 15px;
left: 50%; left: calc((100vw - 640px) / 2);
transform: translateX(-50%);
z-index: 100; z-index: 100;
} }
.base .left { .base .left {

View File

@ -78,8 +78,9 @@ body {
border-radius: 153px; border-radius: 153px;
position: sticky; position: sticky;
bottom: 15px; bottom: 15px;
left: 50%; // left: 50%;
transform: translateX(-50%); // transform: translateX(-50%);
left: calc((100vw - 640px) / 2);
z-index: 100; z-index: 100;
.left { .left {
width: 450px; width: 450px;

View File

@ -15,6 +15,9 @@
<body> <body>
<div class="main" id="app"> <div class="main" id="app">
<div class="" style="position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.8); z-index: 1000">
</div>
<img class="index-icon" src="/img/index-icon.png" /> <img class="index-icon" src="/img/index-icon.png" />
<div class="boxbox"> <div class="boxbox">
@ -670,7 +673,7 @@
</div> </div>
</div> </div>
<script> <script>
const { createApp, ref, onMounted, nextTick, onUnmounted, computed, defineProps } = Vue; const { createApp, ref, onMounted, nextTick, onUnmounted, computed, defineProps } = Vue
const subject = createApp({ const subject = createApp({
setup() { setup() {
let side = ref({ let side = ref({
@ -681,249 +684,249 @@
graduate: "毕业&就业", graduate: "毕业&就业",
issue: "常见问题", issue: "常见问题",
links: "相关链接", links: "相关链接",
}); })
const stateObj = ref({ const stateObj = ref({
0: "待定", 0: "待定",
1: "主申", 1: "主申",
2: "冲刺", 2: "冲刺",
3: "保底", 3: "保底",
}); })
let rankingsObj = ref({}); let rankingsObj = ref({})
let disciplineObj = ref({}); let disciplineObj = ref({})
const uniqid = "IwdCOvZ08KUhkXtjXQ5vhAPHczKneFd45T-d55pDZx8TvBsGm2D9tbuIj9YdJhDq2Zy09bXaoc4-lAhiMmE1"; const uniqid = "IwdCOvZ08KUhkXtjXQ5vhAPHczKneFd45T-d55pDZx8TvBsGm2D9tbuIj9YdJhDq2Zy09bXaoc4-lAhiMmE1"
onMounted(() => { onMounted(() => {
window.addEventListener("scroll", handleScroll); window.addEventListener("scroll", handleScroll)
getBaseData().then((data) => { getBaseData().then(data => {
rankingsObj.value = data.rankings; rankingsObj.value = data.rankings
disciplineObj.value = data.discipline; disciplineObj.value = data.discipline
getData(); getData()
}); })
}); })
const handleScroll = () => { const handleScroll = () => {
const keyElements = detailsRef.value.querySelectorAll(".side-item"); const keyElements = detailsRef.value.querySelectorAll(".side-item")
for (const keyElement of keyElements) { for (const keyElement of keyElements) {
const rect = keyElement.getBoundingClientRect(); const rect = keyElement.getBoundingClientRect()
// console.log(rect) // console.log(rect)
if (rect.top + rect.height > 0) { if (rect.top + rect.height > 0) {
// console.log("keyElement", keyElement.getAttribute("type")) // console.log("keyElement", keyElement.getAttribute("type"))
sideKey.value = keyElement.getAttribute("type"); sideKey.value = keyElement.getAttribute("type")
break; break
} }
} }
}; }
let info = ref({}); let info = ref({})
let remark = ref(""); let remark = ref("")
let sideKey = ref("pivotal"); let sideKey = ref("pivotal")
let contras = ref({}); let contras = ref({})
let course = ref({}); let course = ref({})
const getData = () => { const getData = () => {
$ajaxget("/api/detail", { $ajaxget("/api/detail", {
uniqid, uniqid,
}).then((res) => { }).then(res => {
const data = res.data; const data = res.data
decodeKey(data.info).then((res) => { decodeKey(data.info).then(res => {
data.info = res; data.info = res
let courseObj = { let courseObj = {
required: [], required: [],
requiredCount: 0, requiredCount: 0,
elective: [], elective: [],
electiveCount: 0, electiveCount: 0,
};
const infoObj = data.info || {};
const fields = ["tuition_fee", "tuition_fee_per_credit", "application_fee", "admission_deposit"];
fields.forEach((field) => {
const textKey = `${field}_text`;
infoObj[textKey] = formatNumberWithSpaces(info[field] || "");
});
const curriculum = infoObj.curriculum || [];
if (infoObj.language_of_instruction) {
let strOutput = infoObj.language_of_instruction.join(",");
infoObj["language_of_instruction_text"] = strOutput;
} }
curriculum.forEach((element) => { const infoObj = data.info || {}
if (element.credit == "N/A") element.credit = 0;
element.type === "必修课" ? (courseObj.required.push(element), (courseObj.requiredCount += element.credit)) : (courseObj.elective.push(element), (courseObj.electiveCount += element.credit));
});
let contrasObj = data.contras; const fields = ["tuition_fee", "tuition_fee_per_credit", "application_fee", "admission_deposit"]
if (Array.isArray(contrasObj)) contrasObj = {}; fields.forEach(field => {
remark.value = contrasObj.remarks || ""; const textKey = `${field}_text`
infoObj[textKey] = formatNumberWithSpaces(info[field] || "")
})
const curriculum = infoObj.curriculum || []
if (infoObj.language_of_instruction) {
let strOutput = infoObj.language_of_instruction.join(",")
infoObj["language_of_instruction_text"] = strOutput
}
curriculum.forEach(element => {
if (element.credit == "N/A") element.credit = 0
element.type === "必修课" ? (courseObj.required.push(element), (courseObj.requiredCount += element.credit)) : (courseObj.elective.push(element), (courseObj.electiveCount += element.credit))
})
let contrasObj = data.contras
if (Array.isArray(contrasObj)) contrasObj = {}
remark.value = contrasObj.remarks || ""
// 算出最后申请时间 // 算出最后申请时间
infoObj["application_end"] = calculateApplicaDeadline(infoObj.nonlocal_application_end || {}); infoObj["application_end"] = calculateApplicaDeadline(infoObj.nonlocal_application_end || {})
// 算出面试轮时间 // 算出面试轮时间
infoObj["interviewRounds"] = calculateInterviewRound(infoObj.nonlocal_application_end || {}); infoObj["interviewRounds"] = calculateInterviewRound(infoObj.nonlocal_application_end || {})
if (typeof infoObj.mode_of_study == "string") infoObj.mode_of_study = JSON.parse(info.mode_of_study); if (typeof infoObj.mode_of_study == "string") infoObj.mode_of_study = JSON.parse(info.mode_of_study)
let sideObj = side.value; let sideObj = side.value
// 判断是否常见问题 ,没有则删除左侧 // 判断是否常见问题 ,没有则删除左侧
if (!infoObj.faq || infoObj.faq.length == 0) delete sideObj.issue; if (!infoObj.faq || infoObj.faq.length == 0) delete sideObj.issue
// 判断 毕业就业 没有则删除左侧 // 判断 毕业就业 没有则删除左侧
if (!info.award_zh && !infoObj.graduation_requirements && !infoObj.domains && !infoObj.employers && !infoObj.positions) delete sideObj.graduate; if (!info.award_zh && !infoObj.graduation_requirements && !infoObj.domains && !infoObj.employers && !infoObj.positions) delete sideObj.graduate
// 判断奖学金文案 // 判断奖学金文案
if (infoObj.scholarship) infoObj["scholarshipText"] = JudgmentScholarshipText(infoObj.scholarship); if (infoObj.scholarship) infoObj["scholarshipText"] = JudgmentScholarshipText(infoObj.scholarship)
if (infoObj.leaflet_url) { if (infoObj.leaflet_url) {
const leaflet_url = decodeURIComponent(infoObj.leaflet_url); const leaflet_url = decodeURIComponent(infoObj.leaflet_url)
const urlWithoutParams = leaflet_url.split("?")[0]; const urlWithoutParams = leaflet_url.split("?")[0]
const urlParts = urlWithoutParams.split("/"); const urlParts = urlWithoutParams.split("/")
const fileName = urlParts[urlParts.length - 1]; const fileName = urlParts[urlParts.length - 1]
infoObj["leaflet_name"] = fileName; infoObj["leaflet_name"] = fileName
} }
// const isadmission = info.admissionsproject || 0 // const isadmission = info.admissionsproject || 0
// if (isadmission == 1) this.getAdmissionList() // if (isadmission == 1) this.getAdmissionList()
const date = new Date(); const date = new Date()
const month = date.getMonth() + 1; const month = date.getMonth() + 1
const year = date.getFullYear(); const year = date.getFullYear()
const semester = infoObj.semester || {}; const semester = infoObj.semester || {}
if (month > semester.month && year + 1 <= semester.year) infoObj["semesterState"] = true; if (month > semester.month && year + 1 <= semester.year) infoObj["semesterState"] = true
console.log("infoObj", infoObj); console.log("infoObj", infoObj)
info.value = infoObj; info.value = infoObj
side.value = sideObj; side.value = sideObj
sideKey.value = "basic"; sideKey.value = "basic"
course.value = courseObj; course.value = courseObj
contras.value = contrasObj; contras.value = contrasObj
}); })
}); })
}; }
// 判断奖学金文案 // 判断奖学金文案
const JudgmentScholarshipText = (obj) => { const JudgmentScholarshipText = obj => {
let text = ""; let text = ""
if (obj.local && obj.nonlocal) text = "均有"; if (obj.local && obj.nonlocal) text = "均有"
else if (!obj.local && !obj.nonlocal) text = "均无"; else if (!obj.local && !obj.nonlocal) text = "均无"
else if (obj.local && !obj.nonlocal) text = "非本地学生无"; else if (obj.local && !obj.nonlocal) text = "非本地学生无"
else if (!obj.local && obj.nonlocal) text = "非本地学生有"; else if (!obj.local && obj.nonlocal) text = "非本地学生有"
return text; return text
}; }
// 计算出外地申请截止时间 // 计算出外地申请截止时间
const calculateApplicaDeadline = (obj) => { const calculateApplicaDeadline = obj => {
// 初始化变量来存储最大时间点的属性和日期 // 初始化变量来存储最大时间点的属性和日期
let maxDate = null; let maxDate = null
// 遍历对象的属性 // 遍历对象的属性
for (const item in obj) { for (const item in obj) {
// 如果当前日期是最大日期或是第一个日期,则更新最大日期和属性 // 如果当前日期是最大日期或是第一个日期,则更新最大日期和属性
if (maxDate === null || obj[item] > maxDate) maxDate = obj[item]; if (maxDate === null || obj[item] > maxDate) maxDate = obj[item]
} }
return maxDate; return maxDate
}; }
// 计算出面试轮的数组 // 计算出面试轮的数组
const calculateInterviewRound = (obj) => { const calculateInterviewRound = obj => {
let rounds = []; let rounds = []
const chineseNumbers = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]; const chineseNumbers = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]
const formatTime = (time, index) => { const formatTime = (time, index) => {
return { return {
text: `第${chineseNumbers[index]}轮`, text: `第${chineseNumbers[index]}轮`,
time, time,
}; }
}; }
Object.keys(obj).forEach((key, index) => { Object.keys(obj).forEach((key, index) => {
rounds.push(formatTime(obj[key], index)); rounds.push(formatTime(obj[key], index))
}); })
if (rounds.length == 0) rounds = [{}]; if (rounds.length == 0) rounds = [{}]
return rounds || [{}]; return rounds || [{}]
}; }
let studyMode = ref("ft"); // 'ft', // 学习模式显示状态 ft 全日制 pt 兼读制 let studyMode = ref("ft") // 'ft', // 学习模式显示状态 ft 全日制 pt 兼读制
const cutStudyMode = (type) => { const cutStudyMode = type => {
studyMode.value = type; studyMode.value = type
}; }
const copy = (url) => { const copy = url => {
let copyInput = document.createElement("input"); let copyInput = document.createElement("input")
document.body.appendChild(copyInput); document.body.appendChild(copyInput)
copyInput.setAttribute("value", url); copyInput.setAttribute("value", url)
copyInput.select(); copyInput.select()
document.execCommand("Copy"); document.execCommand("Copy")
copyInput.remove(); copyInput.remove()
}; }
// 下载文件 // 下载文件
const download = (url) => { const download = url => {
// 下载文件 // 下载文件
window.open(url); window.open(url)
}; }
const bindblur = () => { const bindblur = () => {
$ajax("/api/user/remarks", { $ajax("/api/user/remarks", {
token: contras.value.token, token: contras.value.token,
remarks: remark.value, remarks: remark.value,
}).then((res) => {}); }).then(res => {})
}; }
// 点击加入对比单 // 点击加入对比单
const addComparison = () => { const addComparison = () => {
$ajax("/api/contrast/add", { $ajax("/api/contrast/add", {
projectid: info.value.id, projectid: info.value.id,
}).then((res) => { }).then(res => {
if (res.code != 200) return; if (res.code != 200) return
const data = res.data; const data = res.data
contras.value["status"] = 1; contras.value["status"] = 1
contras.value["ismanage"] = 1; contras.value["ismanage"] = 1
contras.value["typeid"] = 0; // 默认是待定 contras.value["typeid"] = 0 // 默认是待定
contras.value["token"] = data.token; contras.value["token"] = data.token
}); })
}; }
const detailsRef = ref(null); const detailsRef = ref(null)
// 使 页面滚动到 // 使 页面滚动到
const cutSide = (key) => { const cutSide = key => {
// sideKey.value = key // sideKey.value = key
const keyElement = detailsRef.value.querySelector(`.side-item[type=${key}]`); const keyElement = detailsRef.value.querySelector(`.side-item[type=${key}]`)
keyElement.scrollIntoView({ behavior: "smooth" }); keyElement.scrollIntoView({ behavior: "smooth" })
}; }
let stateState = ref(false); let stateState = ref(false)
const cutState = () => { const cutState = () => {
stateState.value = !stateState.value; stateState.value = !stateState.value
}; }
// 修改 项目 状态 // 修改 项目 状态
const changeType = (typeid) => { const changeType = typeid => {
$ajax("/api/user/changeType", { $ajax("/api/user/changeType", {
token: contras.value.token || "", token: contras.value.token || "",
typeid, typeid,
}).then((res) => { }).then(res => {
if (res.code != 200) return; if (res.code != 200) return
contras.value["typeid"] = typeid; contras.value["typeid"] = typeid
cutState(); cutState()
}); })
}; }
const deletee = () => { const deletee = () => {
const contras = this.data.contras; const contras = this.data.contras
$ajax("/api/user/delete", { $ajax("/api/user/delete", {
token: contras.value.token, token: contras.value.token,
}).then((res) => { }).then(res => {
if (res.code != 200) return; if (res.code != 200) return
contras.value["ismanage"] = 0; contras.value["ismanage"] = 0
stateState.value = false; stateState.value = false
}); })
}; }
const offerList = ref([ const offerList = ref([
{ {
@ -964,7 +967,7 @@
url: "https://offer.gter.net/details/HD4DmDCi0aCa", url: "https://offer.gter.net/details/HD4DmDCi0aCa",
view: 242, view: 242,
}, },
]); ])
const urls = ref([ const urls = ref([
[ [
@ -1001,39 +1004,39 @@
url: "https://bbs.gter.net/thread-2617401-1-1.html", url: "https://bbs.gter.net/thread-2617401-1-1.html",
}, },
], ],
]); ])
const moldObj = ref({ const moldObj = ref({
1: "直播", 1: "直播",
2: "回放", 2: "回放",
3: "答疑", 3: "答疑",
}); })
let admissionCurrent = ref(0); let admissionCurrent = ref(0)
const swiperRef = ref(null); const swiperRef = ref(null)
// 写一个 点击切换轮播图 // 写一个 点击切换轮播图
const cutSwiper = (index) => { const cutSwiper = index => {
admissionCurrent.value = index; admissionCurrent.value = index
const dom = document.querySelector(".swiper-item" + index); const dom = document.querySelector(".swiper-item" + index)
const left = dom.offsetLeft; const left = dom.offsetLeft
swiperRef.value.scrollTo({ swiperRef.value.scrollTo({
left, left,
behavior: "smooth", behavior: "smooth",
}); })
}; }
let previewShow = ref(false); let previewShow = ref(false)
const openPreview = () => (previewShow.value = true); const openPreview = () => (previewShow.value = true)
const hidePreview = () => (previewShow.value = false); const hidePreview = () => (previewShow.value = false)
return { previewShow, openPreview, hidePreview, swiperRef, cutSwiper, admissionCurrent, moldObj, urls, offerList, side, sideKey, info, disciplineObj, rankingsObj, cutStudyMode, studyMode, course, contras, copy, download, stateObj, bindblur, remark, addComparison, cutSide, detailsRef, stateState, cutState, changeType, deletee }; return { previewShow, openPreview, hidePreview, swiperRef, cutSwiper, admissionCurrent, moldObj, urls, offerList, side, sideKey, info, disciplineObj, rankingsObj, cutStudyMode, studyMode, course, contras, copy, download, stateObj, bindblur, remark, addComparison, cutSide, detailsRef, stateState, cutState, changeType, deletee }
}, },
}); })
subject.component("text-module", textModule); subject.component("text-module", textModule)
subject.mount("#app"); subject.mount("#app")
</script> </script>
</body> </body>
</html> </html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 332 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 295 KiB