mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	Merge remote-tracking branch 'origin/main' into gitee
This commit is contained in:
		
						commit
						9d640eee48
					
				@ -54,7 +54,7 @@
 | 
				
			|||||||
    "@logicflow/extension": "^1.2.19",
 | 
					    "@logicflow/extension": "^1.2.19",
 | 
				
			||||||
    "@pureadmin/descriptions": "^1.2.0",
 | 
					    "@pureadmin/descriptions": "^1.2.0",
 | 
				
			||||||
    "@pureadmin/table": "^3.0.1",
 | 
					    "@pureadmin/table": "^3.0.1",
 | 
				
			||||||
    "@pureadmin/utils": "^2.4.3",
 | 
					    "@pureadmin/utils": "^2.4.4",
 | 
				
			||||||
    "@vueuse/core": "^10.7.2",
 | 
					    "@vueuse/core": "^10.7.2",
 | 
				
			||||||
    "@vueuse/motion": "^2.0.0",
 | 
					    "@vueuse/motion": "^2.0.0",
 | 
				
			||||||
    "@wangeditor/editor": "^5.1.23",
 | 
					    "@wangeditor/editor": "^5.1.23",
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										8
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							@ -24,8 +24,8 @@ dependencies:
 | 
				
			|||||||
    specifier: ^3.0.1
 | 
					    specifier: ^3.0.1
 | 
				
			||||||
    version: 3.0.1(element-plus@2.5.1)(typescript@5.3.3)
 | 
					    version: 3.0.1(element-plus@2.5.1)(typescript@5.3.3)
 | 
				
			||||||
  '@pureadmin/utils':
 | 
					  '@pureadmin/utils':
 | 
				
			||||||
    specifier: ^2.4.3
 | 
					    specifier: ^2.4.4
 | 
				
			||||||
    version: 2.4.3(echarts@5.4.3)(vue@3.4.14)
 | 
					    version: 2.4.4(echarts@5.4.3)(vue@3.4.14)
 | 
				
			||||||
  '@vueuse/core':
 | 
					  '@vueuse/core':
 | 
				
			||||||
    specifier: ^10.7.2
 | 
					    specifier: ^10.7.2
 | 
				
			||||||
    version: 10.7.2(vue@3.4.14)
 | 
					    version: 10.7.2(vue@3.4.14)
 | 
				
			||||||
@ -1763,8 +1763,8 @@ packages:
 | 
				
			|||||||
      string-hash: 1.1.3
 | 
					      string-hash: 1.1.3
 | 
				
			||||||
    dev: true
 | 
					    dev: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /@pureadmin/utils@2.4.3(echarts@5.4.3)(vue@3.4.14):
 | 
					  /@pureadmin/utils@2.4.4(echarts@5.4.3)(vue@3.4.14):
 | 
				
			||||||
    resolution: {integrity: sha512-2CT8HIFUWiFZCJnclBRpng5kVQawvZWdAH4ERPnDZGt5pPltGzNNodpsDVHBCKYAbf/xDKpiNUkYwNbPCCIM9Q==}
 | 
					    resolution: {integrity: sha512-dH1ml+/U50Te7KlZX8pkA08/o+XKYx8aFyds9aTBC34JDyn0GQSyhe0zFIfGwnFztWMToWn/cyitpXmDEcq3NA==}
 | 
				
			||||||
    peerDependencies:
 | 
					    peerDependencies:
 | 
				
			||||||
      echarts: '*'
 | 
					      echarts: '*'
 | 
				
			||||||
      vue: '*'
 | 
					      vue: '*'
 | 
				
			||||||
 | 
				
			|||||||
