This commit is contained in:
Pan
2018-10-29 15:29:54 +08:00
parent aefd8bb36a
commit 51f99770fe
15 changed files with 172 additions and 22 deletions

View File

@@ -33,10 +33,11 @@ export default {
isActive: {
type: Boolean,
default: false
},
toggleClick: {
type: Function,
default: null
}
},
methods: {
toggleClick() {
this.$emit('toggleClick')
}
}
}

View File

@@ -36,7 +36,11 @@ export function parseTime(time, cFormat) {
}
export function formatTime(time, option) {
time = +time * 1000
if (('' + time).length === 10) {
time = parseInt(time) * 1000
} else {
time = +time
}
const d = new Date(time)
const now = Date.now()

View File

@@ -2,7 +2,7 @@
* Created by jiachenpan on 16/11/18.
*/
export function isvalidUsername(str) {
export function validUsername(str) {
const valid_map = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0
}

View File

@@ -1,6 +1,6 @@
<template>
<div class="navbar">
<hamburger :toggle-click="toggleSideBar" :is-active="sidebar.opened" class="hamburger-container"/>
<hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar"/>
<breadcrumb class="breadcrumb-container"/>

View File

@@ -63,7 +63,7 @@
</template>
<script>
import { isvalidUsername } from '@/utils/validate'
import { validUsername } from '@/utils/validate'
import LangSelect from '@/components/LangSelect'
import SocialSign from './socialsignin'
@@ -72,7 +72,7 @@ export default {
components: { LangSelect, SocialSign },
data() {
const validateUsername = (rule, value, callback) => {
if (!isvalidUsername(value)) {
if (!validUsername(value)) {
callback(new Error('Please enter the correct user name'))
} else {
callback()