Commit 52116f52 by liimin

db数据加密

1 parent a07faa38
...@@ -28,4 +28,9 @@ ...@@ -28,4 +28,9 @@
} }
.el-dialog{ .el-dialog{
margin-top: 6vh !important; margin-top: 6vh !important;
&__footer {
.el-button {
width: 200px;
}
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 19:06:01 * @Date: 2019-09-01 19:06:01
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-05 18:15:54 * @Last Modified time: 2019-09-05 20:06:12
*/ */
import {LOGIN_URL,REG_URL,Role_LIST_URL} from '@/api/sys.account' import {LOGIN_URL,REG_URL,Role_LIST_URL} from '@/api/sys.account'
...@@ -42,4 +42,8 @@ export const LogExternals = [ ...@@ -42,4 +42,8 @@ export const LogExternals = [
REG_URL, // 注册 REG_URL, // 注册
BaseDataURL, //基础数据 BaseDataURL, //基础数据
Role_LIST_URL //角色列表 Role_LIST_URL //角色列表
]
\ No newline at end of file \ No newline at end of file
]
/**
* 登录来源
*/
export const LOGIN_TYPE = 1 //1pc,2小程序
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,10 @@ import LocalStorage from 'lowdb/adapters/LocalStorage' ...@@ -3,7 +3,10 @@ import LocalStorage from 'lowdb/adapters/LocalStorage'
import util from '@/libs/util' import util from '@/libs/util'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
const adapter = new LocalStorage(`d2admin-${process.env.VUE_APP_VERSION}`) const adapter = new LocalStorage(`d2admin-${process.env.VUE_APP_VERSION}`, {
serialize: (data) => escape(JSON.stringify(data)),
deserialize: (data) => JSON.parse(unescape(data))
})
const db = low(adapter) const db = low(adapter)
db db
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
</el-form> </el-form>
<div slot="footer"> <div slot="footer">
<el-button @click="submit" type="primary" class="button-submit">提交</el-button> <el-button @click="submit" type="primary" class="button-submit">提交</el-button>
<el-button @click="handleClose" type="plain" class="button-submit">取消</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
...@@ -237,21 +238,10 @@ $login-dialog-font: 13px; ...@@ -237,21 +238,10 @@ $login-dialog-font: 13px;
// } // }
} }
.el-dialog__footer { .el-dialog__footer {
padding: 0 0 38px 163px !important; padding-top:0;
.button-submit {
width: 145px;
height: 35px;
border-radius: 2px;
letter-spacing: 2px;
font-size: 14px;
line-height: 35px;
display: flex; display: flex;
justify-content: center; justify-content: flex-end;
box-sizing: border-box; // padding: 0 0 38px 0 !important;
span {
transform: translateY(-12px);
}
}
} }
.sigle-select { .sigle-select {
width: 100%; width: 100%;
......
import page from './page'
export default page
...@@ -36,11 +36,11 @@ ...@@ -36,11 +36,11 @@
<span class="form-sub">让服务更智慧、更直接</span> <span class="form-sub">让服务更智慧、更直接</span>
</div> </div>
<div class="input-wrap"> <div class="input-wrap">
<el-form-item prop="username"> <el-form-item prop="loginName">
<el-input <el-input
type="text" type="text"
v-on:keyup.native.13="submit" v-on:keyup.native.13="submit"
v-model="formLogin.username" v-model="formLogin.loginName"
placeholder="请输入用户名" placeholder="请输入用户名"
clearable clearable
v-focus > v-focus >
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
<script> <script>
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { mapActions,mapState } from 'vuex' import { mapActions,mapState } from 'vuex'
import { LOGIN_TYPE } from '@/common/constants'
export default { export default {
components: { components: {
'DialogReg': () => import('./dialogReg'), 'DialogReg': () => import('./dialogReg'),
...@@ -107,13 +108,13 @@ export default { ...@@ -107,13 +108,13 @@ export default {
time: dayjs().format('HH:mm:ss'), time: dayjs().format('HH:mm:ss'),
// 表单 // 表单
formLogin: { formLogin: {
username: 'admin', loginName: 'admin',
password: 'admin', password: 'admin',
code: 'v9am' loginType: LOGIN_TYPE
}, },
// 表单校验 // 表单校验
rules: Object.freeze({ rules: Object.freeze({
username: [ loginName: [
{ {
required: true, required: true,
message: '请输入用户名', message: '请输入用户名',
...@@ -144,36 +145,18 @@ export default { ...@@ -144,36 +145,18 @@ export default {
refreshTime () { refreshTime () {
this.time = dayjs().format('HH:mm:ss') this.time = dayjs().format('HH:mm:ss')
}, },
/**
* @description 接收选择一个用户快速登录的事件
* @param {Object} user 用户信息
*/
handleUserBtnClick (user) {
this.formLogin.username = user.username
this.formLogin.password = user.password
this.submit()
},
/**
* @description 提交表单
*/
// 提交登录信息 // 提交登录信息
submit () { submit () {
this.$refs.loginForm.validate((valid) => { this.$refs.loginForm.validate((valid) => {
if (valid) { if (valid) {
console.log(this.$store.state.d2admin.ua.data); const { browser , os } = this.$store.state.d2admin.ua.data
const _p = {...this.formLogin,deviceCode:`${os.name}${os.version}-${browser.name}${browser.version}`}
// 登录 // 登录
// 注意 这里的演示没有传验证码 // 注意 这里的演示没有传验证码
// 具体需要传递的数据请自行修改代码 // 具体需要传递的数据请自行修改代码
this.login({ this.login(_p)
username: this.formLogin.username, .then(() => this.$store.dispatch('d2admin/auth/init'))
password: this.formLogin.password .then(_ => this.$router.replace(this.$route.query.redirect || '/'))
})
.then(() => {
this.$store.dispatch('d2admin/auth/init').then(_ => {
// 重定向对象不存在则返回顶层路径
this.$router.replace(this.$route.query.redirect || '/')
})
})
} else { } else {
// 登录表单校验失败 // 登录表单校验失败
this.$message.error('表单校验失败,请检查') this.$message.error('表单校验失败,请检查')
......
...@@ -117,11 +117,6 @@ export default { ...@@ -117,11 +117,6 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.edit-role-dialog { .edit-role-dialog {
.el-dialog__footer{
.el-button{
width: 200px;
}
}
.el-divider--horizontal{ .el-divider--horizontal{
margin: 30px 0px 20px; margin: 30px 0px 20px;
} }
......
...@@ -202,15 +202,3 @@ export default { ...@@ -202,15 +202,3 @@ export default {
} }
} }
</script> </script>
<style lang="scss">
$login-dialog-lable-width: 90px;
$login-dialog-font: 13px;
.reg-dialog-admin{
.el-dialog__footer {
text-align: right;
.el-button {
width: 200px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!