api接口修改

This commit is contained in:
结发受长生 2019-09-07 20:39:35 +08:00
parent a8f51e2e00
commit 74b5b07498
5 changed files with 37 additions and 35 deletions

View File

@ -3,7 +3,7 @@
margin: 0 30px; margin: 0 30px;
padding-right: 60px; padding-right: 60px;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
background: $colorBg; background: adjust-color($colorBg, $alpha: -0.2);
@extend %trans; @extend %trans;
&:first-child{ &:first-child{
margin-top: 30px; margin-top: 30px;

View File

@ -76,7 +76,7 @@ body.night {
} }
// 归档列表 // 归档列表
.archives-wrap { .archives-wrap {
background: $articleBg_night; background: adjust-color($articleBg_night, $alpha: -0.2);
border-bottom-color: $borderColor_night; border-bottom-color: $borderColor_night;
.archive-article { .archive-article {
border-color: $borderColor_night; border-color: $borderColor_night;

View File

@ -10,7 +10,7 @@ window.AV = require('leancloud-storage')
import(/* webpackChunkName: "valine" */ '../lib/Valine.min').then(({default: Valine }) => { import(/* webpackChunkName: "valine" */ '../lib/Valine.min').then(({default: Valine }) => {
// 从接口获取评论配置 // 从接口获取评论配置
axios.get(`${window.themeConfig.root}api/common/valineConfig`).then(res => { axios.get(`${window.themeConfig.root}api/common/config/valine_config`).then(res => {
let config = res.data let config = res.data
config.path = window.location.pathname config.path = window.location.pathname
// config.av = AV // config.av = AV

View File

@ -48,12 +48,10 @@ if(window.themeConfig.isPost && window.themeConfig.comment) {
import(/* webpackChunkName: "comment" */ './comment') import(/* webpackChunkName: "comment" */ './comment')
} }
var hideWaifu = localStorage.getItem('hideWaifu') // 初始化看板娘
if(!hideWaifu || !eval(hideWaifu)) { import(/* webpackChunkName: "waifu" */ './waifu').then(waifuInit => {
import(/* webpackChunkName: "waifu" */ './waifu').then(waifuInit => { waifuInit.default.init()
waifuInit.default.init() })
})
}
// 控制台 // 控制台
console.log( console.log(

View File

@ -174,7 +174,9 @@ const vm = new Vue({
}).catch(err => { }).catch(err => {
console.warn('加载文章列表失败') console.warn('加载文章列表失败')
}) })
this.showMessage(welcomeMessage(), 6000) welcomeMessage().then(msg => {
this.showMessage(msg, 6000)
})
document.addEventListener('copy', () => { document.addEventListener('copy', () => {
this.showMessage('你都复制了些什么呀,转载要记得加上出处哦') this.showMessage('你都复制了些什么呀,转载要记得加上出处哦')
}) })
@ -221,29 +223,31 @@ function handleSearch(searchItems) {
}) })
} }
function welcomeMessage() { async function welcomeMessage() {
let now = new Date().getHours() let now = new Date().getHours()
let text return axios.get(`${window.themeConfig.root}api/common/config/waifu_tip`).then(res => {
if (now > 23 || now <= 5) { let textTimes = res.data
text = '你是夜猫子呀?这么晚还不睡觉,明天起的来嘛' let text = null
} else if (now > 5 && now <= 7) { Array.prototype.sort.call(textTimes, (item1, item2) => {
text = '早上好!一日之计在于晨,美好的一天就要开始了' if(item1.start>item2.start) {
} else if (now > 7 && now <= 11) { return 1
text = '上午好!工作顺利嘛,不要久坐,多起来走动走动哦!' } else if(item1.start<item2.start) {
} else if (now > 11 && now <= 14) { return -1
text = '中午了,工作了一个上午,现在是午餐时间!' } else {
} else if (now > 14 && now <= 17) { return 0
text = '午后很容易犯困呢,今天的运动目标完成了吗?' }
} else if (now > 17 && now <= 19) { })
text = '傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~' Array.prototype.forEach.call(textTimes, textTime => {
} else if (now > 19 && now <= 21) { if(now > textTime.start && now <= textTime.end) {
text = '晚上好,今天过得怎么样?' text = textTime.text
} else if (now > 21 && now <= 23) { }
text = '已经这么晚了呀,早点休息吧,晚安~' })
} else { if(!text) {
text = '嗨~ 快来逗我玩吧!' text = textTimes[textTimes.length-1].text
} }
return text this.showMessage(res.data.hitokoto + (res.data.from?`  ——${res.data.from}`:''))
return text
})
} }
const waifuTools = { const waifuTools = {
@ -253,10 +257,10 @@ const waifuTools = {
window.Live2D.captureFrame = true window.Live2D.captureFrame = true
}, },
'tools.close'() { 'tools.close'() {
// 隐藏看板娘 // 移除看板娘
setTimeout(function() { setTimeout(function() {
document.querySelector('.waifu').style.display = 'none' let waifuDiv = document.querySelector('.waifu')
localStorage.setItem('hideWaifu', true) waifuDiv.parentNode.removeChild(waifuDiv)
}, 1300) }, 1300)
}, },
'tools.eye'() { 'tools.eye'() {