前端国际化

uat_us
熊飞 2024-01-10 11:40:34 +08:00
parent 607e6e6dac
commit 4421a1900e
14 changed files with 12340 additions and 20 deletions

220
public/error.html Normal file
View File

@ -0,0 +1,220 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="pragram" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-store,no-cache,must-revalidate">
<meta http-equiv="Cache" content="no-cache">
<title>Title</title>
<script src="./error_assets/vue.js"></script>
</head>
<body>
<div id="app">
<div class="login-container">
<div class="login-header">
</div>
<div class="login-body">
<div class="login-l">
<div class="login-logo">
<img src="./error_assets/zzlogo2.png" alt="">
<img v-show="false" src="./error_assets/zzlogo3.png" alt="">
</div>
<div class="login-image">
<img src="./error_assets/login-bg.png">
</div>
</div>
<div class="login-r">
<div class="title-container" style="display: flex;padding-top:180px;justify-content: flex-start;height: 100%;box-sizing: border-box">
<!-- IRC Management System -->
<!-- <div class="title" style="text-align: center;font-size: 28px;margin-top: 100px;padding-right: 120px"></div>-->
<!-- <div class="title" v-show="false">IRC Imaging System</div>-->
<div style="color: #0a84ff;text-align: left;font-size: 28px">
{{message}}
</div>
</div>
</div>
</div>
<div class="login-footer">
<span>Copyright © {{ new Date().getFullYear() }} 上海展影医疗科技有限公司 版权所有</span>
<span> | </span>
<a target="_blank" href="https://beian.miit.gov.cn/">
<span style="color:#999">
沪ICP备2021037850-2
</span>
</a>
<span> | </span>
<a style="color:#999" target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=31011002005859">
<img src="./error_assets/filing.png">
<span>沪公网安备 31011002005859号</span>
</a>
</div>
<el-dialog
v-if="aboutVisible"
:visible.sync="aboutVisible"
width="680px"
style="margin-top: 0;"
:close-on-click-modal="false"
size="small"
>
<div style="margin: 0 auto;width: 600px;line-height: 28px;text-align: center" >
<h1 style="text-align: center;margin-bottom: 20px">关于</h1>
<p style="margin-bottom: 20px">
IRC Imaging System
</p>
<p style="margin-bottom: 20px">
V1.2.0.001
</p>
<p style="margin-bottom: 20px">
Copyright © {{ new Date().getFullYear() }} 上海展影医疗科技有限公司 版权所有
</p>
<p style="margin-bottom: 20px" >
Copyright © {{ new Date().getFullYear() }} Shanghai Extensive Imaging Inc.
</p>
<div style="margin-bottom: 20px">
<img style="width: 180px" src="./error_assets/zzlogo2.png" alt="">
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" size="mini" @click="aboutVisible = false">关闭</el-button>
</div>
</el-dialog>
</div>
</div>
<script>
console.log(Vue)
new Vue({
el: '#app',
data() {
return {
aboutVisible: false,
message: '出错了'
}
},
mounted() {
const urlParams = new URLSearchParams(window.location.search);
var message = urlParams.get('message');
this.message = message
}
})
</script>
</body>
<style>
#app, body, html{
height: 100%;
}
/* reset element-ui css */
.login-container .el-input {
display: inline-block;
height: 47px;
width: 85%;
}
.login-container .el-input input {
background: #f4f4f5;
border: 0px;
-webkit-appearance: none;
border-radius: 0px;
padding: 12px 5px 12px 15px;
height: 47px;
}
.login-container .el-form-item {
border: 1px solid rgba(255, 255, 255, 0.1);
background: #f4f4f5;
border-radius: 5px;
color: #454545;
}
</style>
<style>
.login-container{
position: relative;
width: 100%;
height: 100%;
overflow: auto;
background: rgb(249, 249, 249);
}
.login-container .login-header{
margin: 10px 0px 20px 10px;
height: 3rem;
width: 720px;
}
.login-container .login-header .login-logo{
height: 100%;
}
.login-container .login-body{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
width: 1200px;
height: 600px;
box-sizing: border-box;
background: rgb(255, 255, 255);
border-radius: 10px 0px 0px 10px;
}
.login-container .login-body .login-l{
position: relative;
float: left;
width: 50%;
height: 100%;
}
.login-container .login-body .login-l .login-logo{
position: absolute;
top:35px;
left: 50px;
}
.login-container .login-body .login-l .login-logo img{
height: 40px;
}
.login-container .login-body .login-l .login-image{
position: absolute;
top:10px;
left: 0px;
height: 100%;
}
.login-container .login-body .login-l .login-image img{
height: 100%;
}
.login-container .login-body .login-r{
position: relative;
float: left;
width: 50%;
height: 100%;
}
.login-footer {
position: absolute;
bottom: 50px;
left: 0px;
width: 100%;
text-align: center;
line-height: 20px;
font-size: 14px;
display: flex;
justify-content: center;
align-items: center;
color: #909399;
}
.login-footer a{
display:inline-block;
text-decoration:none;
height:20px;
line-height:20px;
display: flex;
justify-content: center;
}
.login-footer span{
margin: 0 2px;
}
.login-footer img{
height:20px;
line-height:20px;
}
</style>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

