<template>
|
<view class="template-job tn-safe-area-inset-bottom">
|
|
<!-- 顶部自定义导航 -->
|
<tn-nav-bar fixed :isBack="false" :bottomShadow="false" backgroundColor="unset">
|
<text class="page-title">我的</text>
|
</tn-nav-bar>
|
|
<view class="home-top-bg"></view>
|
|
<view class="home-top-box" :style="{paddingTop:paddingTop+'px'}">
|
<view class="userinfo-box">
|
<view class="userinfo-img" style="">
|
<!-- <u-avatar src="../../static/companylogo.png" style="background: #3E989D;"></u-avatar> -->
|
<image :src="companylogo" style="width:109.375px;height:25px;background: #3E989D;"></image>
|
</view>
|
<view class="userinfo-value-box">
|
<view class="user-nickname">{{ vuex_is_login ? vuex_user :'昵称' }}</view>
|
<view class="user-nickname">{{ vuex_is_login ? company :'公司' }}</view>
|
<!-- <view class="user-company">{{ vuex_is_login ? usercode :'暂未登录' }}</view> -->
|
</view>
|
</view>
|
<view style="margin:0 15px;margin-top:20px;">
|
<u-notice-bar v-if="text1.length!=0" mode="closable" direction="row" step
|
:text="text1">{{text1}}</u-notice-bar>
|
<u-cell-group>
|
<u-cell size="large" icon="level" title="当前版本" :value="appversion" isLink @click="update">
|
</u-cell>
|
<u-cell size="large" icon="setting-fill" title="切换数据源" value="输入地址" isLink
|
@click="updatedata"></u-cell>
|
<u-cell size="large" icon="setting-fill" title="部门管理" isLink @click="tobumen"></u-cell>
|
<u-cell size="large" icon="setting-fill" title="语音设置" isLink @click="tospeech"></u-cell>
|
|
<!-- <u-cell size="large" icon="bell-fill" title="测试通知" value="发送通知" isLink @click="message"></u-cell> -->
|
<!-- <u-cell size="large" icon="camera-fill" title="信息登记" value="前往录入" isLink @click="camera"></u-cell> -->
|
<!-- <u-cell v-show="juese=='超级管理员'" size="large" icon="../../static/my/faka.png" title="发卡管理"
|
value="进入管理" isLink @click="faka"></u-cell> -->
|
<!-- <u-cell size="large" icon="../../static/my/base.png" title="显示基站">
|
<u-switch slot="value" v-model="isbase" @change="changejizhan"></u-switch></u-cell> -->
|
<u-cell size="large" icon="../../static/my/fence.png" title="显示围栏">
|
<u-switch slot="value" v-model="isfence" @change="changeweilan"></u-switch></u-cell>
|
<u-cell size="large" icon="../../static/my/offline.png" title="离线显示">
|
<u-switch slot="value" v-model="isoffline" @change="changelixian"></u-switch></u-cell>
|
<u-cell size="large" icon="../../static/my/3wei.png" title="显示3维">
|
<u-switch slot="value" v-model="is3wei" @change="change3wei"></u-switch></u-cell>
|
<!-- <u-cell size="large" icon="../../static/my/ceju.png" title="寻物防丢">
|
<u-switch slot="value" v-model="isceju" @change="changeceju"></u-switch></u-cell> -->
|
</u-cell-group>
|
</view>
|
</view>
|
|
<scroll-view scroll-y="true" class="scroll-Y">
|
<view class="scroll-box">
|
|
</view>
|
</scroll-view>
|
|
<view class="confirm-box">
|
<view class="confirm-right" @click="logout" v-if="vuex_is_login">退出登录</view>
|
<view class="confirm-right" @click="confirm" v-if="!vuex_is_login">去登录</view>
|
</view>
|
|
<!-- <tn-popup v-model="showpopup" mode="bottom" closeBtn>
|
<view class="page-wrap u-skeleton">
|
<tn-form>
|
<tn-form-item label="类型:" :labelWidth="labelWidth">
|
<tn-input v-model="form.type" type="select" @click="show1 = true" placeholder="请选择类型" />
|
<tn-action-sheet :list="typeList" v-model="show1" @click="typeCallback"></tn-action-sheet>
|
</tn-form-item>
|
|
<tn-form-item label="名称:">
|
<tn-input v-model="form.name" inputAlign="right" placeholder="请输入名称"></tn-input>
|
</tn-form-item>
|
|
</tn-form>
|
<button style="margin-top: 20px;" type="primary" @click="submitForm">保存</button>
|
</view>
|
</tn-popup> -->
|
<u-modal style="position: absolute;z-index: 99999999999999;" buttonReverse confirmText="保存" cancelText="取消"
|
:show="showpopup" @cancel="cancelsave" @confirm="save" ref="uModal" :showCancelButton="true"
|
:closeOnClickOverlay="true">
|
<!-- <u-icon name="close" style="position: absolute;right: 10px;top:10px" @click="closemodal"></u-icon> -->
|
<u--form style="" labelPosition="left" :model="form" ref="uForm">
|
|
<u-form-item required label="围栏类型:" prop="type" borderBottom ref="item1" :labelWidth="labelWidth">
|
<tn-input v-model="form.type" type="select" @click="show1 = true" placeholder="请输入选择围栏类型" />
|
<tn-action-sheet :list="typeList" v-model="show1" @click="typeCallback"></tn-action-sheet>
|
</u-form-item>
|
|
<u-form-item required label="预警语音:" prop="nowarnmes" borderBottom ref="item1" labelWidth="80px">
|
<u--input v-model="form.nowarnmes" border="none" placeholder="请输入预警语音"></u--input>
|
</u-form-item>
|
<u-form-item required label="告警语音:" prop="warnmes" borderBottom ref="item1" labelWidth="80px">
|
<u--input v-model="form.warnmes" border="none" placeholder="请输入告警语音"></u--input>
|
</u-form-item>
|
|
</u--form>
|
</u-modal>
|
<!-- <tn-popup v-model="showpopup" mode="bottom" closeBtn>
|
|
|
<view style="padding: 30rpx;margin-top:70px;">
|
<tn-form>
|
<tn-form-item label="类型:" :labelWidth="labelWidth">
|
<tn-input v-model="form.type" type="select" @click="show1 = true" placeholder="请选择类型" />
|
<tn-action-sheet :list="typeList" v-model="show1" @click="typeCallback"></tn-action-sheet>
|
</tn-form-item>
|
|
<tn-form-item label="告警语音:" :labelWidth="labelWidth">
|
<tn-input v-model="form.name" inputAlign="right" placeholder="请输入告警语音"></tn-input>
|
</tn-form-item>
|
</tn-form>
|
<button style="margin-top: 20px;" type="primary" @click="submitForm">提交</button>
|
</view>
|
</tn-popup> -->
|
<!-- <bumenCom v-show="isbumen" ref="mainRef"></bumenCom> -->
|
|
<tn-popup v-model="showpopupip" mode="bottom" closeBtn>
|
|
|
<view style="padding: 30rpx;margin-bottom:70px;">
|
<tn-form>
|
<tn-form-item label="IP地址:" labelWidth='100rpx'>
|
<tn-input v-model="form.url" inputAlign="right" placeholder="请输入IP地址"></tn-input>
|
</tn-form-item>
|
<tn-form-item label="端口:" labelWidth='100rpx'>
|
<tn-input v-model="form.port" inputAlign="right" placeholder="请输入端口"></tn-input>
|
</tn-form-item>
|
</tn-form>
|
<button style="margin-top: 20px;" type="primary" @click="submitForm">提交</button>
|
</view>
|
</tn-popup>
|
<u-modal :show="show" :title="title" @cancel="cancel" @confirm="confirm" ref="uModal" :showCancelButton="true"
|
:content='content'></u-modal>
|
<successCom ref="refSuccess"></successCom>
|
|
</view>
|
|
|
</template>
|
|
<script>
|
// const content = require('./content')
|
const http = uni.$u.http
|
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
|
var url = http.config.baseURL.split(":")[0] + ":" + http.config.baseURL.split(":")[1]
|
import successCom from '@/components/success.vue'
|
import {
|
formatDate,
|
get_time_cha_s
|
} from '@/js/tools.js'
|
import store from '@/store/index.js'
|
import linkCom from '@/components/linkBox.vue'
|
import bumenCom from './bumen.vue';
|
import {
|
updateBaseURL
|
} from '@/config/request.js' // 导入 updateBaseURL 函数
|
import {
|
checkLogin,
|
saveWarnmes,
|
findWarnmes,
|
findTbUpapp,
|
} from '@/config/api.js';
|
import {
|
minLogin
|
} from '@/js/minLogin.js'
|
import {
|
pagesPerson
|
} from '@/js/pages/person.js'
|
export default {
|
mixins: [pagesPerson, minLogin],
|
components: {
|
bumenCom,
|
successCom,
|
linkCom
|
},
|
data() {
|
return {
|
src:this.companylogo=='-1' ? "../../static/companylogo.png" :this.companylogo,
|
show1:false,
|
typeList: [{
|
text: '保护区'
|
},
|
{
|
text: '禁入区'
|
},
|
{
|
text: '工作区'
|
},
|
{
|
text: '安全区'
|
},
|
],
|
form: {
|
nowarnmes: '',
|
warnmes: '',
|
type: '',
|
},
|
showpopupip:false,
|
showpopup:false,
|
labelWidth: 100,
|
isbumen: false,
|
value: 0,
|
appversion: 'v1.0.9',
|
downloadUrl: '',
|
text1: [],
|
jizhan: false,
|
weilan: false,
|
lixian: true,
|
show: false,
|
title: '退出登录',
|
content: '确认退出当前登录?',
|
scrollHeight: 500,
|
paddingTop: 60,
|
list: [{
|
title: '当前版本',
|
route: '',
|
icon: '/static/my/test1.png',
|
value: 'v1.0.3',
|
},
|
{
|
title: '切换数据源',
|
route: 'updatedata',
|
icon: '/static/my/test2.png',
|
value: '',
|
},
|
{
|
title: '测试通知',
|
route: 'message',
|
icon: '/static/my/test2.png',
|
value: '',
|
}
|
]
|
}
|
},
|
mounted() {
|
console.log(this.companylogo);
|
this.lunbo()
|
setTimeout(() => {
|
this.paddingTop = this.vuex_padding_top
|
this.paddingTop += 5
|
}, 700)
|
},
|
methods: {
|
submitForm() {
|
// 更新 baseURL
|
updateBaseURL("http://" + this.form.url + ':' + this.form.port); // 调用 updateBaseURL 函数
|
if (this.vuex_is_login) {
|
const params = {
|
token: uni.getStorageSync('access_token'),
|
}
|
console.log(params);
|
checkLogin(params).then((res) => {
|
console.log(res);
|
if (res.code == 0) {
|
this.$refs.refSuccess.showBox({
|
type: 'success',
|
txt: "切换数据源成功!请重新登录"
|
});
|
|
this.showpopupip = false
|
this.form.port = ''
|
this.form.url = ''
|
store.commit('$tStore', {
|
name: 'vuex_is_login',
|
value: false
|
})
|
setTimeout(() =>{
|
uni.reLaunch({
|
url: '/pages/index/index'
|
});
|
}, 3000);
|
} else {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: res.data
|
});
|
this.showpopupip = false
|
this.form.port = ''
|
this.form.url = ''
|
}
|
})
|
}
|
},
|
getPortFromUrl(url) {
|
if (typeof url === 'string' && url.includes('//') && url.includes(':')) {
|
return url.split('//')[1].split(':')[1];
|
}
|
return null;
|
},
|
updatedata() {
|
const baseUrl = uni.getStorageSync('newBaseURL')== ''? 'http://123.117.152.120:8090' : uni.getStorageSync('newBaseURL');
|
// const result = baseUrl === '' ? 'http://123.117.152.120:8090' : getPortFromUrl(baseUrl) || getPortFromUrl('http://123.117.152.120:8090');
|
console.log(baseUrl.split('//')[1].split(':')[1]);
|
// console.log(result);
|
// console.log(uni.getStorageSync('newBaseURL')== ''? 'http://123.117.152.120:8090' : uni.getStorageSync('newBaseURL'));
|
// console.log(uni.getStorageSync('newBaseURL')== ''? 'http://123.117.152.120:8090' : uni.getStorageSync('newBaseURL').split("//")[1]);
|
// console.log(uni.getStorageSync('newBaseURL')== ''? 'http://123.117.152.120:8090' : uni.getStorageSync('newBaseURL').split("//")[1].split(":")[1]);
|
this.showpopupip = true
|
|
this.form.port =baseUrl.split('//')[1].split(':')[1]
|
this.form.url = baseUrl.split('//')[1].split(':')[0]
|
|
},
|
cancelsave(){
|
this.showpopup=false
|
|
},
|
save(){
|
if (this.form.nowarnmes=='') {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '预警语音不能为空'
|
});
|
}else if (this.form.warnmes==''){
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '告警语音不能为空'
|
});
|
}else{
|
|
// this.showpopup=false
|
saveWarnmes(this.form).then((res) => {
|
console.log(res);
|
this.showpopup=false
|
if (res.code == 0) {
|
// nowarnmes: '靠近危险请注意',
|
// warnmes: '进入危险区域请注意',
|
|
} else {
|
|
}
|
})
|
}
|
},
|
typeCallback(index) {
|
this.form.type = this.typeList[index].text;
|
const params = {
|
type: this.typeList[index].text,
|
}
|
console.log(params);
|
console.log(211111111111);
|
findWarnmes(params).then((res) => {
|
console.log(res);
|
if (res.code == 0) {
|
// nowarnmes: '靠近危险请注意',
|
// warnmes: '进入危险区域请注意',
|
// if (res.data.type=="工作区") {
|
// this.form.nowarnmes = res.data.nowarnmes+";"+res.data.nowarnmestype
|
// this.form.warnmes = res.data.warnmes+";"+res.data.warnmestype
|
// }else{
|
this.form.nowarnmes = res.data.nowarnmes
|
this.form.warnmes = res.data.warnmes
|
// }
|
|
console.log(this.form.watnmes);
|
console.log(this.form.nowarnmes);
|
} else {
|
|
}
|
})
|
|
},
|
tobumen() {
|
this.$emit('tobumen', 5);
|
},
|
|
tospeech(){
|
//语音管理
|
this.showpopup=true
|
|
},
|
lunbo() {
|
if (this.vuex_is_login) {
|
findTbUpapp().then((res) => {
|
if (res.code == 0) {
|
if (this.appversion != res.data.version) {
|
for (var i = 0; i < res.data.info.split(",").length; i++) {
|
this.text1.push(res.data.info.split(",")[i])
|
}
|
this.downloadUrl = res.data.address
|
}
|
}
|
})
|
}
|
},
|
update() {
|
if (this.text1 == undefined) {
|
this.$refs.refSuccess.showBox({
|
type: 'error',
|
txt: '未检测到新版本'
|
});
|
} else {
|
uni.showLoading({
|
title: '正在下载'
|
});
|
|
uni.downloadFile({
|
url: this.downloadUrl,
|
header: {
|
'Authorization': uni.getStorageSync('access_token')
|
},
|
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'
|
});
|
}
|
});
|
downloadTask.onProgressUpdate((res) => {
|
const progress = res.progress;
|
uni.showLoading({
|
title: `正在下载 ${progress}%`
|
});
|
});
|
}
|
},
|
changeweilan(e) {
|
store.commit('$tStore', {
|
name: 'isfence',
|
value: e
|
})
|
},
|
changelixian(e) {
|
store.commit('$tStore', {
|
name: 'isoffline',
|
value: e
|
})
|
},
|
|
change3wei(e) {
|
store.commit('$tStore', {
|
name: 'is3wei',
|
value: e
|
})
|
},
|
|
cancel() {
|
this.show = false;
|
},
|
confirm() {
|
store.commit('$tStore', {
|
name: 'vuex_is_login',
|
value: false
|
})
|
uni.reLaunch({
|
url: '/pages/index/login'
|
});
|
},
|
getCurrentDateTime() {
|
var now = new Date();
|
var year = now.getFullYear();
|
var month = String(now.getMonth() + 1).padStart(2, '0');
|
var day = String(now.getDate()).padStart(2, '0');
|
var hours = String(now.getHours()).padStart(2, '0');
|
var minutes = String(now.getMinutes()).padStart(2, '0');
|
var seconds = String(now.getSeconds()).padStart(2, '0');
|
|
var currentDateAndTime = year + month + day + hours + minutes + seconds;
|
return currentDateAndTime
|
},
|
logout() {
|
store.commit('$tStore', {
|
name: 'uuid',
|
value: ''
|
})
|
this.show = true;
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.biaoge {
|
border-top-color: #000000;
|
}
|
|
.u-content {
|
padding: 24rpx;
|
font-size: 32rpx;
|
color: $u-content-color;
|
line-height: 1.6;
|
}
|
|
.home-top-bg {
|
width: 100%;
|
height: 175px;
|
|
background: linear-gradient(225deg, #D1EEE8 0%, #D0EEE7 0%, #F5F5F5 100%);
|
border-radius: 0px 0px 0px 0px;
|
opacity: 1;
|
filter: blur(220px);
|
position: fixed;
|
top: 0;
|
left: 0;
|
z-index: 1;
|
}
|
|
.home-top-box {
|
width: 100%;
|
height: 302px;
|
position: fixed;
|
top: 0;
|
left: 0;
|
border-bottom-left-radius: 30px;
|
border-bottom-right-radius: 30px;
|
z-index: 1;
|
}
|
|
.scroll-Y {
|
width: 100%;
|
margin-top: 232px;
|
position: relative;
|
}
|
|
.scroll-box {
|
padding-top: 30px;
|
padding-bottom: 50px;
|
display: flex;
|
flex-wrap: wrap;
|
}
|
|
.confirm-box {
|
position: fixed;
|
width: 100%;
|
height: 65px;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: env(safe-area-inset-bottom);
|
bottom: 70px;
|
padding: 0 30px;
|
|
.confirm-left {
|
font-size: 14px;
|
color: rgba(35, 35, 35, 0.5);
|
}
|
|
.confirm-right {
|
height: 45px;
|
background: #3E989D;
|
border-radius: 32px;
|
color: #fff;
|
font-size: 15px;
|
font-weight: bold;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
width: 100%;
|
}
|
}
|
|
.userinfo-box {
|
padding: 0 15px;
|
margin-top: 20px;
|
display: flex;
|
|
.userinfo-img {
|
// padding-left: 15px;
|
height: 50px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
|
.userinfo-value-box {
|
padding-left: 20px;
|
|
.user-nickname {
|
height: 28px;
|
font-size: 15px;
|
font-weight: bold;
|
color: #000000;
|
}
|
|
.user-company {
|
height: 22px;
|
font-size: 12px;
|
color: rgba(35, 35, 35, 0.7);
|
}
|
}
|
}
|
</style>
|