spring
2025-11-26 5422df60ff6a9751c52dc21d145b6e1d88c514ae
src/pages/login/index.vue
@@ -75,6 +75,11 @@
          <text class="text">和</text>
          <text class="link" @click="navigateToPrivacy">《隐私政策》</text>
        </view>
        <!-- 版本号 -->
        <view class="version">
          <text class="version-text">版本号:{{ versionName }}</text>
        </view>
      </view>
    </view>
@@ -87,12 +92,41 @@
import { type LoginFormData } from "@/api/auth";
import { useUserStore } from "@/store/modules/user";
import { useToast } from "wot-design-uni";
import { ref } from "vue";
import { ref, onMounted } from "vue";
const loginFormRef = ref();
const toast = useToast();
const loading = ref(false);
const userStore = useUserStore();
// 版本号
const versionName = ref("1.0.16");
// 获取版本号
onMounted(() => {
  // #ifdef MP-WEIXIN
  try {
    const accountInfo = uni.getAccountInfoSync();
    if (accountInfo?.miniProgram?.version) {
      versionName.value = accountInfo.miniProgram.version;
    }
  } catch (e) {
    // 获取失败时使用默认值
  }
  // #endif
  // #ifdef APP-PLUS
  try {
    // @ts-ignore
    if (plus?.runtime?.version) {
      // @ts-ignore
      versionName.value = plus.runtime.version;
    }
  } catch (e) {
    // 获取失败时使用默认值
  }
  // #endif
});
// 登录表单数据
const loginFormData = ref<LoginFormData>({
@@ -384,4 +418,16 @@
.agreement .link {
  color: #165dff;
}
.version {
  display: flex;
  justify-content: center;
  margin-top: 20rpx;
  margin-bottom: 20rpx;
}
.version-text {
  font-size: 22rpx;
  color: #9ca3af;
}
</style>