about.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view>
  3. <view class="line"></view>
  4. <view class="logo-box">
  5. <image :src="$imageURL+ '/bigdata_app'+'/image/c9b4eb88c03b2f7460e8479e80f40fc.png'" mode="widthFix" v-if="$isneutral"></image>
  6. <view class="version">
  7. <view v-if="$isneutral">
  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" v-if="$isneutral">
  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" v-if="$isneutral"></view>
  31. <view class="part" v-if="$isneutral">
  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" v-if="$isneutral"></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" v-if="$isneutral">
  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. if(this.$isneutral){
  148. this.appName = "big_data"//标准版
  149. }else{
  150. this.appName = "big_data2"//中性版
  151. }
  152. // this.appName = "big_data"
  153. var url = "http://hnyfwlw.com/app/" + this.appName + ".apk"
  154. console.log(url)
  155. const downloadTask = uni.downloadFile({
  156. url: url, //仅为示例,并非真实的资源
  157. success: (res) => {
  158. console.log(res)
  159. if (res.statusCode === 200) {
  160. console.log('下载成功');
  161. console.log('安装包下载成功,即将安装:' + JSON.stringify(res, null, 4));
  162. plus.runtime.openFile(res.tempFilePath);
  163. this.showA = false
  164. this.isShow = false
  165. }
  166. },
  167. fail: (err) => {
  168. console.log(err)
  169. },
  170. complete: (com) => {
  171. console.log(com)
  172. }
  173. });
  174. downloadTask.onProgressUpdate((res) => {
  175. this.percentNum = res.progress
  176. if (res.progress == 100) {
  177. console.log('下载完成了')
  178. plus.runtime.quit();
  179. }
  180. });
  181. },
  182. record() {
  183. uni.navigateTo({
  184. url: "../record/record"
  185. })
  186. }
  187. },
  188. onShow() {
  189. this.id = plus.runtime.version
  190. this.getEquipList()
  191. },
  192. onBackPress(option) {
  193. uni.redirectTo({
  194. url: "../index/index"
  195. })
  196. }
  197. }
  198. </script>
  199. <style lang="scss">
  200. page {
  201. background: $uni-bg-color-grey;
  202. }
  203. .line {
  204. height: 16rpx;
  205. width: 100%;
  206. background: $uni-bg-color-grey;
  207. }
  208. .bottom {
  209. height: 190rpx;
  210. line-height: 190rpx;
  211. font-size: 8px;
  212. text-align: center;
  213. }
  214. .logo-box {
  215. background: #fff;
  216. text-align: center;
  217. padding: 80rpx 0;
  218. image {
  219. width: 150rpx;
  220. }
  221. .version {
  222. font-size: 24rpx;
  223. margin-top: 20rpx;
  224. }
  225. }
  226. .part {
  227. background: #fff;
  228. padding: 0 40rpx;
  229. .divide {
  230. width: 100%;
  231. height: 1px;
  232. background: $uni-bg-color-grey;
  233. }
  234. .info-item {
  235. display: flex;
  236. justify-content: space-between;
  237. line-height: 100rpx;
  238. position: relative;
  239. .tit {
  240. font-size: 14px
  241. }
  242. .val {
  243. font-size: 12px;
  244. color: #666;
  245. }
  246. .update{
  247. position: absolute;
  248. top: 34rpx;
  249. right: 32rpx;
  250. font-size: 16rpx !important;
  251. background-color: #f00;
  252. border-radius: 25rpx;
  253. height: 30rpx;
  254. padding: 2rpx 16rpx;
  255. line-height: 30rpx;
  256. color: #fff;
  257. }
  258. }
  259. }
  260. .record {
  261. background: #fff;
  262. padding: 0 40rpx;
  263. .info-item {
  264. display: flex;
  265. justify-content: space-between;
  266. line-height: 100rpx;
  267. .tit {
  268. font-size: 14px
  269. }
  270. }
  271. }
  272. .upgradeBox {
  273. padding: 15rpx;
  274. }
  275. </style>