123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <template>
- <view class="content">
- <view class="up-wrap">
- <image src="../../static/img/upapp.png" mode="" class="upapp-bg"></image>
- <view class="tit">
- 新版本升级
- </view>
- <view class="val">
- 客户端体验优化
- </view>
- <view class="btn444" @click="upApp">
- {{is_up?(schedule + '%'): '马上更新'}}
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- downurl: '',
- schedule: 0,
- is_up: false,
- }
- },
- onLoad(opt) {
- this.downurl = opt.downurl
- },
- onShow() {
- },
- onBackPress() {
- return true
- },
- methods: {
- upApp() {
- let that = this
- that.is_up = true
- let downloadTask = uni.downloadFile({
- url: that.downurl,
- success: (res1) => {
- // wgtWaiting.close();
- if (res1.statusCode === 200) {
- plus.runtime.install(res1.tempFilePath, {}, (e) => {
- plus.runtime.restart();
- console.log(e)
- }, (e) => {
- uni.showModal({
- content: "update error [" +
- e
- .code + "]:" + e
- .message,
- showCancel: false,
- });
- });
- } else {
- uni.showModal({
- content: "api error update fail!",
- showCancel: false,
- });
- }
- }
- });
- downloadTask.onProgressUpdate((res) => {
- console.log(res.progress);
- that.schedule = res.progress
- });
-
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- position: absolute;
- height: 100%;
- width: 100%;
- background-color: #7f7f7f;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .up-wrap {
- width: 522rpx;
- height: 499rpx;
- background: #FFFFFF;
- border-radius: 28rpx;
- position: relative;
- .upapp-bg {
- width: 345rpx;
- height: 307rpx;
- position: absolute;
- left: 0;
- right: 0;
- top: -150rpx;
- margin: auto;
- }
- .tit {
- margin-top: 190rpx;
- font-size: 39rpx;
- font-weight: 500;
- color: #FF443F;
- text-align: center;
- }
- .val {
- font-size: 31rpx;
- font-weight: 500;
- color: #A5A5A5;
- text-align: center;
- margin-top: 10rpx;
- }
- .btn444 {
- width: 357rpx;
- height: 83rpx !important;
- background: #FF443F;
- border-radius: 41rpx;
- text-align: center;
- line-height: 83rpx;
- font-size: 34rpx;
- font-weight: 500;
- color: #FFFFFF;
- margin: 10rpx auto 0;
- }
- }
- </style>
|