diff --git a/src/api/info/banners.js b/src/api/info/banners.js new file mode 100644 index 0000000..fb398ac --- /dev/null +++ b/src/api/info/banners.js @@ -0,0 +1,55 @@ +import request from "@/utils/request"; +function customParamsSerializer(params) { + let result = ''; + for (let key in params) { + if (params.hasOwnProperty(key)) { + if (Array.isArray(params[key])) { + params[key].forEach((item,index) => { + if(item.key){ + result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`; + + }else{ + result +=`${key}[${index}]=${item}&` + } + }); + } else { + result += `${key}=${params[key]}&`; + } + } + } + return result.slice(0, -1); +} +export function index(params,isLoading = false) { + return request({ + method: "get", + url: "/api/admin/banners/index", + params, + paramsSerializer: customParamsSerializer, + isLoading + }) +} + +export function show(params, isLoading = true) { + return request({ + method: "get", + url: "/api/admin/banners/show", + params, + isLoading + }) +} + +export function save(data) { + return request({ + method: "post", + url: "/api/admin/banners/save", + data + }) +} + +export function destroy(params) { + return request({ + method: "get", + url: "/api/admin/banners/destroy", + params + }) +} diff --git a/src/api/info/configs.js b/src/api/info/configs.js new file mode 100644 index 0000000..ce5bc12 --- /dev/null +++ b/src/api/info/configs.js @@ -0,0 +1,55 @@ +import request from "@/utils/request"; +function customParamsSerializer(params) { + let result = ''; + for (let key in params) { + if (params.hasOwnProperty(key)) { + if (Array.isArray(params[key])) { + params[key].forEach((item,index) => { + if(item.key){ + result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`; + + }else{ + result +=`${key}[${index}]=${item}&` + } + }); + } else { + result += `${key}=${params[key]}&`; + } + } + } + return result.slice(0, -1); +} +export function index(params,isLoading = false) { + return request({ + method: "get", + url: "/api/admin/configs/index", + params, + paramsSerializer: customParamsSerializer, + isLoading + }) +} + +export function show(params, isLoading = true) { + return request({ + method: "get", + url: "/api/admin/configs/show", + params, + isLoading + }) +} + +export function save(data) { + return request({ + method: "post", + url: "/api/admin/configs/save", + data + }) +} + +export function destroy(params) { + return request({ + method: "get", + url: "/api/admin/configs/destroy", + params + }) +} diff --git a/src/api/info/teachers.js b/src/api/info/teachers.js new file mode 100644 index 0000000..b54a6ea --- /dev/null +++ b/src/api/info/teachers.js @@ -0,0 +1,55 @@ +import request from "@/utils/request"; +function customParamsSerializer(params) { + let result = ''; + for (let key in params) { + if (params.hasOwnProperty(key)) { + if (Array.isArray(params[key])) { + params[key].forEach((item,index) => { + if(item.key){ + result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`; + + }else{ + result +=`${key}[${index}]=${item}&` + } + }); + } else { + result += `${key}=${params[key]}&`; + } + } + } + return result.slice(0, -1); +} +export function index(params,isLoading = false) { + return request({ + method: "get", + url: "/api/admin/teachers/index", + params, + paramsSerializer: customParamsSerializer, + isLoading + }) +} + +export function show(params, isLoading = true) { + return request({ + method: "get", + url: "/api/admin/teachers/show", + params, + isLoading + }) +} + +export function save(data) { + return request({ + method: "post", + url: "/api/admin/teachers/save", + data + }) +} + +export function destroy(params) { + return request({ + method: "get", + url: "/api/admin/teachers/destroy", + params + }) +} diff --git a/src/styles/iconfont.css b/src/styles/iconfont.css index 9f6fdb2..5d51b9e 100644 --- a/src/styles/iconfont.css +++ b/src/styles/iconfont.css @@ -1,8 +1,8 @@ @font-face { - font-family: "iconfont"; /* Project id 4052909 */ - src: url('iconfont.woff2?t=1683361610626') format('woff2'), - url('iconfont.woff?t=1683361610626') format('woff'), - url('iconfont.ttf?t=1683361610626') format('truetype'); + font-family: "iconfont"; /* Project id 4625369 */ + src: url('iconfont.woff2?t=1721285561761') format('woff2'), + url('iconfont.woff?t=1721285561761') format('woff'), + url('iconfont.ttf?t=1721285561761') format('truetype'); } .iconfont { @@ -13,107 +13,79 @@ -moz-osx-font-smoothing: grayscale; } -.icon-jurassic_process-list:before { - content: "\e6c4"; +.icon-xinxi:before { + content: "\e600"; } -.icon-biaodan:before { - content: "\e663"; +.icon-xueyuan-xueyuansousuo:before { + content: "\e610"; } -.icon-biaozhunhuaguizeguanli:before { - content: "\e60a"; +.icon-yuyuedingdan:before { + content: "\e8a2"; } -.icon-a-zhidu6:before { - content: "\eb07"; +.icon-lishihangcheng:before { + content: "\e8d5"; } -.icon-dat:before { - content: "\e691"; +.icon-fl-baobiao:before { + content: "\e636"; } -.icon-audio:before { - content: "\e692"; +.icon-lunbotu:before { + content: "\e62b"; } -.icon-video:before { - content: "\e693"; +.icon-kecheng:before { + content: "\e605"; } -.icon-zip:before { - content: "\e694"; +.icon-kecheng1:before { + content: "\e66f"; } -.icon-image:before { - content: "\e695"; +.icon-xiaoyuanxinwentongzhigonggao:before { + content: "\e653"; } -.icon-pdf:before { - content: "\e696"; +.icon-ico_yuyueguanli_jiedaiyuyue:before { + content: "\e8ba"; } -.icon-ppt:before { - content: "\e697"; +.icon-xianxiabaoming:before { + content: "\e61f"; } -.icon-21excel:before { - content: "\e698"; +.icon-tongxunlu:before { + content: "\e670"; } -.icon-21word:before { - content: "\e699"; +.icon-tongzhi:before { + content: "\e68f"; } -.icon-21move:before { - content: "\e69a"; +.icon-jiekou:before { + content: "\e669"; } -.icon-21setting:before { - content: "\e69b"; +.icon-xueyuanguanli:before { + content: "\e6ac"; } -.icon-21upload:before { - content: "\e69c"; +.icon-paikeguanli:before { + content: "\e7b4"; } -.icon-21download:before { - content: "\e69d"; +.icon-lunbotu1:before { + content: "\e6d1"; } -.icon-21cancel:before { - content: "\e69e"; +.icon-xueyuanguanli1:before { + content: "\e61a"; } -.icon-21ok:before { - content: "\e69f"; -} - -.icon-21copy:before { - content: "\e6a0"; -} - -.icon-21delete:before { - content: "\e6a1"; -} - -.icon-21edit:before { - content: "\e6a2"; -} - -.icon-21new:before { - content: "\e6a3"; -} - -.icon-21folder:before { - content: "\e6a4"; -} - -.icon-21mutil:before { - content: "\e6a5"; -} - -.icon-21file:before { - content: "\e6a6"; +.icon-tongzhigonggao:before { + content: "\e7ab"; } diff --git a/src/styles/iconfont.ttf b/src/styles/iconfont.ttf index 4e2970e..e247078 100644 Binary files a/src/styles/iconfont.ttf and b/src/styles/iconfont.ttf differ diff --git a/src/styles/iconfont.woff b/src/styles/iconfont.woff index b7c5531..a8a5f9c 100644 Binary files a/src/styles/iconfont.woff and b/src/styles/iconfont.woff differ diff --git a/src/styles/iconfont.woff2 b/src/styles/iconfont.woff2 index 0c051c5..699d6a3 100644 Binary files a/src/styles/iconfont.woff2 and b/src/styles/iconfont.woff2 differ diff --git a/src/utils/common.js b/src/utils/common.js index 6a7e618..51233da 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -251,6 +251,76 @@ let base = { nodes.unshift(_node) } return nodes + }, + + isNull(p) { + return p == '' || p == undefined || p == null || p == 'undefined' || p == 'null'; + }, + deepCopy(data) { + //string,number,bool,null,undefined,symbol + //object,array,date + if (data && typeof data === "object") { + //针对函数的拷贝 + if (typeof data === "function") { + let tempFunc = data.bind(null); + tempFunc.prototype = this.deepCopy(data.prototype); + return tempFunc; + } + + switch (Object.prototype.toString.call(data)) { + case "[object String]": + return data.toString(); + case "[object Number]": + return Number(data.toString()); + case "[object Boolean]": + return Boolean(data.toString()); + case "[object Date]": + return new Date(data.getTime()); + case "[object Array]": + let arr = []; + for (let i = 0; i < data.length; i++) { + arr[i] = this.deepCopy(data[i]); + } + return arr; + + //js自带对象或用户自定义类实例 + case "[object Object]": + let obj = {}; + for (let key in data) { + //会遍历原型链上的属性方法,可以用hasOwnProperty来控制 (obj.hasOwnProperty(prop) + obj[key] = this.deepCopy(data[key]); + } + return obj; + } + } else { + //string,number,bool,null,undefined,symbol + return data; + } + }, + // 按顺序把接口返回值 赋给 form + requestToForm(requestObj,form){ + // 获取a对象中属性的顺序和值 + let aKeys = Object.keys(form); + let aValues = aKeys.map(key => form[key]); + + // 遍历b对象,将属性等于a中属性值的对象深拷贝给a中的相应属性 + for (let i = 0; i < aKeys.length; i++) { + let key = aKeys[i]; + let value = aValues[i]; + if (requestObj[key] === value) { + // 深拷贝对象 + Object.assign(form, { [key]: this.deepCopy(requestObj[key]) }); + } + } + + // 遍历b对象,将b中独有的属性按照a的顺序插入到a中 + for (let key in requestObj) { + if (!form[key]) { + // 深拷贝属性值 + Object.assign(form, { [key]: this.deepCopy(requestObj[key]) }); + } + } + return form } } diff --git a/src/utils/index.js b/src/utils/index.js index 32825fb..6ea3063 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,173 +1,178 @@ -/** - * Created by PanJiaChen on 16/11/18. - */ +/** + * Created by PanJiaChen on 16/11/18. + */ + +/** + * Parse the time to string + * @param {(Object|string|number)} time + * @param {string} cFormat + * @returns {string | null} + */ +export function parseTime(time, cFormat) { + if (arguments.length === 0 || !time) { + return null + } + const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string')) { + if ((/^[0-9]+$/.test(time))) { + // support "1548221490638" + time = parseInt(time) + } else { + // support safari + // https://stackoverflow.com/questions/4310953/invalid-date-in-safari + time = time.replace(new RegExp(/-/gm), '/') + } + } + + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { + const value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { + return ['日', '一', '二', '三', '四', '五', '六'][value] + } + return value.toString().padStart(2, '0') + }) + return time_str +} + +/** + * @param {number} time + * @param {string} option + * @returns {string} + */ +export function formatTime(time, option) { + if (('' + time).length === 10) { + time = parseInt(time) * 1000 + } else { + time = +time + } + const d = new Date(time) + const now = Date.now() + + const diff = (now - d) / 1000 + + if (diff < 30) { + return '刚刚' + } else if (diff < 3600) { + // less 1 hour + return Math.ceil(diff / 60) + '分钟前' + } else if (diff < 3600 * 24) { + return Math.ceil(diff / 3600) + '小时前' + } else if (diff < 3600 * 24 * 2) { + return '1天前' + } + if (option) { + return parseTime(time, option) + } else { + return ( + d.getMonth() + + 1 + + '月' + + d.getDate() + + '日' + + d.getHours() + + '时' + + d.getMinutes() + + '分' + ) + } +} + +/** + * @param {string} url + * @returns {Object} + */ +export function param2Obj(url) { + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') + if (!search) { + return {} + } + const obj = {} + const searchArr = search.split('&') + searchArr.forEach(v => { + const index = v.indexOf('=') + if (index !== -1) { + const name = v.substring(0, index) + const val = v.substring(index + 1, v.length) + obj[name] = val + } + }) + return obj +} + +//深拷贝数据 +export function deepCopy(data) { + //string,number,bool,null,undefined,symbol + //object,array,date + if (data && typeof data === "object") { + //针对函数的拷贝 + if (typeof data === "function") { + let tempFunc = data.bind(null); + tempFunc.prototype = deepCopy(data.prototype); + return tempFunc; + } + + switch (Object.prototype.toString.call(data)) { + case "[object String]": + return data.toString(); + case "[object Number]": + return Number(data.toString()); + case "[object Boolean]": + return Boolean(data.toString()); + case "[object Date]": + return new Date(data.getTime()); + case "[object Array]": + let arr = []; + for (let i = 0; i < data.length; i++) { + arr[i] = deepCopy(data[i]); + } + return arr; + + //js自带对象或用户自定义类实例 + case "[object Object]": + let obj = {}; + for (let key in data) { + //会遍历原型链上的属性方法,可以用hasOwnProperty来控制 (obj.hasOwnProperty(prop) + obj[key] = deepCopy(data[key]); + } + return obj; + } + } else { + //string,number,bool,null,undefined,symbol + return data; + } +} + +export function debounce(func, delay) { + let timer = null; + return function() { + const context = this; + const args = arguments; + clearTimeout(timer); + timer = setTimeout(function() { + func.apply(context, args); + }, delay); + } +} -/** - * Parse the time to string - * @param {(Object|string|number)} time - * @param {string} cFormat - * @returns {string | null} - */ -export function parseTime(time, cFormat) { - if (arguments.length === 0 || !time) { - return null - } - const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}' - let date - if (typeof time === 'object') { - date = time - } else { - if ((typeof time === 'string')) { - if ((/^[0-9]+$/.test(time))) { - // support "1548221490638" - time = parseInt(time) - } else { - // support safari - // https://stackoverflow.com/questions/4310953/invalid-date-in-safari - time = time.replace(new RegExp(/-/gm), '/') - } - } - - if ((typeof time === 'number') && (time.toString().length === 10)) { - time = time * 1000 - } - date = new Date(time) - } - const formatObj = { - y: date.getFullYear(), - m: date.getMonth() + 1, - d: date.getDate(), - h: date.getHours(), - i: date.getMinutes(), - s: date.getSeconds(), - a: date.getDay() - } - const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => { - const value = formatObj[key] - // Note: getDay() returns 0 on Sunday - if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] } - return value.toString().padStart(2, '0') - }) - return time_str -} - -/** - * @param {number} time - * @param {string} option - * @returns {string} - */ -export function formatTime(time, option) { - if (('' + time).length === 10) { - time = parseInt(time) * 1000 - } else { - time = +time - } - const d = new Date(time) - const now = Date.now() - - const diff = (now - d) / 1000 - - if (diff < 30) { - return '刚刚' - } else if (diff < 3600) { - // less 1 hour - return Math.ceil(diff / 60) + '分钟前' - } else if (diff < 3600 * 24) { - return Math.ceil(diff / 3600) + '小时前' - } else if (diff < 3600 * 24 * 2) { - return '1天前' - } - if (option) { - return parseTime(time, option) - } else { - return ( - d.getMonth() + - 1 + - '月' + - d.getDate() + - '日' + - d.getHours() + - '时' + - d.getMinutes() + - '分' - ) - } -} - -/** - * @param {string} url - * @returns {Object} - */ -export function param2Obj(url) { - const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') - if (!search) { - return {} - } - const obj = {} - const searchArr = search.split('&') - searchArr.forEach(v => { - const index = v.indexOf('=') - if (index !== -1) { - const name = v.substring(0, index) - const val = v.substring(index + 1, v.length) - obj[name] = val - } - }) - return obj +export function isNull(p) { + return p == '' || p == undefined || p == null || p == 'undefined' || p == 'null'; } - -//深拷贝数据 -export function deepCopy(data) { - //string,number,bool,null,undefined,symbol - //object,array,date - if (data && typeof data === "object") { - //针对函数的拷贝 - if (typeof data === "function") { - let tempFunc = data.bind(null); - tempFunc.prototype = deepCopy(data.prototype); - return tempFunc; - } - - switch (Object.prototype.toString.call(data)) { - case "[object String]": - return data.toString(); - case "[object Number]": - return Number(data.toString()); - case "[object Boolean]": - return Boolean(data.toString()); - case "[object Date]": - return new Date(data.getTime()); - case "[object Array]": - let arr = []; - for (let i = 0; i < data.length; i++) { - arr[i] = deepCopy(data[i]); - } - return arr; - - //js自带对象或用户自定义类实例 - case "[object Object]": - let obj = {}; - for (let key in data) { - //会遍历原型链上的属性方法,可以用hasOwnProperty来控制 (obj.hasOwnProperty(prop) - obj[key] = deepCopy(data[key]); - } - return obj; - } - } else { - //string,number,bool,null,undefined,symbol - return data; - } -} - -export function debounce(func, delay) { - let timer = null; - return function() { - const context = this; - const args = arguments; - clearTimeout(timer); - timer = setTimeout(function() { - func.apply(context, args); - }, delay); - } -} - diff --git a/src/views/book/components/checkBook.vue b/src/views/book/components/checkBook.vue new file mode 100644 index 0000000..edcc790 --- /dev/null +++ b/src/views/book/components/checkBook.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/src/views/book/index.vue b/src/views/book/index.vue new file mode 100644 index 0000000..bd2ea1b --- /dev/null +++ b/src/views/book/index.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/src/views/component/imports.vue b/src/views/component/imports.vue index fd62748..6ff157e 100644 --- a/src/views/component/imports.vue +++ b/src/views/component/imports.vue @@ -44,6 +44,8 @@ import * as XLSX from "xlsx"; import { saveAs } from "file-saver"; import { getToken } from "@/utils/auth"; import { imports } from "@/api/system/baseForm"; +import { realTableShow } from "@/api/system/customForm"; +import request from '@/utils/request' export default { props: { formInfo: { @@ -55,6 +57,7 @@ export default { data() { return { action: `${process.env.VUE_APP_BASE_API}/api/admin/base-form/excel-show`, + import_action:'', dialogVisible: false, headers: [], @@ -70,7 +73,19 @@ export default { hidden() { this.dialogVisible = false; }, - + // 获取表头 + async getHeaders(){ + const res = await realTableShow({ + table_name:this.tableName + }) + let b = []; + for (let key in res) { + if (!this.base.isNull(res[key])) { + b.push({ key: key, title: res[key] }); + } + } + this.table = this.headers = b + }, //上传 uploadFail(err) { console.log(err); @@ -104,9 +119,13 @@ export default { }, imports() { - imports({ - table_name: this.tableName, - data: this.tableList + request({ + method: "post", + url: this.import_action, + data:{ + table_name: this.tableName, + data: this.tableList + } }).then(res => { console.log(res) this.$message({ @@ -130,6 +149,15 @@ export default { }); } }, + dialogVisible(newval){ + console.log("newval",newval,this.tableName) + if(newval){ + this.action = `${process.env.VUE_APP_BASE_API}/api/admin/${this.tableName}/excel-show` + this.import_action = `/api/admin/${this.tableName}/import` + this.getHeaders() + console.log("action",this.action,this.import_action) + } + } }, }; diff --git a/src/views/config/banner.vue b/src/views/config/banner.vue new file mode 100644 index 0000000..ed2ba04 --- /dev/null +++ b/src/views/config/banner.vue @@ -0,0 +1,209 @@ + + + + + diff --git a/src/views/config/components/addBanner.vue b/src/views/config/components/addBanner.vue new file mode 100644 index 0000000..f301c73 --- /dev/null +++ b/src/views/config/components/addBanner.vue @@ -0,0 +1,204 @@ + + + + + diff --git a/src/views/config/components/addInfo.vue b/src/views/config/components/addInfo.vue new file mode 100644 index 0000000..fcbad30 --- /dev/null +++ b/src/views/config/components/addInfo.vue @@ -0,0 +1,121 @@ + + + + + diff --git a/src/views/config/components/addTeacher.vue b/src/views/config/components/addTeacher.vue new file mode 100644 index 0000000..705c13d --- /dev/null +++ b/src/views/config/components/addTeacher.vue @@ -0,0 +1,134 @@ + + + + + diff --git a/src/views/config/info.vue b/src/views/config/info.vue new file mode 100644 index 0000000..5b18248 --- /dev/null +++ b/src/views/config/info.vue @@ -0,0 +1,139 @@ + + + + + diff --git a/src/views/config/teacher.vue b/src/views/config/teacher.vue new file mode 100644 index 0000000..36552f8 --- /dev/null +++ b/src/views/config/teacher.vue @@ -0,0 +1,182 @@ + + + + + diff --git a/src/views/course/apply.vue b/src/views/course/apply.vue index 09b1d27..cfb87d4 100644 --- a/src/views/course/apply.vue +++ b/src/views/course/apply.vue @@ -193,7 +193,9 @@ }, methods: { goApply(){ - window.location.href = '/admin/#/course/apply_list' + this.$router.push({ + path: '/course/apply_list' + }) }, } } diff --git a/src/views/course/class.vue b/src/views/course/class.vue index 67e813d..02eb745 100644 --- a/src/views/course/class.vue +++ b/src/views/course/class.vue @@ -120,7 +120,9 @@ }, methods: { goAttendance(){ - window.location.href = '/admin/#/course/attendance' + this.$router.push({ + path: '/course/attendance' + }) }, editClass(type, id) { diff --git a/src/views/course/components/addCourse.vue b/src/views/course/components/addCourse.vue index 6db01f7..2312136 100644 --- a/src/views/course/components/addCourse.vue +++ b/src/views/course/components/addCourse.vue @@ -24,6 +24,27 @@ + + - diff --git a/src/views/course/index.vue b/src/views/course/index.vue index d7df539..e5954cc 100644 --- a/src/views/course/index.vue +++ b/src/views/course/index.vue @@ -44,8 +44,14 @@