preface
In order to add a background management system for my app, I tried vue-element-admin and iView-admin, two background management systems. Since this is the first time to use this highly integrated background management system (because I am not very good), SO I recorded this time to ask the big guys from the group to solve the login problem. The project selection is iview-admin.
The installation
Since Github is sometimes fast and sometimes slow, choose iView-admin, which you downloaded from the code cloud. Before the installation, the following is to clone iview-admin locally.
git clone https://github.com/iview/iview-admin.git
npm install
npm run dev
Copy the code
Clone the iview-admin template branch repository
git clone -b template https://github.com/iview/iview-admin.git
Copy the code
Modify the login
1.src/main.js
Ps: NOW I have a problem that needs to be solved. The login status cannot be saved. Let’s talk about it later.
2020-03-19 Resolve the problem that login status cannot be saved
Change resolve() to resolve({access:true}) in store/module/user.js getUserInfo, as required by router/index.js
GetUserInfo ({state, commit}) {return new Promise((resolve, reject) => {
try {
// getUserInfo(state.token).then(res => {
// const data = res.data
// commit('setAvatar', data.avatar)
// commit('setUserName', data.name)
// commit('setUserId', data.user_id)
// commit('setAccess', data.access)
// commit('setHasGetInfo'.true)
// resolve(data)
// }).catch(err => {
// reject(err)
resolve({ access:true }) //
// })
} catch (error) {
reject(error)
}
})
},
Copy the code
Write in the last
1. A rookie just graduated, do not guarantee the above content is all correct, only hope to give some people inspiration.
2. There must be a teacher among three people. There is really a long way to learn in the future.
3. The haze will not last forever, the sky will clear up.