This commit is contained in:
Pan 2017-04-24 17:34:04 +08:00
parent b3e1b6c824
commit 3fe2a376dd
8 changed files with 46 additions and 26 deletions

View File

@ -5,6 +5,8 @@ vue+element+axios 的管理后台 [线上地址](http://panjiachen.github.io/vue
###功能 ###功能
- [x] 登录/注销 - [x] 登录/注销
- [x] 权限验证 - [x] 权限验证
- [x] 侧边栏
- [x] 面包屑
- [x] 富文本编辑器 - [x] 富文本编辑器
- [x] Markdown编辑器 - [x] Markdown编辑器
- [x] JSON编辑器 - [x] JSON编辑器
@ -20,6 +22,10 @@ vue+element+axios 的管理后台 [线上地址](http://panjiachen.github.io/vue
- [x] table example - [x] table example
- [x] form example - [x] form example
- [x] 多环境发布 - [x] 多环境发布
- [x] dashboard
- [x] 二次登录
- [x] 动态侧边栏
###How to use? ###How to use?
```bash ```bash

View File

@ -26,23 +26,30 @@ const userMap = {
export default { export default {
loginByEmail: config => { loginByEmail: config => {
const { email } = config.params; const { email } = config.params;
return new Promise(resolve => { return new Promise((resolve, reject) => {
if (userMap[email.split('@')[0]]) {
setTimeout(() => { setTimeout(() => {
resolve([200, { resolve([200, {
data: userMap[email.split('@')[0]] data: userMap[email.split('@')[0]]
}]); }]);
}, 500); }, 500);
} else {
reject('账号不正确')
}
}) })
}, },
getInfo: config => { getInfo: config => {
const { token } = config.params; const { token } = config.params;
console.log(userMap[token]) return new Promise((resolve, reject) => {
return new Promise(resolve => { if (userMap[token]) {
setTimeout(() => { setTimeout(() => {
resolve([200, { resolve([200, {
data: userMap[token] data: userMap[token]
}]); }]);
}, 100); }, 100);
} else {
reject('获取失败')
}
}) })
}, },
logout: () => new Promise(resolve => { logout: () => new Promise(resolve => {

View File

@ -114,6 +114,7 @@ const user = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout(state.token).then(() => { logout(state.token).then(() => {
commit('SET_TOKEN', ''); commit('SET_TOKEN', '');
commit('SET_ROLES', []);
Cookies.remove('X-Ivanka-Token'); Cookies.remove('X-Ivanka-Token');
resolve(); resolve();
}).catch(error => { }).catch(error => {

View File

@ -61,7 +61,7 @@ export function fetch(options) {
}) })
.catch(error => { .catch(error => {
Message({ Message({
message: '发生异常错误,请刷新页面重试,或联系程序员', message: error,
type: 'error', type: 'error',
duration: 5 * 1000 duration: 5 * 1000
}); });

View File

@ -6,13 +6,12 @@
</PanThumb> </PanThumb>
<div class="info-container"> <div class="info-container">
<span class="display_name">{{name}}</span> <span class="display_name">{{name}}</span>
<span style='font-size:20px;padding-top:20px;display:inline-block;'>赶紧把你们想要的快捷键报给产品锦鲤!</span> <span style='font-size:20px;padding-top:20px;display:inline-block;'>普通编辑dashboard</span>
</div> </div>
</div> </div>
<div> <div>
<img class='emptyGif' :src="emptyGif" > <img class='emptyGif' :src="emptyGif" >
</div> </div>
</div> </div>
</template> </template>

View File

@ -27,12 +27,12 @@
</div> </div>
<div class="btn-group"> <div class="btn-group">
<router-link class="pan-btn blue-btn" to="/components/index"></router-link> <router-link class="pan-btn blue-btn" to="/components/index"></router-link>
<router-link class="pan-btn light-blue-btn" to="/charts/index">图表</router-link> <router-link class="pan-btn light-blue-btn" to="/charts/index">图表</router-link>
<router-link class="pan-btn red-btn" to="/errorpage/404">错误页面</router-link> <router-link class="pan-btn red-btn" to="/errorpage/404">错误页面</router-link>
<router-link class="pan-btn pink-btn" to="/errlog/log">错误日志</router-link> <router-link class="pan-btn pink-btn" to="/excel/download">导出excel</router-link>
<router-link class="pan-btn green-btn" to="/article/wscnlist">导出excel</router-link> <router-link class="pan-btn green-btn" to="/example/table">table</router-link>
<router-link class="pan-btn tiffany-btn" to="/excel/download">实时列表</router-link> <router-link class="pan-btn tiffany-btn" to="/example/form1">form</router-link>
</div> </div>
<div class="clearfix main-dashboard-container"> <div class="clearfix main-dashboard-container">

View File

@ -29,10 +29,11 @@
if (this.roles.indexOf('admin') >= 0) { if (this.roles.indexOf('admin') >= 0) {
return; return;
} }
const isEditor = this.roles.some(v => v.indexOf('editor') >= 0) // const isEditor = this.roles.some(v => v.indexOf('editor') >= 0)
if (!isEditor) { // if (!isEditor) {
// this.currentRole = 'DefaultDashboard';
// }
this.currentRole = 'DefaultDashboard'; this.currentRole = 'DefaultDashboard';
} }
} }
}
</script> </script>

View File

@ -19,6 +19,8 @@
登录 登录
</el-button> </el-button>
</el-form-item> </el-form-item>
<div class='tips'>admin账号为:admin@wallstreetcn 密码随便填</div>
<div class='tips'>editor账号:editor@wallstreetcn 密码随便填</div>
<router-link to="/sendpwd" class="forget-pwd"> <router-link to="/sendpwd" class="forget-pwd">
忘记密码?(或首次登录) 忘记密码?(或首次登录)
</router-link> </router-link>
@ -56,7 +58,7 @@
}; };
return { return {
loginForm: { loginForm: {
email: '', email: 'admin@wallstreetcn.com',
password: '' password: ''
}, },
loginRules: { loginRules: {
@ -125,7 +127,11 @@
<style rel="stylesheet/scss" lang="scss" scoprd> <style rel="stylesheet/scss" lang="scss" scoprd>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
.tips{
font-size: 14px;
color: #fff;
margin-bottom: 5px;
}
.login-container { .login-container {
@include relative; @include relative;
height: 100vh; height: 100vh;