diff --git a/src/main.js b/src/main.js index bfa4c0f..7f9011b 100644 --- a/src/main.js +++ b/src/main.js @@ -74,8 +74,8 @@ Vue.use(adaptive) import dialogDrag from '@/directive/dialogDrag' // 窗口拖拽 Vue.use(dialogDrag) -if(!String.prototype.replaceAll){ - String.prototype.replaceAll = function(str, newStr){ +if (!String.prototype.replaceAll) { + String.prototype.replaceAll = function (str, newStr) { // 正则表达式 if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') { return this.replace(str, newStr) @@ -111,7 +111,7 @@ Vue.prototype.$getObjectName = (url) => { console.log(url) var value = url var str = value.split("//"); //https://进行分割, - var index = str[1].indexOf("/")+1; //indexOf 获取第一个斜杠的索引, + var index = str[1].indexOf("/") + 1; //indexOf 获取第一个斜杠的索引, console.log(str[1].substring(index)); //substring 截取, return '/' + str[1].substring(index) } @@ -128,18 +128,18 @@ Vue.prototype.getGuid = (text) => { t8 = text.substr(14, 2) t9 = text.substr(16, 4) t10 = text.substr(20, 12) - console.log(`${t4+t3+t2+t1}-${t6+t5}-${t8+t7}-${t9}-${t10}`) - return `${t4+t3+t2+t1}-${t6+t5}-${t8+t7}-${t9}-${t10}` + console.log(`${t4 + t3 + t2 + t1}-${t6 + t5}-${t8 + t7}-${t9}-${t10}`) + return `${t4 + t3 + t2 + t1}-${t6 + t5}-${t8 + t7}-${t9}-${t10}` } ///50350000-3e2c-0016-eb4c-08db926b69d6/Image/84410000-3e10-0016-d156-08da242403fe/50350000-3e2c-0016-414e-08db926d9135/50350000-3e2c-0016-fd9d-08db926d9137/1.2.156.110002.21.2019.1.9.84822154.1/1.3.12.2.1107.5.1.4.73793.30000019010509500386600308609/1.3.12.2.1107.5.1.4.73793.30000019010509500386600308616/7fba7d7e-b3b3-d989-fa54-82e41f87a6ed Vue.prototype.getGuid('1.2.156.110002.21.2019.1.9.84822154.11.3.12.2.1107.5.1.4.73793.300000190105095003866003086091.3.12.2.1107.5.1.4.73793.3000001901050950038660030861650350000-3e2c-0016-eb4c-08db926b69d6') //7fba7d7e-b3b3-d989-fa54-82e41f87a6ed Vue.prototype.$validatePassword = (rule, value, callback) => { - var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh' + var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh' /* eslint-disable */ var reg1 = eval(process.env.VUE_APP_PASSWORD_FOR_PERMISSION) ? new RegExp(`${process.env.VUE_APP_PASSWORD_FOR_REGULAR}`) : /.*/g; //密码必须是8位以上、必须含有字母、数字、特殊符号 if (!reg1.test(value)) { - callback(lang==='zh' ? new Error("密码必须包含:1)8 – 32 个字符;2)至少1个数字;3) 至少1个大写字母;4)至少1个小写字母;5)至少1个特殊字符 (~!-@#$%^&*_+?)") : new Error('Passwords must have: 1) 8 - 32 characters; 2) At least 1 number; 3) At least 1 uppercase letter; 4) At least 1 lowercase letter; 5) At least 1 special character (~!-@#$%^&*_+?) ')) + callback(lang === 'zh' ? new Error("密码必须包含:1)8 – 32 个字符;2)至少1个数字;3) 至少1个大写字母;4)至少1个小写字母;5)至少1个特殊字符 (~!-@#$%^&*_+?)") : new Error('Passwords must have: 1) 8 - 32 characters; 2) At least 1 number; 3) At least 1 uppercase letter; 4) At least 1 lowercase letter; 5) At least 1 special character (~!-@#$%^&*_+?) ')) } else { callback(); } @@ -173,7 +173,7 @@ Vue.prototype.fileToBlob = (file) => { } var _vm -async function VueInit () { +async function VueInit() { var params if (~window.location.href.indexOf('/readingDicoms') || ~window.location.href.indexOf('/noneDicomReading') || ~window.location.href.indexOf('/criterionquestions')) { params = $q('TrialReadingCriterionId') @@ -192,14 +192,14 @@ async function VueInit () { i18n.mergeLocaleMessage('en', enMessages) let d = function (code) { var dictInfo = res.Result - var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh' + var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh' try { for (var code in dictInfo) { - var dictList = (dictInfo[code] && dictInfo[code].length > 0) ? dictInfo[code].map(dict => { + var dictList = (dictInfo[code] && dictInfo[code].length > 0) ? dictInfo[code].map(dict => { return { id: dict.Id, - label: lang==='zh' ? dict.ValueCN : dict.Value, - value: dict.DataTypeEnum === 3 ? eval(dict.Code) : dict.IsEnumInt ? parseInt(dict.Code): dict.Code, + label: lang === 'zh' ? dict.ValueCN : dict.Value, + value: dict.DataTypeEnum === 3 ? eval(dict.Code) : dict.IsEnumInt ? parseInt(dict.Code) : dict.Code, raw: Object.assign({}, dict), IsBaseLineUse: false, IsFollowVisitUse: false @@ -207,7 +207,7 @@ async function VueInit () { }) : [] dictInfo[code] = dictList } - } catch (e){ + } catch (e) { console.error(e) } return dictInfo @@ -226,17 +226,17 @@ async function VueInit () { console.log(e) } } - Vue.prototype.$updateDictionary = function() { + Vue.prototype.$updateDictionary = function () { Vue.prototype.$d = function (code) { var dictInfo = res.Result - var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh' + var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh' try { for (var code in dictInfo) { - var dictList = (dictInfo[code] && dictInfo[code].length > 0) ? dictInfo[code].map(dict => { + var dictList = (dictInfo[code] && dictInfo[code].length > 0) ? dictInfo[code].map(dict => { return { id: dict.raw.Id, - label: lang==='zh' ? dict.raw.ValueCN : dict.raw.Value, - value: dict.raw.DataTypeEnum === 3 ? eval(dict.raw.Code) : dict.raw.IsEnumInt ? parseInt(dict.raw.Code): dict.raw.Code, + label: lang === 'zh' ? dict.raw.ValueCN : dict.raw.Value, + value: dict.raw.DataTypeEnum === 3 ? eval(dict.raw.Code) : dict.raw.IsEnumInt ? parseInt(dict.raw.Code) : dict.raw.Code, raw: Object.assign({}, dict.raw), IsBaseLineUse: false, IsFollowVisitUse: false @@ -244,7 +244,7 @@ async function VueInit () { }) : [] _vm.$set(dictInfo, code, dictList) } - } catch (e){ + } catch (e) { console.error(e) } return dictInfo @@ -280,14 +280,14 @@ async function VueInit () { let count = 0; if (eval(process.env.VUE_APP_LOGIN_FOR_PERMISSION)) { setInterval(() => { - var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh' - if ( _vm.$route.path === '/ReviewersResearchForm' || _vm.$route.path === '/ReviewersResearch' || _vm.$route.path === '/login' || _vm.$route.path === '/researchForm' || _vm.$route.path === '/researchLogin' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { + var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh' + if (_vm.$route.path === '/ReviewersResearchForm' || _vm.$route.path === '/ReviewersResearch' || _vm.$route.path === '/login' || _vm.$route.path === '/researchForm' || _vm.$route.path === '/researchLogin' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { return } if (_vm.$store.state.user.userId !== zzSessionStorage.getItem('userId')) { window.location.href = `/login` zzSessionStorage.removeItem('lastWorkbench') - _vm.$alert(lang === 'en'? 'The same browser only allows one user account to be logged in at a time.' : '同一浏览器只允许同时登陆一个账户', { + _vm.$alert(lang === 'en' ? 'The same browser only allows one user account to be logged in at a time.' : '同一浏览器只允许同时登陆一个账户', { type: 'warning', }) } @@ -301,10 +301,10 @@ async function VueInit () { function countTime() { count++ localStorage.setItem('count', count) - if (count == parseInt(second2) || isLock === 'true') { + if (count == parseInt(second2) || isLock === 'true') { callback2(); } - if (count >= second) { + if (count >= second) { callback(); count = 0; localStorage.removeItem('count') @@ -340,22 +340,22 @@ async function VueInit () { const h = _vm.$createElement /* eslint-disable */ waitOperate(eval(process.env.VUE_APP_LOGOUT_FOR_PERMISSION) ? () => { - var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh' - if (_vm.$route.path === '/ReviewersResearchForm' || _vm.$route.path === '/ReviewersResearch' || _vm.$route.path === '/login' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { - count = 0; - localStorage.setItem('count', '0') - return - } - _vm.$store.dispatch('user/logout').then(res => { - window.location.href = `/login` - }) + var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh' + if (_vm.$route.path === '/ReviewersResearchForm' || _vm.$route.path === '/ReviewersResearch' || _vm.$route.path === '/login' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { + count = 0; + localStorage.setItem('count', '0') + return + } + _vm.$store.dispatch('user/logout').then(res => { + window.location.href = `/login` + }) - _vm.$alert(lang === 'zh' ? '由于您长时间未操作,为保护您的数据安全已强制将您下线,如果需要继续操作请重新登陆!' : 'No operation for a long time non-operation, you have been forced logout to protect data security. If continue to operate, please login again!', { - type: 'warning', - }) - } : () => {}, process.env.VUE_APP_LOGOUT_FOR_TIME, + _vm.$alert(lang === 'zh' ? '由于您长时间未操作,为保护您的数据安全已强制将您下线,如果需要继续操作请重新登陆!' : 'No operation for a long time non-operation, you have been forced logout to protect data security. If continue to operate, please login again!', { + type: 'warning', + }) + } : () => { }, process.env.VUE_APP_LOGOUT_FOR_TIME, eval(process.env.VUE_APP_LOCK_FOR_PERMISSION) ? () => { - var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh' + var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh' if (_vm.$route.path === '/ReviewersResearchForm' || _vm.$route.path === '/ReviewersResearch' || _vm.$route.path === '/login' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { count = 0; localStorage.setItem('count', '0') @@ -408,14 +408,14 @@ async function VueInit () { } } }, - message: h('div', {} , [ + message: h('div', {}, [ h('el-form', { props: { labelWidth: "80px" } }, [ h('el-form-item', { - props: {label: lang === 'zh' ? '用户名' : 'User ID'}, + props: { label: lang === 'zh' ? '用户名' : 'User ID' }, }, [ - h('input',{ + h('input', { props: { value: _vm.unlock.my_username }, @@ -435,7 +435,7 @@ async function VueInit () { }) ]), h('el-form-item', { - props: {label: lang === 'zh' ? '密码' : 'Password'}, + props: { label: lang === 'zh' ? '密码' : 'Password' }, }, [ h('input', { props: { @@ -460,7 +460,7 @@ async function VueInit () { ]) ]) }) - } : () => {}, process.env.VUE_APP_LOCK_FOR_TIME) + } : () => { }, process.env.VUE_APP_LOCK_FOR_TIME) } VueInit() diff --git a/src/permission.js b/src/permission.js index c1d1f2d..ef9c6c2 100644 --- a/src/permission.js +++ b/src/permission.js @@ -12,7 +12,7 @@ NProgress.configure({ showSpinner: false }) const whiteList = ['/ReviewersResearch', '/login', '/error', '/resetpassword', '/recompose', '/email-recompose', '/trialStats', '/showdicom', '/imagesShare', '/audit', '/preview', '/researchLogin', '/blindResumeInfo', '/trialsResume', '/joinVerify', '/showNoneDicoms', '/noneDicomReading', '/clinicalData', '/readingDicoms', '/readingPage', '/visitDicomReview', '/visitNondicomReview', '/globalReview', '/adReview', '/oncologyReview', '/nonedicoms'] -router.beforeEach(async(to, from, next) => { +router.beforeEach(async (to, from, next) => { NProgress.start() // 设置页面标题 // document.title = getPageTitle(to.meta.title) @@ -56,7 +56,10 @@ router.beforeEach(async(to, from, next) => { /* has no token*/ if (whiteList.indexOf(to.path) !== -1) { // 在免登录whiteList中,直接进入 - if (to.path === '/readingDicoms' || to.path === '/noneDicomReading'){ + if (to.path === '/readingDicoms' || to.path === '/noneDicomReading') { + OSSclient() + } + if (to.path === '/login') { OSSclient() } next() @@ -68,7 +71,7 @@ router.beforeEach(async(to, from, next) => { next(`/ReviewersResearch?`) NProgress.done() } else { - // 其他无权访问的页面将重定向到登录页面。 + // 其他无权访问的页面将重定向到登录页面。 next(`/login?`) NProgress.done() } diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 326a0c0..3e1ce6f 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -6,7 +6,15 @@