中英文切换修复

master
yujialong 1 year ago
parent 1826aa3ce5
commit 2bbbe94bad
  1. 1
      src/layouts/footer/index.vue
  2. 7
      src/libs/util.js
  3. 15
      src/main.js
  4. 1
      src/pages/column/index.vue
  5. 23
      src/pages/publication/index.vue
  6. 5
      src/router/permission.js

@ -162,7 +162,6 @@ export default {
isSort: 1
}).then(({ data }) => {
console.log("🚀 ~ file: index.vue:177 ~ this.$post ~ json:", window.innerWidth)
this.columns = data.slice(0, 5)
}).catch(err => { })
},

@ -2,6 +2,7 @@ import { _local } from "./util.db";
import { Message } from "element-ui";
import Router from '@/router'
import Setting from '@/setting'
import store from '@/store'
// 文件后缀集合
const exts = {
@ -146,6 +147,12 @@ const util = {
isEn(id) {
return Setting.enIds.includes(+id)
},
// 传入站点id,判断是否英文
getLang(id) {
let siteId = util.getQuery('siteId')
console.log("🚀 ~ file: main.js:42 ~ siteId:", siteId)
return Setting.enIds.includes(siteId ? +siteId : store.state.content.site) ? 'en' : 'zh'
},
};
export default util;

@ -16,7 +16,7 @@ import Util from '@/libs/util'
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import ElementLocale from 'element-ui/lib/locale'
// import permission from '@/router/permission'
// 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, {}))
@ -38,18 +38,25 @@ Vue.use(ElementUI, {
i18n: (key, value) => i18n.t(key, value)
});
const siteId = Util.getQuery('siteId')
router.beforeEach((to, from, next) => {
console.log("🚀 ~ file: permission.js:5 ~ router.beforeEach ~ to:", Util.getLang())
VueI18n.locale = Util.getLang()
next()
})
const i18n = new VueI18n({
locale: Setting.enIds.includes(siteId ? +siteId : store.state.content.site) ? 'en' : 'zh',
locale: Util.getLang(),
messages: {
'en':Object.assign(messages.en,enLocale),//将我们项目中的语言包与Element的语言包进行合并
'zh':Object.assign(messages.zh,zhLocale),
}
});
new Vue({
const vue = new Vue({
mixins: [mixinApp],
router,
i18n,
store,
render: h => h(App)
}).$mount("#app");
export default vue

@ -599,7 +599,6 @@ export default {
this.getAllId = id
this.getArticle(id);
this.columns = data;
console.log("🚀 ~ file: index.vue:608 ~ .then ~ this.columns:", this.columns)
// banner
if (!this.info.columnBanner) {
this.getBanner(data);

@ -1,7 +1,10 @@
<template>
<div class="wrap">
<div class="banner">
<img width="100%" height="280" :src="info.columnBanner" alt="" />
<img width="100%"
height="280"
:src="info.columnBanner"
alt="" />
<div class="texts">
<p class="text">{{ info.columnName }}</p>
</div>
@ -9,18 +12,23 @@
<ul class="tabs wow fadeInLeft">
<template v-for="(item, i) in tabs">
<li :class="{active: item.listStyleId == active}" :key="i" @click="tabChange(item, i)">{{ item.columnName | i18nName($i18n) }}</li>
<li :class="{active: item.listStyleId == active}"
:key="i"
@click="tabChange(item, i)">{{ item.columnName | i18nName($i18n) }}</li>
</template>
</ul>
<div class="tab-content">
<!-- 根据栏目的listStyleId判断是哪个列表样式这个出版物页面只显示下面三个列表样式 -->
<!-- 论文 -->
<Thesis v-if="active === 46" :id.sync="curId" />
<Thesis v-if="active === 46"
:id.sync="curId" />
<!-- 专利 -->
<Patent v-if="active === 44" :id.sync="curId" />
<Patent v-if="active === 44"
:id.sync="curId" />
<!-- 专著 -->
<Monograph v-if="active === 45" :id.sync="curId" />
<Monograph v-if="active === 45"
:id.sync="curId" />
</div>
</div>
</template>
@ -85,7 +93,6 @@ export default {
},
filters: {
i18nName (name, type) {
console.log(type)
switch (name) {
case '专利':
return type.t('column.patent')
@ -140,8 +147,8 @@ export default {
text-shadow: 0px 2px 14px rgba(167, 167, 167, 0.26);
cursor: pointer;
&.active {
color: #1583FF;
border-bottom-color: #1583FF;
color: #1583ff;
border-bottom-color: #1583ff;
}
}
}

@ -1,7 +1,6 @@
import router from "./index";
import Setting from "@/setting";
import router from './index'
import Setting from '@/setting'
router.beforeEach((to, from, next) => {
document.title = Setting.titleSuffix
next()
})
Loading…
Cancel
Save