注销逻辑转移到 vuex

Former-commit-id: f31a633b971c45a544a373c581ef603941cae327 [formerly 23fdc68df2f8fc6fd5c4e69ca8b7d884fe53decf] [formerly f31a633b971c45a544a373c581ef603941cae327 [formerly 23fdc68df2f8fc6fd5c4e69ca8b7d884fe53decf] [formerly f31a633b971c45a544a373c581ef603941cae327 [formerly 23fdc68df2f8fc6fd5c4e69ca8b7d884fe53decf] [formerly 23fdc68df2f8fc6fd5c4e69ca8b7d884fe53decf [formerly b31ed8b7ee9f03071b452e3b7086b06bf261078f [formerly 6c23c54805a07c133be8e8b70752ed73bbf34a13]]]]]
Former-commit-id: 044f1437f929847962bd7eb7f753b8770bccde9e
Former-commit-id: 5bde6cd5f3c5af8a0c1a9ac1e61f69fff025c61c
Former-commit-id: 169a1a6c4eb0c0522a30b6d9bc3f8c078f725d9e [formerly 9cb800d61661dc15361191620058015de2217714]
Former-commit-id: fc88ea03ef389486d001dbcb05798f6340b8bbb7
Former-commit-id: 9c101f9a8098d7f2c411b38a518281ecfeb535f5
Former-commit-id: 6134dbd30721e57493ae936127967df8453c95e2
Former-commit-id: 7657a1fb82e736be0caab9b3c9b3df2b549b9d61
Former-commit-id: de7f04298e233f2e6c5b42fbbbe8f877c9ba44a6
This commit is contained in:
liyang
2018-07-19 17:00:45 +08:00
parent 31c16f2d3a
commit ca97c5ca4f
6 changed files with 29 additions and 37 deletions

View File

@@ -19,9 +19,11 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
background: #757F9A; /* background: #757F9A; */
background: -webkit-linear-gradient(to top, #D7DDE8, #757F9A); /* background: -webkit-linear-gradient(to top, #D7DDE8, #757F9A); */
background: linear-gradient(to top, #D7DDE8, #757F9A); /* background: linear-gradient(to top, #D7DDE8, #757F9A); */
background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.15) 100%), radial-gradient(at top center, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.40) 120%) #989898;
background-blend-mode: multiply,multiply;
} }
.d2-app-loading-title { .d2-app-loading-title {
color: #FFF; color: #FFF;

View File

@@ -9,9 +9,7 @@
</template> </template>
<script> <script>
// 插件 import { mapState, mapActions } from 'vuex'
import Cookies from 'js-cookie'
import { mapState, mapMutations } from 'vuex'
export default { export default {
computed: { computed: {
...mapState({ ...mapState({
@@ -19,29 +17,16 @@ export default {
}) })
}, },
methods: { methods: {
...mapMutations([ ...mapActions([
'd2adminUtilDbRemoveByUuid' 'd2adminLogout'
]), ]),
/**
* @description 登出
*/
logOff () { logOff () {
this.$confirm('注销此账户吗?', '注销', { this.d2adminLogout({
confirmButtonText: '确定', vm: this,
cancelButtonText: '取消', confirm: true
type: 'warning'
}).then(() => {
// 删除用户信息
this.d2adminUtilDbRemoveByUuid({
key: 'userInfo',
emptyValue: ''
})
// 删除cookie
Cookies.remove('token')
Cookies.remove('uuid')
// 跳转路由
this.$router.push({
name: 'login'
})
}).catch(() => {
// 取消了注销
}) })
} }
} }

View File

@@ -14,10 +14,10 @@ const userDB = [
name: '编辑' name: '编辑'
}, },
{ {
username: 'user', username: 'user1',
password: 'user', password: 'user1',
uuid: 'user-uuid', uuid: 'user1-uuid',
name: '一般用户' name: '用户1'
} }
] ]

View File

@@ -79,9 +79,9 @@ export default {
password: 'editor' password: 'editor'
}, },
{ {
name: '用户', name: '用户1',
username: 'user', username: 'user1',
password: 'user' password: 'user1'
} }
], ],
// 表单 // 表单

View File

@@ -1 +1 @@
cb5203e7da4a54f17ca8f08ae175eae15db544f0 ba1f2c6d38619c095d25a69254227124c5bc6000

View File

@@ -12,6 +12,7 @@ module.exports = {
publicPath: '/d2-admin-preview/' // 和 baseUrl 保持一致 publicPath: '/d2-admin-preview/' // 和 baseUrl 保持一致
}, },
// webpack 设置 // webpack 设置
// 默认设置: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js
chainWebpack: config => { chainWebpack: config => {
// markdown // markdown
config.module config.module
@@ -48,8 +49,12 @@ module.exports = {
.add(resolve('src/assets/svg-icons/icons')) .add(resolve('src/assets/svg-icons/icons'))
.end() .end()
// 重新设置 alias // 重新设置 alias
config.resolve config.resolve.alias
.alias
.set('@', resolve('src')) .set('@', resolve('src'))
// babel-polyfill 加入 entry
const entry = config.entry('app')
entry
.add('babel-polyfill')
.end()
} }
} }