version.nvue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="page">
  3. <!-- 状态栏占位 -->
  4. <view class="status-bar" :style="{height: statusBarHeight + 'px'}"></view>
  5. <!-- 自定义导航栏 -->
  6. <view class="nav-bar">
  7. <image src="/static/public/backBlack.png" mode="aspectFill" class="back-img" @click="goBack"></image>
  8. <text class="nav-title">版本信息</text>
  9. <view class="nav-right"></view>
  10. </view>
  11. <!-- 版本信息区 -->
  12. <view class="version-content">
  13. <image class="logo" src="/static/144x144.png" mode="aspectFill"></image>
  14. <text class="app-name">研年健康平台</text>
  15. <text class="version-code">V{{localVersion}}</text>
  16. <text class="check-btn" @click="checkUpdate">检查更新</text>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. statusBarHeight: 44,
  25. localVersion: '1.0.0',
  26. platform: 'android'
  27. }
  28. },
  29. onLoad() {
  30. const sysInfo = uni.getSystemInfoSync()
  31. this.statusBarHeight = sysInfo.statusBarHeight || 44
  32. this.platform = sysInfo.platform || 'android'
  33. // 获取本地版本号
  34. const appBase = uni.getAppBaseInfo()
  35. if (appBase && appBase.appVersion) {
  36. this.localVersion = appBase.appVersion
  37. }
  38. },
  39. methods: {
  40. goBack() {
  41. uni.navigateBack()
  42. },
  43. checkUpdate() {
  44. // TODO: 后续对接后台接口检查更新
  45. uni.showToast({
  46. title: '已是最新版本',
  47. icon: 'none'
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style>
  54. .page {
  55. flex: 1;
  56. background-color: #FFFFFF;
  57. }
  58. .status-bar {
  59. background-color: #FFFFFF;
  60. }
  61. .nav-bar {
  62. flex-direction: row;
  63. align-items: center;
  64. justify-content: space-between;
  65. height: 88rpx;
  66. padding-left: 54rpx;
  67. padding-right: 54rpx;
  68. background-color: #FFFFFF;
  69. }
  70. .back-img {
  71. width: 50rpx;
  72. height: 50rpx;
  73. }
  74. .nav-title {
  75. font-weight: bold;
  76. font-size: 32rpx;
  77. color: #545F71;
  78. }
  79. .nav-right {
  80. width: 50rpx;
  81. height: 50rpx;
  82. }
  83. /* 版本信息区 */
  84. .version-content {
  85. align-items: center;
  86. padding-top: 100rpx;
  87. }
  88. .logo {
  89. width: 208rpx;
  90. height: 208rpx;
  91. border-radius: 120rpx;
  92. margin-bottom: 16rpx;
  93. }
  94. .app-name {
  95. font-size: 32rpx;
  96. color: #545F71;
  97. line-height: 60rpx;
  98. text-align: center;
  99. }
  100. .version-code {
  101. font-size: 32rpx;
  102. color: #BAC0CA;
  103. line-height: 60rpx;
  104. text-align: center;
  105. }
  106. .check-btn {
  107. margin-top: 78rpx;
  108. width: 644rpx;
  109. height: 88rpx;
  110. background-color: #389588;
  111. border-radius: 20rpx;
  112. color: #FFFFFF;
  113. font-size: 32rpx;
  114. line-height: 88rpx;
  115. text-align: center;
  116. }
  117. </style>