Commit 10379fa4 by Jianli Ou

左上角个人资料展示

问题优化
parent 5ef2e7c4
......@@ -12,8 +12,13 @@ window.CodeTable.NationalIndustryClassificationCodeHandle = NationalIndustryClas
window.CodeTable.NationalIndustryClassificationCodeCategory = NationalIndustryClassificationCode.body.filter(item => ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'].indexOf(item[1]) >= 0).sort((a, b) => { return a[1].charCodeAt(0) - b[1].charCodeAt(0) })
const findCategory = function (code, length, arr) {
const result = NationalIndustryClassificationCode.body.filter(item => item[1].substr(0,code.length) === code && item[1].length === length)
result.length > 0 && arr.push(result)
const list = NationalIndustryClassificationCode.body
let result = list.filter(item => item[1].substr(0,code.length) === code && item[1].length === length)
if (length === 4) { // 处理特殊分类
const _result = list.filter(item => item[1].substr(0,3) === code.substr(0,3) && item[1].length === 5 && item[1].slice(-1) === '0')
result = result.concat(_result).sort((a, b) => Number(a[1].substr(1, 3)) - Number(b[1].substr(1, 3)))
}
(result.length > 0 && code.length < 5) && arr.push(result)
if (length < 5) {
return result.length !== 0 ? findCategory(result[0][1], length + 1, arr) : findCategory(code, length + 1, arr)
} else {
......
......@@ -145,6 +145,7 @@ export default {
data () {
return {
loginInfo: {
carno: '', // 条码卡号
id: 16, // 用户ID
isQY: 2, // 是否开通企业认证 1.是 2.否
isXT: 2, // 是否是业务大厅系统成员 1.是 2.否
......
......@@ -269,7 +269,7 @@
top="20vh"
width="65%">
<div>
<t-j-dm-select @cancel="dialogVisible = false" @confirm="confirmEvent"/>
<t-j-dm-select @cancel="dialogVisible = false" :initSelect="form.TJDm" @confirm="confirmEvent"/>
</div>
</el-dialog>
</div>
......@@ -415,6 +415,7 @@ export default {
});
},
confirmEvent(e) {
console.log(e)
this.form.TJDm = e
this.dialogVisible = false
},
......
......@@ -36,6 +36,9 @@
<script>
export default {
name: "TJDmSelect",
props: {
initSelect: {type: String, default: ''}
},
computed: {
comColor () {
return function (level, index) {
......@@ -91,13 +94,68 @@ export default {
if (level === 1) {
this.categoryList = _categoryList
} else {
if (this.categoryList.length === 2) return
if (this.categoryList.length === 2 && level === 3 && _categoryList.length === 0) return
this.categoryList = this.categoryList.slice(0, level - 1).concat(_categoryList)
}
},
initSelectHandle(code, level, index) {
let oneLevelCode = ''
let twoLevelCode = ''
let threeLevelCode = ''
let fourLevelCode = ''
let _level = ''
if (code.length >= 1) {
_level = 1
oneLevelCode = code.substr(0, 1)
this.findCategory(oneLevelCode, _level, index)
this.category.some((item, index) => {
item[1] === oneLevelCode && (this.levelAction = [index, 0, 0, 0])
return item[1] === oneLevelCode
})
}
if (code.length >= 3) {
_level = 2
twoLevelCode = code.substr(0, 3)
this.findCategory(twoLevelCode, _level, index)
this.categoryList[0].some((item, index) => {
item[1] === twoLevelCode && (this.levelAction = [this.levelAction[0], index, 0, 0])
return item[1] === twoLevelCode
})
}
if (code.length >= 4 || (code.length === 5 && code.slice(-1) === '0')) {
_level = 3
if (code.length === 4) {
threeLevelCode = code.substr(0, 4)
} else {
threeLevelCode = code.substr(0, 5)
}
this.findCategory(threeLevelCode, _level, index)
this.categoryList[1].some((item, index) => {
item[1] === threeLevelCode && (this.levelAction = [this.levelAction[0], this.levelAction[1], index, 0])
return item[1] === threeLevelCode
})
}
if (code.length >= 5 && code.slice(-1) !== '0'){
_level = 4
fourLevelCode = code.substr(0, 5)
this.findCategory(fourLevelCode, _level, index)
this.categoryList[2].some((item, index) => {
item[1] === fourLevelCode && (this.levelAction = [this.levelAction[0], this.levelAction[1], this.levelAction[2], index])
return item[1] === fourLevelCode
})
}
console.log(oneLevelCode, twoLevelCode, threeLevelCode, fourLevelCode, _level)
this.level = _level
console.log(code, level, index)
}
},
mounted() {
// this.findCategory('A', 1, 0)
if (this.initSelect === '') {
this.findCategory('A', 1, 0)
} else {
this.initSelectHandle(this.initSelect, 1, 0)
}
}
}
</script>
......
......@@ -3,7 +3,7 @@
<div class="cnt">
<img src="../../../assets/image/mymanage/headImg.png" alt="">
<template v-if="type === UN_VERIFY">
<p>{{ userName }}/{{ phone }}/{{ cardNo }}</p>
<p>{{ userName }}/{{ phone }}{{ cardNo ? '/'+cardNo : '' }}</p>
<p>{{ userType }} | {{ nocardNo }}</p>
</template>
<template v-else-if="type === ADMIN">
......@@ -25,7 +25,8 @@ const ADMIN = 2;
const ADMINBRANCH = 3;
export default {
props: {
type: Number
type: Number,
loginInfo: {type: Object, default: () => {}}
},
data() {
return {
......@@ -37,10 +38,38 @@ export default {
phone: '手机号',
cardNo: '条码卡号',
userType: '用户类别',
nocardNo: '未申请条码卡'
nocardNo: '未申请条码卡',
memberInfo: {}
};
},
methods: {
async getMemberInfo() {
this.memberInfo = (await this.$api.myManage.memberInfo({id: this.loginInfo.id})).data
this.userName = this.memberInfo.username
this.phone = this.memberInfo.phone
if (this.loginInfo.carno) {
this.nocardNo = '已申请条码卡'
this.cardNo = this.loginInfo.carno
} else {
this.nocardNo = '未申请条码卡'
this.cardNo = ''
}
switch (this.loginInfo.userType) {
case 1:
this.userType = '手机号用户'
break
case 2:
this.userType = '条码成员'
break
case 3:
this.userType = '官网用户'
break
}
}
},
mounted() {
this.getMemberInfo()
},
created() {
},
......
......@@ -2,7 +2,7 @@
<div class="nav-me container marginTop20 mb-5" style="position: relative">
<div class="row">
<div class="col-lg-3">
<UserInfo :type="userType"/>
<UserInfo :type="userType" :loginInfo="loginInfo"/>
<SubNav/>
</div>
<div class="col-lg-9">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment