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;
position: sticky;
bottom: 15px;
left: 50%;
transform: translateX(-50%);
left: calc((100vw - 640px) / 2);
z-index: 100;
}
.base .left {

View File

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

View File

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