通过地址栏切换语言
This commit is contained in:
parent
27cbe72e19
commit
350f310c0d
|
@ -10,6 +10,7 @@
|
||||||
import { defineComponent, ref, onBeforeMount, onMounted, watch ,provide} from 'vue'
|
import { defineComponent, ref, onBeforeMount, onMounted, watch ,provide} from 'vue'
|
||||||
import { ElConfigProvider } from 'element-plus'
|
import { ElConfigProvider } from 'element-plus'
|
||||||
import { ipoStore } from "@/stores/ipo"
|
import { ipoStore } from "@/stores/ipo"
|
||||||
|
import router from './router'
|
||||||
const showRouter=ref(true)
|
const showRouter=ref(true)
|
||||||
const reflashRouter=()=>{
|
const reflashRouter=()=>{
|
||||||
showRouter.value=false;
|
showRouter.value=false;
|
||||||
|
|
|
@ -28,6 +28,32 @@ export const staticRoutes: Array<RouteRecordRaw> = [
|
||||||
hidden: true,
|
hidden: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
path: "/home/en",
|
||||||
|
name: "XLogin1",
|
||||||
|
component: () => import("@/views/login/index.vue"),
|
||||||
|
meta: {
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/home/tc",
|
||||||
|
name: "XLogin2",
|
||||||
|
component: () => import("@/views/login/index.vue"),
|
||||||
|
meta: {
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/home/sc",
|
||||||
|
name: "XLogin3",
|
||||||
|
component: () => import("@/views/login/index.vue"),
|
||||||
|
meta: {
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: "/dashboard",
|
path: "/dashboard",
|
||||||
name: "Xdashboard",
|
name: "Xdashboard",
|
||||||
|
|
|
@ -641,7 +641,7 @@ function setAdvisers(mockRes: any) {
|
||||||
}
|
}
|
||||||
function setTransaction(mockRes: any) {
|
function setTransaction(mockRes: any) {
|
||||||
const { brokerage, sfcLevy, sehkTradingFee, afrcTransactionLevy } = mockRes;
|
const { brokerage, sfcLevy, sehkTradingFee, afrcTransactionLevy } = mockRes;
|
||||||
console.log('@@11123', afrcTransactionLevy)
|
//console.log('@@11123', afrcTransactionLevy)
|
||||||
const arr = [
|
const arr = [
|
||||||
{ info: has_data(brokerage?.toFixed(5), "%"), info2: has_data(sfcLevy?.toFixed(5), "%") },
|
{ info: has_data(brokerage?.toFixed(5), "%"), info2: has_data(sfcLevy?.toFixed(5), "%") },
|
||||||
{ info: has_data(sehkTradingFee?.toFixed(5), "%"), info2: has_data(afrcTransactionLevy?.toFixed(5), "%") },
|
{ info: has_data(sehkTradingFee?.toFixed(5), "%"), info2: has_data(afrcTransactionLevy?.toFixed(5), "%") },
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { ref, defineExpose ,inject} from 'vue';
|
||||||
import { getCurrentInstance } from 'vue'
|
import { getCurrentInstance } from 'vue'
|
||||||
import { ipoStore } from "@/stores/ipo"
|
import { ipoStore } from "@/stores/ipo"
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import router from '@/router';
|
||||||
const store = ipoStore()
|
const store = ipoStore()
|
||||||
const route=useRouter()
|
const route=useRouter()
|
||||||
const { proxy } = (getCurrentInstance() as any)
|
const { proxy } = (getCurrentInstance() as any)
|
||||||
|
@ -30,6 +31,7 @@ const IpoReflash=()=>{
|
||||||
// }
|
// }
|
||||||
reflashRouter()
|
reflashRouter()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleLang1 = () => {
|
const handleLang1 = () => {
|
||||||
if (proxy.$i18n.locale = 'en') {
|
if (proxy.$i18n.locale = 'en') {
|
||||||
proxy.$i18n.locale = 'en'
|
proxy.$i18n.locale = 'en'
|
||||||
|
@ -46,6 +48,7 @@ const handleLang2 = () => {
|
||||||
}
|
}
|
||||||
store.setLocale(2)
|
store.setLocale(2)
|
||||||
IpoReflash()
|
IpoReflash()
|
||||||
|
|
||||||
}
|
}
|
||||||
const handleLang3 = () => {
|
const handleLang3 = () => {
|
||||||
if (proxy.$i18n.locale = 'zhCn') {
|
if (proxy.$i18n.locale = 'zhCn') {
|
||||||
|
@ -53,6 +56,7 @@ const handleLang3 = () => {
|
||||||
}
|
}
|
||||||
store.setLocale(3)
|
store.setLocale(3)
|
||||||
IpoReflash()
|
IpoReflash()
|
||||||
|
|
||||||
}
|
}
|
||||||
defineExpose({
|
defineExpose({
|
||||||
showLang
|
showLang
|
||||||
|
|
|
@ -15,27 +15,21 @@
|
||||||
<div class="searchWrap">
|
<div class="searchWrap">
|
||||||
<el-autocomplete v-model="state" :fetch-suggestions="querySearch" :trigger-on-focus="false"
|
<el-autocomplete v-model="state" :fetch-suggestions="querySearch" :trigger-on-focus="false"
|
||||||
clearable class="inline-input w-50" @select="handleSelect" @keyup.enter="handleSelect"
|
clearable class="inline-input w-50" @select="handleSelect" @keyup.enter="handleSelect"
|
||||||
:enterkeyhint="'search'"
|
:enterkeyhint="'search'">
|
||||||
>
|
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<img class="imgSearch123" src="@/assets/1x/1x/source2.png" alt="找不到图片"
|
<img class="imgSearch123" src="@/assets/1x/1x/source2.png" alt="找不到图片"
|
||||||
@click="handleSelect">
|
@click="handleSelect">
|
||||||
</template>
|
</template>
|
||||||
</el-autocomplete>
|
</el-autocomplete>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<img src="@/assets/1x/source4.png" class="first " @click="handleShowCup">
|
<img src="@/assets/1x/source4.png" class="first " @click="handleShowCup">
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown1">
|
<div class="dropdown1">
|
||||||
|
|
||||||
<img src="@/assets/1x/source1.png" @click="handleShowLang" class="second">
|
<img src="@/assets/1x/source1.png" @click="handleShowLang" class="second">
|
||||||
<Lang class="alert" ref="lang" />
|
<Lang class="alert" ref="lang" />
|
||||||
|
|
||||||
<!-- <SearchCup ref="SearchCupDom" class="searchCup" /> -->
|
<!-- <SearchCup ref="SearchCupDom" class="searchCup" /> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="bigger">
|
<div class="bigger">
|
||||||
<Main v-for="(item, index) in logos" :data="item" :key="index"></Main>
|
<Main v-for="(item, index) in logos" :data="item" :key="index"></Main>
|
||||||
|
@ -64,15 +58,11 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<!-- <template #date-cell="{ data }">
|
|
||||||
|
|
||||||
</template> -->
|
|
||||||
</el-calendar>
|
</el-calendar>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-bottom1">
|
<div class="right-bottom1">
|
||||||
<Event v-if="Eventdata.length" :data="Eventdata" />
|
<Event v-if="Eventdata.length" :data="Eventdata" />
|
||||||
<div v-else class="right-bottom-title1">No event</div>
|
<div v-else class="right-bottom-title1">No event</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -84,7 +74,7 @@ export default {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, onUnmounted, watch } from 'vue';
|
import { ref, onMounted, onUnmounted, watch, inject } from 'vue';
|
||||||
import Lang from "./components/Lang.vue";
|
import Lang from "./components/Lang.vue";
|
||||||
import Main from './components/Main.vue';
|
import Main from './components/Main.vue';
|
||||||
import { getHomeIpo, getIpo } from '@/api/reqIpo/ipo'
|
import { getHomeIpo, getIpo } from '@/api/reqIpo/ipo'
|
||||||
|
@ -99,10 +89,32 @@ import { ElMessage } from 'element-plus'
|
||||||
import SearchCup from "./components/SearchCup.vue";
|
import SearchCup from "./components/SearchCup.vue";
|
||||||
import Drawer from "./modelComponents/Drawer.vue";
|
import Drawer from "./modelComponents/Drawer.vue";
|
||||||
import Select from "./components/Select.vue";
|
import Select from "./components/Select.vue";
|
||||||
|
import { ipoStore } from "@/stores/ipo"
|
||||||
|
const { proxy } = (getCurrentInstance() as any)
|
||||||
|
const reflashRouter = inject('reflashRouter') as Function
|
||||||
|
const router = useRouter()
|
||||||
|
const store = ipoStore()
|
||||||
const selectR = ref();
|
const selectR = ref();
|
||||||
const dayValue = ref(new Date())
|
const dayValue = ref(new Date())
|
||||||
const drawer = ref(false)
|
const drawer = ref(false)
|
||||||
|
onMounted(() => {
|
||||||
|
window.onhashchange = function () {
|
||||||
|
const langHref = window.location.href.split("home/")[1]
|
||||||
|
if (langHref == 'en') {
|
||||||
|
proxy.$i18n.locale = 'en'
|
||||||
|
store.setLocale(1)
|
||||||
|
} else if (langHref == 'tc') {
|
||||||
|
proxy.$i18n.locale = 'zhCt'
|
||||||
|
store.setLocale(2)
|
||||||
|
} else if (langHref == 'sc') {
|
||||||
|
proxy.$i18n.locale = 'zhCn'
|
||||||
|
|
||||||
|
store.setLocale(3)
|
||||||
|
}
|
||||||
|
reflashRouter()
|
||||||
|
|
||||||
|
};
|
||||||
|
})
|
||||||
const selectCards = async (res: any) => {
|
const selectCards = async (res: any) => {
|
||||||
async function demo() {
|
async function demo() {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
|
@ -112,7 +124,7 @@ const selectCards = async (res: any) => {
|
||||||
throw ("222")
|
throw ("222")
|
||||||
}
|
}
|
||||||
const data = (res as any).data.map((item: any) => {
|
const data = (res as any).data.map((item: any) => {
|
||||||
let { stkCode, dateTime, status, ipoID, companyEngFull, companyChiFull, priceFinal, logoLink, priceMin, priceMax, listingDate, pricingDate,tradeCurrency } = item;
|
let { stkCode, dateTime, status, ipoID, companyEngFull, companyChiFull, priceFinal, logoLink, priceMin, priceMax, listingDate, pricingDate, tradeCurrency } = item;
|
||||||
return {
|
return {
|
||||||
logolinks: logoLink,
|
logolinks: logoLink,
|
||||||
title: companyEngFull + ";" + companyChiFull,
|
title: companyEngFull + ";" + companyChiFull,
|
||||||
|
@ -123,7 +135,7 @@ const selectCards = async (res: any) => {
|
||||||
ipoID: ipoID,
|
ipoID: ipoID,
|
||||||
price: priceFinal,
|
price: priceFinal,
|
||||||
listingDate: listingDate,
|
listingDate: listingDate,
|
||||||
tradeCurrency:tradeCurrency
|
tradeCurrency: tradeCurrency
|
||||||
}
|
}
|
||||||
function priceMinMax() {
|
function priceMinMax() {
|
||||||
if (priceMin && priceMax) {
|
if (priceMin && priceMax) {
|
||||||
|
@ -164,12 +176,12 @@ const handleDrawer = (done: () => void) => {
|
||||||
const openDrawer = () => {
|
const openDrawer = () => {
|
||||||
drawer.value = true;
|
drawer.value = true;
|
||||||
}
|
}
|
||||||
const { proxy } = (getCurrentInstance() as any)
|
|
||||||
const handleSelect = () => {
|
const handleSelect = () => {
|
||||||
// console.log('@@@', state.value)
|
// console.log('@@@', state.value)
|
||||||
getSearchIpoList(state.value)
|
getSearchIpoList(state.value)
|
||||||
}
|
}
|
||||||
const router = useRouter()
|
|
||||||
watch(dayValue, async (ne, ol) => {
|
watch(dayValue, async (ne, ol) => {
|
||||||
const day = moment(ne).format("YYYY-MM-DD")
|
const day = moment(ne).format("YYYY-MM-DD")
|
||||||
const result = await getEventData(day);
|
const result = await getEventData(day);
|
||||||
|
@ -257,6 +269,7 @@ const setEventdata = (EventD: any) => {
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const getHomeIpoList = async () => {
|
const getHomeIpoList = async () => {
|
||||||
async function demo() {
|
async function demo() {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
|
@ -277,7 +290,7 @@ const getHomeIpoList = async () => {
|
||||||
ipoID: ipoID,
|
ipoID: ipoID,
|
||||||
price: priceFinal,
|
price: priceFinal,
|
||||||
listingDate: listingDate,
|
listingDate: listingDate,
|
||||||
tradeCurrency:tradeCurrency
|
tradeCurrency: tradeCurrency
|
||||||
}
|
}
|
||||||
function priceMinMax() {
|
function priceMinMax() {
|
||||||
if (priceMin && priceMax) {
|
if (priceMin && priceMax) {
|
||||||
|
@ -335,7 +348,7 @@ const getSearchIpoList = async (keyword: string) => {
|
||||||
ipoID: ipoID,
|
ipoID: ipoID,
|
||||||
price: priceFinal,
|
price: priceFinal,
|
||||||
listingDate: listingDate,
|
listingDate: listingDate,
|
||||||
tradeCurrency:tradeCurrency
|
tradeCurrency: tradeCurrency
|
||||||
}
|
}
|
||||||
function priceMinMax() {
|
function priceMinMax() {
|
||||||
if (priceMin && priceMax) {
|
if (priceMin && priceMax) {
|
||||||
|
@ -755,8 +768,8 @@ function fn(data: any) {
|
||||||
|
|
||||||
:deep(.el-calendar-table) {
|
:deep(.el-calendar-table) {
|
||||||
width: 380px;
|
width: 380px;
|
||||||
// transform: translateX(-20px);
|
// transform: translateX(-20px);
|
||||||
// margin-top: 20px;
|
// margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-button--small) {
|
:deep(.el-button--small) {
|
||||||
|
@ -788,6 +801,7 @@ function fn(data: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.el-calendar-table td) {
|
:deep(.el-calendar-table td) {
|
||||||
border: none;
|
border: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
Loading…
Reference in New Issue