about.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view>
  3. <!-- <view class="line"></view>
  4. <view class="logo-box">
  5. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/c9b4eb88c03b2f7460e8479e80f40fc.png'" mode="widthFix"></image>
  6. <view class="version">
  7. <view>
  8. 云飞物联网
  9. </view>
  10. <view>
  11. V{{id}}
  12. </view>
  13. </view>
  14. </view>
  15. <view class="line"></view>
  16. <view class="part">
  17. <view class="info-item">
  18. <text class="tit">技术支持</text>
  19. <text class="val">河南云飞科技发展有限公司</text>
  20. </view>
  21. <view class="divide"></view>
  22. <view class="info-item">
  23. <text class="tit">关注微信</text>
  24. <text class="val">河南云飞科技发展有限公司</text>
  25. </view>
  26. </view>
  27. <view class="line"></view>
  28. <view class="part">
  29. <view class="info-item">
  30. <text class="tit">公司官网</text>
  31. <text class="val">www.hnyfkj.cn</text>
  32. </view>
  33. <view class="divide"></view>
  34. <view class="info-item">
  35. <text class="tit">业务合作</text>
  36. <text class="val">400-690-7990</text>
  37. </view>
  38. <view class="divide"></view>
  39. <view class="info-item">
  40. <text class="tit">公司邮箱</text>
  41. <text class="val">hnyf826@163.com</text>
  42. </view>
  43. </view> -->
  44. <view class="line"></view>
  45. <view class="part">
  46. <view class="info-item" @click="renewal">
  47. <text class="tit">版本更新</text>
  48. <u-icon name="arrow-right"></u-icon>
  49. </view>
  50. </view>
  51. <view class="line"></view>
  52. <view class="record">
  53. <view class="info-item" @click="record">
  54. <text class="tit">更新记录</text>
  55. <u-icon name="arrow-right"></u-icon>
  56. </view>
  57. </view>
  58. <!-- <view class="bottom">
  59. ©河南云飞科技发展有限公司
  60. </view> -->
  61. <u-modal title="升级中请勿随意操作" :show-confirm-button="false" v-model="showA" :content="contentA">
  62. <view class="upgradeBox">
  63. <u-line-progress v-show="isShow" active-color="#19be6b" :striped="true" :percent="percentNum" :striped-active="true"></u-line-progress>
  64. </view>
  65. </u-modal>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data() {
  71. return {
  72. id: '',
  73. versions: '',
  74. showA: false, //
  75. contentA: '',
  76. isShow: false, //进度条
  77. percentNum: 0, //在线下载进度,
  78. value: "",
  79. }
  80. },
  81. methods: {
  82. async getEquipList() {
  83. const res = await this.$myRequest({
  84. url: '/api/api_gateway?method=home.homes.app_version_record',
  85. data: {
  86. ret: "first"
  87. }
  88. })
  89. console.log(res)
  90. this.appName = res[0].app_name
  91. this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
  92. var ids = Number(plus.runtime.version.match(/\d+/g).join(""))
  93. if (this.percentNum > 0) {
  94. console.log("更新中")
  95. } else {
  96. if (this.versions > ids) {
  97. uni.showModal({
  98. title: '检测到有新版本,是否更新?',
  99. content: '建议更新,不更新可能会出现部分数据无法获取!',
  100. confirmText: "更新",
  101. cancelText: "不更新",
  102. success: (res) => {
  103. if (res.confirm) {
  104. console.log('用户点击确定');
  105. this.showA = true
  106. this.isShow = true
  107. this.upgrade()
  108. } else if (res.cancel) {
  109. // plus.runtime.quit();
  110. console.log('用户点击取消');
  111. }
  112. }
  113. })
  114. } else {
  115. uni.showToast({
  116. title: "当前版本已是最新版本",
  117. icon: "none"
  118. })
  119. }
  120. }
  121. },
  122. renewal() {
  123. this.getEquipList()
  124. },
  125. upgrade() {
  126. uni.getStorage({
  127. key: 'http',
  128. success: (res) => {
  129. this.value = res.data
  130. }
  131. })
  132. console.log(this.appName)
  133. // ---------------------------------------------------------------------------------------------------------------------------
  134. //中性版
  135. this.appName = "big_data2"
  136. var url = "http://hnyfwlw.com/app/" + this.appName + ".apk"
  137. console.log(url)
  138. const downloadTask = uni.downloadFile({
  139. url: url, //仅为示例,并非真实的资源
  140. success: (res) => {
  141. console.log(res)
  142. if (res.statusCode === 200) {
  143. console.log('下载成功');
  144. console.log('安装包下载成功,即将安装:' + JSON.stringify(res, null, 4));
  145. plus.runtime.openFile(res.tempFilePath);
  146. this.showA = false
  147. this.isShow = false
  148. }
  149. },
  150. fail: (err) => {
  151. console.log(err)
  152. },
  153. complete: (com) => {
  154. console.log(com)
  155. }
  156. });
  157. downloadTask.onProgressUpdate((res) => {
  158. this.percentNum = res.progress
  159. if (res.progress == 100) {
  160. console.log('下载完成了')
  161. plus.runtime.quit();
  162. }
  163. });
  164. },
  165. record() {
  166. uni.navigateTo({
  167. url: "../record/record"
  168. })
  169. }
  170. },
  171. onShow() {
  172. this.id = plus.runtime.version
  173. },
  174. onBackPress(option) {
  175. uni.redirectTo({
  176. url: "../index/index"
  177. })
  178. }
  179. }
  180. </script>
  181. <style lang="scss">
  182. page {
  183. background: $uni-bg-color-grey;
  184. }
  185. .line {
  186. height: 16rpx;
  187. width: 100%;
  188. background: $uni-bg-color-grey;
  189. }
  190. .bottom {
  191. height: 190rpx;
  192. line-height: 190rpx;
  193. font-size: 8px;
  194. text-align: center;
  195. }
  196. .logo-box {
  197. background: #fff;
  198. text-align: center;
  199. padding: 80rpx 0;
  200. image {
  201. width: 150rpx;
  202. }
  203. .version {
  204. font-size: 24rpx;
  205. margin-top: 20rpx;
  206. }
  207. }
  208. .part {
  209. background: #fff;
  210. padding: 0 40rpx;
  211. .divide {
  212. width: 100%;
  213. height: 1px;
  214. background: $uni-bg-color-grey;
  215. }
  216. .info-item {
  217. display: flex;
  218. justify-content: space-between;
  219. line-height: 100rpx;
  220. .tit {
  221. font-size: 14px
  222. }
  223. .val {
  224. font-size: 12px;
  225. color: #666;
  226. }
  227. }
  228. }
  229. .record {
  230. background: #fff;
  231. padding: 0 40rpx;
  232. .info-item {
  233. display: flex;
  234. justify-content: space-between;
  235. line-height: 100rpx;
  236. .tit {
  237. font-size: 14px
  238. }
  239. }
  240. }
  241. .upgradeBox {
  242. padding: 15rpx;
  243. }
  244. </style>