fix:用户中心新增测试版本号
This commit is contained in:
@@ -69,6 +69,10 @@ onMounted(() => {
|
|||||||
const envVersion = accountInfo.miniProgram.envVersion;
|
const envVersion = accountInfo.miniProgram.envVersion;
|
||||||
if (envVersion !== "release") showLogout.value = true;
|
if (envVersion !== "release") showLogout.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* global __BUILD_TIME__ */
|
||||||
|
/** 构建时刻,由 vite.config.js define 在打包时自动注入;仅开发/体验版展示 */
|
||||||
|
const buildVersion = typeof __BUILD_TIME__ !== 'undefined' ? __BUILD_TIME__ : '';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -140,6 +144,10 @@ onMounted(() => {
|
|||||||
:onClick="toAudioTestPage"
|
:onClick="toAudioTestPage"
|
||||||
v-if="showLogout"
|
v-if="showLogout"
|
||||||
/>
|
/>
|
||||||
|
<UserItem
|
||||||
|
title="版本信息"
|
||||||
|
v-if="showLogout"
|
||||||
|
>{{ buildVersion }}</UserItem>
|
||||||
<UserItem
|
<UserItem
|
||||||
title="退出登录(仅用于测试)"
|
title="退出登录(仅用于测试)"
|
||||||
:onClick="logout"
|
:onClick="logout"
|
||||||
|
|||||||
@@ -12,6 +12,14 @@ export default defineConfig({
|
|||||||
plugins: [
|
plugins: [
|
||||||
uni(),
|
uni(),
|
||||||
],
|
],
|
||||||
|
/** 构建时常量注入:__BUILD_TIME__ 在源码中展开为精确的打包时刻字符串 */
|
||||||
|
define: (() => {
|
||||||
|
const d = new Date();
|
||||||
|
const pad = (n) => String(n).padStart(2, '0');
|
||||||
|
// 格式:YYYY.MMDD.HHmm,如 2026.0514.1530
|
||||||
|
const version = `${d.getFullYear()}.${pad(d.getMonth() + 1)}${pad(d.getDate())}.${pad(d.getHours())}${pad(d.getMinutes())}`;
|
||||||
|
return { __BUILD_TIME__: JSON.stringify(version) };
|
||||||
|
})(),
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user