305 lines
5.9 KiB
Vue
305 lines
5.9 KiB
Vue
<template>
|
||
<view>
|
||
<u-navbar title="秘钥管理" :border-bottom="false" :background="bgc" title-color='#fff' back-icon-color="#fff"
|
||
title-size='36' height='42'></u-navbar>
|
||
<!-- 有秘钥 -->
|
||
<view class="wubox" v-if="flag">
|
||
<view class="youmy">
|
||
<view class="key">
|
||
key:{{accessKey}}
|
||
</view>
|
||
<view class="xian"></view>
|
||
<view class="mima">
|
||
secrect:*********
|
||
</view>
|
||
</view>
|
||
<view class="cz" @click="btncz">
|
||
重置秘钥
|
||
</view>
|
||
</view>
|
||
<view class="" v-else>
|
||
<view class="img">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uCvMUhBep204JORh00p4" mode=""></image>
|
||
</view>
|
||
<view class="ts">
|
||
暂无秘钥
|
||
</view>
|
||
<view class="sq" @click="btnsq">
|
||
申请
|
||
</view>
|
||
</view>
|
||
<!-- 弹窗 -->
|
||
<view class="tanc" v-if="maskflag">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uNaia3ZQXsWB9nkprcaa" mode=""></image>
|
||
<view class="tit">
|
||
仅提示一次
|
||
</view>
|
||
<view class="shuom">
|
||
请勿泄露秘钥,妥善保管
|
||
</view>
|
||
<view class="miyao">
|
||
{{miyao}}
|
||
</view>
|
||
<view class="xiande"></view>
|
||
<view class="anniu">
|
||
<view class="fz" @click="btnfz">
|
||
复制
|
||
</view>
|
||
<view class="gb" @click="btngb">
|
||
关闭
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="mask" v-if="maskflag"></view>
|
||
<view v-if="btnmsk" style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .1;z-index: 999;"></view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
btnmsk:false,
|
||
bgc: {
|
||
backgroundColor: "#8883f0",
|
||
},
|
||
flag: true,
|
||
accessId:'',
|
||
maskflag:false,
|
||
miyao:'',
|
||
accessKey:''
|
||
}
|
||
},
|
||
onLoad(){
|
||
this.getcha()
|
||
},
|
||
methods: {
|
||
btnfz(){
|
||
uni.setClipboardData({
|
||
data: this.miyao,
|
||
success: function(res) {
|
||
console.log('复制的信息:', this.miyao)
|
||
uni.showToast({
|
||
title: '复制成功',
|
||
})
|
||
}
|
||
})
|
||
},
|
||
btngb(){
|
||
this.maskflag = false
|
||
},
|
||
btnsq(){
|
||
this.btnmsk = true
|
||
this.$u.post(`/app/access`).then(res => {
|
||
if (res.code == 200) {
|
||
uni.showToast({
|
||
title: '申请成功',
|
||
icon: 'success',
|
||
duration: 2000
|
||
})
|
||
this.btnmsk = false
|
||
this.getcha()
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
this.btnmsk = false
|
||
}
|
||
})
|
||
},
|
||
btncz(){
|
||
this.btnmsk = true
|
||
this.$u.put(`/app/access/${this.accessId}/reset`).then(res =>{
|
||
if(res.code == 200){
|
||
this.maskflag = true
|
||
this.btnmsk = false
|
||
this.miyao = res.data
|
||
}else{
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
this.btnmsk = false
|
||
}
|
||
})
|
||
},
|
||
getcha() {
|
||
this.$u.get(`/app/access/list?pageNum=1&pageSize=99`).then(res => {
|
||
if (res.code == 200) {
|
||
if (res.rows.length > 0) {
|
||
this.flag = true
|
||
this.accessId = res.rows[0].accessId
|
||
this.accessKey = res.rows[0].accessKey
|
||
} else {
|
||
this.flag = false
|
||
}
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
/deep/ .u-title {
|
||
padding-bottom: 22rpx;
|
||
}
|
||
|
||
/deep/ .u-icon__icon {
|
||
padding-bottom: 22rpx;
|
||
}
|
||
.mask{
|
||
width: 100%;
|
||
height: 100vh;
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
background-color: #000;
|
||
opacity: .6;
|
||
}
|
||
.tanc{
|
||
width: 620rpx;
|
||
max-height: 100%;
|
||
background: linear-gradient( 180deg, #FFFFFF 0%, #FFFFFF 100%);
|
||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||
position: fixed;
|
||
top: 30vh;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
z-index: 1;
|
||
image{
|
||
width: 96rpx;
|
||
height: 96rpx;
|
||
position: relative;
|
||
top: -22rpx;
|
||
}
|
||
.tit{
|
||
font-weight: 500;
|
||
font-size: 36rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
.shuom{
|
||
font-size: 28rpx;
|
||
color: #3D3D3D;
|
||
margin-top: 10rpx;
|
||
}
|
||
.miyao{
|
||
font-size: 40rpx;
|
||
color: #3D3D3D;
|
||
word-wrap: break-word;
|
||
white-space: normal;
|
||
overflow: hidden;
|
||
width: 600rpx;
|
||
margin: auto;
|
||
margin-top: 22rpx;
|
||
margin-bottom: 10rpx;
|
||
}
|
||
.xiande{
|
||
width: 620rpx;
|
||
height: 0rpx;
|
||
border: 1rpx solid #D8D8D8;
|
||
}
|
||
.anniu{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
.fz{
|
||
width: 310rpx;
|
||
text-align: center;
|
||
height: 104rpx;
|
||
line-height: 104rpx;
|
||
font-size: 40rpx;
|
||
color: #3D3D3D;
|
||
border-right: 1px solid #D8D8D8;
|
||
}
|
||
.gb{
|
||
width: 310rpx;
|
||
text-align: center;
|
||
height: 104rpx;
|
||
line-height: 104rpx;
|
||
font-size: 40rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
}
|
||
page {
|
||
background-color: #F7FAFE;
|
||
text-align: center;
|
||
}
|
||
.wubox {
|
||
margin: auto;
|
||
width: 646rpx;
|
||
margin-top: 48rpx;
|
||
text-align: left !important;
|
||
.youmy {
|
||
width: 646rpx;
|
||
height: 210rpx;
|
||
background: #FFFFFF;
|
||
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
|
||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||
font-size: 36rpx;
|
||
color: #3D3D3D;
|
||
.key {
|
||
height: 106rpx;
|
||
line-height: 106rpx;
|
||
padding-left: 24rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
.xian {
|
||
width: 606rpx;
|
||
height: 0rpx;
|
||
border: 2rpx solid #D8D8D8;
|
||
margin-left: 24rpx;
|
||
}
|
||
.mima {
|
||
height: 106rpx;
|
||
line-height: 106rpx;
|
||
padding-left: 24rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
}
|
||
.cz {
|
||
margin-top: 44rpx;
|
||
width: 646rpx;
|
||
height: 88rpx;
|
||
background: #E4E3FB;
|
||
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
|
||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||
text-align: center;
|
||
line-height: 88rpx;
|
||
font-size: 36rpx;
|
||
color: #8883F0;
|
||
}
|
||
}
|
||
.img {
|
||
width: 430rpx;
|
||
height: 430rpx;
|
||
margin: auto;
|
||
margin-top: 114rpx;
|
||
image {
|
||
width: 430rpx;
|
||
height: 430rpx;
|
||
}
|
||
}
|
||
.ts {
|
||
font-weight: 500;
|
||
font-size: 36rpx;
|
||
color: #3D3D3D;
|
||
margin-top: 94rpx;
|
||
}
|
||
.sq {
|
||
width: 370rpx;
|
||
height: 96rpx;
|
||
background: #E4E3FB;
|
||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||
text-align: center;
|
||
line-height: 96rpx;
|
||
font-weight: 700;
|
||
font-size: 40rpx;
|
||
color: #8883F0;
|
||
margin: auto;
|
||
margin-top: 84rpx;
|
||
}
|
||
</style> |