2023-04-12 14:40:19 +08:00
|
|
|
|
|
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
|
|
|
import en from 'element-plus/dist/locale/en.mjs'
|
|
|
|
|
import zhTw from 'element-plus/dist/locale/zh-tw.mjs'
|
2023-06-16 16:02:24 +08:00
|
|
|
import request from "@/utils/request";
|
|
|
|
|
enum Api {
|
|
|
|
|
selectUrl="/api/ipo/refdata/searchAndFilter",
|
|
|
|
|
|
|
|
|
|
}
|
2023-04-12 14:40:19 +08:00
|
|
|
export const ipoStore = defineStore({
|
|
|
|
|
id: 'app',
|
|
|
|
|
state: () => ({
|
|
|
|
|
//1代表英文 2代表繁体中文 3代表简体中文
|
2023-04-14 14:52:32 +08:00
|
|
|
locale:1,
|
2023-06-16 16:02:24 +08:00
|
|
|
homeDay:new Date(),
|
|
|
|
|
mobileActiveShow:1,
|
|
|
|
|
mainExpand:-1,
|
|
|
|
|
filterObj:{}, //把过滤条件放在这里
|
|
|
|
|
keyWord:"",
|
|
|
|
|
selectedArr:{},
|
|
|
|
|
ipoIds:[] as any
|
2023-04-12 14:40:19 +08:00
|
|
|
}),
|
|
|
|
|
getters: {
|
|
|
|
|
localeLang(state) {
|
|
|
|
|
return [en,zhTw,zhCn][state.locale-1];
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
actions: {
|
|
|
|
|
//更改语言的方法
|
|
|
|
|
setLocale(data: number) {
|
2023-06-16 16:02:24 +08:00
|
|
|
this.locale = data
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
setHomeDay(day:string|Date){
|
|
|
|
|
this.homeDay=day as Date;
|
|
|
|
|
},
|
|
|
|
|
setMobileActiveShow(num:number){
|
|
|
|
|
this.mobileActiveShow=num;
|
|
|
|
|
},
|
|
|
|
|
setMainExpand(num:number){
|
|
|
|
|
this.mainExpand=num;
|
|
|
|
|
},
|
|
|
|
|
setFilterObje(obj:any){
|
|
|
|
|
this.filterObj=obj;
|
|
|
|
|
},
|
|
|
|
|
// reqSearchList(keyworld:string){
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
setSelectedArr(data:any){
|
|
|
|
|
this.selectedArr=data;
|
|
|
|
|
},
|
|
|
|
|
setKeyWord(keyWord:string){
|
|
|
|
|
this.keyWord=keyWord;
|
|
|
|
|
},
|
|
|
|
|
getSearchSelectList(){
|
|
|
|
|
const keyWord=this.keyWord;
|
|
|
|
|
const selectedArr=this.selectedArr;
|
|
|
|
|
return request.post<any, null>(Api.selectUrl,{keyWord,...selectedArr});
|
|
|
|
|
},
|
|
|
|
|
setIpoIds(ipoId:string|number){
|
|
|
|
|
const arr=this.$state.ipoIds;
|
|
|
|
|
const hasId= arr.some((i:any)=>i==ipoId);
|
|
|
|
|
const index=arr.findIndex((i:any)=>i==ipoId);
|
|
|
|
|
hasId&&arr.splice(index,1)
|
|
|
|
|
!hasId&&arr.push(ipoId)
|
|
|
|
|
},
|
|
|
|
|
isExpand(ipoId:string|number){
|
|
|
|
|
return this.$state.ipoIds.some((i:any)=>i==ipoId);
|
2023-04-12 14:40:19 +08:00
|
|
|
}
|
2023-06-16 16:02:24 +08:00
|
|
|
},
|
|
|
|
|
|
2023-04-12 14:40:19 +08:00
|
|
|
})
|