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