This commit is contained in:
Pan 2017-06-26 18:03:05 +08:00
parent 472cbb6d65
commit 40a5977d1f
22 changed files with 57 additions and 773 deletions

View File

@ -11,6 +11,10 @@ var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
var env = config.build.env var env = config.build.env
function resolveApp(relativePath) {
return path.resolve(relativePath);
}
var webpackConfig = merge(baseWebpackConfig, { var webpackConfig = merge(baseWebpackConfig, {
module: { module: {
rules: utils.styleLoaders({ rules: utils.styleLoaders({
@ -53,6 +57,7 @@ var webpackConfig = merge(baseWebpackConfig, {
filename: config.build.index, filename: config.build.index,
template: 'index.html', template: 'index.html',
inject: true, inject: true,
favicon: resolveApp('favicon.ico'),
minify: { minify: {
removeComments: true, removeComments: true,
collapseWhitespace: true, collapseWhitespace: true,

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<svg t="1492500959545" @click="toggleClick" class="wscn-icon hamburger" :class="{'is-active':isActive}" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1691" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M966.8023 568.849776 57.196677 568.849776c-31.397081 0-56.850799-25.452695-56.850799-56.850799l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 543.397081 998.200404 568.849776 966.8023 568.849776z" p-id="1692"></path><path d="M966.8023 881.527125 57.196677 881.527125c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 856.07443 998.200404 881.527125 966.8023 881.527125z" p-id="1693"></path><path d="M966.8023 256.17345 57.196677 256.17345c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.850799 56.850799-56.850799l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.850799l0 0C1023.653099 230.720755 998.200404 256.17345 966.8023 256.17345z" p-id="1694"></path></svg> <svg t="1492500959545" @click="toggleClick" class="svg-icon hamburger" :class="{'is-active':isActive}" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1691" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M966.8023 568.849776 57.196677 568.849776c-31.397081 0-56.850799-25.452695-56.850799-56.850799l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 543.397081 998.200404 568.849776 966.8023 568.849776z" p-id="1692"></path><path d="M966.8023 881.527125 57.196677 881.527125c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 856.07443 998.200404 881.527125 966.8023 881.527125z" p-id="1693"></path><path d="M966.8023 256.17345 57.196677 256.17345c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.850799 56.850799-56.850799l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.850799l0 0C1023.653099 230.720755 998.200404 256.17345 966.8023 256.17345z" p-id="1694"></path></svg>
</div> </div>
</template> </template>

View File

@ -1,11 +0,0 @@
import Vue from 'vue'
function registerAllComponents(requireContext) {
return requireContext.keys().forEach(comp => {
const vueComp = requireContext(comp)
const compName = vueComp.name ? vueComp.name.toLowerCase() : /\/([\w-]+)\.vue$/.exec(comp)[1]
Vue.component(compName, vueComp)
})
}
registerAllComponents(require.context('./', false, /\.vue$/))

View File

@ -1,12 +1,12 @@
<template> <template>
<svg class="wscn-icon" aria-hidden="true"> <svg class="svg-icon" aria-hidden="true">
<use :xlink:href="iconName"></use> <use :xlink:href="iconName"></use>
</svg> </svg>
</template> </template>
<script> <script>
export default { export default {
name: 'wscn-icon-svg', name: 'icon-svg',
props: { props: {
iconClass: { iconClass: {
type: String, type: String,
@ -20,7 +20,3 @@
} }
} }
</script> </script>
<style lang="scss" scoped>
</style>

View File

@ -1,52 +0,0 @@
<template>
<div class="icon-container" :style="containerStyle">
<slot class="icon"></slot>
</div>
</template>
<script>
export default {
name: 'wscn-icon-stack',
props: {
width: {
type: Number,
default: 20
},
shape: {
type: String,
default: 'circle',
validator: val => {
const validShapes = ['circle', 'square']
return validShapes.indexOf(val) > -1
}
}
},
computed: {
containerStyle() {
return {
width: `${this.width}px`,
height: `${this.width}px`,
fontSize: `${this.width * 0.6}px`,
borderRadius: `${this.shape === 'circle' && '50%'}`
}
}
}
}
</script>
<style lang="scss" scoped>
.icon-container {
display: inline-block;
position: relative;
overflow: hidden;
background: #1482F0;
.icon {
position: absolute;
color: #ffffff;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
</style>

View File

@ -4,31 +4,32 @@ import Vue from 'vue'
import App from './App' import App from './App'
import router from './router' import router from './router'
import store from './store' import store from './store'
import ElementUI from 'element-ui'; import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css' import 'element-ui/lib/theme-default/index.css'
import NProgress from 'nprogress' import NProgress from 'nprogress'
import 'normalize.css/normalize.css';// normalize.css 样式格式化 import 'normalize.css/normalize.css'
import '@/styles/index.scss'; // 全局自定义的css样式 import '@/styles/index.scss' // 全局自定义的css样式
import '@/components/Icon-svg/index'; // 封装的svg组件 import '@/assets/iconfont/iconfont'
import IconSvg from '@/components/Icon-svg/index.vue'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.component('icon-svg', IconSvg)
const whiteList = ['/login'];
const whiteList = ['/login'];// 不重定向白名单
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start(); // 开启Progress NProgress.start();
if (store.getters.token) { // 判断是否有token if (store.getters.token) {
if (to.path === '/login') { if (to.path === '/login') {
next({ path: '/' }); next({ path: '/' });
} else { } else {
if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息 if (store.getters.roles.length === 0) {
store.dispatch('GetInfo').then(res => { // 拉取user_info store.dispatch('GetInfo').then(res => {
const roles = res.data.role; const roles = res.data.role;
store.dispatch('GenerateRoutes', { roles }).then(() => { // 生成可访问的路由表 store.dispatch('GenerateRoutes', { roles }).then(() => {
router.addRoutes(store.getters.addRouters) // 动态添加可访问路由表 router.addRoutes(store.getters.addRouters)
next(to.path); // hack方法 确保addRoutes已完成 next(to.path);
}) })
}).catch(err => { }).catch(err => {
console.log(err); console.log(err);
@ -38,10 +39,10 @@ router.beforeEach((to, from, next) => {
} }
} }
} else { } else {
if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 if (whiteList.indexOf(to.path) !== -1) {
next() next()
} else { } else {
next('/login'); // 否则全部重定向到登录页 next('/login');
NProgress.done(); NProgress.done();
} }
} }

View File

@ -1,12 +1,8 @@
const getters = { const getters = {
sidebar: state => state.app.sidebar, sidebar: state => state.app.sidebar,
visitedViews: state => state.app.visitedViews,
token: state => state.user.token, token: state => state.user.token,
avatar: state => state.user.avatar, avatar: state => state.user.avatar,
name: state => state.user.name, name: state => state.user.name,
uid: state => state.user.uid,
email: state => state.user.email,
introduction: state => state.user.introduction,
roles: state => state.user.roles, roles: state => state.user.roles,
permission_routers: state => state.permission.routers, permission_routers: state => state.permission.routers,
addRouters: state => state.permission.addRouters addRouters: state => state.permission.addRouters

View File

@ -1,103 +0,0 @@
$blue:#324157;
$light-blue:#3A71A8;
$red:#C03639;
$pink: #E65D6E;
$green: #30B08F;
$tiffany: #4AB7BD;
$yellow:#FEC171;
$panGreen: #30B08F;
@mixin colorBtn($color) {
background: $color;
&:hover {
color: $color;
&:before, &:after {
background: $color;
}
}
}
.blue-btn {
@include colorBtn($blue)
}
.light-blue-btn{
@include colorBtn($light-blue)
}
.red-btn {
@include colorBtn($red)
}
.pink-btn {
@include colorBtn($pink)
}
.green-btn {
@include colorBtn($green)
}
.tiffany-btn {
@include colorBtn($tiffany)
}
.yellow-btn {
@include colorBtn($yellow)
}
.pan-btn {
font-size: 14px;
color: #fff;
padding: 14px 36px;
border-radius: 8px;
border: none;
outline: none;
margin-right: 25px;
transition: 600ms ease all;
position: relative;
display: inline-block;
&:hover {
background: #fff;
&:before, &:after {
width: 100%;
transition: 600ms ease all;
}
}
&:before, &:after {
content: '';
position: absolute;
top: 0;
right: 0;
height: 2px;
width: 0;
transition: 400ms ease all;
}
&::after {
right: inherit;
top: inherit;
left: 0;
bottom: 0;
}
}
.custom-button{
display: inline-block;
line-height: 1;
white-space: nowrap;
cursor: pointer;
background: #fff;
color: #fff;
-webkit-appearance: none;
text-align: center;
box-sizing: border-box;
outline: 0;
margin: 0;
padding: 10px 15px;
font-size: 14px;
border-radius: 4px;
}

View File

@ -1,23 +1,4 @@
//覆盖一些element-ui样式 //覆盖一些element-ui样式 覆盖css样式可在这里添加
.block-checkbox {
display: block;
}
.operation-container {
.cell {
padding: 10px !important;
}
.el-button {
&:nth-child(3) {
margin-top: 10px;
margin-left: 0px;
}
&:nth-child(4) {
margin-top: 10px;
}
}
}
.el-upload { .el-upload {
input[type="file"] { input[type="file"] {
display: none !important; display: none !important;
@ -28,29 +9,6 @@
display: none; display: none;
} }
.cell {
.el-tag {
margin-right: 8px;
}
}
.small-padding {
.cell {
padding-left: 8px;
padding-right: 8px;
}
}
.status-col {
.cell {
padding: 0 10px;
text-align: center;
.el-tag {
margin-right: 0px;
}
}
}
//暂时性解决diolag 问题 https://github.com/ElemeFE/element/issues/2461 //暂时性解决diolag 问题 https://github.com/ElemeFE/element/issues/2461
.el-dialog { .el-dialog {
transform: none; transform: none;
@ -59,18 +17,6 @@
margin: 0 auto; margin: 0 auto;
} }
//文章页textarea修改样式
.article-textarea {
textarea {
padding-right: 40px;
resize: none;
border: none;
border-radius: 0px;
border-bottom: 1px solid #bfcbd9;
}
}
//element ui upload //element ui upload
.upload-container { .upload-container {
.el-upload { .el-upload {

View File

@ -1,4 +1,3 @@
@import './btn.scss';
@import './element-ui.scss'; @import './element-ui.scss';
@import "./mixin.scss"; @import "./mixin.scss";
body { body {
@ -8,10 +7,6 @@ body {
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
} }
label {
font-weight: 700;
}
html { html {
box-sizing: border-box; box-sizing: border-box;
} }
@ -22,14 +17,6 @@ html {
box-sizing: inherit; box-sizing: inherit;
} }
.no-padding {
padding: 0px !important;
}
.padding-content {
padding: 4px 0;
}
a:focus, a:focus,
a:active { a:active {
outline: none; outline: none;
@ -43,145 +30,6 @@ a:hover {
text-decoration: none; text-decoration: none;
} }
.fr {
float: right;
}
.fl {
float: left;
}
.pr-5 {
padding-right: 5px;
}
.pl-5 {
padding-left: 5px;
}
.block {
display: block;
}
.pointer {
cursor: pointer;
}
.inlineBlock {
display: block;
}
code {
background: #eef1f6;
padding: 15px 10px;
margin-bottom: 20px;
display: block;
line-height: 36px;
a {
color: #337ab7;
cursor: pointer;
&:hover {
color: rgb(32, 160, 255);
}
}
}
.fade-enter-active,
.fade-leave-active {
transition: all .2s ease
}
.fade-enter,
.fade-leave-active {
opacity: 0;
}
//main-container全局样式
.app-container {
padding: 20px;
}
.components-container {
margin: 30px 50px;
position: relative;
}
.pagination-container {
margin-top: 30px;
}
.editor-container .CodeMirror {
height: 100%!important;
}
.wscn-icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
.sub-navbar {
height: 50px;
line-height: 50px;
position: relative;
width: 100%;
text-align: right;
padding-right: 20px;
transition: 600ms ease position;
background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%);
.subtitle {
font-size: 20px;
color: #fff;
}
&.draft {
background: #d0d0d0;
}
&.deleted {
background: #d0d0d0;
}
}
.link-type,
.link-type:focus {
color: #337ab7;
cursor: pointer;
&:hover {
color: rgb(32, 160, 255);
}
}
.publishedTag,
.draftTag,
.deletedTag {
color: #fff;
background-color: $panGreen;
line-height: 1;
text-align: center;
margin: 0;
padding: 8px 12px;
font-size: 14px;
border-radius: 4px;
position: absolute;
left: 20px;
top: 10px;
}
.draftTag {
background-color: $yellow;
}
.deletedTag {
background-color: $red;
}
.input-label {
font-size: 14px;
color: #48576a;
line-height: 1;
padding: 11px 5px 11px 0;
}
.clearfix { .clearfix {
&:after { &:after {
visibility: hidden; visibility: hidden;
@ -193,74 +41,31 @@ code {
} }
} }
.no-marginLeft { //vue router transition css
.el-checkbox { .fade-enter-active,
margin: 0 20px 15px 0; .fade-leave-active {
} transition: all .2s ease
.el-checkbox+.el-checkbox {
margin-left: 0px;
}
} }
.filter-container { .fade-enter,
padding-bottom: 10px; .fade-leave-active {
.filter-item { opacity: 0;
display: inline-block;
vertical-align: middle;
margin-bottom: 10px;
}
} }
//main-container全局样式
//refine vue-multiselect plugin .app-main{
.multiselect { min-height: 100%
line-height: 16px;
} }
.multiselect--active { .app-container {
z-index: 1000 !important; padding: 20px;
} }
//refine simplemde .svg-icon {
.simplemde-container{ width: 1em;
.editor-toolbar.fullscreen,.CodeMirror-fullscreen{ height: 1em;
z-index: 1003; vertical-align: -0.15em;
} fill: currentColor;
overflow: hidden;
} }
//暂时性解决diolag 问题 https://github.com/ElemeFE/element/issues/2461
.el-dialog {
transform: none;
left: 0;
position: relative;
margin: 0 auto;
}
//github-corner
.github-corner:hover .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
@keyframes octocat-wave {
0%,
100% {
transform: rotate(0)
}
20%,
60% {
transform: rotate(-25deg)
}
40%,
80% {
transform: rotate(10deg)
}
}
@media (max-width:500px) {
.github-corner:hover .octo-arm {
animation: none
}
.github-corner .octo-arm {
animation: octocat-wave 560ms ease-in-out
}
}

View File

@ -25,36 +25,3 @@
height: 100%; height: 100%;
} }
@mixin pct($pct) {
width: #{$pct};
position: relative;
margin: 0 auto;
}
@mixin triangle($width, $height, $color, $direction) {
$width: $width/2;
$color-border-style: $height solid $color;
$transparent-border-style: $width solid transparent;
height: 0;
width: 0;
@if $direction==up {
border-bottom: $color-border-style;
border-left: $transparent-border-style;
border-right: $transparent-border-style;
}
@else if $direction==right {
border-left: $color-border-style;
border-top: $transparent-border-style;
border-bottom: $transparent-border-style;
}
@else if $direction==down {
border-top: $color-border-style;
border-left: $transparent-border-style;
border-right: $transparent-border-style;
}
@else if $direction==left {
border-right: $color-border-style;
border-top: $transparent-border-style;
border-bottom: $transparent-border-style;
}
}

View File

@ -1,8 +0,0 @@
/**
* Created by jiachenpan on 17/3/8.
*/
export default function createUniqueString() {
const timestamp = +new Date() + '';
const randomNum = parseInt((1 + Math.random()) * 65536) + '';
return (+(randomNum + timestamp)).toString(32);
}

View File

@ -57,92 +57,6 @@
} }
} }
// 格式化时间
export function getQueryObject(url) {
url = url == null ? window.location.href : url;
const search = url.substring(url.lastIndexOf('?') + 1);
const obj = {};
const reg = /([^?&=]+)=([^?&=]*)/g;
search.replace(reg, (rs, $1, $2) => {
const name = decodeURIComponent($1);
let val = decodeURIComponent($2);
val = String(val);
obj[name] = val;
return rs;
});
return obj;
}
/**
*get getByteLen
* @param {Sting} val input value
* @returns {number} output value
*/
export function getByteLen(val) {
let len = 0;
for (let i = 0; i < val.length; i++) {
if (val[i].match(/[^\x00-\xff]/ig) != null) {
len += 1;
} else { len += 0.5; }
}
return Math.floor(len);
}
export function cleanArray(actual) {
const newArray = [];
for (let i = 0; i < actual.length; i++) {
if (actual[i]) {
newArray.push(actual[i]);
}
}
return newArray;
}
export function param(json) {
if (!json) return '';
return cleanArray(Object.keys(json).map(key => {
if (json[key] === undefined) return '';
return encodeURIComponent(key) + '=' +
encodeURIComponent(json[key]);
})).join('&');
}
export function param2Obj(url) {
const search = url.split('?')[1];
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}')
}
export function html2Text(val) {
const div = document.createElement('div');
div.innerHTML = val;
return div.textContent || div.innerText;
}
export function objectMerge(target, source) {
/* Merges two objects,
giving the last one precedence */
if (typeof target !== 'object') {
target = {};
}
if (Array.isArray(source)) {
return source.slice();
}
for (const property in source) {
if (source.hasOwnProperty(property)) {
const sourceProperty = source[property];
if (typeof sourceProperty === 'object') {
target[property] = objectMerge(target[property], sourceProperty);
continue;
}
target[property] = sourceProperty;
}
}
return target;
}
export function scrollTo(element, to, duration) { export function scrollTo(element, to, duration) {
if (duration <= 0) return; if (duration <= 0) return;
const difference = to - element.scrollTop; const difference = to - element.scrollTop;
@ -154,61 +68,3 @@
scrollTo(element, to, duration - 10); scrollTo(element, to, duration - 10);
}, 10); }, 10);
} }
export function toggleClass(element, className) {
if (!element || !className) {
return;
}
let classString = element.className;
const nameIndex = classString.indexOf(className);
if (nameIndex === -1) {
classString += '' + className;
} else {
classString = classString.substr(0, nameIndex) + classString.substr(nameIndex + className.length);
}
element.className = classString;
}
export const pickerOptions = [
{
text: '今天',
onClick(picker) {
const end = new Date();
const start = new Date(new Date().toDateString());
end.setTime(start.getTime());
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一周',
onClick(picker) {
const end = new Date(new Date().toDateString());
const start = new Date();
start.setTime(end.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date(new Date().toDateString());
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date(new Date().toDateString());
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
}
}]
export function getTime(type) {
if (type === 'start') {
return new Date().getTime() - 3600 * 1000 * 24 * 90
} else {
return new Date(new Date().toDateString())
}
}

View File

@ -1,27 +0,0 @@
/**
*Created by jiachenpan on 16/11/29.
* @param {Sting} url
* @param {Sting} title
* @param {Number} w
* @param {Number} h
*/
export default function openWindow(url, title, w, h) {
// Fixes dual-screen position Most browsers Firefox
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left;
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top;
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
const left = ((width / 2) - (w / 2)) + dualScreenLeft;
const top = ((height / 2) - (h / 2)) + dualScreenTop;
const newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
// Puts focus on the newWindow
if (window.focus) {
newWindow.focus();
}
}

View File

@ -20,12 +20,6 @@ export function validateLowerCase(str) {
return reg.test(str); return reg.test(str);
} }
/* 验证key*/
// export function validateKey(str) {
// var reg = /^[a-z_\-:]+$/;
// return reg.test(str);
// }
/* 大写字母*/ /* 大写字母*/
export function validateUpperCase(str) { export function validateUpperCase(str) {
const reg = /^[A-Z]+$/; const reg = /^[A-Z]+$/;

View File

@ -1,5 +1,5 @@
<template> <template>
<section class="app-main" style="min-height: 100%"> <section class="app-main">
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<router-view :key="key"></router-view> <router-view :key="key"></router-view>
</transition> </transition>

View File

@ -1,11 +1,11 @@
<template> <template>
<div class="app-wrapper" :class="{hideSidebar:!sidebar.opened}"> <div class="app-wrapper" :class="{hideSidebar:!sidebar.opened}">
<div class="sidebar-wrapper"> <div class="sidebar-wrapper">
<Sidebar class="sidebar-container" /> <sidebar class="sidebar-container"></sidebar>
</div> </div>
<div class="main-container"> <div class="main-container">
<Navbar/> <navbar></navbar>
<App-main/> <app-main></app-main>
</div> </div>
</div> </div>
</template> </template>

View File

@ -13,11 +13,6 @@
首页 首页
</el-dropdown-item> </el-dropdown-item>
</router-link> </router-link>
<router-link class='inlineBlock' to="/admin/profile">
<el-dropdown-item>
设置
</el-dropdown-item>
</router-link>
<el-dropdown-item divided><span @click="logout" style="display:block;">退出登录</span></el-dropdown-item> <el-dropdown-item divided><span @click="logout" style="display:block;">退出登录</span></el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>

View File

@ -3,12 +3,12 @@
<template v-for="item in routes"> <template v-for="item in routes">
<router-link v-if="!item.hidden&&item.noDropdown&&item.children.length>0" :to="item.path+'/'+item.children[0].path"> <router-link v-if="!item.hidden&&item.noDropdown&&item.children.length>0" :to="item.path+'/'+item.children[0].path">
<el-menu-item :index="item.path+'/'+item.children[0].path"> <el-menu-item :index="item.path+'/'+item.children[0].path">
<wscn-icon-svg v-if='item.icon' :icon-class="item.icon" /> {{item.children[0].name}} <icon-svg v-if='item.icon' :icon-class="item.icon" /> {{item.children[0].name}}
</el-menu-item> </el-menu-item>
</router-link> </router-link>
<el-submenu :index="item.name" v-if="!item.noDropdown&&!item.hidden"> <el-submenu :index="item.name" v-if="!item.noDropdown&&!item.hidden">
<template slot="title"> <template slot="title">
<wscn-icon-svg v-if='item.icon' :icon-class="item.icon" /> {{item.name}} <icon-svg v-if='item.icon' :icon-class="item.icon" /> {{item.name}}
</template> </template>
<template v-for="child in item.children" v-if='!child.hidden'> <template v-for="child in item.children" v-if='!child.hidden'>
<sidebar-item class='menu-indent' v-if='child.children&&child.children.length>0' :routes='[child]'> </sidebar-item> <sidebar-item class='menu-indent' v-if='child.children&&child.children.length>0' :routes='[child]'> </sidebar-item>
@ -36,7 +36,7 @@
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.wscn-icon { .svg-icon {
margin-right: 10px; margin-right: 10px;
} }
.hideSidebar .menu-indent{ .hideSidebar .menu-indent{

View File

@ -1,45 +0,0 @@
<template>
<div class='tabs-view-container'>
<router-link class="tabs-view" v-for="tag in Array.from(visitedViews)" :to="tag.path" :key="tag.path">
<el-tag :closable="true" @close='closeViewTabs(tag,$event)'>
{{tag.name}}
</el-tag>
</router-link>
</div>
</template>
<script>
export default {
computed: {
visitedViews() {
return this.$store.state.app.visitedViews.slice(-6)
}
},
methods: {
closeViewTabs(view, $event) {
this.$store.dispatch('delVisitedViews', view)
$event.preventDefault()
},
addViewTabs() {
this.$store.dispatch('addVisitedViews', this.$route.matched[this.$route.matched.length - 1])
}
},
watch: {
$route() {
this.addViewTabs()
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.tabs-view-container{
display: inline-block;
vertical-align: top;
margin-left: 10px;
.tabs-view{
margin-left: 10px;
}
}
</style>

View File

@ -5,12 +5,16 @@
class="card-box login-form"> class="card-box login-form">
<h3 class="title">系统登录</h3> <h3 class="title">系统登录</h3>
<el-form-item prop="email"> <el-form-item prop="email">
<span class="svg-container"><wscn-icon-svg icon-class="jiedianyoujian"/></span> <span class="svg-container">
<icon-svg icon-class="jiedianyoujian"></icon-svg>
</span>
<el-input name="email" type="text" v-model="loginForm.email" autoComplete="on" <el-input name="email" type="text" v-model="loginForm.email" autoComplete="on"
placeholder="邮箱"></el-input> placeholder="邮箱"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<span class="svg-container"><wscn-icon-svg icon-class="mima"/></span> <span class="svg-container">
<icon-svg icon-class="mima" ></icon-svg>
</span>
<el-input name="password" type="password" @keyup.enter.native="handleLogin" v-model="loginForm.password" <el-input name="password" type="password" @keyup.enter.native="handleLogin" v-model="loginForm.password"
autoComplete="on" placeholder="密码"></el-input> autoComplete="on" placeholder="密码"></el-input>
</el-form-item> </el-form-item>
@ -21,15 +25,11 @@
</el-form-item> </el-form-item>
<div class='tips'>admin账号为:admin@wallstreetcn.com 密码随便填</div> <div class='tips'>admin账号为:admin@wallstreetcn.com 密码随便填</div>
<div class='tips'>editor账号:editor@wallstreetcn.com 密码随便填</div> <div class='tips'>editor账号:editor@wallstreetcn.com 密码随便填</div>
<router-link to="/sendpwd" class="forget-pwd">
忘记密码?(或首次登录)
</router-link>
</el-form> </el-form>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
import { isWscnEmail } from '@/utils/validate'; import { isWscnEmail } from '@/utils/validate';
export default { export default {
@ -62,15 +62,9 @@
{ required: true, trigger: 'blur', validator: validatePass } { required: true, trigger: 'blur', validator: validatePass }
] ]
}, },
loading: false, loading: false
showDialog: false
} }
}, },
computed: {
...mapGetters([
'auth_type'
])
},
methods: { methods: {
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
@ -79,7 +73,6 @@
this.$store.dispatch('Login', this.loginForm).then(() => { this.$store.dispatch('Login', this.loginForm).then(() => {
this.loading = false; this.loading = false;
this.$router.push({ path: '/' }); this.$router.push({ path: '/' });
// this.showDialog = true;
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
}); });
@ -88,31 +81,7 @@
return false; return false;
} }
}); });
},
afterQRScan() {
// const hash = window.location.hash.slice(1);
// const hashObj = getQueryObject(hash);
// const originUrl = window.location.origin;
// history.replaceState({}, '', originUrl);
// const codeMap = {
// wechat: 'code',
// tencent: 'code'
// };
// const codeName = hashObj[codeMap[this.auth_type]];
// if (!codeName) {
// alert('');
// } else {
// this.$store.dispatch('LoginByThirdparty', codeName).then(() => {
// this.$router.push({ path: '/' });
// });
// }
} }
},
created() {
// window.addEventListener('hashchange', this.afterQRScan);
},
destroyed() {
// window.removeEventListener('hashchange', this.afterQRScan);
} }
} }
</script> </script>