11965
public/error_assets/vue.js Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -1,12 +1,108 @@
<template>
<div id="app">
<div id="app" style="position: relative">
<router-view />
<div @click="openI18n" style="position: fixed;bottom: 100px;right: 50px;z-index: 100000;width: 50px;height: 50px;background: #409eff88;line-height: 50px;text-align: center;color:#fff;border-radius: 50%;cursor: pointer">
i18n
</div>
<el-drawer
title="国际化"
:visible.sync="drawer"
direction="rtl"
size="80%">
<el-table
:data="tableData"
v-adaptive="{bottomOffset:50}"
height="100"
style="width: 100%">
<el-table-column
prop="Code"
label="标签"
width="300">
</el-table-column>
<el-table-column
prop="Description"
label="路由"
show-overflow-tooltip
width="180">
<template slot-scope="scope">
{{scope.row.Description}}
</template>
</el-table-column>
<el-table-column
prop="Value"
label="英文">
<template slot-scope="scope">
<el-input v-model="scope.row.Value" @input="(e) => {$set(scope.row, 'Value', e)}" size="mini"></el-input>
</template>
</el-table-column>
<el-table-column
prop="ValueCN"
label="中文">
<template slot-scope="scope">
<el-input v-model="scope.row.ValueCN" @input="(e) => {$set(scope.row, 'ValueCN', e)}" size="mini"></el-input>
</template>
</el-table-column>
</el-table>
<div style="text-align: right;padding-top: 10px;padding-right: 10px;">
<el-button size="mini" @click="drawer = false">取消
</el-button>
<el-button size="mini" type="primary" @click="handleSave"></el-button>
</div>
</el-drawer>
</div>
</template>
<script>
import { batchAddOrUpdateFrontInternationalization } from '@/api/dictionary/dictionary'
import Vue from "vue";
import i18n from "./lang";
export default {
name: 'App'
name: 'App',
data () {
return {
drawer: false,
tableData: []
}
},
mounted() {
},
methods: {
changeValue(target, attr, e) {
this.$set(target, attr, e)
},
handleSave() {
console.log(this.tableData)
this.$confirm('确定修改当前页面国际化内容?').then(() => {
batchAddOrUpdateFrontInternationalization(this.tableData).then(res => {
var zhMessages = {}, enMessages = {}
this.tableData.forEach(v => {
zhMessages[v.Description + '_' + v.Code] = v.ValueCN
enMessages[v.Description + '_' + v.Code] = v.Value
})
i18n.mergeLocaleMessage('zh', zhMessages)
i18n.mergeLocaleMessage('en', enMessages)
this.drawer = false
this.$message.success('国际化修改成功')
})
})
},
openI18n() {
this.tableData = []
this.drawer = true
let tableData = this.$tl.map(v => {
let a = {...v}
if (!a.Description) {
a.Description = this.$route.path
}
return a
})
tableData = tableData.filter(v => {
return ~this.$path.indexOf(v.Description + '_' + v.Code)
})
this.tableData = Object.assign([], tableData)
console.log(this.tableData)
}
}
}
</script>

View File

@ -37,3 +37,18 @@ export function setCriterionDictionary(params) {
})
}
export function getFrontInternationalizationList(params) {
return request({
url: `/Internationalization/getFrontInternationalizationList`,
method: 'get',
})
}
export function batchAddOrUpdateFrontInternationalization(params) {
return request({
url: `/Internationalization/batchAddOrUpdateFrontInternationalization`,
method: 'post',
data: params
})
}

View File

@ -3,18 +3,17 @@ import VueI18n from 'vue-i18n'
import store from '@/store'
import elementEnLocale from 'element-ui/lib/locale/lang/en' // element-ui lang
import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'// element-ui lang
import enLocale from './en'
import zhLocale from './zh'
// import enLocale from './en'
// import zhLocale from './zh'
// import { getFrontInternationalizationList } from '@/api/dictionary/dictionary'
// import xfenLocale from './xfen'
// import xfzhLocale from './xfzh'
Vue.use(VueI18n)
const messages = {
en: {
...enLocale,
...elementEnLocale
},
zh: {
...zhLocale,
...elementZhLocale
}
}

View File

