App.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <a-config-provider :locale="locale">
  3. <a-alert class="alert_txt" type="warning" v-if="show_warning"
  4. >您的软件试用期即将到期,输入授权密钥方可正常使用! <span @click="toAuth">去授权 >></span></a-alert
  5. >
  6. <router-view />
  7. </a-config-provider>
  8. </template>
  9. <script setup>
  10. import { ref, computed } from 'vue';
  11. import { useRouter } from 'vue-router';
  12. import { useLocaleStore } from './base/store/use-locale';
  13. /**
  14. * @see https://arco.design/vue/component/config-provider
  15. */
  16. import zhCN from '@arco-design/web-vue/es/locale/lang/zh-cn';
  17. import enUS from '@arco-design/web-vue/es/locale/lang/en-us';
  18. const locales = {
  19. zh: zhCN,
  20. en: enUS
  21. };
  22. const localStore = useLocaleStore();
  23. const router = useRouter();
  24. /**
  25. * 多语言
  26. */
  27. const locale = computed(() => {
  28. return locales[localStore.value] || zhCN;
  29. });
  30. const show_warning = ref(false);
  31. /**
  32. *去授权
  33. * */
  34. const toAuth = () => {
  35. router.push({
  36. path: '/auth'
  37. });
  38. };
  39. </script>
  40. <style scoped>
  41. .alert_txt {
  42. position: absolute;
  43. width: 500px;
  44. top: 60px;
  45. left: calc(50% - 250px);
  46. z-index: 9999;
  47. span {
  48. cursor: pointer;
  49. color: var(--color-link-1);
  50. }
  51. }
  52. </style>