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 activeMenu = _ts.$store.state.activeMenu;
if (activeMenu !== item) {
this.$store.commit('setActiveMenu', item);
if (item === 'topic') {
_ts.$router.push(
{

View File

@ -1,6 +1,6 @@
import appConfig from './config/app.config'
import apiConfig from './config/api.config'
import { isProdMode, isDevMode } from './environment'
import {isProdMode, isDevMode} from './environment'
export default {
@ -32,13 +32,13 @@ export default {
head: {
title: appConfig.meta.title,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'keywords', name: 'keywords', content: appConfig.meta.keywords },
{ hid: 'description', name: 'description', content: appConfig.meta.description }
{charset: 'utf-8'},
{name: 'viewport', content: 'width=device-width, initial-scale=1'},
{hid: 'keywords', name: 'keywords', content: appConfig.meta.keywords},
{hid: 'description', name: 'description', content: appConfig.meta.description}
],
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
*/
plugins: [
'@/plugins/element-ui',
// '@/plugins/axios'
{src: '@/plugins/element-ui', ssr: true},
{src: '@/plugins/vditor', ssr: false}
],
/*
** Nuxt.js dev-modules
*/
buildModules: [
],
buildModules: [],
/*
** Nuxt.js modules
*/
modules: [
['@nuxtjs/axios', { baseURL: apiConfig.BASE }]
['@nuxtjs/axios', {baseURL: apiConfig.BASE}]
],
/*
** Build configuration

View File

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

View File

@ -78,6 +78,7 @@
}
_ts.$axios.$post('/api/v1/console/login', data).then(function (res) {
console.log(res);
if (res.data) {
if (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(
// isBrowser
// )
console.log(params)
if (isBrowser) {
Vue.nextTick(() => {
window.scrollTo(0, 300);
})
}
// if (isBrowser) {
// Vue.nextTick(() => {
// window.scrollTo(0, 300);
// })
// }
commit('updateDetailFetching', true)
commit('updateDetailData', {})
// commit('updateDetailData', {})
return this.$axios
.$get(`${ARTICLE_API_PATH}/article/${params.article_id}`)
.then(response => {
commit('updateDetailData', response.data)
commit('updateDetailFetching', false)
// return new Promise(resolve => {
// delay(() => {
// resolve(response)
// })
// })
return new Promise(resolve => {
commit('updateDetailData', response.data)
commit('updateDetailFetching', false)
resolve(response)
// delay(() => {
// resolve(response)
// })
})
})
.catch(error => {
commit('updateDetailFetching', false)