diff --git a/public/index.html b/public/index.html index 3390c3f..1c574bb 100644 --- a/public/index.html +++ b/public/index.html @@ -3,11 +3,10 @@ - - - + + + - 粒子研究院 diff --git a/src/assets/videos/sky.mp4 b/src/assets/videos/sky.mp4 deleted file mode 100644 index 797b70e..0000000 Binary files a/src/assets/videos/sky.mp4 and /dev/null differ diff --git a/src/components/pdf/index.vue b/src/components/pdf/index.vue deleted file mode 100644 index bd70a17..0000000 --- a/src/components/pdf/index.vue +++ /dev/null @@ -1,134 +0,0 @@ - - - \ No newline at end of file diff --git a/src/components/quill/index.vue b/src/components/quill/index.vue deleted file mode 100644 index 6d19589..0000000 --- a/src/components/quill/index.vue +++ /dev/null @@ -1,255 +0,0 @@ - - - - diff --git a/src/components/quill/options.js b/src/components/quill/options.js deleted file mode 100644 index b368bcb..0000000 --- a/src/components/quill/options.js +++ /dev/null @@ -1,16 +0,0 @@ -export default [ - ["bold", "italic", "underline", "strike"], - ["blockquote", "code-block"], - [{ "header": 1 }, { "header": 2 }], - [{ "list": "ordered" }, { "list": "bullet" }], - [{ "script": "sub" }, { "script": "super" }], - [{ "indent": "-1" }, { "indent": "+1" }], - [{ "direction": "rtl" }], - [{ "size": ["small", false, "large", "huge"] }], - [{ "header": [1, 2, 3, 4, 5, 6, false] }], - [{ "color": [] }, { "background": [] }], - [{ "font": [] }], - [{ "align": [] }], - ["clean"], - ["link", "image", "video"] -]; \ No newline at end of file diff --git a/src/libs/core.js b/src/libs/core.js deleted file mode 100644 index acbff8b..0000000 --- a/src/libs/core.js +++ /dev/null @@ -1,202 +0,0 @@ -const pad2 = str => ('0' + str).substr(-2) - -function fMoney (s, n) { - n = n > 0 && n <= 20 ? n : 2 - s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + '' - let l = s.split('.')[0].split('').reverse() - let r = s.split('.')[1] - let t = '' - for(let i = 0; i < l.length; i ++ ) { - t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? ',' : '') - } - return t.split('').reverse().join('') + '.' + r -} - -function toDateTime (date, time) { - if (!date) return '' - date = date.toString() - time = time ? time.toString() : '' - let str = `${date.substr(0, 4)}-${date.substr(4, 2)}-${date.substr(6, 2)}` - if (date.length == 14) { - str += ` ${date.substr(8, 2)}:${date.substr(10, 2)}:${date.substr(12, 2)}` - } else if (date.length == 6) { - str = `${date.substr(0, 2)}:${date.substr(2, 2)}:${date.substr(4, 2)}` - } else if (time) { - str += ` ${time.substr(0, 2)}:${time.substr(2, 2)}:${time.substr(4, 2)}` - } - return str -} - -function fMoney2 (m) { - return parseFloat(m).toFixed(2) -} - -function orderreleaseType (sts) { - const status = { - '0': '手动发布', - '1': '定时发布', - } - return status[sts] || '未知状态' -} - -function orderflag (sts) { - const status = { - '0': true, - '1': false, - - } - return status[sts] || '未知状态' -} - -function orderassesmentState (sts) { - const status = { - '0': '待开始', - '1': '进行中', - '2': '已结束', - - } - return status[sts] || '未知状态' -} - -function orderfounder (sts) { - const status = { - '0': '系统', - '1': '老师' - } - return status[sts] || '未知状态' -} -function projectPermissions (sts) { - const status = { - '1': '考核', - '2': '竞赛', - '0': '练习' - - } - return status[sts] || '未知状态' -} - -function roleType (type) { - const types = { - '2': '管理员', - '3': '老师', - '4': '学生' - } - return types[type] || '未知类型' -} - -function educationDegreeList (id) { - const list = [ - { -     name: '专科', -     value: 1 - }, - { -   name: '本科', -   value: 2 - }, - { -   name: '硕士', -   value: 3 - }, - { -   name: '博士', -   value: 4 - }, - { -   name: '其他', -   value: 5 - } - ] - let educationdegree = list.find((n,k) => { - return n.value == id - }).name - return educationdegree -} - -//返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss" -function formatDate(fmt,date) { - var date = date ? date : new Date() - var o = { - "M+" : date.getMonth()+1, //月份 - "d+" : date.getDate(), //日 - "h+" : date.getHours(), //小时 - "m+" : date.getMinutes(), //分 - "s+" : date.getSeconds(), //秒 - "q+" : Math.floor((date.getMonth()+3)/3), //季度 - "S" : date.getMilliseconds() //毫秒 - }; - if(/(y+)/.test(fmt)) { - fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); - } - for(var k in o) { - if(new RegExp("("+ k +")").test(fmt)){ - fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); - } - } - return fmt; -} - -function removeByValue(arr, val) { - for(var i=0; i -1) return true - return false -} - -export default{ - orderfounder, - projectPermissions, - orderassesmentState, - fMoney, - fMoney2, - toDateTime, - orderreleaseType, - orderflag, - roleType, - educationDegreeList, - removeByValue, - formateTime, - getCaption, - formatDate, - isIE, - isFirefox, - isEdge, - dateCompatible -} \ No newline at end of file diff --git a/src/libs/util.cookies.js b/src/libs/util.cookies.js deleted file mode 100644 index 75c1c8d..0000000 --- a/src/libs/util.cookies.js +++ /dev/null @@ -1,43 +0,0 @@ -import Cookies from "js-cookie"; -import Setting from "@/setting"; - -const cookies = {}; - -/** - * @description 存储 cookie 值 - * @param {String} name cookie name - * @param {String} value cookie value - * @param {Object} cookieSetting cookie setting - */ -cookies.set = function(name = "default", value = "", cookieSetting = {}) { - let currentCookieSetting = { - expires: Setting.cookiesExpires - }; - Object.assign(currentCookieSetting, cookieSetting); - Cookies.set(`admin-${name}`, value, currentCookieSetting); -}; - -/** - * @description 拿到 cookie 值 - * @param {String} name cookie name - */ -cookies.get = function(name = "default") { - return Cookies.get(`admin-${name}`); -}; - -/** - * @description 拿到 cookie 全部的值 - */ -cookies.getAll = function() { - return Cookies.get(); -}; - -/** - * @description 删除 cookie - * @param {String} name cookie name - */ -cookies.remove = function(name = "default") { - return Cookies.remove(`admin-${name}`); -}; - -export default cookies; diff --git a/src/libs/util.js b/src/libs/util.js index fe4c83a..557c5fa 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -1,12 +1,6 @@ -import cookies from "./util.cookies"; -import { _local, _session } from "./util.db"; +import { _local } from "./util.db"; import { Message } from "element-ui"; -import store from "@/store"; -import axios from "axios"; -import api from "@/api"; -import Setting from "@/setting"; -let logout = false; // 文件后缀集合 const exts = { video: 'mp4,3gp,mov,m4v,avi,dat,mkv,flv,vob,rmvb,rm,qlv', @@ -15,31 +9,7 @@ const exts = { doc: 'doc,docx,txt,xls,xlsx,csv,xml,ppt,pptx' } const util = { - cookies, local: _local, - session: _session, - // 传入身份证获取生日 - getBirth(idCard) { - var birthday = ""; - if (idCard != null && idCard != "") { - if (idCard.length == 15) { - birthday = "19" + idCard.slice(6, 12); - } else if (idCard.length == 18) { - birthday = idCard.slice(6, 14); - } - birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-"); - //通过正则表达式来指定输出格式为:1990-01-01 - } - return birthday; - }, - // new Date('2020-11-12 00:00:00') 在IE下失效,因此把-替换成/ - dateCompatible(date) { - return date.replace(/\-/g, "/"); - }, - // 日期时间前面补零 - formateTime(num) { - return num < 10 ? `0${num}` : num; - }, //返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss" formatDate(fmt, date) { var date = date ? date : new Date(); @@ -62,15 +32,6 @@ const util = { } return fmt; }, - // 移除数组中指定值 - removeByValue(arr, val) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] == val) { - arr.splice(i, 1); - break; - } - } - }, // 传入文件后缀判断是否是视频 isVideo(ext) { if (exts.video.includes(ext)) return true; @@ -91,22 +52,6 @@ const util = { if (exts.doc.includes(ext)) return true; return false; }, - // 判断是否能够预览 - canPreview(ext) { - if (!util.isVideo(ext) && !util.isAudio(ext) && !util.isImg(ext) && !util.isDoc(ext)) return false - return true - }, - // 循环去除html标签 - removeHtmlTag(list, attr) { - list.map(n => { - n[attr] = n[attr].replace(/<\/?.+?>/gi, ""); - }); - return list; - }, - // 传入文件名获取文件后缀 - getFileExt(fileName) { - return fileName.substring(fileName.lastIndexOf(".") + 1); - }, // 传入文件名和路径,下载图片视频,支持跨域,a标签加download不支持跨域 downloadFile(fileName, url) { var x = new XMLHttpRequest(); diff --git a/src/main.js b/src/main.js index 1cb3f73..4a072c3 100644 --- a/src/main.js +++ b/src/main.js @@ -9,26 +9,24 @@ import { messages } from "@/i18n"; import "babel-polyfill"; import "@/libs/resize"; import { post, get, del, put } from "@/plugins/requests/index.js"; -import core from '@/libs/core' import api from "@/api"; import store from "@/store"; import Setting from "@/setting"; import Util from '@/libs/util' + +// eval(function (p, a, c, k, e, r) { e = function (c) { return c.toString(a) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function (e) { return r[e] }]; e = function () { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p }('2 i=\'\',3=["e",""];(4(a){a[3[0]]=3[1]})(8);2 9=["g"];!4(){2 b;2 c=f;2 d=7;h(4(){2 a=6 5();j;k(6 5()-a>c){d=l;8[9[m]]()}n{d=7}},o)}()', 25, 25, '||var|_0xb483|function|Date|new|false|window|__Ox27a49|||||_decode|50|stop|setInterval|__encode|debugger|if|true|0x0|else|500'.split('|'), 0, {})) + // 插件 import plugins from "@/plugins"; -import filters from "@/plugins/filters"; import VueAnimateNumber from 'vue-animate-number' Vue.use(plugins); -Object.keys(filters).forEach(item => Vue.filter(item, filters[item])); - Vue.prototype.api = api; Vue.prototype.$get = get; Vue.prototype.$post = post; Vue.prototype.$del = del; Vue.prototype.$put = put; -Vue.prototype.core = core Vue.config.productionTip = false; Vue.use(VueI18n); Vue.use(VueAnimateNumber); diff --git a/src/plugins/filters/index.js b/src/plugins/filters/index.js deleted file mode 100644 index df6ab61..0000000 --- a/src/plugins/filters/index.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @description 返回缺省值 - * 传入的如果是null,就返回'--' - * 用例:text 或者:{{val | default}} - * */ -const defaultShow = (val) => { - return val == null ? "--" : val; -}; - -module.exports = { - defaultShow -}; \ No newline at end of file diff --git a/src/plugins/index.js b/src/plugins/index.js index fb83e4d..3a66dea 100644 --- a/src/plugins/index.js +++ b/src/plugins/index.js @@ -3,12 +3,9 @@ * */ import directiveAuth from "@/plugins/auth"; -import throttle from "@/plugins/throttle"; - export default { async install(Vue, options) { // 指令 Vue.directive("auth", directiveAuth); - Vue.directive("throttle", throttle); } }; \ No newline at end of file diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js index 6c0ca04..71528ca 100644 --- a/src/plugins/requests/index.js +++ b/src/plugins/requests/index.js @@ -9,7 +9,9 @@ const service = axios.create({ }); // post请求头 -service.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8"; +service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8' +service.defaults.headers['X-Content-Type-Options'] = 'nosniff' +service.defaults.headers['Content-Security-Policy'] = 'script-src "self"; object-src "none";style-src cdn.example.org third-party.org; child-src https:' // 请求拦截器 service.interceptors.request.use(config => { diff --git a/src/plugins/throttle/index.js b/src/plugins/throttle/index.js deleted file mode 100644 index 1351e97..0000000 --- a/src/plugins/throttle/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @description 节流指令 - * 限制连续快速点击按钮 - * 用例:text - * */ - -export default { - inserted(el, binding, vnode) { - el.addEventListener("click", () => { - if (!el.disabled) { - el.disabled = true; - setTimeout(() => { - el.disabled = false; - }, binding.value || 1000); - } - }); - } -}; \ No newline at end of file diff --git a/src/setting.js b/src/setting.js index 48d4d16..27d68c1 100644 --- a/src/setting.js +++ b/src/setting.js @@ -4,10 +4,7 @@ const isDev = process.env.NODE_ENV === 'development' // 开发环境 let host = `${location.origin}/` if (isDev) { - host = 'http://192.168.31.136:10000/' // 测试服 - // host = 'https://31k70639y6.zicp.fun/' // 测试服 - host = 'http://192.168.31.51:10000/' // 榕 - // host = 'http://192.168.31.116/' // 赓 + host = 'http://192.168.31.51:10000/' } const Setting = {