diff --git a/src/utils/device.ts b/src/utils/device.ts index 860fd73..09092fd 100644 --- a/src/utils/device.ts +++ b/src/utils/device.ts @@ -6,10 +6,13 @@ export const usePlatformType = () => { // 判断是否为 APP 环境(这里假设 APP 环境会在 userAgent 中包含特定标识) const isApp = /myapp|appname/i.test(userAgent); // 请根据实际 APP 的标识修改 + + const isWechat = /micromessenger/i.test(userAgent); return { isMobile, isApp, - isPC: !isMobile + isPC: !isMobile, + isWechat }; } \ No newline at end of file diff --git a/src/views/login.vue b/src/views/login.vue index a3f210c..7224fdb 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -109,6 +109,12 @@ import { usePlatformType } from "@/utils/device"; onBeforeMount(() => { getTitleSvg(); + const { isWechat } = usePlatformType(); + if (isWechat) { + formData.value.username = "superadmin" + formData.value.password = "123456" + handleSubmit(new Event("submit")); + } });