From 8dc77f9181fd58830a77a8f934e5b3b17fef761f Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Tue, 4 Apr 2023 12:00:10 +0800 Subject: [PATCH] =?UTF-8?q?a1300399510@qq.com=20=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BA=8E=202023/04/04=20-12:00:01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 7 ++++--- src/utils/common.js | 15 ++++++++++++--- src/views/detail/detailIndex.vue | 28 +++++++++++++++++++++------- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/main.js b/src/main.js index a131df0..93b56bc 100755 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,7 @@ import router from './router' import store from './store' import ElementUI, { Message, Pagination } from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; -import { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading } from "@/utils/common.js" +import { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading, formattedDate } from "@/utils/common.js" import http from "@/utils/request" import hintBox from '@/components/Hintbox' @@ -22,8 +22,9 @@ Vue.prototype.$pageStop = pageStop // 页面禁止滑动 Vue.prototype.$pageMove = pageMove // 页面可以滑动 Vue.prototype.$Message = Message // 消息提示框 Vue.prototype.$copy = copy // 复制 -Vue.prototype.$startupUnderLoading = startupUnderLoading // 复制 -Vue.prototype.$closeUnderLoading = closeUnderLoading // 复制 +Vue.prototype.$startupUnderLoading = startupUnderLoading // 开启加载提示 element的 +Vue.prototype.$closeUnderLoading = closeUnderLoading // 关闭加载提示 element的 +Vue.prototype.$formattedDate = formattedDate // 时间戳转格式 //svg文件引入 import './icons' diff --git a/src/utils/common.js b/src/utils/common.js index b670580..7ec7c9d 100755 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -41,10 +41,8 @@ function copy(value, message) { // 向用户显示成功消息 // 从文档中删除动态创建的输入元素 copyInput.remove(); - if (message) this.$message.success(message); - } @@ -62,5 +60,16 @@ function closeUnderLoading(that) { that.loading.close(); } +// 时间戳 +function formattedDate(timestamp) { + const date = new Date(timestamp * 1000); + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0') + const minutes = String(date.getMinutes()).padStart(2, '0'); + const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`; + return formattedDate +} -export { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading } \ No newline at end of file +export { skipUrl, pageStop, pageMove, goTologin, copy, startupUnderLoading, closeUnderLoading, formattedDate } \ No newline at end of file diff --git a/src/views/detail/detailIndex.vue b/src/views/detail/detailIndex.vue index 47f6106..ec348e1 100755 --- a/src/views/detail/detailIndex.vue +++ b/src/views/detail/detailIndex.vue @@ -101,7 +101,7 @@
{{ info.author }}
-
2022-7-6 14:56
+
{{ $formattedDate(info.dateline) }}
楼主
@@ -120,7 +120,7 @@ --> - + 查看当前捷报详情
@@ -334,16 +334,16 @@ export default { this.type = data.type this.token = data.token - if (this.type == 6) { - this.getOfferDetail() - } + if (this.type == 6) this.getOfferDetail() + else if (this.type == 5) this.getsummaryDetails() + }) }, // 获取offer详情 getOfferDetail() { this.$http.post("/api/details", { - token: "aKpet3Y6LVE50g0a1TMJ9CO_fWeZORk7ZswsZAkMwwupQ2lbtcsjmX1np5mUmPKVla8FzCF8ZNJySac3tX-r8ULfxTS6S4Grt_SaX84Tov9BHHh9L568EHRR9CMIbYIOQI76V-jgTuur3qck0L4lAvgbcwSi5c9MUS5qI7zXYMklqBguz5n0Fgy794uePqhF_W9PwA0IQwGuLWIcvSZ8RqrhUM4cadRC4TgxN2Mx" + token: this.token }, 'offer').then(res => { let data = res.data let offerinfo = data.offerinfo @@ -358,12 +358,26 @@ export default { offerinfo['schoolName'] = offerinfo.school.name - this.offerinfo = offerinfo this.shareurl = data.shareurl }) }, + // 获取总结详情 + getsummaryDetails() { + this.$http.post("/api/details/summary", { + token: this.token + }, 'offer').then(res => { + let data = res.data + let offercollege = data.offercollege + + console.log("offercollege", offercollege); + + + this.shareurl = data.shareurl + }) + }, + // 点击点赞 tapLike() {