spring
2025-11-26 5422df60ff6a9751c52dc21d145b6e1d88c514ae
fix: 添加版本可见
已修改4个文件
111 ■■■■■ 文件已修改
.env.development 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/manifest.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login/index.vue 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/mine/index.vue 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.development
@@ -9,11 +9,11 @@
# API 基础路径,开发环境下的请求前缀
#VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes'
# VITE_APP_BASE_API = 'http://114.132.189.42:7002/mes'
VITE_APP_BASE_API = 'http://192.168.10.119:7002/mes' # 邹裕
# VITE_APP_BASE_API = 'http://192.168.100.131:7002/mes' #
# VITE_APP_BASE_API = 'http://192.168.10.119:7002/mes' # 邹裕
VITE_APP_BASE_API = 'http://192.168.100.131:7002/mes' #
# API 服务器的 URL
#VITE_APP_API_URL = 'http://114.132.189.42:7002/mes'
VITE_APP_API_URL = 'http://192.168.10.119:7002/mes'
# VITE_APP_API_URL = 'http://192.168.100.131:7002/mes' #
# VITE_APP_API_URL = 'http://192.168.10.119:7002/mes'
VITE_APP_API_URL = 'http://192.168.100.131:7002/mes' #
src/manifest.json
@@ -2,7 +2,7 @@
  "name": "线缆上报",
  "appid": "__UNI__F64E0A4",
  "description": "",
  "versionName": "1.0.15",
    "versionName" : "1.0.20",
  "versionCode": "100",
  "transformPx": false,
  /* 5+App特有相关 */
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>
src/pages/mine/index.vue
@@ -7,7 +7,7 @@
        <view class="avatar-container" @click="navigateToProfile">
          <image
            class="avatar"
            :src="isLogin ? userInfo!.avatar : defaultAvatar"
            :src="isLogin ? userInfo?.avatar : defaultAvatar"
            mode="aspectFill"
          />
          <view v-if="isLogin" class="avatar-edit">
@@ -16,7 +16,7 @@
        </view>
        <view class="user-details">
          <block v-if="isLogin">
            <view class="nickname">{{ userInfo!.nickname || "匿名用户" }}</view>
            <view class="nickname">{{ userInfo?.nickname || "匿名用户" }}</view>
            <view class="user-id">ID: {{ userInfo?.username || "0000000" }}</view>
          </block>
          <block v-else>
@@ -215,6 +215,11 @@
      <wd-button class="logout-btn" @click="handleLogout">退出登录</wd-button>
    </view>
    <!-- 版本号 -->
    <view class="version">
      <text class="version-text">版本号:{{ versionName }}</text>
    </view>
    <wd-toast />
  </view>
</template>
@@ -223,7 +228,7 @@
import { useToast } from "wot-design-uni";
import { useUserStore } from "@/store/modules/user";
import { useThemeStore } from "@/store/modules/theme";
import { computed } from "vue";
import { computed, ref, onMounted } from "vue";
const toast = useToast();
const userStore = useUserStore();
@@ -231,6 +236,35 @@
const userInfo = computed(() => userStore.userInfo);
const isLogin = computed(() => !!userInfo.value);
const defaultAvatar = "/static/images/default-avatar.png";
// 版本号
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 navigateToLoginPage = () => {
@@ -661,4 +695,17 @@
    }
  }
}
// 版本号
.version {
  display: flex;
  justify-content: center;
  margin-top: 20rpx;
  margin-bottom: 40rpx;
}
.version-text {
  font-size: 22rpx;
  color: #9ca3af;
}
</style>