uu
This commit is contained in:
parent
7ee98eeb19
commit
8ad91d60d4
@ -62,14 +62,10 @@ function handleResponse({
|
|||||||
if ((code == 200)) {
|
if ((code == 200)) {
|
||||||
resolve(data)
|
resolve(data)
|
||||||
} else {
|
} else {
|
||||||
// TODO
|
if ( code == 401) { // 统一判断需要认证, 并作页面跳转
|
||||||
if (
|
|
||||||
true
|
|
||||||
// code == '-1'
|
|
||||||
) { // 统一判断需要认证, 并作页面跳转
|
|
||||||
showToast(msg)
|
showToast(msg)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
goto(`TODO`, 1)
|
goto("login/login", 2)
|
||||||
}, 3500)
|
}, 3500)
|
||||||
return reject({
|
return reject({
|
||||||
code: {}
|
code: {}
|
||||||
|
|||||||
@ -1,28 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<tpx-dialog :show="show" title="请选择地区" @onClose="handleCloseModal()">
|
<tpx-dialog :show="show" title="请选择地区" @onClose="handleCloseModal()">
|
||||||
<view style="position: relative;height: calc(70vh);">
|
<view style="position: relative;height: calc(75vh);">
|
||||||
<tpx-layout>
|
<tpx-layout>
|
||||||
<template v-slot:body>
|
<template v-slot:header>
|
||||||
<u-steps direction="column" activeColor="#B12D29" inactiveColor="#B12D29" dot="true">
|
<u-steps v-if="!regnameLoading" direction="column" activeColor="#B12D29" inactiveColor="#B12D29" dot="true">
|
||||||
<u-steps-item v-for="(item, index) in submitVals.regNames">
|
<u-steps-item v-for="(item, index) in submitVals.regNames">
|
||||||
<template v-slot:desc>
|
<template v-slot:desc>
|
||||||
<view :class="`pl-20 ${curTabIndex == index?'clr-prm':''}`" @click="changeCurTab(index)">
|
<view :class="`pl-20 pb-20 ${curTabIndex == index?'clr-prm':''}`" @click="changeCurTab(index)">
|
||||||
{{item}}
|
<u-row>
|
||||||
|
<view style="flex: 1;">{{item}}</view>
|
||||||
|
<u-icon name="arrow-right" size="32" color="rgb(214, 215, 217)"></u-icon>
|
||||||
|
</u-row>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</u-steps-item>
|
</u-steps-item>
|
||||||
</u-steps>
|
</u-steps>
|
||||||
|
</template>
|
||||||
|
<template v-slot:body>
|
||||||
<view class="showselect-list">
|
<view class="showselect-list">
|
||||||
<view v-for="(item, index) in curShowData" class="showselect-group">
|
<view v-for="(item, index) in curShowData" class="showselect-group">
|
||||||
<view v-if="item.letters" class="pr-20">{{item.letters}}</view>
|
<view v-if="item.letters" class="pr-20">{{item.letters}}</view>
|
||||||
<view>
|
<view style="flex: 1;">
|
||||||
<view v-for="(sItem, sIndex) in item.data" :class="`showselect-item`" @click="selectItemRegion(sItem)">
|
<view v-for="(sItem, sIndex) in item.data" :class="`showselect-item ${submitVals.regIds.indexOf(sItem.id) > -1?'active':''}`" @click="selectItemRegion(sItem)">
|
||||||
{{sItem.name}}
|
{{sItem.name}}
|
||||||
<view v-if="submitVals.regIds.indexOf(sItem.id) > -1?'active':''">
|
<view class="chk">
|
||||||
<u-icon name="checkbox-mark" size="32" :bold="true"
|
<u-icon name="checkbox-mark" size="32" :bold="true" color="inherit"></u-icon>
|
||||||
:custom-style="`'color:#B12D29;'`"
|
|
||||||
></u-icon>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -94,6 +96,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
regnameLoading: false,
|
||||||
curTabIndex: 0,
|
curTabIndex: 0,
|
||||||
curCountryList: [], // { id , name, nameEn }
|
curCountryList: [], // { id , name, nameEn }
|
||||||
curList: [], // { id , name, nameEn }
|
curList: [], // { id , name, nameEn }
|
||||||
@ -115,6 +118,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
initData() {
|
initData() {
|
||||||
if (this.submitVals.regIds.length == 0) {
|
if (this.submitVals.regIds.length == 0) {
|
||||||
|
this.curTabIndex = 0
|
||||||
let item = this.curCountryList.filter(t => t.name == '中国')[0]
|
let item = this.curCountryList.filter(t => t.name == '中国')[0]
|
||||||
// 默认选择中国
|
// 默认选择中国
|
||||||
this.selectItemRegion(item)
|
this.selectItemRegion(item)
|
||||||
@ -136,7 +140,10 @@
|
|||||||
t.name = t.regionName
|
t.name = t.regionName
|
||||||
t.nameEn = t.regionNameEn
|
t.nameEn = t.regionNameEn
|
||||||
})
|
})
|
||||||
|
if(list.length > 0) {
|
||||||
this.curList = list
|
this.curList = list
|
||||||
|
}
|
||||||
|
return list
|
||||||
},
|
},
|
||||||
changeCurTab(index) {
|
changeCurTab(index) {
|
||||||
this.curTabIndex = index
|
this.curTabIndex = index
|
||||||
@ -146,17 +153,34 @@
|
|||||||
this.getListData()
|
this.getListData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectItemRegion(item = {}) {
|
async addEmptyItem(item){
|
||||||
|
const list = await this.getListData({
|
||||||
|
parentId: item.id
|
||||||
|
})
|
||||||
|
if(list.length > 0) {
|
||||||
|
this.curTabIndex = this.curTabIndex + 1
|
||||||
|
this.submitVals.regIds.push()
|
||||||
|
this.submitVals.regNames.push('请选择')
|
||||||
|
this.hackUpdateRgnames()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async selectItemRegion(item = {}) {
|
||||||
// 选择数据变化,需清除下所有层级选中数据
|
// 选择数据变化,需清除下所有层级选中数据
|
||||||
if (item.id != this.submitVals[this.curTabIndex]) {
|
if (item.id != this.submitVals[this.curTabIndex]) {
|
||||||
this.submitVals.regIds.length = this.curTabIndex
|
this.submitVals.regIds.length = this.curTabIndex
|
||||||
this.submitVals.regNames.length = this.curTabIndex
|
this.submitVals.regNames.length = this.curTabIndex
|
||||||
this.submitVals.regIds.push(item.id)
|
this.submitVals.regIds.push(item.id)
|
||||||
this.submitVals.regNames.push(item.name)
|
this.submitVals.regNames.push(item.name)
|
||||||
|
this.hackUpdateRgnames()
|
||||||
}
|
}
|
||||||
this.getListData({
|
// 选中后切换下一层级视图
|
||||||
parentId: item.id
|
this.addEmptyItem(item)
|
||||||
})
|
},
|
||||||
|
hackUpdateRgnames() {
|
||||||
|
this.regnameLoading = true
|
||||||
|
setTimeout(()=> {
|
||||||
|
this.regnameLoading = false
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handleCloseModal() {
|
handleCloseModal() {
|
||||||
this.$emit('update:show', false)
|
this.$emit('update:show', false)
|
||||||
@ -180,6 +204,18 @@
|
|||||||
}
|
}
|
||||||
.showselect-item{
|
.showselect-item{
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 20rpx;;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
.chk{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
&.active{
|
||||||
|
font-weight: bold;
|
||||||
|
color: #B12D29;
|
||||||
|
.chk{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user