eslint; 收入合同

This commit is contained in:
zhaoxiao
2021-09-03 19:27:41 +08:00
parent c53de39b40
commit 303c1026f8
164 changed files with 5964 additions and 4788 deletions
+5 -5
View File
@@ -12,10 +12,10 @@ const FormTypes = {
file: 'file',
image: 'image',
popup:'popup',
list_multi:"list_multi",
sel_search:"sel_search",
list_multi:'list_multi',
sel_search:'sel_search',
radio:'radio',
checkbox_meta:"checkbox_meta",
checkbox_meta:'checkbox_meta',
input_pop:'input_pop',
sel_depart: 'sel_depart',
sel_user: 'sel_user',
@@ -90,7 +90,7 @@ export function validateTables(cases, deleteTempId) {
}
return new Promise((resolve, reject) => {
let tables = []
let index = 0;
let index = 0
if(!cases || cases.length === 0){
resolve()
}
@@ -108,7 +108,7 @@ export function validateTables(cases, deleteTempId) {
// 出现未验证通过的表单,不再进行下一步校验,直接返回失败并跳转到该表格
if (error === VALIDATE_NO_PASSED) {
// 尝试获取tabKey,如果在ATab组件内即可获取
let paneKey;
let paneKey
let tabPane = getVmParentByName(vm, 'ATabPane')
if (tabPane) {
paneKey = tabPane.$vnode.key
+60 -60
View File
@@ -1,20 +1,20 @@
import { USER_AUTH,SYS_BUTTON_AUTH } from "@/store/mutation-types"
import { USER_AUTH,SYS_BUTTON_AUTH } from '@/store/mutation-types'
export function disabledAuthFilter(code,formData) {
if(nodeDisabledAuth(code,formData)){
return true;
return true
}else{
return globalDisabledAuth(code);
return globalDisabledAuth(code)
}
}
function nodeDisabledAuth(code,formData){
// console.log("页面权限禁用--NODE--开始");
let permissionList = [];
let permissionList = []
try {
// console.log("页面权限禁用--NODE--开始",formData);
if (formData) {
let bpmList = formData.permissionList;
let bpmList = formData.permissionList
permissionList = bpmList.filter(item=>item.type=='2')
// for (let bpm of bpmList) {
// if(bpm.type == '2') {
@@ -22,102 +22,102 @@ function nodeDisabledAuth(code,formData){
// }
// }
}else{
return false;
return false
}
} catch (e) {
//console.log("页面权限异常----", e);
}
if (permissionList.length == 0) {
return false;
return false
}
//
// console.log("流程节点页面权限禁用--NODE--开始");
let permissions = [];
let permissions = []
for (let item of permissionList) {
if(item.type == '2') {
permissions.push(item.action);
permissions.push(item.action)
}
}
//console.log("页面权限----"+code);
if (!permissions.includes(code)) {
return false;
return false
}else{
for (let item2 of permissionList) {
if(code === item2.action){
// console.log("流程节点页面权限禁用--NODE--生效");
return true;
return true
}
}
}
return false;
return false
}
function globalDisabledAuth(code){
// console.log("全局页面禁用权限--Global--开始");
let permissionList = [];
let allPermissionList = [];
let permissionList = []
let allPermissionList = []
//let authList = Vue.ls.get(USER_AUTH);
let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
for (let auth of authList) {
if(auth.type == '2') {
permissionList.push(auth);
permissionList.push(auth)
}
}
//console.log("页面禁用权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
for (let gauth of allAuthList) {
if(gauth.type == '2') {
allPermissionList.push(gauth);
allPermissionList.push(gauth)
}
}
//设置全局配置是否有命中
let gFlag = false;//禁用命中
let invalidFlag = false;//无效命中
if(allPermissionList != null && allPermissionList != "" && allPermissionList != undefined && allPermissionList.length > 0){
let gFlag = false//禁用命中
let invalidFlag = false//无效命中
if(allPermissionList != null && allPermissionList != '' && allPermissionList != undefined && allPermissionList.length > 0){
for (let itemG of allPermissionList) {
if(code === itemG.action){
if(itemG.status == '0'){
invalidFlag = true;
break;
invalidFlag = true
break
}else{
gFlag = true;
break;
gFlag = true
break
}
}
}
}
if(invalidFlag){
return false;
return false
}
if (permissionList === null || permissionList === "" || permissionList === undefined||permissionList.length<=0) {
return gFlag;
if (permissionList === null || permissionList === '' || permissionList === undefined||permissionList.length<=0) {
return gFlag
}
let permissions = [];
let permissions = []
for (let item of permissionList) {
if(item.type == '2') {
permissions.push(item.action);
permissions.push(item.action)
}
}
//console.log("页面禁用权限----"+code);
if (!permissions.includes(code)) {
return gFlag;
return gFlag
}else{
for (let item2 of permissionList) {
if(code === item2.action){
// console.log("全局页面权限解除禁用--Global--生效");
gFlag = false;
gFlag = false
}
}
return gFlag;
return gFlag
}
}
export function colAuthFilter(columns,pre) {
let authList = getNoAuthCols(pre);
let authList = getNoAuthCols(pre)
const cols = columns.filter(item => {
if (hasColoum(item,authList)) {
return true
@@ -136,11 +136,11 @@ export function colAuthFilter(columns,pre) {
* @returns {*}
*/
export function colAuthFilterJEditableTable(columns,pre) {
let authList = getAllShowAndDisabledAuthCols(pre);
let authList = getAllShowAndDisabledAuthCols(pre)
const cols = columns.filter(item => {
let oneAuth = authList.find(auth => {
return auth.action === pre + item.key;
});
return auth.action === pre + item.key
})
if(!oneAuth){
return true
}
@@ -152,7 +152,7 @@ export function colAuthFilterJEditableTable(columns,pre) {
//禁用逻辑
if (oneAuth.type == '2' && !oneAuth.isAuth) {
item["disabled"] = true
item['disabled'] = true
return true
}
//隐藏逻辑逻辑
@@ -178,39 +178,39 @@ export function getNoAuthCols(pre){
if(!pre || pre.length==0){
return []
}
let permissionList = [];
let allPermissionList = [];
let permissionList = []
let allPermissionList = []
//let authList = Vue.ls.get(USER_AUTH);
let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
for (let auth of authList) {
//显示策略,有效状态
if(auth.type == '1'&&startWith(auth.action,pre)) {
permissionList.push(substrPre(auth.action,pre));
permissionList.push(substrPre(auth.action,pre))
}
}
//console.log("页面禁用权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
for (let gauth of allAuthList) {
//显示策略,有效状态
if(gauth.type == '1'&&gauth.status == '1'&&startWith(gauth.action,pre)) {
allPermissionList.push(substrPre(gauth.action,pre));
allPermissionList.push(substrPre(gauth.action,pre))
}
}
const cols = allPermissionList.filter(item => {
if (permissionList.includes(item)) {
return false;
return false
}
return true;
return true
})
return cols;
return cols
}
/**
* 将Online的行编辑按钮权限,添加至本地存储
*/
export function addOnlineBtAuth2Storage(pre, authList){
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
let newAuthList = allAuthList.filter(item=>{
if(!item.action){
return true
@@ -225,7 +225,7 @@ export function addOnlineBtAuth2Storage(pre, authList){
status:1
})
}
let temp = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
let temp = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
let newArr = temp.filter(item=>{
if(!item.action){
return true
@@ -248,30 +248,30 @@ export function addOnlineBtAuth2Storage(pre, authList){
*/
function getAllShowAndDisabledAuthCols(pre){
//用户拥有的权限
let userAuthList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
let userAuthList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
//全部权限配置
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
let newAllAuthList = allAuthList.map(function (item, index) {
let hasAuthArray = userAuthList.filter(u => u.action===item.action );
let hasAuthArray = userAuthList.filter(u => u.action===item.action )
if (hasAuthArray && hasAuthArray.length>0) {
item["isAuth"] = true
item['isAuth'] = true
}
return item;
return item
})
return newAllAuthList;
return newAllAuthList
}
function startWith(str,pre) {
if (pre == null || pre == "" || str==null|| str==""|| str.length == 0 || pre.length > str.length)
return false;
if (pre == null || pre == '' || str==null|| str==''|| str.length == 0 || pre.length > str.length)
return false
if (str.substr(0, pre.length) == pre)
return true;
return true
else
return false;
return false
}
function substrPre(str,pre) {
return str.substr(pre.length);
return str.substr(pre.length)
}
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -1,5 +1,5 @@
import Vue from "vue";
import * as dayjs from "dayjs";
import Vue from 'vue'
import * as dayjs from 'dayjs'
Vue.filter('NumberFormat', function (value) {
if (!value) {
@@ -20,7 +20,7 @@ Vue.filter('moment', function(dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
/** 字符串超长截取省略号显示 */
Vue.filter('ellipsis', function (value, vlength = 25) {
if(!value){
return "";
return ''
}
if (value.length > vlength) {
return value.slice(0, vlength) + '...'
+40 -40
View File
@@ -1,4 +1,4 @@
import { USER_AUTH,SYS_BUTTON_AUTH } from "@/store/mutation-types"
import { USER_AUTH,SYS_BUTTON_AUTH } from '@/store/mutation-types'
const hasPermission = {
install (Vue, options) {
@@ -8,126 +8,126 @@ const hasPermission = {
//console.time()
//节点权限处理,如果命中则不进行全局权限处理
if(!filterNodePermission(el, binding, vnode)){
filterGlobalPermission(el, binding, vnode);
filterGlobalPermission(el, binding, vnode)
}
}
});
})
}
};
}
/**
* 流程节点权限控制
*/
export function filterNodePermission(el, binding, vnode) {
let permissionList = [];
let permissionList = []
try {
let obj = vnode.context.$props.formData;
let obj = vnode.context.$props.formData
if (obj) {
let bpmList = obj.permissionList;
let bpmList = obj.permissionList
for (let bpm of bpmList) {
if(bpm.type != '2') {
permissionList.push(bpm);
permissionList.push(bpm)
}
}
}else{
return false;
return false
}
} catch (e) {
//console.log("页面权限异常----", e);
}
if (permissionList === null || permissionList === "" || permissionList === undefined||permissionList.length<=0) {
if (permissionList === null || permissionList === '' || permissionList === undefined||permissionList.length<=0) {
//el.parentNode.removeChild(el)
return false;
return false
}
console.log("流程节点页面权限--NODE--");
let permissions = [];
console.log('流程节点页面权限--NODE--')
let permissions = []
for (let item of permissionList) {
if(item.type != '2') {
permissions.push(item.action);
permissions.push(item.action)
}
}
//console.log("页面权限----"+permissions);
//console.log("页面权限----"+binding.value);
if (!permissions.includes(binding.value)) {
//el.parentNode.removeChild(el)
return false;
return false
}else{
for (let item2 of permissionList) {
if(binding.value === item2.action){
return true;
return true
}
}
}
return false;
return false
}
/**
* 全局权限控制
*/
export function filterGlobalPermission(el, binding, vnode) {
console.log("全局页面权限--Global--");
console.log('全局页面权限--Global--')
let permissionList = [];
let allPermissionList = [];
let permissionList = []
let allPermissionList = []
//let authList = Vue.ls.get(USER_AUTH);
let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || '[]')
for (let auth of authList) {
if(auth.type != '2') {
permissionList.push(auth);
permissionList.push(auth)
}
}
//console.log("页面权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || '[]')
for (let gauth of allAuthList) {
if(gauth.type != '2') {
allPermissionList.push(gauth);
allPermissionList.push(gauth)
}
}
//设置全局配置是否有命中
let invalidFlag = false;//无效命中
if(allPermissionList != null && allPermissionList != "" && allPermissionList != undefined && allPermissionList.length > 0){
let invalidFlag = false//无效命中
if(allPermissionList != null && allPermissionList != '' && allPermissionList != undefined && allPermissionList.length > 0){
for (let itemG of allPermissionList) {
if(binding.value === itemG.action){
if(itemG.status == '0'){
invalidFlag = true;
break;
invalidFlag = true
break
}
}
}
}
if(invalidFlag){
return;
return
}
if (permissionList === null || permissionList === "" || permissionList === undefined||permissionList.length<=0) {
el.parentNode.removeChild(el);
return;
if (permissionList === null || permissionList === '' || permissionList === undefined||permissionList.length<=0) {
el.parentNode.removeChild(el)
return
}
let permissions = [];
let permissions = []
for (let item of permissionList) {
//权限策略1显示2禁用
if(item.type != '2'){
//update--begin--autor:wangshuai-----date:20200729------for:按钮权限,授权标识的提示信息是多个用逗号分隔逻辑处理 gitee#I1OUGU-------
if(item.action){
if(item.action.includes(",")){
let split = item.action.split(",")
if(item.action.includes(',')){
let split = item.action.split(',')
for (let i = 0; i <split.length ; i++) {
if(!split[i] ||split[i].length==0){
continue;
continue
}
permissions.push(split[i]);
permissions.push(split[i])
}
}else{
permissions.push(item.action);
permissions.push(item.action)
}
}
//update--end--autor:wangshuai-----date:20200729------for:按钮权限,授权标识的提示信息是多个用逗号分隔逻辑处理 gitee#I1OUGU------
}
}
if (!permissions.includes(binding.value)) {
el.parentNode.removeChild(el);
el.parentNode.removeChild(el)
}
}
export default hasPermission;
export default hasPermission
+1 -1
View File
@@ -1,5 +1,5 @@
// import Vue from 'vue'
import { mapState } from "vuex";
import { mapState } from 'vuex'
// const mixinsComputed = Vue.config.optionMergeStrategies.computed
// const mixinsMethods = Vue.config.optionMergeStrategies.methods
+22 -22
View File
@@ -2,7 +2,7 @@ import Vue from 'vue'
import axios from 'axios'
import store from '@/store'
import {Modal, notification} from 'ant-design-vue'
import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
/**
* 【指定 axios的 baseURL】
@@ -10,7 +10,7 @@ import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types"
* 则映射后端域名,通过 vue.config.js
* @type {*|string}
*/
let apiBaseUrl = window._CONFIG['domianURL'] || "/jero-boot";
let apiBaseUrl = window._CONFIG['domianURL'] || '/jero-boot'
//console.log("apiBaseUrl= ",apiBaseUrl)
// 创建 axios 实例
const service = axios.create({
@@ -23,23 +23,23 @@ const err = (error) => {
if (error.response) {
let data = error.response.data
const token = Vue.ls.get(ACCESS_TOKEN)
console.log("------异常响应------",token)
console.log("------异常响应------",error.response.status)
console.log('------异常响应------',token)
console.log('------异常响应------',error.response.status)
switch (error.response.status) {
case 403:
notification.error({ message: '系统提示', description: '拒绝访问',duration: 4})
break
case 500:
console.log("------error.response------",error.response)
console.log('------error.response------',error.response)
// update-begin- --- author:liusq ------ date:20200910 ---- for:处理Blob情况----
let type=error.response.request.responseType;
let type=error.response.request.responseType
if(type === 'blob'){
blobToJson(data);
break;
blobToJson(data)
break
}
// update-end- --- author:liusq ------ date:20200910 ---- for:处理Blob情况----
//notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4})
if(token && data.message.includes("Token失效")){
if(token && data.message.includes('Token失效')){
// update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
Modal.error({
title: '登录已过期',
@@ -51,8 +51,8 @@ const err = (error) => {
Vue.ls.remove(ACCESS_TOKEN)
try {
let path = window.document.location.pathname
console.log("location pathname -> "+path)
if(path!="/" && path.indexOf('/user/login')==-1){
console.log('location pathname -> '+path)
if(path!='/' && path.indexOf('/user/login')==-1){
window.location.reload()
}
}catch (e) {
@@ -90,7 +90,7 @@ const err = (error) => {
}
}
return Promise.reject(error)
};
}
// request interceptor
service.interceptors.request.use(config => {
@@ -101,12 +101,12 @@ service.interceptors.request.use(config => {
//update-begin-author:taoyan date:2020707 for:多租户
let tenantid = Vue.ls.get(TENANT_ID)
if (!tenantid) {
tenantid = 0;
tenantid = 0
}
config.headers[ 'tenant_id' ] = tenantid
//update-end-author:taoyan date:2020707 for:多租户
if(config.method=='get'){
if(config.url.indexOf("sys/dict/getDictItems")<0){
if(config.url.indexOf('sys/dict/getDictItems')<0){
config.params = {
_t: Date.parse(new Date())/1000,
...config.params
@@ -128,15 +128,15 @@ service.interceptors.response.use((response) => {
* @param data
*/
function blobToJson(data) {
let fileReader = new FileReader();
let token = Vue.ls.get(ACCESS_TOKEN);
let fileReader = new FileReader()
let token = Vue.ls.get(ACCESS_TOKEN)
fileReader.onload = function() {
try {
let jsonData = JSON.parse(this.result); // 说明是普通对象数据,后台转换失败
console.log("jsonData",jsonData)
let jsonData = JSON.parse(this.result) // 说明是普通对象数据,后台转换失败
console.log('jsonData',jsonData)
if (jsonData.status === 500) {
console.log("token----------》",token)
if(token && jsonData.message.includes("Token失效")){
console.log('token----------》',token)
if(token && jsonData.message.includes('Token失效')){
Modal.error({
title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录',
@@ -153,9 +153,9 @@ function blobToJson(data) {
}
} catch (err) {
// 解析成对象失败,说明是正常的文件流
console.log("blob解析fileReader返回err",err)
console.log('blob解析fileReader返回err',err)
}
};
}
fileReader.readAsText(data)
}
+35 -35
View File
@@ -1,6 +1,6 @@
import * as api from '@/api/api'
import { isURL } from '@/utils/validate'
import { JSEncrypt } from "jsencrypt";
import { JSEncrypt } from 'jsencrypt'
// import onlineCommons from '@/components/onlineForm/onlineForm'
//
export function timeFix() {
@@ -32,16 +32,16 @@ export function triggerWindowResizeEvent() {
*/
export function filterObj(obj) {
if (!(typeof obj == 'object')) {
return;
return
}
for ( let key in obj) {
if (obj.hasOwnProperty(key)
&& (obj[key] == null || obj[key] == undefined || obj[key] === '')) {
delete obj[key];
delete obj[key]
}
}
return obj;
return obj
}
/**
@@ -51,10 +51,10 @@ export function filterObj(obj) {
* @returns {*}
*/
export function formatDate(value, fmt) {
let regPos = /^\d+(\.\d+)?$/;
let regPos = /^\d+(\.\d+)?$/
if(regPos.test(value)){
//如果是数字
let getDate = new Date(value);
let getDate = new Date(value)
let o = {
'M+': getDate.getMonth() + 1,
'd+': getDate.getDate(),
@@ -63,7 +63,7 @@ export function formatDate(value, fmt) {
's+': getDate.getSeconds(),
'q+': Math.floor((getDate.getMonth() + 3) / 3),
'S': getDate.getMilliseconds()
};
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
}
@@ -72,11 +72,11 @@ export function formatDate(value, fmt) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
}
}
return fmt;
return fmt
}else{
//TODO
value = value.trim();
return value.substr(0,fmt.length);
value = value.trim()
return value.substr(0,fmt.length)
}
}
@@ -93,27 +93,27 @@ let indexRouter = [{
...generateChildRouters(data)
]
},{
"path": "*", "redirect": "/404", "hidden": true
'path': '*', 'redirect': '/404', 'hidden': true
}]
return indexRouter;
return indexRouter
}
// 生成嵌套路由(子路由)
function generateChildRouters (data) {
const routers = [];
const routers = []
for (let item of data) {
let component = "";
if(item.component.indexOf("layouts")>=0){
component = "components/"+item.component;
let component = ''
if(item.component.indexOf('layouts')>=0){
component = 'components/'+item.component
}else{
component = "views/"+item.component;
component = 'views/'+item.component
}
// eslint-disable-next-line
let URL = (item.meta.url|| '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
if (isURL(URL)) {
item.meta.url = URL;
item.meta.url = URL
}
let componentPath
@@ -160,11 +160,11 @@ function generateChildRouters (data) {
}
}
if(item.alwaysShow){
menu.alwaysShow = true;
menu.redirect = menu.path;
menu.alwaysShow = true
menu.redirect = menu.path
}
if (item.children && item.children.length > 0) {
menu.children = [...generateChildRouters( item.children)];
menu.children = [...generateChildRouters( item.children)]
}
//--update-begin----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
//判断是否生成路由
@@ -172,7 +172,7 @@ function generateChildRouters (data) {
//console.log(' 不生成路由 item.route '+item.route);
//console.log(' 不生成路由 item.path '+item.path);
}else{
routers.push(menu);
routers.push(menu)
}
//--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
}
@@ -249,8 +249,8 @@ export function randomUUID() {
*/
export function underLine2CamelCase(string){
return string.replace( /_([a-z])/g, function( all, letter ) {
return letter.toUpperCase();
});
return letter.toUpperCase()
})
}
/**
@@ -259,10 +259,10 @@ export function underLine2CamelCase(string){
* @returns {*}
*/
export function showDealBtn(bpmStatus){
if(bpmStatus!="1"&&bpmStatus!="3"&&bpmStatus!="4"){
return true;
if(bpmStatus!='1'&&bpmStatus!='3'&&bpmStatus!='4'){
return true
}
return false;
return false
}
/**
@@ -272,7 +272,7 @@ export function showDealBtn(bpmStatus){
*/
export function cssExpand(css, id) {
let style = document.createElement('style')
style.type = "text/css"
style.type = 'text/css'
style.innerHTML = `@charset "UTF-8"; ${css}`
// 清除旧样式
if (id) {
@@ -554,12 +554,12 @@ export function removeArrayElement(array, prod, value) {
let index = -1
for(let i = 0;i<array.length;i++){
if(array[i][prod] == value){
index = i;
break;
index = i
break
}
}
if(index>=0){
array.splice(index, 1);
array.splice(index, 1)
}
}
/**
@@ -577,13 +577,13 @@ export function encrypt(publicKey, message) {
* 校验数组是否有重复的元素
* */
export function isRepeat(arr) {
var hash = {};
var hash = {}
for(var i in arr) {
if(hash[arr[i]]) {
return true;
return true
}
// 不存在该元素,则赋值为true,可以赋任意值,相应的修改if判断条件即可
hash[arr[i]] = true;
hash[arr[i]] = true
}
return false;
return false
}
+3 -3
View File
@@ -6,7 +6,7 @@ const vTrim = {
input.oninput = (event) => {
console.log(event.target.value)
// event.target.value = event.target.value.replace(/(^\s*)|(\s*$)/g, "")
input.value = input.value.replace(/(^\s*)|(\s*$)/g, "")
input.value = input.value.replace(/(^\s*)|(\s*$)/g, '')
}
// // 获取当前光标所在位置
// const inputSelection = input.selectionStart
@@ -23,8 +23,8 @@ const vTrim = {
// input.dispatchEvent(new Event(modifiers.lazy ? 'change' : 'input'))
// }
}
});
})
}
};
}
export default vTrim
+2 -2
View File
@@ -1,5 +1,5 @@
import {duplicateCheck} from "@api/api";
import {phoneReg, isEmail, passwordReg, isPhone,chineseReg} from "@/utils/validate";
import {duplicateCheck} from '@api/api'
import {phoneReg, isEmail, passwordReg, isPhone,chineseReg} from '@/utils/validate'
// 手机校验的错误信息提示
const phoneErrMsg = {