合买源码搭建出租

合买源码搭建出租

Q【1148916888】
合买源码搭建出租

实现思路

( 1 ) 设置锁屏密码
( 2 ) 密码存localStorage (本项目已经封装h5的sessionStorage和localStorage)
( 3 ) vuex设置 SET_LOCK state.isLock = true (为true是锁屏状态)
( 4 ) 在路由里面判断vuex里面的isLock(为true锁屏状态不能让用户后退url和自行修改url跳转页面否则可以)
(1)设置锁屏密码

handleSetLock() {
this.$refs['form'].validate(valid => {
if (valid) {
this.$store.commit('SET_LOCK_PASSWD', this.form.passwd)
this.handleLock()
}
})
},
1
2
3
4
5
6
7
8
( 2 ) 密码存localStorage setStore是自己封装的方法

SET_LOCK_PASSWD: (state, lockPasswd) => {
state.lockPasswd = lockPasswd
setStore({
name: 'lockPasswd',
content: state.lockPasswd,
type: 'session'
})
},
1
2
3
4
5
6
7
8
( 3 ) vuex设置 SET_LOCK state.isLock = true 同时存在store里面

SET_LOCK: (state, action) => {
state.isLock = true
setStore({
name: 'isLock',
content: state.isLock,
type: 'session'
})
},
1
2
3
4
5
6
7
8
( 4 ) 在路由里面判断vuex里面的isLock

if (store.getters.isLock && to.path !== lockPage) {
next({
path: lockPage
})
NProgress.done()
1
2
3
4
5
源码地址

前端学习交流群493671066,美女多多。老司机快上车,来不及解释了。

作者相关Vue文章

基于Vue2.0实现后台系统权限控制

前端文档汇总

VUE2.0增删改查附编辑添加model(弹框)组件共用

猜你喜欢

转载自blog.51cto.com/13843686/2134289