about.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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(TF) {
  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.id = res[0].app_num
  92. this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
  93. var ids = Number(this.id.match(/\d+/g).join(""))
  94. if (this.percentNum > 0) {
  95. console.log("更新中")
  96. } else {
  97. if (TF) {
  98. if (this.versions > ids) {
  99. uni.showModal({
  100. title: '检测到有新版本,是否更新?',
  101. content: '建议更新,不更新可能会出现部分数据无法获取!',
  102. confirmText: "更新",
  103. cancelText: "不更新",
  104. success: (res) => {
  105. if (res.confirm) {
  106. console.log('用户点击确定');
  107. this.showA = true
  108. this.isShow = true
  109. this.upgrade()
  110. } else if (res.cancel) {
  111. // plus.runtime.quit();
  112. console.log('用户点击取消');
  113. }
  114. }
  115. })
  116. } else {
  117. uni.showToast({
  118. title: "当前版本已是最新版本",
  119. icon: "none"
  120. })
  121. }
  122. }
  123. }
  124. },
  125. renewal() {
  126. this.getEquipList(true)
  127. },
  128. upgrade() {
  129. uni.getStorage({
  130. key: 'http',
  131. success: (res) => {
  132. this.value = res.data
  133. }
  134. })
  135. console.log(this.appName)
  136. var url = "http://hnyfwlw.com/app/big_data.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. this.getEquipList(false)
  174. },
  175. onBackPress(option) {
  176. uni.redirectTo({
  177. url: "../index/index"
  178. })
  179. }
  180. }
  181. </script>
  182. <style lang="scss">
  183. page {
  184. background: $uni-bg-color-grey;
  185. }
  186. .line {
  187. height: 16rpx;
  188. width: 100%;
  189. background: $uni-bg-color-grey;
  190. }
  191. .bottom {
  192. height: 190rpx;
  193. line-height: 190rpx;
  194. font-size: 8px;
  195. text-align: center;
  196. }
  197. .logo-box {
  198. background: #fff;
  199. text-align: center;
  200. padding: 80rpx 0;
  201. image {
  202. width: 150rpx;
  203. }
  204. .version {
  205. font-size: 24rpx;
  206. margin-top: 20rpx;
  207. }
  208. }
  209. .part {
  210. background: #fff;
  211. padding: 0 40rpx;
  212. .divide {
  213. width: 100%;
  214. height: 1px;
  215. background: $uni-bg-color-grey;
  216. }
  217. .info-item {
  218. display: flex;
  219. justify-content: space-between;
  220. line-height: 100rpx;
  221. .tit {
  222. font-size: 14px
  223. }
  224. .val {
  225. font-size: 12px;
  226. color: #666;
  227. }
  228. }
  229. }
  230. .record {
  231. background: #fff;
  232. padding: 0 40rpx;
  233. .info-item {
  234. display: flex;
  235. justify-content: space-between;
  236. line-height: 100rpx;
  237. .tit {
  238. font-size: 14px
  239. }
  240. }
  241. }
  242. .upgradeBox {
  243. padding: 15rpx;
  244. }
  245. </style>