about.vue 6.4 KB

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