aboutUs.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view>
  3. <view class="userDetalis_ul">
  4. <view class="userDetalis_list" @click="examineUpdate()">
  5. <view class="userDetalis_listTxt">版本更新</view>
  6. <u-icon name="arrow-right" color="#666" size="28"></u-icon>
  7. </view>
  8. <view class="userDetalis_line"></view>
  9. <view class="userDetalis_list" @click="defailList()">
  10. <view class="userDetalis_listTxt">历史版本更新列表</view>
  11. <u-icon name="arrow-right" color="#666" size="28"></u-icon>
  12. </view>
  13. </view>
  14. <view class="introduceBox_brand">© 河南云飞科技发展有限公司</view>
  15. <!-- 升级提示框 -->
  16. <u-modal v-model="show" :show-cancel-button="true" confirm-text="升级" title="发现新版本" @cancel="cancel"
  17. @confirm="confirm">
  18. <view class="u-update-content">
  19. <rich-text :nodes="newVersionInfo.app_desc"></rich-text>
  20. </view>
  21. </u-modal>
  22. <u-modal title="升级中请勿随意操作" :show-confirm-button="false" v-model="showA">
  23. <view class="upgradeBox">
  24. <u-line-progress v-show="isShow" active-color="#19be6b" :striped="true" :percent="percentNum"
  25. :striped-active="true"></u-line-progress>
  26. </view>
  27. </u-modal>
  28. <u-toast ref="uToast" />
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. edition: '', //版本号
  36. percentNum: 0, //在线下载进度
  37. isShow: false, //进度条
  38. show: false,
  39. showA: false, //
  40. newVersionInfo: {
  41. app_name: '',
  42. app_version: "",
  43. app_desc: '',
  44. create_time: '',
  45. down_path: ''
  46. }
  47. }
  48. },
  49. methods: {
  50. // 版本更新-监测
  51. async examineUpdate() {
  52. const res = await this.$myRequest({
  53. url: '/api/api_gateway?method=back_source.appupdate.check_update',
  54. data: {
  55. old_version: this.edition
  56. }
  57. })
  58. console.log(res)
  59. if (Object.keys(res).length) {
  60. console.log(22)
  61. this.newVersionInfo = res
  62. this.show = true
  63. } else {
  64. console.log(11)
  65. this.$refs.uToast.show({
  66. title: '已经是最新版本啦',
  67. type: 'success',
  68. })
  69. }
  70. },
  71. // 在线升级
  72. confirm() {
  73. const downloadTask = uni.downloadFile({
  74. url: this.newVersionInfo.down_path,
  75. // url:'/app_file/suyuan/'+this.newVersionInfo.app_name,
  76. success: (downloadResult) => {
  77. if (downloadResult.statusCode === 200) {
  78. console.log('安装包下载成功,即将安装:' + JSON.stringify(downloadResult, null, 4));
  79. plus.runtime.openFile(downloadResult.tempFilePath);
  80. }
  81. }
  82. })
  83. downloadTask.onProgressUpdate((res) => {
  84. this.percentNum = res.progress
  85. if (res.progress == 100) {
  86. console.log('下载完成了')
  87. }
  88. });
  89. this.showA = true
  90. this.isShow = true
  91. },
  92. // 在线升级取消
  93. cancel() {
  94. this.show = false;
  95. },
  96. // 历史版本更新列表
  97. defailList() {
  98. uni.navigateTo({
  99. url: '../updateList/updateList'
  100. })
  101. },
  102. },
  103. onLoad() {
  104. this.edition = this.$store.state.versionNumber;
  105. console.log(this.edition)
  106. },
  107. }
  108. </script>
  109. <style lang="scss">
  110. page {
  111. background: #f4f4f4;
  112. }
  113. .introduceBox {
  114. background: #fff;
  115. padding: 55rpx 45rpx 65rpx 45rpx;
  116. .introduceBox_img {
  117. width: 160rpx;
  118. height: 160rpx;
  119. display: block;
  120. margin: 0 auto;
  121. }
  122. .introduceBox_num {
  123. text-align: center;
  124. color: #777777;
  125. line-height: 85rpx;
  126. }
  127. .introduceBox_txt {
  128. text-indent: 2em;
  129. letter-spacing: 2px;
  130. font-size: 13px;
  131. font-weight: 550;
  132. }
  133. }
  134. .userDetalis_ul {
  135. background: #fff;
  136. margin: 15rpx 0 0 0;
  137. .userDetalis_line {
  138. border-bottom: 1px solid #cfcfcf;
  139. width: 690rpx;
  140. margin: 0 0 0 20rpx;
  141. }
  142. .userDetalis_list {
  143. height: 90rpx;
  144. display: flex;
  145. width: 700rpx;
  146. margin: 0 auto;
  147. justify-content: space-between;
  148. .userDetalis_listTxt {
  149. color: #5d5d5d;
  150. padding: 25rpx 0 25rpx 0;
  151. }
  152. .userDetalis_listName {
  153. color: #5d5d5d;
  154. }
  155. .userDetalis_listRight {
  156. width: 50rpx;
  157. height: 50rpx;
  158. margin: 20rpx 0 0 0;
  159. }
  160. }
  161. }
  162. .introduceBox_brand {
  163. text-align: center;
  164. line-height: 105rpx;
  165. color: #777777;
  166. font-size: 13px;
  167. }
  168. .u-full-content {
  169. background-color: #00C777;
  170. }
  171. .u-update-content {
  172. font-size: 26rpx;
  173. color: $u-content-color;
  174. line-height: 1.7;
  175. padding: 30rpx;
  176. text-align: center;
  177. padding: 15rpx 0 15rpx 0;
  178. }
  179. .upgradeBox {
  180. padding: 15rpx;
  181. }
  182. </style>