@ -3,7 +3,7 @@ import Vue from 'vue'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI, { MessageBox } from 'element-ui'
import { getBasicDataAllSelect } from '@/api/dictionary/dictionary'
import { getBasicDataAllSelect, getFrontInternationalizationList } from '@/api/dictionary/dictionary'
// import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/theme-blue/index.css' // 浅绿色主题
import './assets/css/iconfont/index.css' // 阿里巴巴图标库
@ -54,12 +54,6 @@ Vue.use(hasPermi)
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale, size: 'medium' })
// 如果想要中文版 element-ui按如下方式声明
// Vue.use(ElementUI)
Vue.use(ElementUI, {
i18n: (key, value) => i18n.t(key, value),
size: 'medium'
})
import upload from '@/components/element-ui/upload'
Vue.use(upload)
import adaptive from '@/directive/adaptive/index'
@ -169,6 +163,19 @@ async function VueInit () {
params = $q('TrialReadingCriterionId')
}
var res = await getBasicDataAllSelect(params)
var Internationalization = await getFrontInternationalizationList()
Vue.prototype.$tl = Internationalization.Result
let zhMessages = {}, enMessages = {}
Vue.prototype.$tl.forEach(v => {
zhMessages[v.Description + '_' + v.Code] = v.ValueCN
enMessages[v.Description + '_' + v.Code] = v.Value
})
i18n.mergeLocaleMessage('zh', zhMessages)
i18n.mergeLocaleMessage('en', enMessages)
Vue.use(ElementUI, {
i18n: (key, value) => i18n.t(key, value),
size: 'medium'
})
let d = function (code) {
var dictInfo = res.Result
var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh'
@ -202,7 +209,6 @@ async function VueInit () {
return i[type] === v
}).label : ''
} catch (e) {
console.log(e)
}
}
Vue.prototype.$updateDictionary = function() {
@ -230,6 +236,12 @@ async function VueInit () {
}()
_vm.$forceUpdate()
}
Vue.prototype.$path = []
var t = function (key) {
Vue.prototype.$path.push(Vue.prototype.toPath + '_' + key)
return i18n.t(Vue.prototype.toPath + '_' + key)
}
Vue.prototype.$t = t
_vm = new Vue({
el: '#app',
router,

View File

@ -4,6 +4,7 @@ import store from './store'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth'
import Vue from 'vue'
import { OSSclient } from './utils/oss'
// import getPageTitle from '@/utils/get-page-title'
@ -18,6 +19,8 @@ router.beforeEach(async(to, from, next) => {
// 确定用户是否已登录
const hasToken = getToken()
Vue.prototype.toPath = to.path
Vue.prototype.$path = []
if (hasToken) {
if (to.path === '/login' || to.path === '/recompose' || to.path === '/email-recompose' || to.path === '/error' || to.path === '/ReviewersResearchForm' || to.path === '/ReviewersResearch') {
next()

View File

@ -16,6 +16,7 @@
<div slot="file" slot-scope="{file}">
<img
class="el-upload-list__item-thumbnail"
crossOrigin="Anonymous"
:src="OSSclientConfig.basePath + file.url"
alt=""
>
@ -42,7 +43,7 @@
:visible.sync="imgVisible"
width="600px"
>
<el-image :src="imageUrl" width="100%">
<el-image :src="imageUrl" width="100%" crossOrigin="Anonymous">
<div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span>
</div>

View File

@ -47,6 +47,16 @@
<el-option v-for="item of $d.YesOrNo" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item :label="$t('trials:crcQuestion:table:isClose')">
<el-select v-model="searchData.IsClosed" clearable style="width:120px">
<el-option v-for="item of $d.YesOrNo" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item :label="$t('trials:crcQuestion:table:reuploadSatus')">
<el-select v-model="searchData.ReuploadEnum" clearable style="width:120px">
<el-option v-for="item of $d.ReuploadEnum" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">
{{ $t('common:button:search') }}
@ -265,6 +275,7 @@ const searchDataDefault = () => {
SubjectCode: '',
SiteId: '',
VisitPlanArray: [],
IsClosed: null,
PageIndex: 1,
PageSize: 20
}

View File

@ -629,7 +629,7 @@ export default {
while (
studyIndex < scope.uploadQueues.length &&
scope.uploadQueues[studyIndex].dicomInfo.studyUid !== studyUid &&
(pixelDataElement || modality !== 'SR')
(pixelDataElement || modality === 'SR') && modality != ''
) {
++studyIndex
}
@ -697,7 +697,7 @@ export default {
while (
instanceIndex < fileList.length &&
fileList[instanceIndex].instanceUid !== instanceUid &&
(pixelDataElement || modality !== 'SR')
(pixelDataElement || modality === 'SR')
) {
++instanceIndex
}
@ -717,7 +717,7 @@ export default {
var seriesItem = seriesList.find(function(item) {
return item.seriesUid === seriesUid
})
if (!seriesItem) {
if (!seriesItem && (pixelDataElement || modality === 'SR')) {
var date = data.string('x00080021')
var time = data.string('x00080031')
var seriesTime = ''
@ -1049,8 +1049,6 @@ export default {
let fileId = cornerstoneWADOImageLoader.wadouri.fileManager.add(
o.file
)
console.log(o)
console.log(o.modality)
let blob = await scope.dicomToPng(fileId, o.imageColumns, o.imageRows)
let thumbnailPath = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}/${v.seriesUid}.png`
let OSSclient = scope.OSSclient