接口对接

This commit is contained in:
仲么了
2023-04-07 11:31:54 +08:00
parent 99c1f1c0bc
commit 1c810f506d
9 changed files with 818 additions and 11 deletions

View File

@@ -22,6 +22,8 @@
</Cn-grid>
</view>
<view class="nav">
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }" @click="showDrawer">{{
select.projectName || '工程' }} </view>
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text">
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{
select.projectName || '项目' }} </view>
@@ -38,11 +40,16 @@
</uni-card>
<uni-load-more status="nomore"></uni-load-more>
</view>
<uni-drawer ref="showRight" mode="right" :mask-click="false" :width="375">
<uni-indexed-list :options="gcListFilter" :showSelect="false" @click="closeDrawer"></uni-indexed-list>
</uni-drawer>
</view>
</template>
<script>
import { pinyin } from 'pinyin-pro';
export default {
data () {
data() {
return {
loading: false,
userInfo: {},
@@ -124,11 +131,94 @@ export default {
type: '监测',
project: 'XXX项目3'
}
],
gcList: [
'南京灿能',
'南京灿能',
'南京灿能',
'南京灿能',
'南京灿能',
'北京灿能',
'北京灿能',
'北京灿能',
'北京灿能',
'北京灿能',
'上海灿能',
'上海灿能',
'上海灿能',
'上海灿能',
'上海灿能',
'上海灿能',
'广州灿能',
'广州灿能',
'广州灿能',
'广州灿能',
'广州灿能',
'深圳灿能',
'深圳灿能',
'深圳灿能',
'深圳灿能',
'深圳灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'杭州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
'苏州灿能',
]
}
},
computed: {
deviceListFilter () {
gcListFilter() {
// [{
// "letter": "A",
// "data": [
// "阿克苏机场",
// "阿拉山口机场",
// "阿勒泰机场",
// "阿里昆莎机场",
// "安庆天柱山机场",
// "澳门国际机场"
// ]
// }, {
// "letter": "B",
// "data": [
// "保山机场",
// "包头机场",
// "北海福成机场",
// "北京南苑机场",
// "北京首都国际机场"
// ]
// }]
let result = []
this.gcList.forEach(item => {
let arr = pinyin(item[0], { toneType: 'none', type: 'array' })
let letter = arr[0][0].toUpperCase()
console.log(letter);
let index = result.findIndex(item => item.letter === letter)
if (index === -1) {
result.push({
letter,
data: [item]
})
} else {
result[index].data.push(item)
}
})
return result
},
deviceListFilter() {
return this.deviceList.filter(item => {
if (this.select.projectName) {
return item.project === this.select.projectName
@@ -141,8 +231,14 @@ export default {
}
},
methods: {
submitFeedBack () { uni.navigateTo({ url: '/pages/home/feedback' }) },
projectTypeChange (e) {
showDrawer() {
this.$refs.showRight.open();
},
closeDrawer() {
this.$refs.showRight.close();
},
submitFeedBack() { uni.navigateTo({ url: '/pages/home/feedback' }) },
projectTypeChange(e) {
// 重置name
this.select.projectName = ''
this.select.projectNameIndex = 0
@@ -156,7 +252,7 @@ export default {
},
projectNameChange (e) {
projectNameChange(e) {
console.log(e);
// 重置type
this.select.projectType = ''
@@ -169,7 +265,7 @@ export default {
}
this.select.projectName = this.projectList[e.detail.value].text
},
registerDevice () {
registerDevice() {
uni.showModal({
title: '提示',
content: '请选择设备类型',
@@ -189,15 +285,15 @@ export default {
}
})
},
registerGateway () {
registerGateway() {
uni.navigateTo({
url: '/pages/gateway/new'
})
},
navMenuClick (index) {
navMenuClick(index) {
this.navMenuActive = index
},
jump (item) {
jump(item) {
if (item.name.indexOf('APF') > -1) {
uni.navigateTo({
url: '/pages/device/APF/detail'
@@ -209,7 +305,7 @@ export default {
}
},
},
mounted () {
mounted() {
this.userInfo = uni.getStorageSync('userInfo')
setTimeout(() => {
// 获取nav高度