index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="home-page-box">
  3. <view class="bg-box">
  4. <image style="width: 100%; height: 100%;" src="/static/images/index/bg.png" mode="scaleToFill"></image>
  5. </view>
  6. <view class="status-bar-box"></view>
  7. <view class="navigation-bar-box"></view>
  8. <view class="home-page-box-content">
  9. <!-- 单位 -->
  10. <view class="conpany-box">
  11. <view class="conpany-title">
  12. 黑龙滩管理处
  13. </view>
  14. <view class="split-line"></view>
  15. </view>
  16. <!-- 标题 -->
  17. <header-title></header-title>
  18. <!-- 水库水情功能区 -->
  19. <reservoir-func></reservoir-func>
  20. <!-- 巡查管护功能区 -->
  21. <inspection-func></inspection-func>
  22. <view class="empty-box"></view>
  23. </view>
  24. <!-- 自定义检查更新弹窗 -->
  25. <zwy-popup :ishide="check.popShow" :zindex="999999" width="660rpx" height="600rpx" radius="12rpx">
  26. <!-- 自定义展示内容 -->
  27. <view class="update-content">
  28. <view class="update-title">
  29. 发现更新 {{`【V${check.updateVersion}】`}}
  30. </view>
  31. <view class="update-note" v-if="check.updateNote.length">
  32. <view class="update-note-item" v-for="(item,index) in check.updateNote" :key="index">
  33. {{index+1}}.{{' '+item}};
  34. </view>
  35. </view>
  36. <view class="update-footer">
  37. <button class="btn cancel-btn" v-if="!check.isForceUpdate" :disabled="check.isStart" type="default" @tap="handleCancel">暂不更新</button>
  38. <button :disabled="check.isStart" :loading="check.isStart" class="btn" type="primary" @tap="handleOk">立即下载</button>
  39. </view>
  40. </view>
  41. </zwy-popup>
  42. </view>
  43. </template>
  44. <script setup>
  45. import {
  46. onMounted,
  47. reactive,
  48. ref
  49. } from 'vue';
  50. import moment from 'moment';
  51. import headerTitle from './components/headerTitle.vue';
  52. import reservoirFunc from './components/reservoirFunc.vue';
  53. import inspectionFunc from './components/inspectionFunc.vue';
  54. import { useAppStore } from '@/store/index.js';
  55. const appStore = useAppStore()
  56. const check = reactive({
  57. popShow: false,
  58. currentVersion: "",
  59. updateVersion: "",
  60. isForceUpdate: false,
  61. updateNote: [],
  62. isStart: false
  63. })
  64. const handleCancel = () => {
  65. check.popShow = false
  66. }
  67. const handleOk = () => {
  68. check.isStart = true
  69. //此处开始下载
  70. setTimeout(()=>{
  71. uni.$msg('下载完成')
  72. appStore.setSysVersion(check.updateVersion)
  73. check.popShow = false
  74. check.isStart = false
  75. },3000)
  76. }
  77. const onCheck = () => {
  78. console.log(check.currentVersion)
  79. //使用本机版本号去请求是否需要更新
  80. check.updateVersion = "1.0.1"
  81. check.popShow = true
  82. check.updateNote = ['更新bug','更新组件','更新bug','更新组件','更新bug','更新组件','更新bug','更新组件','更新bug','更新组件','更新bug','更新组件']
  83. }
  84. onMounted(() => {
  85. //先获取本机app版本号
  86. uni.getSystemInfo({
  87. success: info => {
  88. check.currentVersion = info.appWgtVersion || info.appVersion;
  89. appStore.setSysVersion(check.currentVersion)
  90. onCheck()
  91. }
  92. });
  93. })
  94. </script>
  95. <style lang="scss" scoped>
  96. .home-page-box {
  97. padding: 0 20rpx;
  98. .bg-box {
  99. position: fixed;
  100. left: 0;
  101. top: 0;
  102. width: 100%;
  103. height: 100%;
  104. z-index: -1;
  105. }
  106. .status-bar-box {
  107. height: var(--status-bar-height);
  108. }
  109. .navigation-bar-box{
  110. height: 88rpx;
  111. }
  112. &-content {
  113. height: calc(100vh - var(--window-bottom) - 88rpx - var(--status-bar-height));
  114. overflow: auto;
  115. .conpany-box {
  116. .conpany-title {
  117. font-family: Source Han Sans;
  118. font-size: 50rpx;
  119. font-weight: bold;
  120. font-feature-settings: "kern" on;
  121. color: $uni-text-color;
  122. line-height: 72rpx;
  123. }
  124. .split-line {
  125. margin-top: 16rpx;
  126. width: 140rpx;
  127. height: 8rpx;
  128. background: #2E7DF3;
  129. }
  130. }
  131. .empty-box {
  132. height: 40rpx;
  133. }
  134. }
  135. .update-content{
  136. padding: 20rpx;
  137. height: calc(100% - 40rpx);
  138. .update-title{
  139. height: 80rpx;
  140. display: flex;
  141. justify-content: center;
  142. align-items: center;
  143. font-size: 36rpx;
  144. text-align: center;
  145. color: $uni-text-color;
  146. box-sizing: border-box;
  147. border-bottom: 2rpx solid $uni-border-color;
  148. }
  149. .update-note{
  150. margin: 20rpx 0;
  151. height: calc(100% - 140rpx - 40rpx);
  152. overflow: auto;
  153. }
  154. .update-footer{
  155. height: 60rpx;
  156. display: flex;
  157. justify-content: space-around;
  158. align-items: center;
  159. .btn{
  160. height: 60rpx;
  161. line-height: 60rpx;
  162. width: 45%;
  163. border-radius: 19998rpx;
  164. }
  165. .cancel-btn{
  166. border: 2rpx solid $uni-color-primary;
  167. }
  168. }
  169. }
  170. }
  171. </style>