about.vue 6.3 KB

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