refine
This commit is contained in:
parent
385ec5a762
commit
3c05519a09
|
@ -32,6 +32,7 @@
|
||||||
"vue-count-to": "1.0.5",
|
"vue-count-to": "1.0.5",
|
||||||
"vue-multiselect": "2.0.2",
|
"vue-multiselect": "2.0.2",
|
||||||
"vue-router": "2.7.0",
|
"vue-router": "2.7.0",
|
||||||
|
"vue-splitpane": "^1.0.0",
|
||||||
"vuedraggable": "2.14.1",
|
"vuedraggable": "2.14.1",
|
||||||
"vuex": "2.3.1",
|
"vuex": "2.3.1",
|
||||||
"xlsx": "^0.10.8"
|
"xlsx": "^0.10.8"
|
||||||
|
|
|
@ -19,7 +19,7 @@ export function logout() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInfo(token) {
|
export function getUserInfo(token) {
|
||||||
return fetch({
|
return fetch({
|
||||||
url: '/user/info',
|
url: '/user/info',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
|
|
@ -11,7 +11,7 @@ Mock.setup({
|
||||||
// 登录相关
|
// 登录相关
|
||||||
Mock.mock(/\/login\/login/, 'post', loginAPI.loginByUsername)
|
Mock.mock(/\/login\/login/, 'post', loginAPI.loginByUsername)
|
||||||
Mock.mock(/\/login\/logout/, 'post', loginAPI.logout)
|
Mock.mock(/\/login\/logout/, 'post', loginAPI.logout)
|
||||||
Mock.mock(/\/user\/info\.*/, 'get', loginAPI.getInfo)
|
Mock.mock(/\/user\/info\.*/, 'get', loginAPI.getUserInfo)
|
||||||
|
|
||||||
// 文章相关
|
// 文章相关
|
||||||
Mock.mock(/\/article\/list/, 'get', articleAPI.getList)
|
Mock.mock(/\/article\/list/, 'get', articleAPI.getList)
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default {
|
||||||
const { username } = JSON.parse(config.body)
|
const { username } = JSON.parse(config.body)
|
||||||
return userMap[username]
|
return userMap[username]
|
||||||
},
|
},
|
||||||
getInfo: config => {
|
getUserInfo: config => {
|
||||||
const { token } = param2Obj(config.url)
|
const { token } = param2Obj(config.url)
|
||||||
if (userMap[token]) {
|
if (userMap[token]) {
|
||||||
return userMap[token]
|
return userMap[token]
|
||||||
|
|
|
@ -20,7 +20,7 @@ router.beforeEach((to, from, next) => {
|
||||||
next({ path: '/' })
|
next({ path: '/' })
|
||||||
} else {
|
} else {
|
||||||
if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
|
if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
|
||||||
store.dispatch('GetInfo').then(res => { // 拉取user_info
|
store.dispatch('GetUserInfo').then(res => { // 拉取user_info
|
||||||
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) // 动态添加可访问路由表
|
||||||
|
|
|
@ -5,8 +5,6 @@ const app = {
|
||||||
sidebar: {
|
sidebar: {
|
||||||
opened: !+Cookies.get('sidebarStatus')
|
opened: !+Cookies.get('sidebarStatus')
|
||||||
},
|
},
|
||||||
theme: 'default',
|
|
||||||
livenewsChannels: Cookies.get('livenewsChannels') || '[]',
|
|
||||||
visitedViews: []
|
visitedViews: []
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { loginByUsername, logout, getInfo } from 'api/login'
|
import { loginByUsername, logout, getUserInfo } from 'api/login'
|
||||||
import { getToken, setToken, removeToken } from 'utils/auth'
|
import { getToken, setToken, removeToken } from 'utils/auth'
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
|
@ -60,9 +60,9 @@ const user = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
GetInfo({ commit, state }) {
|
GetUserInfo({ commit, state }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getInfo(state.token).then(response => {
|
getUserInfo(state.token).then(response => {
|
||||||
const data = response.data
|
const data = response.data
|
||||||
commit('SET_ROLES', data.role)
|
commit('SET_ROLES', data.role)
|
||||||
commit('SET_NAME', data.name)
|
commit('SET_NAME', data.name)
|
||||||
|
@ -117,7 +117,7 @@ const user = {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
commit('SET_TOKEN', role)
|
commit('SET_TOKEN', role)
|
||||||
setToken(role)
|
setToken(role)
|
||||||
getInfo(role).then(response => {
|
getUserInfo(role).then(response => {
|
||||||
const data = response.data
|
const data = response.data
|
||||||
commit('SET_ROLES', data.role)
|
commit('SET_ROLES', data.role)
|
||||||
commit('SET_NAME', data.name)
|
commit('SET_NAME', data.name)
|
||||||
|
|
|
@ -5,29 +5,27 @@ $pink: #E65D6E;
|
||||||
$green: #30B08F;
|
$green: #30B08F;
|
||||||
$tiffany: #4AB7BD;
|
$tiffany: #4AB7BD;
|
||||||
$yellow:#FEC171;
|
$yellow:#FEC171;
|
||||||
|
|
||||||
$panGreen: #30B08F;
|
$panGreen: #30B08F;
|
||||||
|
|
||||||
@mixin colorBtn($color) {
|
@mixin colorBtn($color) {
|
||||||
background: $color;
|
background: $color;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $color;
|
color: $color;
|
||||||
&:before, &:after {
|
&:before,
|
||||||
|
&:after {
|
||||||
background: $color;
|
background: $color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.blue-btn {
|
.blue-btn {
|
||||||
@include colorBtn($blue)
|
@include colorBtn($blue)
|
||||||
}
|
}
|
||||||
|
|
||||||
.light-blue-btn{
|
.light-blue-btn {
|
||||||
@include colorBtn($light-blue)
|
@include colorBtn($light-blue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.red-btn {
|
.red-btn {
|
||||||
@include colorBtn($red)
|
@include colorBtn($red)
|
||||||
}
|
}
|
||||||
|
@ -40,12 +38,10 @@ $panGreen: #30B08F;
|
||||||
@include colorBtn($green)
|
@include colorBtn($green)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.tiffany-btn {
|
.tiffany-btn {
|
||||||
@include colorBtn($tiffany)
|
@include colorBtn($tiffany)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.yellow-btn {
|
.yellow-btn {
|
||||||
@include colorBtn($yellow)
|
@include colorBtn($yellow)
|
||||||
}
|
}
|
||||||
|
@ -63,12 +59,14 @@ $panGreen: #30B08F;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
&:before, &:after {
|
&:before,
|
||||||
|
&:after {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
transition: 600ms ease all;
|
transition: 600ms ease all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&:before, &:after {
|
&:before,
|
||||||
|
&:after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -85,19 +83,20 @@ $panGreen: #30B08F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-button{
|
.custom-button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
@import './btn.scss';
|
@import './btn.scss';
|
||||||
@import './element-ui.scss';
|
@import './element-ui.scss';
|
||||||
@import './sidebar.scss';
|
@import './sidebar.scss';
|
||||||
|
|
||||||
body {
|
body {
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
|
@ -98,15 +97,16 @@ code {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//main-container全局样式
|
//main-container全局样式
|
||||||
.app-container {
|
.app-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.components-container {
|
.components-container {
|
||||||
margin: 30px 50px;
|
margin: 30px 50px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-container {
|
.pagination-container {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
@ -115,9 +115,10 @@ code {
|
||||||
height: 100%!important;
|
height: 100%!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text-center{
|
.text-center {
|
||||||
text-align: center
|
text-align: center
|
||||||
}
|
}
|
||||||
|
|
||||||
.svg-icon {
|
.svg-icon {
|
||||||
width: 1em;
|
width: 1em;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
|
@ -216,7 +217,6 @@ code {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//refine vue-multiselect plugin
|
//refine vue-multiselect plugin
|
||||||
.multiselect {
|
.multiselect {
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
|
@ -227,8 +227,9 @@ code {
|
||||||
}
|
}
|
||||||
|
|
||||||
//refine simplemde
|
//refine simplemde
|
||||||
.simplemde-container{
|
.simplemde-container {
|
||||||
.editor-toolbar.fullscreen,.CodeMirror-fullscreen{
|
.editor-toolbar.fullscreen,
|
||||||
|
.CodeMirror-fullscreen {
|
||||||
z-index: 1003;
|
z-index: 1003;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { Message } from 'element-ui'
|
import { Message } from 'element-ui'
|
||||||
import store from '../store'
|
import store from '@/store'
|
||||||
import { getToken } from 'utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* Created by jiachenpan on 16/11/18.
|
* Created by jiachenpan on 16/11/18.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* 是否是公司邮箱*/
|
|
||||||
export function isvalidUsername(str) {
|
export function isvalidUsername(str) {
|
||||||
const valid_map = ['admin', 'editor']
|
const valid_map = ['admin', 'editor']
|
||||||
return valid_map.indexOf(str.trim()) >= 0
|
return valid_map.indexOf(str.trim()) >= 0
|
||||||
|
@ -20,12 +19,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]+$/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>这里核心代码用的是<a class='link-type' href='//github.com/dai-siki/vue-image-crop-upload'>vue-image-crop-upload</a>
|
<code>这里核心代码用的是<a class='link-type' href='//github.com/dai-siki/vue-image-crop-upload'> vue-image-crop-upload</a>
|
||||||
由于我在使用时它只有vue@1版本,而且有些业务的需求耦合到七牛等等原因吧,自己改造了一下,如果大家要使用的话,优先还是使用官方component
|
由于我在使用时它只有vue@1版本,而且有些业务的需求耦合到七牛等等原因吧,自己改造了一下,如果大家要使用的话,优先还是使用官方component
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ImageCropper from 'components/ImageCropper'
|
import ImageCropper from '@/components/ImageCropper'
|
||||||
import PanThumb from 'components/PanThumb'
|
import PanThumb from '@/components/PanThumb'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { ImageCropper, PanThumb },
|
components: { ImageCropper, PanThumb },
|
||||||
|
|
|
@ -135,7 +135,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BackToTop from 'components/BackToTop'
|
import BackToTop from '@/components/BackToTop'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { BackToTop },
|
components: { BackToTop },
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>https://github.com/rowanwins/vue-dropzone
|
<code>
|
||||||
|
基于<a class='link-type' href='https://github.com/rowanwins/vue-dropzone'> dropzone </a>封装 ,
|
||||||
由于我司业务有特殊需求,而且要传七牛 所以没用第三方 选择了自己封装
|
由于我司业务有特殊需求,而且要传七牛 所以没用第三方 选择了自己封装
|
||||||
</code>
|
</code>
|
||||||
<div class="editor-container">
|
<div class="editor-container">
|
||||||
|
@ -10,7 +11,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Dropzone from 'components/Dropzone'
|
import Dropzone from '@/components/Dropzone'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Dropzone },
|
components: { Dropzone },
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MdInput from 'components/MDinput'
|
import MdInput from '@/components/MDinput'
|
||||||
import PanThumb from 'components/PanThumb'
|
import PanThumb from '@/components/PanThumb'
|
||||||
import waves from '@/directive/waves.js'// 水波纹指令
|
import waves from '@/directive/waves.js'// 水波纹指令
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="components-container">
|
||||||
<code>splitPane 如果你用过<a href='http://codepen.io/' target='_blank'>codepen</a>,<a href='https://jsfiddle.net/' target='_blank'>jsfiddle</a>就不会陌生了
|
<code>splitPane 如果你用过<a href='http://codepen.io/' target='_blank'> codepen</a>,<a href='https://jsfiddle.net/' target='_blank'> jsfiddle </a>就不会陌生了
|
||||||
暂还没有时间开源封装好,日后补上
|
<a href='https://github.com/PanJiaChen/vue-split-pane' target='_blank'>项目地址</a>
|
||||||
</code>
|
</code>
|
||||||
<split-pane v-on:resize="resize" split="vertical">
|
<split-pane v-on:resize="resize" split="vertical">
|
||||||
<template slot="paneL">
|
<template slot="paneL">
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import splitPane from 'components/SplitPane'
|
import splitPane from 'vue-splitpane'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { splitPane },
|
components: { splitPane },
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Sticky from 'components/Sticky'
|
import Sticky from '@/components/Sticky'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { Sticky },
|
components: { Sticky },
|
||||||
|
|
Loading…
Reference in New Issue