| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <template>
- <view>
- <view class="line"></view>
- <view class="logo-box">
- <image src="../../../static/image/c9b4eb88c03b2f7460e8479e80f40fc.png" mode="widthFix"></image>
- <view class="version">
- <view>
- 云飞物联网
- </view>
- <view>
- V{{id}}
- </view>
- </view>
- </view>
- <view class="line"></view>
- <view class="part">
- <view class="info-item">
- <text class="tit">技术支持</text>
- <text class="val">河南云飞科技发展有限公司</text>
- </view>
- <view class="divide"></view>
- <view class="info-item">
- <text class="tit">关注微信</text>
- <text class="val">河南云飞科技发展有限公司</text>
- </view>
- </view>
- <view class="line"></view>
- <view class="part">
- <view class="info-item">
- <text class="tit">公司官网</text>
- <text class="val">www.hnyfkj.cn</text>
- </view>
- <view class="divide"></view>
- <view class="info-item">
- <text class="tit">业务合作</text>
- <text class="val">400-690-7990</text>
- </view>
- <view class="divide"></view>
- <view class="info-item">
- <text class="tit">公司邮箱</text>
- <text class="val">hnyf826@163.com</text>
- </view>
- </view>
- <view class="line"></view>
- <view class="part">
- <view class="info-item" @click="renewal">
- <text class="tit">版本更新</text>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <view class="line"></view>
- <view class="record">
- <view class="info-item" @click="record">
- <text class="tit">更新记录</text>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <view class="bottom">
- ©河南云飞科技发展有限公司
- </view>
- <u-modal title="升级中请勿随意操作" :show-confirm-button="false" v-model="showA" :content="contentA">
- <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>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- id:'1.0.0',
- versions:'',
- showA: false, //
- contentA: '',
- isShow: false, //进度条
- percentNum: 0, //在线下载进度
- }
- },
- methods: {
- async getEquipList() {
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=home.homes.app_version_record',
- data: {
- ret:"first"
- }
- })
- console.log(res)
- this.appName = res[0].app_name
- this.versions = Number(res[0].app_num.match(/\d+/g).join(""))
- var ids = Number(this.id.match(/\d+/g).join(""))
- if (this.versions > ids) {
- uni.showModal({
- title: '提示',
- content: '检测到有新版本,是否更新?',
- success: (res) => {
- if (res.confirm) {
- console.log('用户点击确定');
- this.showA = true
- this.isShow = true
- this.upgrade()
- } else if (res.cancel) {
- plus.runtime.quit();
- console.log('用户点击取消');
- }
- }
- })
- }else{
- uni.showToast({
- title:"当前版本已是最新版本",
- icon:"none"
- })
- }
- },
- renewal(){
- this.getEquipList()
- },
- upgrade() {
- console.log(this.appName)
- var url = "http://182.92.193.64:8002/app_file/" + this.appName
- console.log(url)
- const downloadTask = uni.downloadFile({
- url: url, //仅为示例,并非真实的资源
- success: (res) => {
- console.log(res)
- if (res.statusCode === 200) {
- console.log('下载成功');
- console.log('安装包下载成功,即将安装:' + JSON.stringify(res, null, 4));
- plus.runtime.openFile(res.tempFilePath);
- }
- },
- fail: (err) => {
- console.log(err)
- },
- complete: (com) => {
- console.log(com)
- }
- });
- downloadTask.onProgressUpdate((res) => {
- this.percentNum = res.progress
- if (res.progress == 100) {
- console.log('下载完成了')
- plus.runtime.quit();
- }
- });
- },
- record(){
- uni.navigateTo({
- url:"../record/record"
- })
- }
- },
- onShow() {
- // this.id = plus.runtime.version
- },
- onBackPress(option){
- uni.redirectTo({
- url:"../index/index"
- })
- }
- }
- </script>
- <style lang="scss">
- page {
- background:$uni-bg-color-grey;
- }
- .line{
- height:16rpx;
- width:100%;
- background:$uni-bg-color-grey;
- }
- .bottom{
- height:190rpx;
- line-height:190rpx;
- font-size:8px;
- text-align: center;
- }
- .logo-box{
- background:#fff;
- text-align: center;
- padding:80rpx 0;
- image{
- width:150rpx;
- }
- .version{
- font-size:24rpx;
- margin-top:20rpx;
- }
- }
- .part{
- background:#fff;
- padding:0 40rpx;
- .divide{
- width:100%;
- height:1px;
- background:$uni-bg-color-grey;
- }
- .info-item{
- display:flex;
- justify-content: space-between;
- line-height:100rpx;
- .tit{font-size:14px}
- .val{
- font-size:12px;
- color:#666;
- }
- }
- }
- .record{
- background:#fff;
- padding:0 40rpx;
- .info-item{
- display:flex;
- justify-content: space-between;
- line-height:100rpx;
- .tit{font-size:14px}
- }
- }
- .upgradeBox {
- padding: 15rpx;
- }
- </style>
|