about.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view>
  3. <view class="line"></view>
  4. <view class="logo-box">
  5. <image src="../../../static/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:'1.0.0',
  73. versions:'',
  74. showA: false, //
  75. contentA: '',
  76. isShow: false, //进度条
  77. percentNum: 0, //在线下载进度
  78. }
  79. },
  80. methods: {
  81. async getEquipList() {
  82. const res = await this.$myRequest({
  83. url: '/api/api_gateway?method=home.homes.app_version_record',
  84. data: {
  85. ret:"first"
  86. }
  87. })
  88. console.log(res)
  89. this.appName = res[0].app_name
  90. this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
  91. var ids = Number(this.id.match(/\d+/g).join(""))
  92. if (this.versions > ids) {
  93. uni.showModal({
  94. title: '提示',
  95. content: '检测到有新版本,是否更新?',
  96. success: (res) => {
  97. if (res.confirm) {
  98. console.log('用户点击确定');
  99. this.showA = true
  100. this.isShow = true
  101. this.upgrade()
  102. } else if (res.cancel) {
  103. plus.runtime.quit();
  104. console.log('用户点击取消');
  105. }
  106. }
  107. })
  108. }else{
  109. uni.showToast({
  110. title:"当前版本已是最新版本",
  111. icon:"none"
  112. })
  113. }
  114. },
  115. renewal(){
  116. this.getEquipList()
  117. },
  118. upgrade() {
  119. console.log(this.appName)
  120. var url = "http://182.92.193.64:8002/app_file/" + this.appName
  121. console.log(url)
  122. const downloadTask = uni.downloadFile({
  123. url: url, //仅为示例,并非真实的资源
  124. success: (res) => {
  125. console.log(res)
  126. if (res.statusCode === 200) {
  127. console.log('下载成功');
  128. console.log('安装包下载成功,即将安装:' + JSON.stringify(res, null, 4));
  129. plus.runtime.openFile(res.tempFilePath);
  130. }
  131. },
  132. fail: (err) => {
  133. console.log(err)
  134. },
  135. complete: (com) => {
  136. console.log(com)
  137. }
  138. });
  139. downloadTask.onProgressUpdate((res) => {
  140. this.percentNum = res.progress
  141. if (res.progress == 100) {
  142. console.log('下载完成了')
  143. plus.runtime.quit();
  144. }
  145. });
  146. },
  147. record(){
  148. uni.navigateTo({
  149. url:"../record/record"
  150. })
  151. }
  152. },
  153. onShow() {
  154. // this.id = plus.runtime.version
  155. },
  156. onBackPress(option){
  157. uni.redirectTo({
  158. url:"../index/index"
  159. })
  160. }
  161. }
  162. </script>
  163. <style lang="scss">
  164. page {
  165. background:$uni-bg-color-grey;
  166. }
  167. .line{
  168. height:16rpx;
  169. width:100%;
  170. background:$uni-bg-color-grey;
  171. }
  172. .bottom{
  173. height:190rpx;
  174. line-height:190rpx;
  175. font-size:8px;
  176. text-align: center;
  177. }
  178. .logo-box{
  179. background:#fff;
  180. text-align: center;
  181. padding:80rpx 0;
  182. image{
  183. width:150rpx;
  184. }
  185. .version{
  186. font-size:24rpx;
  187. margin-top:20rpx;
  188. }
  189. }
  190. .part{
  191. background:#fff;
  192. padding:0 40rpx;
  193. .divide{
  194. width:100%;
  195. height:1px;
  196. background:$uni-bg-color-grey;
  197. }
  198. .info-item{
  199. display:flex;
  200. justify-content: space-between;
  201. line-height:100rpx;
  202. .tit{font-size:14px}
  203. .val{
  204. font-size:12px;
  205. color:#666;
  206. }
  207. }
  208. }
  209. .record{
  210. background:#fff;
  211. padding:0 40rpx;
  212. .info-item{
  213. display:flex;
  214. justify-content: space-between;
  215. line-height:100rpx;
  216. .tit{font-size:14px}
  217. }
  218. }
  219. .upgradeBox {
  220. padding: 15rpx;
  221. }
  222. </style>