From f280061e26ba47665346a090e7c79716bf485104 Mon Sep 17 00:00:00 2001 From: yxq Date: Thu, 5 Sep 2024 16:17:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=20=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E5=BD=92=E5=AF=9D=E5=AE=A2=E6=B5=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- monitorMobile/api/user.js | 8 +++ monitorMobile/api/work/passengerFlow.js | 11 ++++ monitorMobile/api/work/returnBed.js | 20 ++++++ monitorMobile/components/selectSearch.vue | 26 +++++--- monitorMobile/http/api.js | 21 +++--- monitorMobile/http/config.js | 3 - monitorMobile/pages/login.vue | 16 +++-- monitorMobile/pages/my/index.vue | 64 ++++++++++++++----- .../pages/work/passengerFlow/detail.vue | 38 ++++++++--- .../pages/work/passengerFlow/index.vue | 34 +++++----- monitorMobile/pages/work/returnBed/detail.vue | 61 +++++++++++------- monitorMobile/pages/work/returnBed/index.vue | 63 +++++++++++------- monitorMobile/pages/work/rollCall/detail.vue | 6 +- monitorMobile/pages/work/rollCall/index.vue | 3 +- monitorMobile/store/index.js | 21 +++--- 15 files changed, 261 insertions(+), 134 deletions(-) create mode 100644 monitorMobile/api/work/passengerFlow.js create mode 100644 monitorMobile/api/work/returnBed.js diff --git a/monitorMobile/api/user.js b/monitorMobile/api/user.js index 0199891..6aaf2e0 100644 --- a/monitorMobile/api/user.js +++ b/monitorMobile/api/user.js @@ -15,4 +15,12 @@ export const getLoginUser = (params) => { method: 'GET', params }) +} +// 修改用户信息 +export const updateUserInfo = (data) => { + return http.request({ + url: '/api/userCenter/updateUserInfo', + method: 'POST', + data + }) } \ No newline at end of file diff --git a/monitorMobile/api/work/passengerFlow.js b/monitorMobile/api/work/passengerFlow.js new file mode 100644 index 0000000..89f1101 --- /dev/null +++ b/monitorMobile/api/work/passengerFlow.js @@ -0,0 +1,11 @@ +import http from '@/http/api.js' +const url = '/api/business/passengerFlowApi/' + +// 获取列表 +export const page = (params) => { + return http.request({ + url: url + '/getPageList', + method: 'get', + params + }) +} \ No newline at end of file diff --git a/monitorMobile/api/work/returnBed.js b/monitorMobile/api/work/returnBed.js new file mode 100644 index 0000000..ce0cff3 --- /dev/null +++ b/monitorMobile/api/work/returnBed.js @@ -0,0 +1,20 @@ +import http from '@/http/api.js' +const url = '/api/business/dormitory' + +// 获取归寝寝室列表 +export const returnPageList = (params) => { + return http.request({ + url: url + '/getReturnPageList', + method: 'get', + params + }) +} + +// 获取归寝人员列表 +export const returnInfo = (params) => { + return http.request({ + url: url + '/getReturnInfo', + method: 'get', + params + }) +} \ No newline at end of file diff --git a/monitorMobile/components/selectSearch.vue b/monitorMobile/components/selectSearch.vue index 3049010..d03c81c 100644 --- a/monitorMobile/components/selectSearch.vue +++ b/monitorMobile/components/selectSearch.vue @@ -80,25 +80,34 @@ data() { return { show: false, - title_: this.title || this.placeholder, + // title_: this.title || this.placeholder, value_: this.value, searchText: '', cellValue: [], }; }, + computed: { + title_() { + if (!this.multiple) { + let obj = this.options.find(e1 => e1.value == this.value) + return obj ? obj.label : this.placeholder + } else { + let arr = this.options.filter(e1 => this.value_.includes(e1.value)) + this.cellValue = arr.map(e => e.label) + return this.placeholder + } + } + }, mounted() { this.value_ = JSON.parse(JSON.stringify(this.value)) if (!this.multiple) { let obj = this.options.find(e1 => e1.value == this.value_) if (obj) { - this.title_ = obj.label this.$emit("update:title", this.title_) - }else{ + } else { this.$emit("update:title", '') } } else { - let arr = this.options.filter(e1 => this.value_.includes(e1.value)) - this.cellValue = arr.map(e => e.label) this.$emit("update:title", this.cellValue) } }, @@ -117,14 +126,11 @@ if (!this.multiple) { let obj = this.options.find(e1 => e1.value == this.value_) if (obj) { - this.title_ = obj.label - this.$emit("update:title", this.title_ ) - }else{ + this.$emit("update:title", this.title_) + } else { this.$emit("update:title", '') } } else { - let arr = this.options.filter(e1 => this.value_.includes(e1.value)) - this.cellValue = arr.map(e => e.label) this.$emit("update:title", this.cellValue) } this.close() diff --git a/monitorMobile/http/api.js b/monitorMobile/http/api.js index b7cab86..450622a 100644 --- a/monitorMobile/http/api.js +++ b/monitorMobile/http/api.js @@ -9,7 +9,6 @@ http.interceptors.request.use((config) => { // 可使用async await 做异步操 let token = uni.getStorageSync('token'); if (token) { config.header['Authorization'] = 'Bearer ' + token; - const jwt = decryptJWT(token); const exp = getJWTDate(jwt.exp); // token 已经过期 @@ -43,6 +42,15 @@ http.interceptors.response.use((response) => { icon: 'none' }); }) + + if (response.data.code == 401) { + const pages = getCurrentPages() + const currentPage = pages[pages.length - 1] + store.dispatch('clearToken') + uni.redirectTo({ + url: `/pages/login?redirect=/${currentPage.route}` + }) + } return Promise.reject(response); } return response.data; @@ -54,15 +62,7 @@ http.interceptors.response.use((response) => { icon: 'none' }); }) - - if (response.statusCode == 401) { - const pages = getCurrentPages() - const currentPage = pages[pages.length - 1] - this.$store.dispatch('clearToken') - uni.redirectTo({ - url: `/pages/login?redirect=/${currentPage.route}` - }) - } + return Promise.reject(response) }) /** @@ -71,6 +71,7 @@ http.interceptors.response.use((response) => { * @returns object */ function decryptJWT(token) { + console.log(token) token = token.replace(/_/g, "/").replace(/-/g, "+"); const json = decodeURIComponent(escape(window.atob(token.split(".")[1]))); return JSON.parse(json); diff --git a/monitorMobile/http/config.js b/monitorMobile/http/config.js index 33be5e9..e481d51 100644 --- a/monitorMobile/http/config.js +++ b/monitorMobile/http/config.js @@ -41,9 +41,6 @@ var options = { // return statusCode >= 200 && statusCode < 300 // } // 预览地址 - // previewUrl: 'https://www.bjjyp.org.cn/preview/onlinePreview', - // previewUrl: 'http://114.255.136.189:6696/onlinePreview', - // previewUrl: 'http://192.168.100.236:85/onlinePreview', previewUrl: '', }; export { options }; diff --git a/monitorMobile/pages/login.vue b/monitorMobile/pages/login.vue index 6b7c961..e2d66fd 100644 --- a/monitorMobile/pages/login.vue +++ b/monitorMobile/pages/login.vue @@ -74,9 +74,11 @@ } }, onLoad(e) { - if (e.redirect) this.redirect = redirect - this.form.account = 'superAdmin' - this.form.password = '123456' + if (e.redirect) this.redirect = e.redirect + if (process.env.NODE_ENV === 'development') { + this.form.account = 'superAdmin' + this.form.password = '123456' + } }, methods: { async login() { @@ -87,7 +89,9 @@ }).then(res => { if (res.code != 200) return let data = res.data - this.$store.dispatch('setToken',{token:data.token}) + this.$store.dispatch('setToken', { + token: data.token + }) this.$store.dispatch('getUserInfo') this.$store.dispatch('getAllOptions') this.NAV_TO('/') @@ -96,8 +100,8 @@ }) }) }, - getLoginUser(){ - return getLoginUser().then(res=>{ + getLoginUser() { + return getLoginUser().then(res => { if (res.code != 200) return this.$u.vuex('userInfo', res.data) }) diff --git a/monitorMobile/pages/my/index.vue b/monitorMobile/pages/my/index.vue index 67c34ff..9212007 100644 --- a/monitorMobile/pages/my/index.vue +++ b/monitorMobile/pages/my/index.vue @@ -2,14 +2,14 @@ - + - 张云 + {{userInfo.name}} - 山西科技大学 | 校长 + {{userInfo.orgNames}} | {{userInfo.positionName}} @@ -20,31 +20,31 @@ - 543asd25a1 + {{userInfo.account}} - 杨云 + {{userInfo.name}} - 18633460001 + {{userInfo.phone}} - 未设置 + {{userInfo.nickname||'未设置'}} - + - {{date}} + {{userInfo.birthday}} @@ -73,16 +73,18 @@