| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- <template>
- <view>
- <view class="line"></view>
- <view class="logo-box">
- <image :src="$imageURL+ '/bigdata_app'+'/image/c9b4eb88c03b2f7460e8479e80f40fc.png'" mode="widthFix" v-if="$isneutral"></image>
- <view class="version">
- <view v-if="$isneutral">
- 云飞物联网
- </view>
- <view>
- 当前版本号
- </view>
- <view>
- V{{id}}
- </view>
- </view>
- </view>
- <view class="line"></view>
- <view class="part" v-if="$isneutral">
- <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" v-if="$isneutral"></view>
- <view class="part" v-if="$isneutral">
- <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>
- <p class="update" v-if="updateTF">NEW</p>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </view>
- <view class="line" v-if="$isneutral"></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" v-if="$isneutral">
- ©河南云飞科技发展有限公司
- </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: '',
- versions: '',
- showA: false, //
- contentA: '',
- isShow: false, //进度条
- percentNum: 0, //在线下载进度,
- value: "",
- updateTF:false
- }
- },
- 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(plus.runtime.version.match(/\d+/g).join(""))
- if (this.versions > ids) {
- this.updateTF = true
- } else {
- this.updateTF = false
- }
- },
- renewal() {
- // this.getEquipList()
- var ids = Number(plus.runtime.version.match(/\d+/g).join(""))
- if (this.percentNum > 0) {
- console.log("更新中")
- } else {
- if (this.versions > ids) {
- this.updateTF = true
- uni.showModal({
- title: '检测到有新版本,是否更新?',
- content: '建议更新,不更新可能会出现部分数据无法获取!',
- confirmText: "更新",
- cancelText: "不更新",
- 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 {
- this.updateTF = false
- uni.showToast({
- title: "当前版本已是最新版本",
- icon: "none"
- })
- }
- }
- },
- upgrade() {
- uni.getStorage({
- key: 'http',
- success: (res) => {
- this.value = res.data
- }
- })
- // console.log(this.appName)
- // ---------------------------------------------------------------------------------------------------------------------------
- if(this.$isneutral){
- this.appName = "big_data"//标准版
- }else{
- this.appName = "big_data2"//中性版
- }
- // this.appName = "big_data"
- var url = "http://hnyfwlw.com/app/" + this.appName + ".apk"
- 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);
- this.showA = false
- this.isShow = false
- }
- },
- 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
- this.getEquipList()
- },
- 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;
- position: relative;
- .tit {
- font-size: 14px
- }
- .val {
- font-size: 12px;
- color: #666;
- }
- .update{
- position: absolute;
- top: 34rpx;
- right: 32rpx;
- font-size: 16rpx !important;
- background-color: #f00;
- border-radius: 25rpx;
- height: 30rpx;
- padding: 2rpx 16rpx;
- line-height: 30rpx;
- color: #fff;
- }
- }
- }
- .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>
|