Merge branch 'rymcu:master' into master
This commit is contained in:
commit
ea65d42f42
@ -183,7 +183,6 @@ export default {
|
||||
// isPostingComment: state => state.comment.posting,
|
||||
constants: state => state.global.constants,
|
||||
language: state => state.global.language,
|
||||
isMobile: state => state.global.isMobile,
|
||||
user: state => state.auth.user,
|
||||
loggedIn: state => state.auth.loggedIn,
|
||||
avatar: state => state.auth.user?.avatarUrl
|
||||
|
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<body >
|
||||
<pc-main-view v-if="!isMobile" />
|
||||
<mobile-main-view v-else/>
|
||||
</body>
|
||||
<div>
|
||||
<pc-main-view v-if="$device.isDesktop"/>
|
||||
<mobile-main-view v-else/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
@ -19,10 +19,7 @@ export default Vue.extend({
|
||||
computed: {
|
||||
theme() {
|
||||
return this.$store.state.global.theme
|
||||
},
|
||||
isMobile() {
|
||||
return this.$store.state.global.isMobile
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -71,7 +71,8 @@ export default {
|
||||
modules: [
|
||||
'@nuxtjs/axios',
|
||||
'@nuxtjs/proxy',
|
||||
'@nuxtjs/auth-next'
|
||||
'@nuxtjs/auth-next',
|
||||
'@nuxtjs/device',
|
||||
],
|
||||
auth: {
|
||||
redirect: {
|
||||
|
@ -36,6 +36,7 @@
|
||||
"@commitlint/cli": "^17.4.0",
|
||||
"@commitlint/config-conventional": "^17.4.0",
|
||||
"@nuxt/types": "~2.16.0",
|
||||
"@nuxtjs/device": "^2.1.0",
|
||||
"@nuxtjs/proxy": "^2.1.0",
|
||||
"conventional-changelog-cli": "^2.2.2",
|
||||
"cz-git": "^1.4.1",
|
||||
|
@ -191,7 +191,6 @@ export default {
|
||||
...mapState({
|
||||
article: state => state.article.detail.data,
|
||||
isFetching: state => state.article.detail.fetching,
|
||||
isMobile: state => state.global.isMobile,
|
||||
loggedIn: state => state.auth.loggedIn,
|
||||
user: state => state.auth.user,
|
||||
avatar: state => state.auth.user?.avatarUrl
|
||||
|
@ -87,7 +87,6 @@
|
||||
...mapState({
|
||||
article: state => state.draft.detail.data,
|
||||
isFetching: state => state.draft.detail.fetching,
|
||||
isMobile: state => state.global.isMobile,
|
||||
user: state => state.auth.user,
|
||||
avatar: state => state.auth.user?.avatarURL
|
||||
}),
|
||||
|
@ -82,7 +82,6 @@ export default {
|
||||
portfolio: state => state.portfolio.detail.data,
|
||||
articles: state => state.portfolio.articles,
|
||||
isFetching: state => state.portfolio.detail.fetching,
|
||||
isMobile: state => state.global.isMobile,
|
||||
user: state => state.auth.user,
|
||||
avatar: state => state.auth.user?.avatarURL
|
||||
}),
|
||||
|
@ -26,29 +26,7 @@ export const mutations = {
|
||||
export const actions = {
|
||||
nuxtServerInit(store, {req}) {
|
||||
// 初始化时的全局任务
|
||||
const userAgent = isServer ? req.headers['user-agent'] : navigator.userAgent
|
||||
const browser = {
|
||||
versions: function() {
|
||||
return { //移动终端浏览器版本信息
|
||||
trident: userAgent.indexOf('Trident') > -1, //IE内核
|
||||
presto: userAgent.indexOf('Presto') > -1, //opera内核
|
||||
webKit: userAgent.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
|
||||
gecko: userAgent.indexOf('Gecko') > -1 && userAgent.indexOf('KHTML') == -1, //火狐内核
|
||||
mobile: !!userAgent.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
|
||||
ios: !!userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
|
||||
android: userAgent.indexOf('Android') > -1 || userAgent.indexOf('Linux') > -1, //android终端或uc浏览器
|
||||
iPhone: userAgent.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
|
||||
iPad: userAgent.indexOf('iPad') > -1, //是否iPad
|
||||
webApp: userAgent.indexOf('Safari') == -1 //是否web应用程序,没有头部与底部
|
||||
};
|
||||
} ()
|
||||
}
|
||||
if (browser.versions.mobile) {
|
||||
// 移动端
|
||||
store.commit('global/updateMobileState', true)
|
||||
}
|
||||
|
||||
const initFetchAppData = [
|
||||
const initFetchAppData = [
|
||||
// 内容数据
|
||||
store.dispatch('topic/fetchNavList'),
|
||||
store.dispatch('article/fetchList')
|
||||
|
Loading…
Reference in New Issue
Block a user