debug
parent
302f386891
commit
58ca089d96
|
|
@ -130,7 +130,7 @@ const onLogout = ()=>{
|
|||
localCache.remove('auth');
|
||||
userInfo.updateUserInfo({});
|
||||
showToast('已退出登录!');
|
||||
// window.location.replace('/');
|
||||
window.location.replace('/');
|
||||
}).catch(err => {
|
||||
showToast(err.message);
|
||||
})
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ const router = useRouter();
|
|||
const route = useRoute();
|
||||
|
||||
const props = defineProps({
|
||||
pid: [Number, String],
|
||||
cid: {
|
||||
cid: Object,
|
||||
default: {}
|
||||
|
|
@ -60,6 +61,7 @@ onMounted(()=>{
|
|||
const getList = ()=>{
|
||||
placeholder.value = '数据加载中...';
|
||||
let params = {
|
||||
category_path: props.type == 'government' ? (props.pid ? props.pid : undefined) : undefined,
|
||||
category_id: props.cid ? props.cid : undefined,
|
||||
type: props.type,
|
||||
per_page: pageSize.value,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<li :class="{ active: cid == item.id }" @click="changeCategory(item.id)" v-for="item in categories">{{
|
||||
item.name }}</li>
|
||||
</ul>
|
||||
<CardList :key="cid" :cid="cid" :type="type"></CardList>
|
||||
<CardList :key="cid" :pid="parent_id" :cid="cid" :type="type"></CardList>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
<div class="label"><span></span>联系邮箱</div>
|
||||
<div class="val">
|
||||
<div class="txtBox">
|
||||
<span>{{ userInfo.userData.email || '--' }}</span>
|
||||
<span>{{ userInfo.userData.email }}</span>
|
||||
<van-button type="primary" @click="updateType = 'email'" ><i class="icon-edit"></i>修改</van-button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -102,6 +102,7 @@ import http from '@/io/http';
|
|||
import { localCache } from '@/io/cache';
|
||||
import { showToast } from 'vant';
|
||||
import { useUserInfo } from '@/stores/userInfo';
|
||||
import { useAuthModal } from '@/stores/authModal';
|
||||
import UpdateContactModal from './components/updateContactModal.vue';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import { formatDate } from '@/utils/format.js'
|
||||
|
|
@ -110,6 +111,7 @@ const router = useRouter();
|
|||
|
||||
|
||||
const userInfo = useUserInfo();
|
||||
const authModal = useAuthModal();
|
||||
const updateType = ref('');
|
||||
|
||||
const name = ref();
|
||||
|
|
@ -140,14 +142,30 @@ const onFinish = (data)=>{
|
|||
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
let userData = localCache.get('userInfo') || {};
|
||||
if(userData.id){
|
||||
initData();
|
||||
getAreas();
|
||||
}
|
||||
|
||||
getUserInfo();
|
||||
|
||||
});
|
||||
|
||||
const getUserInfo = () => {
|
||||
const isLoading = !userInfo.userData?.id;
|
||||
http('/api/user/profile', {}, 'get', {isLoading}).then(res => {
|
||||
localCache.set('userInfo', res.data);
|
||||
userInfo.updateUserInfo(res.data);
|
||||
if(res.data.id){
|
||||
initData();
|
||||
isLoading && getAreas();
|
||||
}
|
||||
}).catch(err => {
|
||||
showToast(err.message);
|
||||
})
|
||||
};
|
||||
|
||||
const initData = () => {
|
||||
const data = userInfo.userData;
|
||||
name.value = data.name;
|
||||
|
|
@ -160,10 +178,12 @@ const initData = () => {
|
|||
};
|
||||
|
||||
const initAreaData = (data = [])=>{
|
||||
let _province = data.filter(v=>v.id == province.value)[0];
|
||||
let _city = _province.children.filter(v=>v.id == city.value)[0];
|
||||
let _area = _city.children.filter(v=>v.id == area.value)[0];
|
||||
areaValue.value = [_province, _city, _area].map(v=>v.name).join('/');
|
||||
if(province.value && city.value && area.value){
|
||||
let _province = data.filter(v=>v.id == province.value)[0];
|
||||
let _city = _province.children.filter(v=>v.id == city.value)[0];
|
||||
let _area = _city.children.filter(v=>v.id == area.value)[0];
|
||||
areaValue.value = [_province, _city, _area].map(v=>v.name).join('/');
|
||||
}
|
||||
};
|
||||
|
||||
const getAreas = () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue