oss上传文件名称问题
continuous-integration/drone/push Build is passing Details

uat_us
wangxiaoshuang 2024-05-15 10:16:04 +08:00
parent 289230b72c
commit 85a518d900
2 changed files with 60 additions and 47 deletions

View File

@ -63,8 +63,8 @@ Vue.use(adaptive)
import dialogDrag from '@/directive/dialogDrag' import dialogDrag from '@/directive/dialogDrag'
// 窗口拖拽 // 窗口拖拽
Vue.use(dialogDrag) Vue.use(dialogDrag)
if(!String.prototype.replaceAll){ if (!String.prototype.replaceAll) {
String.prototype.replaceAll = function(str, newStr){ String.prototype.replaceAll = function (str, newStr) {
// 正则表达式 // 正则表达式
if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') { if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {
return this.replace(str, newStr) return this.replace(str, newStr)
@ -96,12 +96,24 @@ Vue.prototype.selectDictLabel = selectDictLabel
// Vue.prototype.download = download // Vue.prototype.download = download
Vue.prototype.handleTree = handleTree Vue.prototype.handleTree = handleTree
Vue.prototype.$getObjectName = (url) => { Vue.prototype.$getObjectName = (url) => {
// console.log(Vue.prototype.)
// console.log(url) // console.log(url)
var value = url var value = url
var str = value.split("//"); //https://进行分割, // 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 截取, // // console.log(str[1].substring(index)); //substring 截取,
return '/' + str[1].substring(index) // return '/' + str[1].substring(index)
let basePath = Vue.prototype.OSSclientConfig.viewEndpoint;
let basePathHttp = Vue.prototype.OSSclientConfig.viewEndpoint.replace("https", 'http')
let arr = value.split(basePath);
let name = null;
if (arr.length > 1) {
name = arr[1];
} else {
name = value.split(basePathHttp)[1];
}
// console.log(name)
return name;
} }
Vue.prototype.getGuid = (text) => { Vue.prototype.getGuid = (text) => {
text = md5(text) text = md5(text)
@ -117,14 +129,14 @@ Vue.prototype.getGuid = (text) => {
t9 = text.substr(16, 4) t9 = text.substr(16, 4)
t10 = text.substr(20, 12) t10 = text.substr(20, 12)
// console.log(`${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}` return `${t4 + t3 + t2 + t1}-${t6 + t5}-${t8 + t7}-${t9}-${t10}`
} }
Vue.prototype.$validatePassword = (rule, value, callback) => { 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 */ /* eslint-disable */
var reg1 = eval(process.env.VUE_APP_PASSWORD_FOR_PERMISSION) ? new RegExp(`${process.env.VUE_APP_PASSWORD_FOR_REGULAR}`) : /.*/g; //密码必须是8位以上、必须含有字母、数字、特殊符号 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)) { if (!reg1.test(value)) {
callback(lang==='zh' ? new Error("密码必须包含18 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("密码必须包含18 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 { } else {
callback(); callback();
} }
@ -158,7 +170,7 @@ Vue.prototype.fileToBlob = (file) => {
} }
var _vm var _vm
async function VueInit () { async function VueInit() {
var params var params
var res var res
if (~window.location.href.indexOf('/readingDicoms') || ~window.location.href.indexOf('/noneDicomReading') || ~window.location.href.indexOf('/criterionquestions') || ~window.location.href.indexOf('/petct')) { if (~window.location.href.indexOf('/readingDicoms') || ~window.location.href.indexOf('/noneDicomReading') || ~window.location.href.indexOf('/criterionquestions') || ~window.location.href.indexOf('/petct')) {
@ -187,14 +199,14 @@ async function VueInit () {
}) })
let d = function (code) { let d = function (code) {
var dictInfo = res.Result var dictInfo = res.Result
var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh' var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh'
try { try {
for (var code in dictInfo) { 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 { return {
id: dict.Id, id: dict.Id,
label: lang==='zh' ? dict.ValueCN : dict.Value, label: lang === 'zh' ? dict.ValueCN : dict.Value,
value: dict.DataTypeEnum === 3 ? eval(dict.Code) : dict.IsEnumInt ? parseInt(dict.Code): dict.Code, value: dict.DataTypeEnum === 3 ? eval(dict.Code) : dict.IsEnumInt ? parseInt(dict.Code) : dict.Code,
raw: Object.assign({}, dict), raw: Object.assign({}, dict),
IsBaseLineUse: false, IsBaseLineUse: false,
IsFollowVisitUse: false IsFollowVisitUse: false
@ -202,7 +214,7 @@ async function VueInit () {
}) : [] }) : []
dictInfo[code] = dictList dictInfo[code] = dictList
} }
} catch (e){ } catch (e) {
console.error(e) console.error(e)
} }
return dictInfo return dictInfo
@ -220,17 +232,17 @@ async function VueInit () {
} catch (e) { } catch (e) {
} }
} }
Vue.prototype.$updateDictionary = function() { Vue.prototype.$updateDictionary = function () {
Vue.prototype.$d = function (code) { Vue.prototype.$d = function (code) {
var dictInfo = res.Result var dictInfo = res.Result
var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh' var lang = zzSessionStorage.getItem('lang') ? zzSessionStorage.getItem('lang') : 'zh'
try { try {
for (var code in dictInfo) { 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 { return {
id: dict.raw.Id, id: dict.raw.Id,
label: lang==='zh' ? dict.raw.ValueCN : dict.raw.Value, 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, value: dict.raw.DataTypeEnum === 3 ? eval(dict.raw.Code) : dict.raw.IsEnumInt ? parseInt(dict.raw.Code) : dict.raw.Code,
raw: Object.assign({}, dict.raw), raw: Object.assign({}, dict.raw),
IsBaseLineUse: false, IsBaseLineUse: false,
IsFollowVisitUse: false IsFollowVisitUse: false
@ -238,7 +250,7 @@ async function VueInit () {
}) : [] }) : []
_vm.$set(dictInfo, code, dictList) _vm.$set(dictInfo, code, dictList)
} }
} catch (e){ } catch (e) {
console.error(e) console.error(e)
} }
return dictInfo return dictInfo
@ -274,14 +286,14 @@ async function VueInit () {
let count = 0; let count = 0;
if (eval(process.env.VUE_APP_LOGIN_FOR_PERMISSION)) { if (eval(process.env.VUE_APP_LOGIN_FOR_PERMISSION)) {
setInterval(() => { setInterval(() => {
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 === '/researchForm' || _vm.$route.path === '/researchLogin' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { 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 return
} }
if (_vm.$store.state.user.userId !== zzSessionStorage.getItem('userId')) { if (_vm.$store.state.user.userId !== zzSessionStorage.getItem('userId')) {
window.location.href = `/login` window.location.href = `/login`
zzSessionStorage.removeItem('lastWorkbench') 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', type: 'warning',
}) })
} }
@ -295,10 +307,10 @@ async function VueInit () {
function countTime() { function countTime() {
count++ count++
localStorage.setItem('count', count) localStorage.setItem('count', count)
if (count == parseInt(second2) || isLock === 'true') { if (count == parseInt(second2) || isLock === 'true') {
callback2(); callback2();
} }
if (count >= second) { if (count >= second) {
callback(); callback();
count = 0; count = 0;
localStorage.removeItem('count') localStorage.removeItem('count')
@ -334,23 +346,23 @@ async function VueInit () {
/* eslint-disable */ /* eslint-disable */
window.VUE_APP_COMPANY_NAME = process.env.VUE_APP_COMPANY_NAME; window.VUE_APP_COMPANY_NAME = process.env.VUE_APP_COMPANY_NAME;
waitOperate(eval(process.env.VUE_APP_LOGOUT_FOR_PERMISSION) ? () => { waitOperate(eval(process.env.VUE_APP_LOGOUT_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 === '/researchForm' || _vm.$route.path === '/researchLogin' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { 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') {
count = 0; count = 0;
localStorage.setItem('count', '0') localStorage.setItem('count', '0')
return return
} }
_vm.$store.dispatch('user/logout').then(res => { _vm.$store.dispatch('user/logout').then(res => {
window.location.href = `/login` 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!', { _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', type: 'warning',
}) })
} : () => {}, process.env.VUE_APP_LOGOUT_FOR_TIME, } : () => { }, process.env.VUE_APP_LOGOUT_FOR_TIME,
eval(process.env.VUE_APP_LOCK_FOR_PERMISSION) ? () => { 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 === '/researchForm' || _vm.$route.path === '/researchLogin' || _vm.$route.path === '/email-recompose' || _vm.$route.path === '/recompose' || _vm.$route.path === '/resetpassword' || _vm.$route.path === '/error') { 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') {
count = 0; count = 0;
localStorage.setItem('count', '0') localStorage.setItem('count', '0')
if (_vm.$route.path === '/login') { if (_vm.$route.path === '/login') {
@ -405,14 +417,14 @@ async function VueInit () {
} }
} }
}, },
message: h('div', {} , [ message: h('div', {}, [
h('el-form', { h('el-form', {
props: { labelWidth: "80px" } props: { labelWidth: "80px" }
}, [ }, [
h('el-form-item', { h('el-form-item', {
props: {label: lang === 'zh' ? '用户名' : 'Username'}, props: { label: lang === 'zh' ? '用户名' : 'Username' },
}, [ }, [
h('input',{ h('input', {
props: { props: {
value: _vm.unlock.my_username value: _vm.unlock.my_username
}, },
@ -432,7 +444,7 @@ async function VueInit () {
}) })
]), ]),
h('el-form-item', { h('el-form-item', {
props: {label: lang === 'zh' ? '密码' : 'Password'}, props: { label: lang === 'zh' ? '密码' : 'Password' },
}, [ }, [
h('input', { h('input', {
props: { props: {
@ -457,7 +469,7 @@ async function VueInit () {
]) ])
]) ])
}) })
} : () => {}, process.env.VUE_APP_LOCK_FOR_TIME) } : () => { }, process.env.VUE_APP_LOCK_FOR_TIME)
} }
VueInit() VueInit()

View File

@ -21,6 +21,7 @@ async function ossGenerateSTS() {
let res = await GetObjectStoreToken() let res = await GetObjectStoreToken()
Vue.prototype.OSSclientConfig = { ...res.Result[res.Result.ObjectStoreUse] } Vue.prototype.OSSclientConfig = { ...res.Result[res.Result.ObjectStoreUse] }
Vue.prototype.OSSclientConfig.basePath = Vue.prototype.OSSclientConfig.viewEndpoint Vue.prototype.OSSclientConfig.basePath = Vue.prototype.OSSclientConfig.viewEndpoint
console.log(Vue.prototype.OSSclientConfig.basePath)
switch (res.Result.ObjectStoreUse) { switch (res.Result.ObjectStoreUse) {
case 'AliyunOSS': case 'AliyunOSS':
Vue.prototype.OSSclientConfig.bucket = Vue.prototype.OSSclientConfig.bucketName Vue.prototype.OSSclientConfig.bucket = Vue.prototype.OSSclientConfig.bucketName
@ -40,7 +41,7 @@ async function ossGenerateSTS() {
if (res && res.url) { if (res && res.url) {
resolve({ resolve({
name: objectName, name: objectName,
url: Vue.prototype.OSSclientConfig.viewEndpoint + objectName url: res.url
}) })
} else { } else {
reject() reject()