[IMP]【电投优化】职业类别控件样式修改

This commit is contained in:
yuweiqi
2020-04-10 18:30:47 +08:00
parent 4992d4fa24
commit 622e0efddb

View File

@@ -40,14 +40,14 @@
<p class="fs14 pl20 fwb pv5">搜索结果</p> <p class="fs14 pl20 fwb pv5">搜索结果</p>
<div class="item p10 search-result fs12 flex flex-direction-colunm"> <div class="item p10 search-result fs12 flex flex-direction-colunm">
<p class="p5 mv5" :class="[item.isActive ? 'active' : '']" v-for="(item, index) in searchList" @click="searchChoose(item, index)" :key="index"> <p class="p5 mv5" :class="[item.isActive ? 'active' : '']" v-for="(item, index) in searchList" @click="searchChoose(item, index)" :key="index">
{{ item.name }} {{ item.showName }}
</p> </p>
</div> </div>
</div> </div>
</div> </div>
<div class="close-btn fixed"> <div class="close-btn fixed">
<van-button type="danger" @click="ensureChoose">确认选择</van-button> <van-button type="danger" @click="ensureChoose">确认选择</van-button>
<van-button type="primary" @click="$emit('chooseOccupation', '')">取消</van-button> <!-- <van-button type="primary" @click="$emit('chooseOccupation', '')">取消</van-button> -->
</div> </div>
</div> </div>
</template> </template>
@@ -59,20 +59,20 @@ export default {
props: { props: {
name: { name: {
type: String, type: String,
default: '', default: ''
}, },
code: { code: {
type: String, type: String,
default: '', default: ''
}, },
life: { life: {
type: String, type: String,
default: '', default: ''
}, },
health: { health: {
type: String, type: String,
default: '', default: ''
}, }
}, },
data() { data() {
return { return {
@@ -93,51 +93,51 @@ export default {
lifeGrade: '1', lifeGrade: '1',
name: '一般学生', name: '一般学生',
healthGrade: '1', healthGrade: '1',
isActive: false, isActive: false
}, },
{ {
code: '2090301', code: '2090301',
lifeGrade: '1', lifeGrade: '1',
name: '中学教师', name: '中学教师',
healthGrade: '1', healthGrade: '1',
isActive: false, isActive: false
}, },
{ {
code: '2090401', code: '2090401',
lifeGrade: '1', lifeGrade: '1',
name: '小学教师', name: '小学教师',
healthGrade: '1', healthGrade: '1',
isActive: false, isActive: false
}, },
{ {
code: '4010101', code: '4010101',
lifeGrade: '1', lifeGrade: '1',
name: '营业员', name: '营业员',
healthGrade: '1', healthGrade: '1',
isActive: false, isActive: false
}, },
{ {
code: '1050102', code: '1050102',
lifeGrade: '1', lifeGrade: '1',
name: '企业经理', name: '企业经理',
healthGrade: '1', healthGrade: '1',
isActive: false, isActive: false
}, },
{ {
code: '4071203', code: '4071203',
lifeGrade: '1', lifeGrade: '1',
name: '家庭主妇', name: '家庭主妇',
healthGrade: '1', healthGrade: '1',
isActive: false, isActive: false
}, }
], ],
isSearch: false, // 是否搜索中 isSearch: false, // 是否搜索中
searchList: [], searchList: []
} }
}, },
components: { components: {
[Search.name]: Search, [Search.name]: Search,
[Sticky.name]: Sticky, [Sticky.name]: Sticky
}, },
created() { created() {
// let occupationData = JSON.parse(window.localStorage.getItem('OccupationList')) // let occupationData = JSON.parse(window.localStorage.getItem('OccupationList'))
@@ -189,15 +189,18 @@ export default {
if (this.searchParams) { if (this.searchParams) {
this.searchList = [] this.searchList = []
this.isSearch = true this.isSearch = true
this.occupationList.forEach((first) => { this.occupationList.forEach(first => {
first.subs.forEach((second) => { first.subs.forEach(second => {
second.subs.forEach((third) => { second.subs.forEach(third => {
if (third.name.indexOf(this.searchParams) != -1) { if (third.name.indexOf(this.searchParams) != -1) {
this.searchList.push(Object.assign(third, { isActive: false })) // this.searchList.push(Object.assign(third, { isActive: false }, { showName: first[index1].name + second[index2].name + third.name }))
this.searchList.push(Object.assign(third, { isActive: false }, { showName: first.name + ' - ' + second.name + ' - ' + third.name }))
console.log('first = ', first)
} }
}) })
}) })
}) })
console.log('this.searchList ==', this.searchList)
} else { } else {
this.isSearch = false this.isSearch = false
} }
@@ -236,9 +239,9 @@ export default {
commonChoose(item, index) { commonChoose(item, index) {
this.commonInit() this.commonInit()
this.commonList[index].isActive = true this.commonList[index].isActive = true
this.occupationList.forEach((occupation) => { this.occupationList.forEach(occupation => {
occupation.subs.forEach((sub) => { occupation.subs.forEach(sub => {
sub.subs.forEach((occupaitonItem) => { sub.subs.forEach(occupaitonItem => {
if (occupaitonItem.code == item.code) { if (occupaitonItem.code == item.code) {
this.first = occupation this.first = occupation
this.sec = occupation.subs this.sec = occupation.subs
@@ -252,7 +255,7 @@ export default {
}) })
}, },
searchChoose(item, index) { searchChoose(item, index) {
this.searchList.forEach((item) => { this.searchList.forEach(item => {
item.isActive = false item.isActive = false
}) })
this.searchList[index].isActive = true this.searchList[index].isActive = true
@@ -260,11 +263,11 @@ export default {
this.chooseName = this.third.name this.chooseName = this.third.name
}, },
commonInit() { commonInit() {
this.commonList.forEach((item) => { this.commonList.forEach(item => {
item.isActive = false item.isActive = false
}) })
}, }
}, }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -272,7 +275,7 @@ export default {
bottom: 0; bottom: 0;
width: 100%; width: 100%;
.van-button { .van-button {
width: 50% !important; width: 100% !important;
} }
} }
.occupation { .occupation {