diff --git a/src/assets/face.png b/src/assets/face.png new file mode 100644 index 0000000..072dc07 Binary files /dev/null and b/src/assets/face.png differ diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 93b3ccd..0d44762 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -6,8 +6,12 @@
-
- +
+
+ + {{userName}} +
+
@@ -36,7 +40,7 @@ } from 'vuex' import Breadcrumb from '@/components/Breadcrumb' import Hamburger from '@/components/Hamburger' - + import state from '@/store/modules/user.js' export default { components: { Breadcrumb, @@ -47,6 +51,15 @@ 'sidebar', 'avatar' ]) + }, + data(){ + return{ + userName:'' + } + }, + created(){ + console.log("state",state) + this.userName = state.state.name?state.state.name:'' }, methods: { toggleSideBar() { @@ -88,7 +101,7 @@ .right-menu { float: right; height: 100%; - line-height: 50px; + line-height: 46px; &:focus { outline: none; @@ -116,21 +129,26 @@ margin-right: 30px; .avatar-wrapper { - margin-top: 5px; + // margin-top: 5px; position: relative; - + display:flex; + align-items: center; + color:#3c4758; .user-avatar { cursor: pointer; - width: 40px; - height: 40px; - border-radius: 10px; + width: 30px; + height: 30px; + border-radius: 10px; + vertical-align: middle; + margin-right: 10px; } .el-icon-caret-bottom { cursor: pointer; - position: absolute; - right: -20px; - top: 25px; + // position: absolute; + // right: -20px; + // top: 25px; + font-size: 12px; } } diff --git a/src/mixin/selectMixin.js b/src/mixin/selectMixin.js index 6913cd3..2df8bef 100644 --- a/src/mixin/selectMixin.js +++ b/src/mixin/selectMixin.js @@ -19,12 +19,12 @@ export default { }], false_or_true: [{ id: 0, - value: '否', - type:'info' + value: '否', + type: 'info' }, { id: 1, - value: '是', - type:'' + value: '是', + type: '' }], apply_status_list: [{ id: 0, @@ -78,14 +78,21 @@ export default { type: '' }], course_date: [{ + value: '课程待定', + type: 'info', + id: 30, + }, { value: '课程未开始', type: 'info', + id: 20, }, { value: '课程进行中', type: '', + id: 10, }, { value: '课程已结束', type: 'success', + id: 40, }], // 学员 @@ -114,19 +121,19 @@ export default { // is_vip_list: [{ id: 0, - value: '普通学员', - type:'' + value: '普通学员', + type: '' }, { id: 1, value: 'vip学员' - }], - is_schoolmate_list: [{ - id: 0, - value: '否', - type:'' - }, { - id: 1, - value: '是' + }], + is_schoolmate_list: [{ + id: 0, + value: '否', + type: '' + }, { + id: 1, + value: '是' }], company_type_list: [{ id: 0, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index c288974..9b1d0e5 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,7 +1,8 @@ import { login, logout, - getInfo + getInfo, + loginMsg } from '@/api/user' import { getToken, @@ -67,6 +68,31 @@ const actions = { reject(error) }) }) + }, + loginMsg({ + commit + }, userInfo) { + const { + mobile, + code + } = userInfo + return new Promise((resolve, reject) => { + loginMsg({ + mobile: mobile, + code: code + }).then(response => { + console.log(response) + const { + data + } = response; + console.log(response.access_token) + commit('SET_TOKEN', response.access_token) + setToken(response.access_token) + resolve() + }).catch(error => { + reject(error) + }) + }) }, // get user info diff --git a/src/utils/auth.js b/src/utils/auth.js index 7ce33e8..d11e676 100644 --- a/src/utils/auth.js +++ b/src/utils/auth.js @@ -5,7 +5,8 @@ export function getToken() { return Cookies.get(TOKEN_KEY) } -export function setToken(token) { +export function setToken(token,callback) { + console.log("set",TOKEN_KEY, token) return Cookies.set(TOKEN_KEY, token) } diff --git a/src/utils/common.js b/src/utils/common.js index e6c9fbe..24c83fb 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -1,4 +1,15 @@ +import { + Message +} from 'element-ui' let base = { + showMessage(msg,type){ + return Message({ + message: msg, + type: type, + duration: 2 * 1000, + offset: window.screen.height / 4 + }) + }, isPhone (val) { return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(val) }, diff --git a/src/utils/request.js b/src/utils/request.js index ab840ea..a3aafa8 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -71,7 +71,8 @@ service.interceptors.response.use( Message({ message: res.errmsg || 'Error', type: 'error', - duration: 5 * 1000 + duration: 5 * 1000, + offset: window.screen.height / 4 }) // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; @@ -98,10 +99,12 @@ service.interceptors.response.use( loading?.close() } console.log('err' + error) // for debug + console.log("window.screen.height / 2",window.screen.height / 4) Message({ message: error.message, type: 'error', - duration: 5 * 1000 + duration: 5 * 1000, + offset: window.screen.height / 4 }) return Promise.reject(error) } diff --git a/src/views/book/appointment.vue b/src/views/book/appointment.vue index ca0089a..04d42c2 100644 --- a/src/views/book/appointment.vue +++ b/src/views/book/appointment.vue @@ -34,9 +34,19 @@
+ +