| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <template>
- <view>
- <view class="userDetalis_ul">
- <view class="userDetalis_list" @click="examineUpdate()">
- <view class="userDetalis_listTxt">版本更新</view>
- <u-icon name="arrow-right" color="#666" size="28"></u-icon>
- </view>
- <view class="userDetalis_line"></view>
- <view class="userDetalis_list" @click="defailList()">
- <view class="userDetalis_listTxt">历史版本更新列表</view>
- <u-icon name="arrow-right" color="#666" size="28"></u-icon>
- </view>
- </view>
- <view class="introduceBox_brand">© 河南云飞科技发展有限公司</view>
- <!-- 升级提示框 -->
- <u-modal v-model="show" :show-cancel-button="true" confirm-text="升级" title="发现新版本" @cancel="cancel"
- @confirm="confirm">
- <view class="u-update-content">
- <rich-text :nodes="newVersionInfo.app_desc"></rich-text>
- </view>
- </u-modal>
- <u-modal title="升级中请勿随意操作" :show-confirm-button="false" v-model="showA">
- <view class="upgradeBox">
- <u-line-progress v-show="isShow" active-color="#19be6b" :striped="true" :percent="percentNum"
- :striped-active="true"></u-line-progress>
- </view>
- </u-modal>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- edition: '', //版本号
- percentNum: 0, //在线下载进度
- isShow: false, //进度条
- show: false,
- showA: false, //
- newVersionInfo: {
- app_name: '',
- app_version: "",
- app_desc: '',
- create_time: '',
- down_path: ''
- }
- }
- },
- methods: {
- // 版本更新-监测
- async examineUpdate() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=back_source.appupdate.check_update',
- data: {
- old_version: this.edition
- }
- })
- console.log(res)
- if (Object.keys(res).length) {
- console.log(22)
- this.newVersionInfo = res
- this.show = true
- } else {
- console.log(11)
- this.$refs.uToast.show({
- title: '已经是最新版本啦',
- type: 'success',
- })
- }
- },
- // 在线升级
- confirm() {
- const downloadTask = uni.downloadFile({
- url: this.newVersionInfo.down_path,
- // url:'/app_file/suyuan/'+this.newVersionInfo.app_name,
- success: (downloadResult) => {
- if (downloadResult.statusCode === 200) {
- console.log('安装包下载成功,即将安装:' + JSON.stringify(downloadResult, null, 4));
- plus.runtime.openFile(downloadResult.tempFilePath);
- }
- }
- })
- downloadTask.onProgressUpdate((res) => {
- this.percentNum = res.progress
- if (res.progress == 100) {
- console.log('下载完成了')
- }
- });
- this.showA = true
- this.isShow = true
- },
- // 在线升级取消
- cancel() {
- this.show = false;
- },
- // 历史版本更新列表
- defailList() {
- uni.navigateTo({
- url: '../updateList/updateList'
- })
- },
- },
- onLoad() {
- this.edition = this.$store.state.versionNumber;
- console.log(this.edition)
- },
- }
- </script>
- <style lang="scss">
- page {
- background: #f4f4f4;
- }
- .introduceBox {
- background: #fff;
- padding: 55rpx 45rpx 65rpx 45rpx;
- .introduceBox_img {
- width: 160rpx;
- height: 160rpx;
- display: block;
- margin: 0 auto;
- }
- .introduceBox_num {
- text-align: center;
- color: #777777;
- line-height: 85rpx;
- }
- .introduceBox_txt {
- text-indent: 2em;
- letter-spacing: 2px;
- font-size: 13px;
- font-weight: 550;
- }
- }
- .userDetalis_ul {
- background: #fff;
- margin: 15rpx 0 0 0;
- .userDetalis_line {
- border-bottom: 1px solid #cfcfcf;
- width: 690rpx;
- margin: 0 0 0 20rpx;
- }
- .userDetalis_list {
- height: 90rpx;
- display: flex;
- width: 700rpx;
- margin: 0 auto;
- justify-content: space-between;
- .userDetalis_listTxt {
- color: #5d5d5d;
- padding: 25rpx 0 25rpx 0;
- }
- .userDetalis_listName {
- color: #5d5d5d;
- }
- .userDetalis_listRight {
- width: 50rpx;
- height: 50rpx;
- margin: 20rpx 0 0 0;
- }
- }
- }
- .introduceBox_brand {
- text-align: center;
- line-height: 105rpx;
- color: #777777;
- font-size: 13px;
- }
- .u-full-content {
- background-color: #00C777;
- }
- .u-update-content {
- font-size: 26rpx;
- color: $u-content-color;
- line-height: 1.7;
- padding: 30rpx;
- text-align: center;
- padding: 15rpx 0 15rpx 0;
- }
- .upgradeBox {
- padding: 15rpx;
- }
- </style>
|