<script>
import { getToken } from '@/utils/const.ts';
import { getUserInfo } from '@/services/user.ts';
import { getIbFund } from '@/services/home/home.ts';
import { useUserStore } from '@/stores/user.ts';
export default {
	data() {
		return {
			langClass: 'zh-font'
		};
	},
	computed: {
		token: () => {
			return getToken();
		}
	},
	methods: {
		async getUserData() {
			const userStore = useUserStore();
			console.log('========getUserInfo========');
			const res = await getUserInfo();
			if (res && res.code === 0) {
				userStore.setUserInfo(res.data.loginUser);
				userStore.userInfo = res.data.loginUser;
				userStore.a = res.data.loginUser;
			}
		},
		async getIbFundData() {
			const userStore = useUserStore();
			const res = await getIbFund();
			if (res && res.code === 0) {
				userStore.ibFund = res.data;
			}
		}
	},
	watch: {
		token(newValue, oldValue) {
			if (newValue) {
				this.getUserData();
				this.getIbFundData();
			}
		}
	},
	onLaunch: function () {
		console.log('App Launch');
		const locale = uni.getLocale();
		console.log('locale==>', locale);
		if (['zh-CN', 'zh-TW'].includes(locale)) {
			this.langClass = 'zh-font';
		} else {
			this.langClass = 'en-font';
		}
	},
	onShow: async function () {
		if (getToken()) {
			this.getUserData();
			// this.getIbFundData();
		}
		console.log('App Show');
	},
	onHide: function () {
		console.log('App Hide');
	}
};
</script>

<style lang="scss">
::-webkit-scrollbar-track {
	border-radius: 10px;
	-webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
	border-radius: 3px;
	-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
	transition: all 3s linear;
	background-color: rgba(18, 21, 26, 0.1);
}
::-webkit-scrollbar-thumb:hover {
	background-color: rgba(18, 21, 26, 0.15);
}

::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}

@font-face {
	font-family: 'SourceHanSans'; /* 你可以给字体起一个别名 */
	src: url('/static/fonts/SourceHanSansCN-Regular.otf') format('truetype'); /* 还可以加上 ttf 格式作为备选 */
	font-weight: normal;
	font-style: normal;
}

#app {
  font-family: 'SourceHanSans';
	::v-deep .uni-easyinput__placeholder-class {
		font-size: 14px;
		text-overflow: ellipsis;
	}
	.uni-subtitle {
		display: block;
		margin-bottom: 2px;
	}
	::v-deep .is-input-border {
		border-radius: 0px;
	}
	::v-deep .uni-select {
		border-radius: 0px;
	}
	::v-deep .checklist-group .checklist-box .radio__inner {
		border-radius: 4px;
	}
	::v-deep .checklist-group .checklist-box .radio__inner .radio__inner-icon {
		border-radius: 2px;
	}
	::v-deep .checklist-group .checklist-box.is--default.is-checked .radio__inner {
		border-color: #e5e5e5 !important;
	}
	::v-deep .uni-datetime-picker--btn {
		background-color: rgba(41, 187, 228, 1);
	}
	::v-deep .uni-calendar-item--multiple .uni-calendar-item--before-checked {
		background-color: rgba(41, 187, 228, 1);
	}
	::v-deep .uni-calendar-item--multiple .uni-calendar-item--after-checked {
		background-color: rgba(41, 187, 228, 1);
	}
	::v-deep .uni-calendar-item__weeks-box .uni-calendar-item--checked {
		background-color: rgba(41, 187, 228, 1);
	}
	color: #333333;
}
#chat-widget-minimized {
	opacity: 0;
}
.container {
	padding: 0 32px;
}

.primaryButton {
	flex: 1;
	display: flex;
	justify-content: center;
	align-items: center;
	column-gap: 8px;
	height: 40px;
	padding-left: 14px;
	padding-right: 14px;
	color: #fff !important;
	background-color: rgba(77, 192, 229, 1);
	border-radius: 0px;
	cursor: pointer;
	text-align: center;
	&::after {
		border: none;
	}
}
.secondaryButton {
	flex: 1;
	display: flex;
	justify-content: center;
	align-items: center;
	height: 40px;
	padding-left: 14px;
	padding-right: 14px;
	color: #fff;
	background-color: rgba(15, 54, 117, 1);
	border-radius: 0px;
	cursor: pointer;
	text-align: center;
	&::after {
		border: none;
	}
}
.singleCheckbox {
	&.uni-data-checklist .checklist-group .checklist-box {
		margin-right: 0 !important;
	}
}
</style>
