diff --git a/src/utils/httpRequest.js b/src/utils/httpRequest.js index 4112705..ff71e4f 100644 --- a/src/utils/httpRequest.js +++ b/src/utils/httpRequest.js @@ -4,7 +4,7 @@ import router from '@/router' import qs from 'qs' import merge from 'lodash/merge' import { clearLoginInfo } from '@/utils' -const baseUrl = '/wx' +// const baseUrl = '/wx' const http = axios.create({ timeout: 1000 * 30, @@ -43,7 +43,8 @@ http.interceptors.response.use(response => { */ http.adornUrl = (actionName) => { // 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截! - return baseUrl + actionName + // return baseUrl + actionName + return actionName } /** diff --git a/src/views/modules/h5/admin-add-or-update.vue b/src/views/modules/h5/admin-add-or-update.vue new file mode 100644 index 0000000..c24cd95 --- /dev/null +++ b/src/views/modules/h5/admin-add-or-update.vue @@ -0,0 +1,185 @@ + + + diff --git a/src/views/modules/h5/admin.vue b/src/views/modules/h5/admin.vue index 4470652..e080b19 100644 --- a/src/views/modules/h5/admin.vue +++ b/src/views/modules/h5/admin.vue @@ -1,19 +1,213 @@ - - - \ No newline at end of file +export default { + data() { + return { + dataForm: { + userName: '' + }, + temp:0, + dataList: [], + pageIndex: 1, + pageSize: 5, + totalCount: 0, + dataListLoading: false, + dataListSelections: [], + addOrUpdateVisible: false, + groupIdes: [], + } + }, + components: { + AddOrUpdate + }, + activated() { + this.getDataList() + this.groupIdes=[] + // 获取分组 + myRequest.getGroupList(this) + }, + computed: {}, + methods: { + // 分组过滤 + filterTag(value, row) { + return row.groupId === value; + }, + getgroups(id) { + try { + let groupIdes = this.groupIdes + return groupIdes[id - 1].text + }catch (e) { + // console.log(e) + return "未分组" + } + + }, + isIdentity(identity) { + switch (identity) { + case 1: + return '管理员' + case 2: + return '研究生' + case 3: + return '本校老师' + case 4: + return '外校老师' + } + }, + // 获取数据列表 + getDataList() { + this.dataListLoading = true + this.$http({ + url: this.$http.adornUrl('/admin/list'), + method: 'get', + params: this.$http.adornParams({ + 'page': this.pageIndex, + 'limit': this.pageSize, + 'userId': this.dataForm.userName + }) + }).then(({data}) => { + if (data && data.code === 200) { + this.dataList = data.page.list + this.totalCount = data.page.totalCount + } else { + this.dataList = [] + this.totalCount = 0 + } + this.dataListLoading = false + }) + }, + // 每页数 + sizeChangeHandle(val) { + this.pageSize = val + this.pageIndex = 1 + this.getDataList() + }, + // 当前页 + currentChangeHandle(val) { + this.pageIndex = val + this.getDataList() + }, + // 多选 + selectionChangeHandle(val) { + this.dataListSelections = val + }, + // 新增 / 修改 + addOrUpdateHandle(id) { + this.addOrUpdateVisible = true + this.$nextTick(() => { + this.$refs.addOrUpdate.init(id) + }) + }, + // 删除 + deleteHandle(userid) { + var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id) + this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$http({ + url: this.$http.adornUrl('/admin/delete'), + method: 'post', + data: this.$http.adornData(userIds, false) + }).then(({data}) => { + if (data && data.code === 200) { + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => this.getDataList() + }) + } else { + this.$message.error(data.msg) + } + }) + }).catch(() => { + }) + } + } +} + diff --git a/src/views/modules/h5/hostel-add-or-update.vue b/src/views/modules/h5/hostel-add-or-update.vue new file mode 100644 index 0000000..4915d85 --- /dev/null +++ b/src/views/modules/h5/hostel-add-or-update.vue @@ -0,0 +1,168 @@ + + + diff --git a/src/views/modules/h5/hostel.vue b/src/views/modules/h5/hostel.vue index 2173cdc..c011b52 100644 --- a/src/views/modules/h5/hostel.vue +++ b/src/views/modules/h5/hostel.vue @@ -1,15 +1,271 @@ - - - \ No newline at end of file +export default { + data() { + + return { + dataForm: { + userName: '' + }, + temp: 0, + dataList: [], + pageIndex: 1, + pageSize: 5, + totalCount: 0, + dataListLoading: false, + dataListSelections: [], + addOrUpdateVisible: false, + groupIdes: [], + fileList: [], + loading: null + } + }, + components: { + AddOrUpdate + }, + activated() { + this.getDataList() + // 获取分组 + // myRequest.getGroupList(this) + }, + computed: {}, + methods: { + // 分组过滤 + filterTag(value, row) { + return row.groupId === value; + }, + getgroups(id) { + try { + let groupIdes = this.groupIdes + return groupIdes[id - 1].text + } catch (e) { + // console.log(e) + return "未分组" + } + + }, + isIdentity(identity) { + switch (identity) { + case 1: + return '管理员' + case 2: + return '研究生' + case 3: + return '本校老师' + case 4: + return '外校老师' + } + }, + // 获取数据列表 + getDataList() { + this.dataListLoading = true + this.$http({ + url: this.$http.adornUrl('/excel/list'), + method: 'get', + params: this.$http.adornParams({ + 'page': this.pageIndex, + 'limit': this.pageSize, + 'userId': this.dataForm.userName + }) + }).then(({data}) => { + if (data && data.code === 200) { + this.dataList = data.page.list + this.totalCount = data.page.totalCount + } else { + this.dataList = [] + this.totalCount = 0 + } + this.dataListLoading = false + }) + }, + // 每页数 + sizeChangeHandle(val) { + this.pageSize = val + this.pageIndex = 1 + this.getDataList() + }, + // 当前页 + currentChangeHandle(val) { + this.pageIndex = val + this.getDataList() + }, + // 多选 + selectionChangeHandle(val) { + this.dataListSelections = val + }, + // 新增 / 修改 + addOrUpdateHandle(id) { + this.addOrUpdateVisible = true + this.$nextTick(() => { + this.$refs.addOrUpdate.init(id) + }) + }, + // 删除 + deleteHandle(userid) { + var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id) + this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$http({ + url: this.$http.adornUrl('/excel/delete'), + method: 'post', + data: this.$http.adornData(userIds, false) + }).then(({data}) => { + if (data && data.code === 200) { + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => this.getDataList() + }) + } else { + this.$message.error(data.msg) + } + }) + }).catch(() => { + }) + }, + //文件上传相关的 + submitUpload() { + if (this.$refs.upload.uploadFiles.length==0){ + this.$message({ + message: '请选择Excel文件', + type: 'error', + duration: 1500, + onClose: () => this.getDataList() + }) + return; + } + this.$refs.upload.submit(); + this.loading= this.$loading({ + lock: true, + text: '文件上传中请耐心等待。。。', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }); + }, + handleRemove(file, fileList) { + console.log(file, fileList); + }, + handlePreview(file) { + console.log(file); + }, + uploadSuccess(){ + this.loading.close(); + this.$refs.upload.clearFiles() + this.$message({ + message: '上传成功', + type: 'success', + duration: 1500, + onClose: () => this.getDataList() + }) + + }, + uploadError(){ + this.$refs.upload.clearFiles() + this.$message({ + message: '上传失败', + type: 'error', + duration: 1500, + onClose: () => this.getDataList() + }) + }, + beforeUpload(file){ + // console.log(file) + + } + } +} + diff --git a/src/views/modules/h5/localTeacher-add-or-update.vue b/src/views/modules/h5/localTeacher-add-or-update.vue new file mode 100644 index 0000000..bc75a79 --- /dev/null +++ b/src/views/modules/h5/localTeacher-add-or-update.vue @@ -0,0 +1,166 @@ + + + diff --git a/src/views/modules/h5/localTeacher.vue b/src/views/modules/h5/localTeacher.vue index 93addf1..41d2628 100644 --- a/src/views/modules/h5/localTeacher.vue +++ b/src/views/modules/h5/localTeacher.vue @@ -1,15 +1,198 @@ - - - \ No newline at end of file + }, + // 获取数据列表 + getDataList() { + this.dataListLoading = true + this.$http({ + url: this.$http.adornUrl('/teach/list'), + method: 'get', + params: this.$http.adornParams({ + 'page': this.pageIndex, + 'limit': this.pageSize, + 'userId': this.dataForm.userName + }) + }).then(({data}) => { + if (data && data.code === 200) { + this.dataList = data.page.list + this.totalCount = data.page.totalCount + } else { + this.dataList = [] + this.totalCount = 0 + } + this.dataListLoading = false + }) + }, + // 每页数 + sizeChangeHandle(val) { + this.pageSize = val + this.pageIndex = 1 + this.getDataList() + }, + // 当前页 + currentChangeHandle(val) { + this.pageIndex = val + this.getDataList() + }, + // 多选 + selectionChangeHandle(val) { + this.dataListSelections = val + }, + // 新增 / 修改 + addOrUpdateHandle(id) { + this.addOrUpdateVisible = true + this.$nextTick(() => { + this.$refs.addOrUpdate.init(id) + }) + }, + // 删除 + deleteHandle(userid) { + var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id) + this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$http({ + url: this.$http.adornUrl('/teach/delete'), + method: 'post', + data: this.$http.adornData(userIds, false) + }).then(({data}) => { + if (data && data.code === 200) { + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => this.getDataList() + }) + } else { + this.$message.error(data.msg) + } + }) + }).catch(() => { + }) + } + } +} + diff --git a/src/views/modules/h5/myRequest.js b/src/views/modules/h5/myRequest.js new file mode 100644 index 0000000..4076d81 --- /dev/null +++ b/src/views/modules/h5/myRequest.js @@ -0,0 +1,27 @@ +export default { + getGroupList(_this,) { + _this.$http({ + url: _this.$http.adornUrl('/group/list'), + method: 'get', + params: _this.$http.adornParams() + }).then(res => { + res.data.list.forEach(item => { + _this.groupIdes.push({ + text: item.name, + id: item.id, + value: item.id + }) + }) + }) + }, + getGroupList2(_this) { + return( + _this.$http({ + url: _this.$http.adornUrl('/group/list'), + method: 'get', + params: _this.$http.adornParams() + })) + } +} + + diff --git a/src/views/modules/h5/student-add-or-update.vue b/src/views/modules/h5/student-add-or-update.vue new file mode 100644 index 0000000..30cbdb5 --- /dev/null +++ b/src/views/modules/h5/student-add-or-update.vue @@ -0,0 +1,166 @@ + + + diff --git a/src/views/modules/h5/student.vue b/src/views/modules/h5/student.vue index a2c1413..6f63ffa 100644 --- a/src/views/modules/h5/student.vue +++ b/src/views/modules/h5/student.vue @@ -1,13 +1,199 @@ - - - \ No newline at end of file +export default { + data() { + return { + dataForm: { + userName: '' + }, + temp:0, + dataList: [], + pageIndex: 1, + pageSize: 5, + totalCount: 0, + dataListLoading: false, + dataListSelections: [], + addOrUpdateVisible: false, + groupIdes: [], + } + }, + components: { + AddOrUpdate + }, + activated() { + this.getDataList() + this.groupIdes=[] + // 获取分组 + myRequest.getGroupList(this) + }, + computed: {}, + methods: { + // isAuth, + // 分组过滤 + filterTag(value, row) { + return row.groupId === value; + }, + getgroups(id) { + try { + let groupIdes = this.groupIdes + return groupIdes[id - 1].text + }catch (e) { + // console.log(e) + return "未分组" + } + + }, + // 获取数据列表 + getDataList() { + this.dataListLoading = true + this.$http({ + url: this.$http.adornUrl('/stu/list'), + method: 'get', + params: this.$http.adornParams({ + 'page': this.pageIndex, + 'limit': this.pageSize, + 'userId': this.dataForm.userName + }) + }).then(({data}) => { + if (data && data.code === 200) { + this.dataList = data.page.list + this.totalCount = data.page.totalCount + } else { + this.dataList = [] + this.totalCount = 0 + } + this.dataListLoading = false + }) + }, + // 每页数 + sizeChangeHandle(val) { + this.pageSize = val + this.pageIndex = 1 + this.getDataList() + }, + // 当前页 + currentChangeHandle(val) { + this.pageIndex = val + this.getDataList() + }, + // 多选 + selectionChangeHandle(val) { + this.dataListSelections = val + }, + // 新增 / 修改 + addOrUpdateHandle(id) { + this.addOrUpdateVisible = true + this.$nextTick(() => { + this.$refs.addOrUpdate.init(id) + }) + }, + // 删除 + deleteHandle(userid) { + var userIds = userid ? [userid] : this.dataListSelections.map(item => item.id) + this.$confirm(`确定对[userid=${userIds.join(',')}]进行[${userid ? '删除' : '批量删除'}]操作?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$http({ + url: this.$http.adornUrl('/stu/delete'), + method: 'post', + data: this.$http.adornData(userIds, false) + }).then(({data}) => { + if (data && data.code === 200) { + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => this.getDataList() + }) + } else { + this.$message.error(data.msg) + } + }) + }).catch(() => { + }) + } + } +} + diff --git a/src/views/modules/h5/user-add-or-update.vue b/src/views/modules/h5/user-add-or-update.vue index 304fc16..d179b15 100644 --- a/src/views/modules/h5/user-add-or-update.vue +++ b/src/views/modules/h5/user-add-or-update.vue @@ -2,26 +2,26 @@ - + - + - + - + {{item.name}} - 禁用 - 正常 + 禁用 + 正常 @@ -34,6 +34,7 @@ diff --git a/src/views/modules/h5/waiTeacher.vue b/src/views/modules/h5/waiTeacher.vue index 31749d4..0e62dbd 100644 --- a/src/views/modules/h5/waiTeacher.vue +++ b/src/views/modules/h5/waiTeacher.vue @@ -1,15 +1,292 @@ + + - - - \ No newline at end of file