about.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view>
  3. <hx-navbar left-text="关于" defaultBackUrl="/pages/user/setting/setting"></hx-navbar>
  4. <view class="container">
  5. <image src="../../static/img/logo96x96.png" mode=""></image>
  6. <view class="title margin-top">
  7. <text>{{appName}}</text>
  8. </view>
  9. <text class="vsersion">版本号 {{version}}</text>
  10. </view>
  11. <view class="cu-list menu sm-border">
  12. <navigator class="cu-item arrow " url="features" open-type="navigate">
  13. <view class="content">
  14. <text class="text-black">功能介绍</text>
  15. </view>
  16. <view class="action">
  17. <text class="text-grey text-sm"></text>
  18. </view>
  19. </navigator>
  20. <!-- #ifdef APP-PLUS -->
  21. <view class="cu-item arrow " @click="upgrade">
  22. <view class="content">
  23. <text class="text-black">检测更新</text>
  24. </view>
  25. <view class="action">
  26. <text class="text-grey text-sm"></text>
  27. </view>
  28. </view>
  29. <!-- #endif -->
  30. <navigator class="cu-item arrow " url="protocol/protocol" open-type="navigate">
  31. <view class="content">
  32. <text class="text-black">服务协议</text>
  33. </view>
  34. <view class="action">
  35. <text class="text-grey text-sm"></text>
  36. </view>
  37. </navigator>
  38. </view>
  39. <view class="foot">
  40. <view class="solid-bottom text-xs padding justify-center">
  41. <text class="text-gray">{{company}} 版权所有</text>
  42. <view></view>
  43. <text class="text-gray">Copyright © 2019-{{nowYear}} {{companyEN}}</text>
  44. <view></view>
  45. <text class="text-gray">All Rights Reserved</text>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. var that;
  52. export default {
  53. data() {
  54. return {
  55. appName: this.$conf.appName,
  56. version: this.$conf.version,
  57. company: this.$conf.company,
  58. companyEN: this.$conf.companyEN,
  59. nowYear: 2019,
  60. server: this.$conf.server
  61. }
  62. },
  63. onLoad(){
  64. },
  65. mounted() {
  66. that= this;
  67. var myDate = new Date();
  68. that.nowYear = myDate.getFullYear();
  69. },
  70. methods: {
  71. // #ifdef APP-PLUS
  72. upgrade(){
  73. let that = this;
  74. plus.runtime.getProperty(plus.runtime.appid,function(inf){
  75. that.$appUpgrade.checkUpgrade( inf.version);
  76. //sessionStorage.setItem('upgrade','1');
  77. });
  78. /* uni.showLoading({
  79. title: '获取最新版本中'
  80. });
  81. setTimeout(function () {
  82. uni.hideLoading();
  83. uni.showToast({
  84. title: '已是最新版本',
  85. position: 'center',
  86. });
  87. }, 2000); */
  88. },
  89. //检查更新
  90. checkUpgrade(wgtVer){
  91. let that = this;
  92. plus.nativeUI.showWaiting("检测更新...");
  93. that.$api.app.upgrade({version:wgtVer}).then((res)=>{
  94. plus.nativeUI.closeWaiting();
  95. let resData = res.data;
  96. if( parseInt(resData.code) ==1 ){
  97. //可以升级
  98. plus.nativeUI.confirm("检查到当前版本有最新更新,下载升级?",
  99. function(event){
  100. if(event.index ==0){
  101. console.log('下载地址:'+ server + resData.url)
  102. downWgt(server + resData.url); //下载更新版的地址
  103. }
  104. } ,'系统消息',['马上升级','下次再说']);
  105. } else{
  106. plus.nativeUI.toast("无新版本可更新!");
  107. }
  108. }).catch((e)=>{
  109. plus.nativeUI.closeWaiting();
  110. plus.nativeUI.toast('检测更新失败!') ;
  111. })
  112. },
  113. // 下载wgt文件
  114. downWgt(wgtUrl){
  115. plus.nativeUI.showWaiting("下载更新文件...");
  116. plus.downloader.createDownload( wgtUrl, {filename:"_doc/update/"}, function(d,status){
  117. if ( status == 200 ) {
  118. //console.log("下载wgt成功:"+d.filename);
  119. installWgt(d.filename); // 安装wgt包
  120. } else {
  121. //console.log("下载wgt失败!");
  122. plus.nativeUI.alert("下载更新失败!");
  123. }
  124. plus.nativeUI.closeWaiting();
  125. }).start();
  126. },
  127. // 更新应用资源
  128. installWgt(path){
  129. plus.nativeUI.showWaiting("正在安装更新文件...");
  130. plus.runtime.install(path,{},function(){
  131. plus.nativeUI.closeWaiting();
  132. plus.nativeUI.alert("应用资源更新完成!",function(){
  133. plus.runtime.restart();
  134. });
  135. },function(e){
  136. plus.nativeUI.closeWaiting();
  137. plus.nativeUI.alert("安装更新文件失败["+e.code+"]:"+e.message);
  138. });
  139. }
  140. // #endif
  141. }
  142. }
  143. </script>
  144. <style>
  145. page{
  146. background: #ffffff;
  147. }
  148. .cu-list.menu {
  149. margin-left:24upx;
  150. margin-right:24upx;
  151. border-top: 2upx solid #f1f1f1;
  152. border-bottom: 2upx solid #f1f1f1;
  153. }
  154. .text-grey{
  155. color: #555555;
  156. }
  157. .container{
  158. margin-top: 60upx;
  159. margin-bottom: 60upx;
  160. text-align: center;
  161. }
  162. .container image{
  163. width: 192upx;
  164. height: 192upx;
  165. }
  166. .title{
  167. font-size: 40upx;
  168. font-weight: bold;
  169. color: #333333;
  170. text-align: center;
  171. margin-bottom: 8upx;
  172. }
  173. .version{
  174. font-size: 32upx;
  175. color: #333333;
  176. }
  177. .foot{
  178. position: absolute;
  179. bottom: 10upx;
  180. text-align: center;
  181. width: 100%;
  182. }
  183. </style>