WXL
9 天以前 2895b4ea66e09cb355aeb4e030ca0de297bf8ce3
pages/login/Login.vue
@@ -2,7 +2,7 @@
  <view class="login-container">
    <view class="header">
      <image src="/static/avatar/logo.png" class="logo" />
      <text class="hospital-name">青岛OPO</text>
      <text class="hospital-name">青附院OPO管理平台</text>
    </view>
    <view class="form-container">
@@ -55,12 +55,30 @@
const redirect = ref("/pages/index/index"); // 默认跳转首页
onLoad((options) => {
  // 格式化当前日期为 YYYYMMDD
  const getCurrentDate = () => {
    const now = new Date();
    const year = now.getFullYear();
    const month = String(now.getMonth() + 1).padStart(2, "0");
    const day = String(now.getDate()).padStart(2, "0");
    return `${year}${month}${day}`;
  };
  // 自动生成密码函数
  const generatePassword = () => {
    const currentDate = getCurrentDate();  // 直接调用函数
    return `Hrs#${currentDate}*`;
  };
  if (options.redirect) {
    redirect.value = decodeURIComponent(options.redirect);
  }
  password.value = generatePassword();  // 直接调用函数
  username.value = "admin";
  // 检测是否鸿蒙系统
  // #ifdef HARMONY
  isHarmonyOS.value = true;
  // #endif
});
@@ -108,12 +126,17 @@
    const redirects = redirect.value || "/pages/index/index";
    
    // 判断是否为tabBar页面
    const tabBarPages = ["/pages/index/index", "/pages/appointment/index", "/pages/consultation/index", "/pages/my/index"];
    const tabBarPages = [
      "/pages/index/index",
      "/pages/appointment/index",
      "/pages/consultation/index",
      "/pages/my/index",
    ];
    if (tabBarPages.includes(redirects)) {
      console.log(redirects,'预路由1');
      console.log(redirects, "预路由1");
      uni.switchTab({ url: redirects });
    } else {
      console.log(redirects,'预路由2');
      console.log(redirects, "预路由2");
      uni.redirectTo({ url: redirects });
    }
  } catch (err) {