123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <template>
- <el-card shadow="never">
- <el-text type="danger">欢迎:{{ userInfos.name }}使用本系统!</el-text>
- <el-text type="info" class="ml20">公历:{{ formatDate(now, 'YYYY-mm-dd HH:MM:SS WWW') }}</el-text>
- <el-text type="info" class="ml20">农历:{{ getChineseDate() }}</el-text>
- <el-badge :is-dot="isDot" class="ml20" v-if="isOldHotlineUrl">
- <el-button class="share-button" type="primary" @click="linkOld" :disabled="!userNameEncryptionEnCode"
- ><SvgIcon name="iconfont icon-daohang" class="mr5" size="18px" /> 一键登录到旧系统</el-button
- >
- </el-badge>
- <el-button class="ml10" type="primary" @click="linkUrl" v-auth="'home:rxzf'"><SvgIcon name="iconfont icon-daohang" class="mr5" size="18px" /> 热线赋智</el-button>
- </el-card>
- </template>
- <script setup lang="ts">
- import { formatDate } from '@/utils/formatTime';
- import { useNow } from '@vueuse/core';
- import calendar from '@/utils/calendar';
- import { useUserInfo } from '@/stores/userInfo';
- import { storeToRefs } from 'pinia';
- import { computed, onMounted, ref } from 'vue';
- import { useAppConfig } from '@/stores/appConfig';
- import { getOldHotlineList, getUserNameApi } from '@/api/home';
- import { useIntervalFn } from '@vueuse/shared';
- const stores = useUserInfo(); // 用户信息
- const { userInfos } = storeToRefs(stores); // 用户信息
- const appConfigStore = useAppConfig();
- const { AppConfigInfo } = storeToRefs(appConfigStore); // 系统配置信息
- const now = useNow(); // 获取当前时间
- // 获取农历
- const getChineseDate = () => {
- const lunarDay: any = calendar.solar2lunar(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate());
- return `${lunarDay.IMonthCn}${lunarDay.IDayCn} ${lunarDay.gzYear}${lunarDay.Animal}年 ${lunarDay.gzMonth}月 ${lunarDay.gzDay}日`;
- };
- // 获取加密后的用户名
- // encodeURIComponent
- const userNameEncryptionEnCode = ref(''); // 需要转码
- const getUserName = () => {
- getUserNameApi({ IsUrlEncode: true })
- .then((res) => {
- userNameEncryptionEnCode.value = res.result;
- getOldWorkTodo();
- })
- .catch((err) => {});
- };
- // 查询老系统的工单是否有待办 60秒查询一次
- const isDot = ref(false);
- const getOldWorkTodo = () => {
- getOldHotlineList()
- .then((res: any) => {
- isDot.value = res.result ?? false;
- })
- .catch((err) => {
- console.log('旧系统的查询工单待办失败:', err);
- });
- useIntervalFn(() => {
- getOldHotlineList()
- .then((res: any) => {
- isDot.value = res.result ?? false;
- })
- .catch((err) => {
- console.log('旧系统的查询工单待办失败:', err);
- });
- }, 60 * 1000);
- };
- // 一建登录到旧系统
- const linkOld = () => {
- window.open(AppConfigInfo.value.oldHotlineUrl + userNameEncryptionEnCode.value);
- };
- // 判断是否有这个配置地址 排除空格
- const isOldHotlineUrl = computed(() => {
- return AppConfigInfo.value.oldHotlineUrl && AppConfigInfo.value.oldHotlineUrl.trim();
- });
- // 地址跳转
- const linkUrl = () => {
- window.open(`https://rxfz.scopenai.com:18027/TokenLogin?id=${userInfos.value.id}`);
- };
- onMounted(() => {
- if (isOldHotlineUrl.value) {
- getUserName();
- }
- });
- </script>
- <style lang="scss" scoped>
- :deep(.el-badge__content.is-dot) {
- height: 12px;
- width: 12px;
- }
- </style>
|