first commit

This commit is contained in:
ronger 2020-06-30 17:50:32 +08:00
parent 2f1a426223
commit fbafa3db60
6 changed files with 50 additions and 42 deletions

View File

@ -144,7 +144,6 @@
let _ts = this; let _ts = this;
let activeMenu = _ts.$store.state.activeMenu; let activeMenu = _ts.$store.state.activeMenu;
if (activeMenu !== item) { if (activeMenu !== item) {
this.$store.commit('setActiveMenu', item);
if (item === 'topic') { if (item === 'topic') {
_ts.$router.push( _ts.$router.push(
{ {

View File

@ -1,6 +1,6 @@
import appConfig from './config/app.config' import appConfig from './config/app.config'
import apiConfig from './config/api.config' import apiConfig from './config/api.config'
import { isProdMode, isDevMode } from './environment' import {isProdMode, isDevMode} from './environment'
export default { export default {
@ -32,13 +32,13 @@ export default {
head: { head: {
title: appConfig.meta.title, title: appConfig.meta.title,
meta: [ meta: [
{ charset: 'utf-8' }, {charset: 'utf-8'},
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }, {name: 'viewport', content: 'width=device-width, initial-scale=1'},
{ hid: 'keywords', name: 'keywords', content: appConfig.meta.keywords }, {hid: 'keywords', name: 'keywords', content: appConfig.meta.keywords},
{ hid: 'description', name: 'description', content: appConfig.meta.description } {hid: 'description', name: 'description', content: appConfig.meta.description}
], ],
link: [ link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } {rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'}
] ]
}, },
/* /*
@ -52,19 +52,18 @@ export default {
** https://nuxtjs.org/guide/plugins ** https://nuxtjs.org/guide/plugins
*/ */
plugins: [ plugins: [
'@/plugins/element-ui', {src: '@/plugins/element-ui', ssr: true},
// '@/plugins/axios' {src: '@/plugins/vditor', ssr: false}
], ],
/* /*
** Nuxt.js dev-modules ** Nuxt.js dev-modules
*/ */
buildModules: [ buildModules: [],
],
/* /*
** Nuxt.js modules ** Nuxt.js modules
*/ */
modules: [ modules: [
['@nuxtjs/axios', { baseURL: apiConfig.BASE }] ['@nuxtjs/axios', {baseURL: apiConfig.BASE}]
], ],
/* /*
** Build configuration ** Build configuration

View File

@ -120,7 +120,7 @@
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import VditorPreview from 'vditor/dist/method.min';
export default { export default {
name: "ArticleDetail", name: "ArticleDetail",
validate({params, store}) { validate({params, store}) {
@ -141,6 +141,11 @@
isMobile: state => state.global.isMobile, isMobile: state => state.global.isMobile,
}) })
}, },
head () {
return {
title: this.article.articleTitle
}
},
data() { data() {
return { return {
isShow: true, isShow: true,
@ -191,17 +196,17 @@
const previewElement = document.getElementById("articleContent"); const previewElement = document.getElementById("articleContent");
// //const outLineElement = document.getElementById("articleToC"); // //const outLineElement = document.getElementById("articleToC");
// VditorPreview.setContentTheme('light'); // VditorPreview.setContentTheme('light');
VditorPreview.codeRender(previewElement, 'zh_CN'); Vue.VditorPreview.codeRender(previewElement, 'zh_CN');
VditorPreview.highlightRender({"enable":true,"lineNumber":false,"style":"github"}, previewElement); Vue.VditorPreview.highlightRender({"enable":true,"lineNumber":false,"style":"github"}, previewElement);
VditorPreview.mathRender(previewElement, { Vue.VditorPreview.mathRender(previewElement, {
math: {"engine":"KaTeX","inlineDigit":false,"macros":{}}, math: {"engine":"KaTeX","inlineDigit":false,"macros":{}},
}); });
VditorPreview.mermaidRender(previewElement, ".language-mermaid"); Vue.VditorPreview.mermaidRender(previewElement, ".language-mermaid");
VditorPreview.graphvizRender(previewElement); Vue.VditorPreview.graphvizRender(previewElement);
VditorPreview.chartRender(previewElement); Vue.VditorPreview.chartRender(previewElement);
VditorPreview.mindmapRender(previewElement); Vue.VditorPreview.mindmapRender(previewElement);
VditorPreview.abcRender(previewElement); Vue.VditorPreview.abcRender(previewElement);
VditorPreview.mediaRender(previewElement); Vue.VditorPreview.mediaRender(previewElement);
//VditorPreview.outlineRender(previewElement, outLineElement); //VditorPreview.outlineRender(previewElement, outLineElement);
}) })
} }

View File

@ -78,6 +78,7 @@
} }
_ts.$axios.$post('/api/v1/console/login', data).then(function (res) { _ts.$axios.$post('/api/v1/console/login', data).then(function (res) {
console.log(res);
if (res.data) { if (res.data) {
if (res.data.message) { if (res.data.message) {
_ts.$message(res.data.message); _ts.$message(res.data.message);

4
plugins/vditor.js Normal file
View File

@ -0,0 +1,4 @@
import Vue from 'vue';
import VditorPreview from 'vditor/dist/method.min';
Vue.VditorPreview = VditorPreview

View File

@ -81,24 +81,24 @@ export const actions = {
// const delay = fetchDelay( // const delay = fetchDelay(
// isBrowser // isBrowser
// ) // )
console.log(params) // if (isBrowser) {
if (isBrowser) { // Vue.nextTick(() => {
Vue.nextTick(() => { // window.scrollTo(0, 300);
window.scrollTo(0, 300); // })
}) // }
}
commit('updateDetailFetching', true) commit('updateDetailFetching', true)
commit('updateDetailData', {}) // commit('updateDetailData', {})
return this.$axios return this.$axios
.$get(`${ARTICLE_API_PATH}/article/${params.article_id}`) .$get(`${ARTICLE_API_PATH}/article/${params.article_id}`)
.then(response => { .then(response => {
return new Promise(resolve => {
commit('updateDetailData', response.data) commit('updateDetailData', response.data)
commit('updateDetailFetching', false) commit('updateDetailFetching', false)
// return new Promise(resolve => { resolve(response)
// delay(() => { // delay(() => {
// resolve(response) // resolve(response)
// }) // })
// }) })
}) })
.catch(error => { .catch(error => {
commit('updateDetailFetching', false) commit('updateDetailFetching', false)