<!-- 关于我们组件 -->
|
<template>
|
<view class="m-form">
|
<view class="m-page-over">
|
<!-- <view class="m-form-head"><u-icon name="close-circle" color="#fff" size="40" @click="cancel"></u-icon></view> -->
|
<!-- 修改 -->
|
<!-- <u-notice-bar v-if="text1.length!=0" mode="closable" direction="row" step
|
:text="text1">{{text1}}</u-notice-bar> -->
|
<view class="m-form-label">
|
<!-- {{info}} -->
|
<uni-notice-bar v-if="info.length!=0" showClose showIcon scrollable single :text="info"><!-- {{info}} --></uni-notice-bar>
|
<u-button v-if="info.length!=0" type="primary" text="下载新版本" @click="Download"></u-button>
|
<u--form
|
labelPosition="left"
|
labelAlign="left"
|
:model="model"
|
ref="form"
|
labelWidth="100"
|
:labelStyle="{ color: '#459EFF', 'white-space': 'nowrap', 'letter-spacing': '0.65em' }"
|
>
|
<u-form-item label="名称" prop="app_name" borderBottom ref="item">
|
<u--input
|
:customStyle="{
|
'background-color': '#459EFF'
|
}"
|
placeholderStyle="color:#fff"
|
color="#fff"
|
v-model="model.app_name"
|
border="none"
|
></u--input>
|
</u-form-item>
|
<!-- <u-form-item label="LOGO" prop="logo_name" borderBottom ref="item" @click="chooseImage">
|
<u--input
|
readonly
|
:customStyle="{
|
'background-color': '#459EFF',
|
}"
|
placeholderStyle="color:#fff"
|
color="#fff"
|
v-model="model.logo_name"
|
border="none"
|
></u--input>
|
</u-form-item> -->
|
<u-form-item label="版本" prop="banben" borderBottom ref="item">
|
<u--input
|
readonly
|
:customStyle="{
|
'background-color': '#459EFF',
|
}"
|
placeholderStyle="color:#fff"
|
color="#fff"
|
v-model="model.banben"
|
border="none"
|
></u--input>
|
</u-form-item>
|
</u--form>
|
</view>
|
<view class="m-form-button-list" >
|
<!-- <view style="display: flex;"> -->
|
<u-button type="primary" text="确定" @click="save"></u-button>
|
|
|
<!-- </view> -->
|
</view>
|
<!-- <view class="m-form-button-list"><u-button type="primary" text="下载" @click="save"></u-button></view> -->
|
<view class="container">
|
<image class="logo" src="/static/log.gif"></image>
|
<!-- 其他内容 -->
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import { chooseImage, saveFile} from '@/common/utils.js';
|
export default {
|
props: {},
|
data() {
|
return {
|
info:'',
|
downloadUrl:'',
|
model: {
|
|
logo_name: '', //logo
|
app_name: '' ,//软件名称
|
banben:'V134'
|
},
|
img_url:''
|
};
|
},
|
|
|
methods: {
|
//保存
|
save() {
|
//修改关于我们信息
|
saveFile(this.img_url).then(res=>{
|
uni.setStorageSync("about_info",{logo_name:this.model.logo_name,app_name:this.model.app_name,img_url:res.savedFilePath})
|
this.$emit('submitAboutUsForm');
|
})
|
},
|
Download(){
|
if (this.info == undefined) {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '未检测到新版本'
|
});
|
} else {
|
uni.showLoading({
|
title: '正在下载'
|
});
|
console.log(this.downloadUrl);
|
uni.downloadFile({
|
url: this.downloadUrl,
|
// header: {
|
// 'Authorization': 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiLnjovpo54iLCJpYXQiOjE3NDA5NjQxODEsImV4cCI6MTc0MTM5NjE4MX0.jDdBkrjGvdEU9bWh7pKC1WduS-8z50KVRY_1D_HY9_o'
|
// },
|
success: (res) => {
|
uni.hideLoading();
|
if (res.statusCode === 200) {
|
// 下载成功,打开文件管理器让用户选择保存位置
|
uni.openDocument({
|
filePath: res.tempFilePath,
|
showMenu: true,
|
success: () => {},
|
fail: (err) => {
|
uni.showToast({
|
title: '文件打开失败',
|
icon: 'none'
|
});
|
}
|
});
|
} else {
|
console.error('下载失败', res);
|
uni.showToast({
|
title: '下载失败',
|
icon: 'none'
|
});
|
}
|
},
|
fail: (err) => {
|
uni.hideLoading();
|
console.error('下载失败', err);
|
uni.showToast({
|
title: '下载失败',
|
icon: 'none'
|
});
|
}
|
});
|
}
|
},
|
//取消
|
cancel() {
|
this.$emit('cancelAboutUsForm');
|
},
|
//获取关于我们信息
|
getInfo() {
|
var info = uni.getStorageSync('about_info');
|
if(!info){
|
this.model.app_name='智能空间电子围栏'
|
return
|
}
|
if(info.app_name)
|
this.model.app_name = info.app_name;
|
if(info.img_url)
|
this.img_url=info.img_url
|
if(info.logo_name)
|
this.model.logo_name=info.logo_name
|
},
|
chooseImage() {
|
chooseImage().then(res => {
|
this.model.logo_name = res.name;
|
this.img_url=res.tempFiles[0].path
|
});
|
}
|
},
|
mounted() {
|
this.getInfo();
|
var data = {}
|
// data.name = '空间围栏'
|
var method ='GET'
|
var contentType='application/x-www-form-urlencoded'
|
uni.request({
|
// url: "http://192.168.31.101:8181/Fence/", //接口地址。
|
// url: "http://111.198.60.6:6008/Fence/", //接口地址。
|
// url: "http://123.56.113.213:8081/api/wx/checkLogin", //接口地址。
|
url: "http://39.106.210.13:8090/api/wx/findTbUpapp?name=空间围栏", //接口地址。
|
// url: "http://192.168.31.98:8090/api/wx/findTbUpapp?name=空间围栏", //接口地址。
|
data: data,
|
method: method,
|
// header: { //请求头可自定义
|
// 'Authorization':uni.getStorageSync('access_token'),Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiLnjovpo54iLCJpYXQiOjE3NDA5NjQxODEsImV4cCI6MTc0MTM5NjE4MX0.jDdBkrjGvdEU9bWh7pKC1WduS-8z50KVRY_1D_HY9_o
|
// 'content-type': contentType,
|
// },
|
timeout:5000,//设置超时时间,默认5秒
|
success: (rep) => { //具体捕获请看自己接口返回的形式
|
console.log(rep);
|
if (this.model.banben!=rep.data.data.version ) {
|
console.log(rep.data.data.info );
|
this.model.banben=rep.data.data.version
|
this.info=rep.data.data.info
|
this.downloadUrl = rep.data.data.address
|
}
|
|
// if (rep.data.code!=0) {
|
// store.commit('$tStore', {
|
// name: 'vuex_is_login',
|
// value: false
|
// })
|
// // uni.reLaunch({
|
// // url: '/pages/index/login'
|
// // });
|
// uni.reLaunch({
|
// url: '/pages/index/index'
|
// });
|
// }else{
|
// uni.reLaunch({
|
// url: '/pages/index/index'
|
// });
|
// }
|
|
},
|
fail(error) {
|
console.log(error);
|
// uni.hideLoading();
|
// uni.$u.toast('网络不通');
|
// reject(error)
|
},
|
// complete() {
|
// uni.hideLoading();
|
// }
|
});
|
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.container {
|
/* 样式根据需要定制 */
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
}
|
.logo {
|
width: 211.3px; /* 根据logo大小调整 */
|
height: 50px; /* 根据logo大小调整 */
|
margin-top: 50px; /* 根据需要调整 */
|
}
|
.m-form {
|
position: fixed;
|
top: calc(3.5em + 20px);
|
left: 0;
|
background-color: rgba(255, 255, 255, 0.9);
|
width: 100%;
|
height: calc(100vh - 3.5em - 20px - 60px);
|
overflow: scroll;
|
z-index: 750;
|
// border-radius: 15px;
|
box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.16);
|
display: flex;
|
flex-direction: column;
|
}
|
.m-page-over {
|
width: calc(100vw - 8em - 1px);
|
height: 100%;
|
position: absolute;
|
left: 0;
|
top: 0;
|
border-right: 1px solid #63aff9;
|
}
|
.m-form-head {
|
width: 100%;
|
border-bottom: 1px solid #fff;
|
}
|
.m-form-head .u-icon {
|
float: right;
|
}
|
// /deep/ .u-form-item:nth-of-type(3) .u-form-item__body__left__content__label,
|
// /deep/ .u-form-item:nth-of-type(4) .u-form-item__body__left__content__label,
|
// /deep/ .u-form-item:nth-of-type(5) .u-form-item__body__left__content__label,
|
// /deep/ .u-form-item:nth-of-type(6) .u-form-item__body__left__content__label {
|
// letter-spacing: 0 !important;
|
// }
|
.m-form-label {
|
width: 80%;
|
margin: 0 auto;
|
margin-bottom: 0.5em;
|
overflow: overlay;
|
}
|
input {
|
width: 50px;
|
}
|
.m-form-button-list {
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
margin-bottom: 1em;
|
}
|
.m-form-button-list .u-button {
|
width: 5em;
|
}
|
.m-form-button-list .u-button:nth-child(2),
|
.m-form-button-list .u-button:nth-child(3),
|
.m-form-button-list .u-button:nth-child(4) {
|
margin-top: 2em;
|
}
|
</style>
|