This commit is contained in:
仲么了
2023-09-18 10:36:14 +08:00
parent 841cad9859
commit 054bdb8ba2
4 changed files with 42 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='select-enineering'>
<Cn-page :loading="loading">
<view slot="body">
<view class="select-enineering">
<uni-indexed-list
:options="engineeringListFilter"
:showSelect="false"
@@ -12,22 +12,22 @@
</Cn-page>
</template>
<script>
import {pinyin} from 'pinyin-pro'
import {queryEngineering} from "@/common/api/engineering";
import { pinyin } from 'pinyin-pro'
import { queryEngineering } from '@/common/api/engineering'
export default {
data() {
return {
loading: false,
engineeringList: [],
options: {}
options: {},
}
},
computed: {
engineeringListFilter() {
let result = []
this.engineeringList.forEach((item) => {
let arr = pinyin(item.name[0], {toneType: 'none', type: 'array'})
let arr = pinyin(item.name[0], { toneType: 'none', type: 'array' })
let letter = arr[0][0].toUpperCase()
console.log(letter)
let index = result.findIndex((item) => item.letter === letter)
@@ -47,9 +47,12 @@ export default {
this.options = options
this.engineeringList = uni.getStorageSync('engineeringList')
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
if (!(this.userInfo.authorities === 'app_vip_user' || this.userInfo.authorities === 'engineering_user')) {
}
},
onShow() {
queryEngineering().then(res => {
queryEngineering().then((res) => {
this.engineeringList = res.data
})
},
@@ -77,11 +80,11 @@ export default {
}
uni.navigateBack()
},
}
},
}
</script>
<style lang='scss'>
<style lang="scss">
.index {
padding: 34rpx;
}
</style>
</style>