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