优化组件类型声明,添加页面描述元信息,更新依赖项,添加新图片,重构多个组件,改进画廊功能
This commit is contained in:
@ -32,8 +32,8 @@
|
||||
</d-menu-item>
|
||||
</d-menu>
|
||||
<!-- 用户区域 -->
|
||||
<div class="!text-[#ec66ab] user-area flex items-center px-3">
|
||||
<span class="flex items-center location-info ">
|
||||
<div class="!text-[#ec66ab] flex items-center" @click="gotoHf">
|
||||
<span class="flex items-center location-info truncate">
|
||||
<d-icon color="#ec66ab" class="mr-1" name="location-new"></d-icon>
|
||||
{{ locationInfo }}
|
||||
</span>
|
||||
@ -41,8 +41,11 @@
|
||||
<span class="weather-info mr-2">{{ wea }}</span>
|
||||
<i :class="'qiIcon qi-' + weaIcon + '-fill'"></i>
|
||||
<span class="weather-info ml-4">{{ temp }}°C</span>
|
||||
<d-avatar v-if="userinfo" :img-src="userinfo.ava_url" class="ml-20 cursor-pointer" alt="用户的头" />
|
||||
<d-avatar v-else class="ml-20 cursor-pointer" @click="toLogin"></d-avatar>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center ">
|
||||
<d-avatar v-if="userinfo" :img-src="userinfo.ava_url" class="ml-10 mr-4 cursor-pointer" alt="用户的头" />
|
||||
<d-avatar v-else class="ml-10 mr-4 cursor-pointer" @click="toLogin"></d-avatar>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -69,6 +72,7 @@ const key = ref("home");
|
||||
const locationInfo = ref("获取位置中...");
|
||||
const latitude = ref<number | null>(null);
|
||||
const longitude = ref<number | null>(null);
|
||||
const fxlink = ref<string>("#")
|
||||
const wea = ref("")
|
||||
const weaIcon = ref<string>("")
|
||||
const temp = ref<number>(0);
|
||||
@ -96,13 +100,13 @@ const getLocation = () => {
|
||||
async (error) => {
|
||||
switch (error.code) {
|
||||
case error.PERMISSION_DENIED:
|
||||
locationInfo.value = "用户拒绝了位置请求";
|
||||
locationInfo.value = "正在定位...";
|
||||
break;
|
||||
case error.POSITION_UNAVAILABLE:
|
||||
locationInfo.value = "位置信息不可用";
|
||||
locationInfo.value = "正在定位...";
|
||||
break;
|
||||
case error.TIMEOUT:
|
||||
locationInfo.value = "获取位置超时";
|
||||
locationInfo.value = "正在定位...";
|
||||
break;
|
||||
}
|
||||
const res = await $http.mix.getIp();
|
||||
@ -125,11 +129,12 @@ async function handdleJw(jw: string) {
|
||||
const zxs = ['北京', '重庆', '天津', '上海']
|
||||
// 根据经纬度获取物理位置
|
||||
const loc = await $http.mix.getLocation({ location: jw });
|
||||
console.log(loc);
|
||||
console.log('>>> --> handdleJw --> loc:', loc)
|
||||
fxlink.value = loc.data.fxLink
|
||||
if (loc.code == 200) {
|
||||
const data = loc.data;
|
||||
if (zxs.includes(data.adm2)) {
|
||||
locationInfo.value = `${data.country}${data.adm1}${data.name}`;
|
||||
locationInfo.value = `${data.adm1}${data.name}`;
|
||||
} else {
|
||||
locationInfo.value = `${data.adm1}${data.adm2}${data.name}`;
|
||||
}
|
||||
@ -138,7 +143,7 @@ async function handdleJw(jw: string) {
|
||||
return
|
||||
}
|
||||
const res = await $http.mix.getWeather({ location: jw });
|
||||
console.log(res);
|
||||
console.log('>>> --> handdleJw --> res:', res)
|
||||
if (res.code == 200) {
|
||||
wea.value = res.data.text;
|
||||
weaIcon.value = res.data.icon;
|
||||
@ -158,11 +163,17 @@ function goHome() {
|
||||
}
|
||||
|
||||
function toLogin() {
|
||||
console.log('>>> --> toLogin --> toLogin:', 'toLogin')
|
||||
|
||||
if ($cookies.get('token')) return
|
||||
router.push('/login');
|
||||
}
|
||||
|
||||
|
||||
function gotoHf(){
|
||||
console.log('>>> --> gotoHf --> fxlink:', fxlink)
|
||||
window.open(fxlink.value,"_BLACK")
|
||||
|
||||
}
|
||||
onMounted(() => {
|
||||
|
||||
userinfo.value = $cookies.get('userinfo');
|
||||
|
||||
Reference in New Issue
Block a user