Commit 10379fa4 by Jianli Ou

左上角个人资料展示

问题优化
parent 5ef2e7c4
...@@ -12,8 +12,13 @@ window.CodeTable.NationalIndustryClassificationCodeHandle = NationalIndustryClas ...@@ -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) }) 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 findCategory = function (code, length, arr) {
const result = NationalIndustryClassificationCode.body.filter(item => item[1].substr(0,code.length) === code && item[1].length === length) const list = NationalIndustryClassificationCode.body
result.length > 0 && arr.push(result) 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) { if (length < 5) {
return result.length !== 0 ? findCategory(result[0][1], length + 1, arr) : findCategory(code, length + 1, arr) return result.length !== 0 ? findCategory(result[0][1], length + 1, arr) : findCategory(code, length + 1, arr)
} else { } else {
......
...@@ -145,6 +145,7 @@ export default { ...@@ -145,6 +145,7 @@ export default {
data () { data () {
return { return {
loginInfo: { loginInfo: {
carno: '', // 条码卡号
id: 16, // 用户ID id: 16, // 用户ID
isQY: 2, // 是否开通企业认证 1.是 2.否 isQY: 2, // 是否开通企业认证 1.是 2.否
isXT: 2, // 是否是业务大厅系统成员 1.是 2.否 isXT: 2, // 是否是业务大厅系统成员 1.是 2.否
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
top="20vh" top="20vh"
width="65%"> width="65%">
<div> <div>
<t-j-dm-select @cancel="dialogVisible = false" @confirm="confirmEvent"/> <t-j-dm-select @cancel="dialogVisible = false" :initSelect="form.TJDm" @confirm="confirmEvent"/>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
...@@ -415,6 +415,7 @@ export default { ...@@ -415,6 +415,7 @@ export default {
}); });
}, },
confirmEvent(e) { confirmEvent(e) {
console.log(e)
this.form.TJDm = e this.form.TJDm = e
this.dialogVisible = false this.dialogVisible = false
}, },
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
<script> <script>
export default { export default {
name: "TJDmSelect", name: "TJDmSelect",
props: {
initSelect: {type: String, default: ''}
},
computed: { computed: {
comColor () { comColor () {
return function (level, index) { return function (level, index) {
...@@ -91,13 +94,68 @@ export default { ...@@ -91,13 +94,68 @@ export default {
if (level === 1) { if (level === 1) {
this.categoryList = _categoryList this.categoryList = _categoryList
} else { } 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) 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() { mounted() {
this.findCategory('A', 1, 0) // this.findCategory('A', 1, 0)
if (this.initSelect === '') {
this.findCategory('A', 1, 0)
} else {
this.initSelectHandle(this.initSelect, 1, 0)
}
} }
} }
</script> </script>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="cnt"> <div class="cnt">
<img src="../../../assets/image/mymanage/headImg.png" alt=""> <img src="../../../assets/image/mymanage/headImg.png" alt="">
<template v-if="type === UN_VERIFY"> <template v-if="type === UN_VERIFY">
<p>{{ userName }}/{{ phone }}/{{ cardNo }}</p> <p>{{ userName }}/{{ phone }}{{ cardNo ? '/'+cardNo : '' }}</p>
<p>{{ userType }} | {{ nocardNo }}</p> <p>{{ userType }} | {{ nocardNo }}</p>
</template> </template>
<template v-else-if="type === ADMIN"> <template v-else-if="type === ADMIN">
...@@ -25,7 +25,8 @@ const ADMIN = 2; ...@@ -25,7 +25,8 @@ const ADMIN = 2;
const ADMINBRANCH = 3; const ADMINBRANCH = 3;
export default { export default {
props: { props: {
type: Number type: Number,
loginInfo: {type: Object, default: () => {}}
}, },
data() { data() {
return { return {
...@@ -37,10 +38,38 @@ export default { ...@@ -37,10 +38,38 @@ export default {
phone: '手机号', phone: '手机号',
cardNo: '条码卡号', cardNo: '条码卡号',
userType: '用户类别', 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() { created() {
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="nav-me container marginTop20 mb-5" style="position: relative"> <div class="nav-me container marginTop20 mb-5" style="position: relative">
<div class="row"> <div class="row">
<div class="col-lg-3"> <div class="col-lg-3">
<UserInfo :type="userType"/> <UserInfo :type="userType" :loginInfo="loginInfo"/>
<SubNav/> <SubNav/>
</div> </div>
<div class="col-lg-9"> <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