app_update.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="app_update">
  3. <view class="logo_box">
  4. <image src="../static/images/crmeb_java.png"></image>
  5. <view class="title">crmeb</view>
  6. <view class="version">Version {{appUpdate.versionCode}}</view>
  7. </view>
  8. <!-- <view class="jiancha" @click="appVersionConfig()">
  9. <text>检查新版本</text>
  10. <text class="iconfont icon-you"></text>
  11. </view> -->
  12. </view>
  13. </template>
  14. <script>
  15. // +----------------------------------------------------------------------
  16. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  17. // +----------------------------------------------------------------------
  18. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  19. // +----------------------------------------------------------------------
  20. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  21. // +----------------------------------------------------------------------
  22. // | Author: CRMEB Team <admin@crmeb.com>
  23. // +----------------------------------------------------------------------
  24. // import {getAppVersion} from '@/api/api.js';
  25. export default {
  26. data() {
  27. return {
  28. appUpdate:{}
  29. }
  30. },
  31. onLoad() {
  32. let that = this;
  33. plus.runtime.getProperty(plus.runtime.appid,function(inf){
  34. that.$set(that.appUpdate,'versionCode',inf.version);
  35. })
  36. },
  37. methods: {
  38. appVersionConfig(){
  39. var that = this;
  40. //app升级
  41. // 获取本地应用资源版本号
  42. getAppVersion().then(res=>{
  43. that.$set(that.appUpdate,'androidAddress',res.data.androidAddress);
  44. that.$set(that.appUpdate,'appVersion',res.data.appVersion);
  45. that.$set(that.appUpdate,'iosAddress',res.data.iosAddress);
  46. that.$set(that.appUpdate,'openUpgrade',res.data.openUpgrade);
  47. plus.runtime.getProperty(plus.runtime.appid,function(inf){
  48. let nowVersion = (inf.version).split('.').join('');
  49. let appVersion = (res.data.appVersion).split('.').join('');
  50. uni.getSystemInfo({
  51. success:(res) => {
  52. if(appVersion > nowVersion){
  53. uni.showModal({
  54. title: '更新提示',
  55. content: '发现新版本,是否前去下载?',
  56. showCancel:that.appUpdate.openUpgrade == 'false' ? true : false,
  57. cancelColor: '#eeeeee',
  58. confirmColor: '#FF0000',
  59. success(response) {
  60. if (response.confirm) {
  61. switch (res.platform){
  62. case "android":
  63. plus.runtime.openURL(that.appUpdate.androidAddress);
  64. break;
  65. case "ios":
  66. plus.runtime.openURL(encodeURI(that.appUpdate.iosAddress));
  67. break;
  68. }
  69. }
  70. }
  71. });
  72. }else if(appVersion <= nowVersion){
  73. uni.showToast({
  74. title:'已是最新版本',
  75. icon:'none'
  76. })
  77. }
  78. }
  79. })
  80. });
  81. })
  82. },
  83. }
  84. }
  85. </script>
  86. <style>
  87. .app_update{
  88. background-color: #fff;
  89. height: 100vh;
  90. }
  91. .logo_box{
  92. height: 500rpx;
  93. display: flex;
  94. flex-direction: column;
  95. justify-content: center;
  96. align-items: center;
  97. }
  98. .logo_box image{
  99. display: block;
  100. margin-top:80rpx;
  101. width: 120rpx;
  102. height: 120rpx;
  103. border-radius: 50%;
  104. }
  105. .title{
  106. font-size: 34rpx;
  107. font-family: PingFang SC;
  108. font-weight: 600;
  109. color: #333333;
  110. margin: 20rpx auto 20rpx;
  111. }
  112. .version{
  113. font-size: 28rpx;
  114. font-family: PingFang SC;
  115. font-weight: 500;
  116. color: #333333;
  117. }
  118. .jiancha{
  119. width: 690rpx;
  120. margin: 20rpx auto 0;
  121. padding: 0 20rpx 0;
  122. height: 100rpx;
  123. line-height: 100rpx;
  124. color: #333333;
  125. font-size: 30rpx;
  126. border-top:1px solid #f5f5f5;
  127. border-bottom:1px solid #f5f5f5;
  128. display: flex;
  129. justify-content: space-between;
  130. }
  131. </style>