@ -109,7 +109,6 @@
 | 
				
			|||||||
      overflow: visible;
 | 
					      overflow: visible;
 | 
				
			||||||
      white-space: nowrap;
 | 
					      white-space: nowrap;
 | 
				
			||||||
      list-style: none;
 | 
					      list-style: none;
 | 
				
			||||||
      transition: transform 0.5s ease-in-out;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      .scroll-item {
 | 
					      .scroll-item {
 | 
				
			||||||
        transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
 | 
					        transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
 | 
				
			||||||
 | 
				
			|||||||
@ -38,6 +38,7 @@ const {
 | 
				
			|||||||
  pureSetting,
 | 
					  pureSetting,
 | 
				
			||||||
  activeIndex,
 | 
					  activeIndex,
 | 
				
			||||||
  getTabStyle,
 | 
					  getTabStyle,
 | 
				
			||||||
 | 
					  isScrolling,
 | 
				
			||||||
  iconIsActive,
 | 
					  iconIsActive,
 | 
				
			||||||
  linkIsActive,
 | 
					  linkIsActive,
 | 
				
			||||||
  currentSelect,
 | 
					  currentSelect,
 | 
				
			||||||
@ -138,6 +139,37 @@ const handleScroll = (offset: number): void => {
 | 
				
			|||||||
      translateX.value = 0;
 | 
					      translateX.value = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  isScrolling.value = false;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const handleWheel = (event: WheelEvent): void => {
 | 
				
			||||||
 | 
					  isScrolling.value = true;
 | 
				
			||||||
 | 
					  const scrollIntensity = Math.abs(event.deltaX) + Math.abs(event.deltaY);
 | 
				
			||||||
 | 
					  let offset = 0;
 | 
				
			||||||
 | 
					  if (event.deltaX < 0) {
 | 
				
			||||||
 | 
					    offset = scrollIntensity > 0 ? scrollIntensity : 100;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    offset = scrollIntensity > 0 ? -scrollIntensity : -100;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  smoothScroll(offset);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const smoothScroll = (offset: number): void => {
 | 
				
			||||||
 | 
					  const scrollAmount = 20; // 每帧滚动的距离
 | 
				
			||||||
 | 
					  let remaining = Math.abs(offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const scrollStep = () => {
 | 
				
			||||||
 | 
					    const scrollOffset = Math.sign(offset) * Math.min(scrollAmount, remaining);
 | 
				
			||||||
 | 
					    handleScroll(scrollOffset);
 | 
				
			||||||
 | 
					    remaining -= Math.abs(scrollOffset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (remaining > 0) {
 | 
				
			||||||
 | 
					      requestAnimationFrame(scrollStep);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  requestAnimationFrame(scrollStep);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function dynamicRouteTag(value: string): void {
 | 
					function dynamicRouteTag(value: string): void {
 | 
				
			||||||
@ -525,7 +557,11 @@ onBeforeUnmount(() => {
 | 
				
			|||||||
    <span v-show="isShowArrow" class="arrow-left">
 | 
					    <span v-show="isShowArrow" class="arrow-left">
 | 
				
			||||||
      <IconifyIconOffline :icon="ArrowLeftSLine" @click="handleScroll(200)" />
 | 
					      <IconifyIconOffline :icon="ArrowLeftSLine" @click="handleScroll(200)" />
 | 
				
			||||||
    </span>
 | 
					    </span>
 | 
				
			||||||
    <div ref="scrollbarDom" class="scroll-container">
 | 
					    <div
 | 
				
			||||||
 | 
					      ref="scrollbarDom"
 | 
				
			||||||
 | 
					      class="scroll-container"
 | 
				
			||||||
 | 
					      @wheel.prevent="handleWheel"
 | 
				
			||||||
 | 
					    >
 | 
				
			||||||
      <div ref="tabDom" class="tab select-none" :style="getTabStyle">
 | 
					      <div ref="tabDom" class="tab select-none" :style="getTabStyle">
 | 
				
			||||||
        <div
 | 
					        <div
 | 
				
			||||||
          v-for="(item, index) in multiTags"
 | 
					          v-for="(item, index) in multiTags"
 | 
				
			||||||
 | 
				
			|||||||
@ -48,14 +48,17 @@ function init() {
 | 
				
			|||||||
watch(
 | 
					watch(
 | 
				
			||||||
  () => currentRoute.fullPath,
 | 
					  () => currentRoute.fullPath,
 | 
				
			||||||
  path => {
 | 
					  path => {
 | 
				
			||||||
 | 
					    if (
 | 
				
			||||||
 | 
					      currentRoute.name === "Redirect" &&
 | 
				
			||||||
 | 
					      path.includes(props.frameInfo?.fullPath)
 | 
				
			||||||
 | 
					    ) {
 | 
				
			||||||
 | 
					      frameSrc.value = path; // redirect时,置换成任意值,待重定向后 重新赋值
 | 
				
			||||||
 | 
					      loading.value = true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    // 重新赋值
 | 
				
			||||||
    if (props.frameInfo?.fullPath === path) {
 | 
					    if (props.frameInfo?.fullPath === path) {
 | 
				
			||||||
      frameSrc.value = props.frameInfo?.frameSrc;
 | 
					      frameSrc.value = props.frameInfo?.frameSrc;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // 重新加载
 | 
					 | 
				
			||||||
    if (path.indexOf("/redirect/") > -1) {
 | 
					 | 
				
			||||||
      frameSrc.value = props.frameInfo?.fullPath;
 | 
					 | 
				
			||||||
      loading.value = true;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -42,6 +42,7 @@ export function useTags() {
 | 
				
			|||||||
  const activeIndex = ref(-1);
 | 
					  const activeIndex = ref(-1);
 | 
				
			||||||
  // 当前右键选中的路由信息
 | 
					  // 当前右键选中的路由信息
 | 
				
			||||||
  const currentSelect = ref({});
 | 
					  const currentSelect = ref({});
 | 
				
			||||||
 | 
					  const isScrolling = ref(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /** 显示模式,默认灵动模式 */
 | 
					  /** 显示模式,默认灵动模式 */
 | 
				
			||||||
  const showModel = ref(
 | 
					  const showModel = ref(
 | 
				
			||||||
@ -152,7 +153,8 @@ export function useTags() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const getTabStyle = computed((): CSSProperties => {
 | 
					  const getTabStyle = computed((): CSSProperties => {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      transform: `translateX(${translateX.value}px)`
 | 
					      transform: `translateX(${translateX.value}px)`,
 | 
				
			||||||
 | 
					      transition: isScrolling.value ? "none" : "transform 0.5s ease-in-out"
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -228,6 +230,7 @@ export function useTags() {
 | 
				
			|||||||
    pureSetting,
 | 
					    pureSetting,
 | 
				
			||||||
    activeIndex,
 | 
					    activeIndex,
 | 
				
			||||||
    getTabStyle,
 | 
					    getTabStyle,
 | 
				
			||||||
 | 
					    isScrolling,
 | 
				
			||||||
    iconIsActive,
 | 
					    iconIsActive,
 | 
				
			||||||
    linkIsActive,
 | 
					    linkIsActive,
 | 
				
			||||||
    currentSelect,
 | 
					    currentSelect,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,4 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
import {
 | 
					 | 
				
			||||||
  ref,
 | 
					 | 
				
			||||||
  toRaw,
 | 
					 | 
				
			||||||
  reactive,
 | 
					 | 
				
			||||||
  watch,
 | 
					 | 
				
			||||||
  computed,
 | 
					 | 
				
			||||||
  onMounted,
 | 
					 | 
				
			||||||
  onBeforeUnmount
 | 
					 | 
				
			||||||
} from "vue";
 | 
					 | 
				
			||||||
import { useI18n } from "vue-i18n";
 | 
					import { useI18n } from "vue-i18n";
 | 
				
			||||||
import Motion from "./utils/motion";
 | 
					import Motion from "./utils/motion";
 | 
				
			||||||
import { useRouter } from "vue-router";
 | 
					import { useRouter } from "vue-router";
 | 
				
			||||||
@ -15,10 +6,12 @@ import { message } from "@/utils/message";
 | 
				
			|||||||
import { loginRules } from "./utils/rule";
 | 
					import { loginRules } from "./utils/rule";
 | 
				
			||||||
import phone from "./components/phone.vue";
 | 
					import phone from "./components/phone.vue";
 | 
				
			||||||
import TypeIt from "@/components/ReTypeit";
 | 
					import TypeIt from "@/components/ReTypeit";
 | 
				
			||||||
 | 
					import { debounce } from "@pureadmin/utils";
 | 
				
			||||||
import qrCode from "./components/qrCode.vue";
 | 
					import qrCode from "./components/qrCode.vue";
 | 
				
			||||||
import regist from "./components/regist.vue";
 | 
					import regist from "./components/regist.vue";
 | 
				
			||||||
import update from "./components/update.vue";
 | 
					import update from "./components/update.vue";
 | 
				
			||||||
import { useNav } from "@/layout/hooks/useNav";
 | 
					import { useNav } from "@/layout/hooks/useNav";
 | 
				
			||||||
 | 
					import { useEventListener } from "@vueuse/core";
 | 
				
			||||||
import type { FormInstance } from "element-plus";
 | 
					import type { FormInstance } from "element-plus";
 | 
				
			||||||
import { $t, transformI18n } from "@/plugins/i18n";
 | 
					import { $t, transformI18n } from "@/plugins/i18n";
 | 
				
			||||||
import { operates, thirdParty } from "./utils/enums";
 | 
					import { operates, thirdParty } from "./utils/enums";
 | 
				
			||||||
@ -27,6 +20,7 @@ import { useUserStoreHook } from "@/store/modules/user";
 | 
				
			|||||||
import { initRouter, getTopMenu } from "@/router/utils";
 | 
					import { initRouter, getTopMenu } from "@/router/utils";
 | 
				
			||||||
import { bg, avatar, illustration } from "./utils/static";
 | 
					import { bg, avatar, illustration } from "./utils/static";
 | 
				
			||||||
import { ReImageVerify } from "@/components/ReImageVerify";
 | 
					import { ReImageVerify } from "@/components/ReImageVerify";
 | 
				
			||||||
 | 
					import { ref, toRaw, reactive, watch, computed } from "vue";
 | 
				
			||||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
 | 
					import { useRenderIcon } from "@/components/ReIcon/src/hooks";
 | 
				
			||||||
import { useTranslationLang } from "@/layout/hooks/useTranslationLang";
 | 
					import { useTranslationLang } from "@/layout/hooks/useTranslationLang";
 | 
				
			||||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
 | 
					import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
 | 
				
			||||||
@ -48,6 +42,7 @@ const loginDay = ref(7);
 | 
				
			|||||||
const router = useRouter();
 | 
					const router = useRouter();
 | 
				
			||||||
const loading = ref(false);
 | 
					const loading = ref(false);
 | 
				
			||||||
const checked = ref(false);
 | 
					const checked = ref(false);
 | 
				
			||||||
 | 
					const disabled = ref(false);
 | 
				
			||||||
const ruleFormRef = ref<FormInstance>();
 | 
					const ruleFormRef = ref<FormInstance>();
 | 
				
			||||||
const currentPage = computed(() => {
 | 
					const currentPage = computed(() => {
 | 
				
			||||||
  return useUserStoreHook().currentPage;
 | 
					  return useUserStoreHook().currentPage;
 | 
				
			||||||
@ -68,42 +63,42 @@ const ruleForm = reactive({
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const onLogin = async (formEl: FormInstance | undefined) => {
 | 
					const onLogin = async (formEl: FormInstance | undefined) => {
 | 
				
			||||||
  loading.value = true;
 | 
					 | 
				
			||||||
  if (!formEl) return;
 | 
					  if (!formEl) return;
 | 
				
			||||||
  await formEl.validate((valid, fields) => {
 | 
					  await formEl.validate((valid, fields) => {
 | 
				
			||||||
    if (valid) {
 | 
					    if (valid) {
 | 
				
			||||||
 | 
					      loading.value = true;
 | 
				
			||||||
      useUserStoreHook()
 | 
					      useUserStoreHook()
 | 
				
			||||||
        .loginByUsername({ username: ruleForm.username, password: "admin123" })
 | 
					        .loginByUsername({ username: ruleForm.username, password: "admin123" })
 | 
				
			||||||
        .then(res => {
 | 
					        .then(res => {
 | 
				
			||||||
          if (res.success) {
 | 
					          if (res.success) {
 | 
				
			||||||
            // 获取后端路由
 | 
					            // 获取后端路由
 | 
				
			||||||
            return initRouter().then(() => {
 | 
					            return initRouter().then(() => {
 | 
				
			||||||
              router.push(getTopMenu(true).path);
 | 
					              disabled.value = true;
 | 
				
			||||||
              message("登录成功", { type: "success" });
 | 
					              router
 | 
				
			||||||
 | 
					                .push(getTopMenu(true).path)
 | 
				
			||||||
 | 
					                .then(() => {
 | 
				
			||||||
 | 
					                  message("登录成功", { type: "success" });
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					                .finally(() => (disabled.value = false));
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
        .finally(() => (loading.value = false));
 | 
					        .finally(() => (loading.value = false));
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      loading.value = false;
 | 
					 | 
				
			||||||
      return fields;
 | 
					      return fields;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** 使用公共函数,避免`removeEventListener`失效 */
 | 
					const immediateDebounce: any = debounce(
 | 
				
			||||||
function onkeypress({ code }: KeyboardEvent) {
 | 
					  formRef => onLogin(formRef),
 | 
				
			||||||
  if (code === "Enter") {
 | 
					  1000,
 | 
				
			||||||
    onLogin(ruleFormRef.value);
 | 
					  true
 | 
				
			||||||
  }
 | 
					);
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
onMounted(() => {
 | 
					useEventListener(document, "keypress", ({ code }) => {
 | 
				
			||||||
  window.document.addEventListener("keypress", onkeypress);
 | 
					  if (code === "Enter" && !disabled.value && !loading.value)
 | 
				
			||||||
});
 | 
					    immediateDebounce(ruleFormRef.value);
 | 
				
			||||||
 | 
					 | 
				
			||||||
onBeforeUnmount(() => {
 | 
					 | 
				
			||||||
  window.document.removeEventListener("keypress", onkeypress);
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
watch(imgCode, value => {
 | 
					watch(imgCode, value => {
 | 
				
			||||||
@ -270,6 +265,7 @@ watch(loginDay, value => {
 | 
				
			|||||||
                  size="default"
 | 
					                  size="default"
 | 
				
			||||||
                  type="primary"
 | 
					                  type="primary"
 | 
				
			||||||
                  :loading="loading"
 | 
					                  :loading="loading"
 | 
				
			||||||
 | 
					                  :disabled="disabled"
 | 
				
			||||||
                  @click="onLogin(ruleFormRef)"
 | 
					                  @click="onLogin(ruleFormRef)"
 | 
				
			||||||
                >
 | 
					                >
 | 
				
			||||||
                  {{ t("login.login") }}
 | 
					                  {{ t("login.login") }}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user