接口节流优化

This commit is contained in:
仲么了
2023-08-31 16:14:15 +08:00
parent 14c7eb5bb1
commit fb5de4370b
4 changed files with 20 additions and 11 deletions

View File

@@ -40,7 +40,7 @@ export default (options = {}) => {
if (arr.indexOf(options.url) > -1) { if (arr.indexOf(options.url) > -1) {
setTimeout(() => { setTimeout(() => {
arr.splice(arr.indexOf(options.url), 1) arr.splice(arr.indexOf(options.url), 1)
}, 300) }, 1500)
} }
if (res.data.resultCode !== 10000 && res.data.code !== 'A0000') { if (res.data.resultCode !== 10000 && res.data.code !== 'A0000') {
errHandler(res.data) errHandler(res.data)
@@ -53,7 +53,7 @@ export default (options = {}) => {
if (arr.indexOf(options.url) > -1) { if (arr.indexOf(options.url) > -1) {
setTimeout(() => { setTimeout(() => {
arr.splice(arr.indexOf(options.url), 1) arr.splice(arr.indexOf(options.url), 1)
}, 300) }, 1500)
} }
reject(err) reject(err)
uni.showToast({ uni.showToast({

View File

@@ -32,7 +32,6 @@
<template v-for="(item,index) in IOData"> <template v-for="(item,index) in IOData">
<view class="item">{{ item.clDid }}</view> <view class="item">{{ item.clDid }}</view>
<view class="item"> <view class="item">
<!-- <view class="status-point-success mr10"></view>-->
<view style="width: 30rpx"> {{ item.value || '-'}}</view> <view style="width: 30rpx"> {{ item.value || '-'}}</view>
<view v-if="item.value"> °C</view> <view v-if="item.value"> °C</view>
</view> </view>
@@ -119,7 +118,7 @@ export default {
navMenuActive: 0, navMenuActive: 0,
navHeight: 0, navHeight: 0,
img: '', img: '',
topoImg:'', topoImg: '',
navMenuList: [ navMenuList: [
{ {
text: '基本', text: '基本',
@@ -369,10 +368,10 @@ export default {
// } // }
// }) // })
this.IOData = JSON.parse(message.toString()) this.IOData = JSON.parse(message.toString())
this.IOData.forEach(item=>{ this.IOData.forEach(item => {
if(item.value === 0){ if (item.value === 0) {
item.value = '0' item.value = '0'
}else if(!item.value){ } else if (!item.value) {
item.value = '' item.value = ''
} }
}) })
@@ -467,6 +466,7 @@ export default {
width: 110rpx; width: 110rpx;
font-size: 16rpx; font-size: 16rpx;
opacity: 0.8; opacity: 0.8;
.grid-card-content-2, .grid-card-content-2,
.grid-card-content-1 { .grid-card-content-1 {
font-size: 16rpx; font-size: 16rpx;
@@ -484,6 +484,7 @@ export default {
right: 10rpx; right: 10rpx;
width: 200rpx; width: 200rpx;
opacity: 0.8; opacity: 0.8;
.grid-card-content-2, .grid-card-content-2,
.grid-card-content-1 { .grid-card-content-1 {
font-size: 16rpx; font-size: 16rpx;

View File

@@ -46,6 +46,7 @@ export default {
onLoad(options) { onLoad(options) {
this.options = options this.options = options
this.engineeringList = uni.getStorageSync('engineeringList') this.engineeringList = uni.getStorageSync('engineeringList')
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
}, },
onShow() { onShow() {
queryEngineering().then(res => { queryEngineering().then(res => {
@@ -53,9 +54,16 @@ export default {
}) })
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
uni.navigateTo({ if (this.userInfo.authorities === 'app_vip_user' || this.userInfo.authorities === 'engineering_user') {
url: '/pages/engineering/new', uni.navigateTo({
}) url: `/pages/engineering/new`,
})
} else {
uni.showToast({
title: '暂无权限',
icon: 'none',
})
}
}, },
methods: { methods: {
confirm(e) { confirm(e) {

View File

@@ -176,7 +176,7 @@ export default {
this.formData.tempFiles.push(item) this.formData.tempFiles.push(item)
} else { } else {
this.formData.files.push({ this.formData.files.push({
url: this.$config.static + item.filePath, url: item.filePath,
extname: item.name.split('.')[1], extname: item.name.split('.')[1],
name: item.name, name: item.name,
...item, ...item,