demo/playground/ua

Former-commit-id: a96394ff0be7a95a5d96adf54391339d69af9fd5 [formerly a96394ff0be7a95a5d96adf54391339d69af9fd5 [formerly a96394ff0be7a95a5d96adf54391339d69af9fd5 [formerly a96394ff0be7a95a5d96adf54391339d69af9fd5 [formerly 0d5cde6f3159acbcd0da4cafbfd1beeb4a2dcf53 [formerly 9d7bd149e7a497dae325b8a76ec2327acb928591]]]]]
Former-commit-id: 44d07b4ce0e2fda3c4f12e4677053a93fdf3e287
Former-commit-id: 0878c077a3e58ca7ae2550563f3277afb2a1505e
Former-commit-id: dd4ec1cd40077c87e04a46b7916b1cb695772598 [formerly 260ba0013721f93c1b750c9a4baced47d846d2b0]
Former-commit-id: f386481937b2dee6b5cb5a55e4150e62194a0d74
Former-commit-id: d6f7d9662b1c5208fb39887b22d91e3ba65f515a
Former-commit-id: c0d04a36620b3811b1ee061c66844a4c45208130
Former-commit-id: 73acb00308ff05f3fb15065b4187126dc5715aa0
Former-commit-id: 0a2e96437f1090566da11b05c19d9b38738890fa
This commit is contained in:
liyang 2018-07-20 10:39:24 +08:00
parent 84228d7b1a
commit d22898d734
7 changed files with 38 additions and 40 deletions

View File

@ -25,6 +25,7 @@ export default {
{ path: `${pre}theme`, title: '主题', icon: 'flask' },
{ path: `${pre}fullscreen`, title: '全屏', icon: 'arrows-alt' },
{ path: `${pre}gray`, title: '灰度模式', icon: 'eye' },
{ path: `${pre}db`, title: '数据持久化', icon: 'database' }
{ path: `${pre}db`, title: '数据持久化', icon: 'database' },
{ path: `${pre}ua`, title: '浏览器信息', icon: 'info-circle' }
])('/demo/playground/')
}

View File

@ -1,6 +1,6 @@
<template>
<d2-container>
<h1 class="d2-mt-0">基础用法</h1>
<el-table
:data="tableData"

View File

@ -0,0 +1,23 @@
<template>
<d2-container>
<p class="d2-mt-0">useragent</p>
<el-input :value="ua.ua"></el-input>
<p>格式化数据 in vuex: state.d2admin.ua</p>
<d2-highlight :code="uaStr"/>
</d2-container>
</template>
<script>
import { mapState } from 'vuex'
export default {
computed: {
...mapState({
ua: state => state.d2admin.ua
}),
uaStr () {
const { browser, engine, os, device, cpu } = this.ua
return JSON.stringify({ browser, engine, os, device, cpu }, null, 2)
}
}
}
</script>

View File

@ -0,0 +1,2 @@
// 例子插件配置地址
// https://vincentgarreau.com/particles.js/#default

View File

@ -56,12 +56,9 @@
<script>
/* eslint-disable */
require('particles.js')
//
// https://vincentgarreau.com/particles.js/#default
import config from './config/default'
import Cookies from 'js-cookie'
import { mapMutations } from 'vuex'
import { mapMutations, mapActions } from 'vuex'
export default {
data () {
return {
@ -113,6 +110,9 @@ export default {
'd2adminUserInfoSet',
'd2adminLoginSuccessLoad'
]),
...mapActions([
'd2adminLogin'
]),
/**
* @description 接收选择一个用户快速登陆的事件
* @param {object} user 用户信息
@ -129,39 +129,11 @@ export default {
submit () {
this.$refs.loginForm.validate((valid) => {
if (valid) {
//
this.$axios({
method: 'post',
url: '/login',
data: {
username: this.formLogin.username,
password: this.formLogin.password
}
this.d2adminLogin({
vm: this,
username: this.formLogin.username,
password: this.formLogin.password
})
.then(res => {
// cookie
const setting = {
expires: 1
}
// cookie uuid token cookie
Cookies.set('uuid', res.data.uuid, setting)
Cookies.set('token', res.data.token, setting)
// vuex
this.d2adminUserInfoSet({
name: res.data.name
})
//
this.d2adminLoginSuccessLoad()
//
this.$router.push({
name: 'index'
})
})
.catch(err => {
console.group('登陆结果')
console.log('err: ', err)
console.groupEnd()
})
} else {
return false
}

View File

@ -1 +1 @@
d1fc661cca201ded872328bf7926689075938e00
8f76893e76107fa094818a6c495320ab7023c0ab

View File

@ -1 +1 @@
5c74482dc6e71d5efa34bc5fdfb5c40943d5d386
87f7615f1492b3bc4534633f7da875df831a5940