فهرست منبع

Merge branch 'dev' of http://1.94.207.143:3000/xyy/xyy-m into dev

qiao 2 ماه پیش
والد
کامیت
f577ee065c

+ 1 - 1
.env.production

@@ -1,7 +1,7 @@
 VITE_APP_ENV=production
 
 # VITE_APP_BASE_URL=https://api.ztzhipin.com/api/
-VITE_APP_BASE_URL=https://m.xiaoyaotravel.com/api/
+VITE_APP_BASE_URL=https://service.xiaoyaotravel.com/api/
 VITE_APP_EMOJI_API=https://v.xiaoyaotravel.com/emoji/
 VITE_APP_IM_USER_SUFFIX=''
 

BIN
src/assets/img/default_avatar.png


BIN
src/assets/img/home/home_travel_notes_bg.png


BIN
src/assets/img/navbar/nav_menu.png


+ 3 - 1
src/components/Home/TravelNotes/index.vue

@@ -1,5 +1,7 @@
 <template>
-  <div class="w-full">
+  <div
+    class="bg-[url('~/assets/img/home/home_travel_notes_bg.png')] bg-cover bg-center bg-no-repeat px-15 pt-15"
+  >
     <div class="relative mx-auto w-wrap">
       <div class="flex items-center justify-between">
         <div class="flex items-center space-x-5">

+ 9 - 5
src/components/NavigationBar/LeftMenu.vue

@@ -1,5 +1,8 @@
 <template>
-  <div class="pt-70 px-20 pb-30 flex flex-col h-screen">
+  <div class="pt-70 px-20 pb-30 flex flex-col h-screen relative">
+    <div @click="visible = false" class="absolute right-20 top-50">
+      <span class="iconfont icon-close"></span>
+    </div>
     <NuxtLink v-if="!token" to="/login" class="flex items-center space-x-15">
       <div
         class="flex items-center justify-center bg-[#d9d9d9] rounded-full h-60 w-60"
@@ -18,7 +21,7 @@
       class="flex items-center space-x-15"
     >
       <van-image
-        :src="userInfo.headImageUrl"
+        :src="userInfo.headImageUrl || defaultAvatar"
         height="60"
         width="60"
         radius="30px"
@@ -37,15 +40,15 @@
       </div>
     </div>
 
-    <div class="flex flex-col mt-20 divide-y flex-1 overflow-scroll">
+    <div class="flex flex-col mt-20 flex-1 overflow-scroll">
       <div
         v-for="item in menuData"
         :key="item.title"
         @click="handleClickMenu(item)"
-        class="flex items-center h-50 space-x-5"
+        class="flex items-center h-50 space-x-5 border-b hover:bg-[#fff8e7]"
       >
         <img :src="item.icon" class="w-23 h-23" alt="" srcset="" />
-        <span class="text-base text-black-3">{{ item.title }}</span>
+        <span class="text-base text-black">{{ item.title }}</span>
       </div>
     </div>
 
@@ -70,6 +73,7 @@ import menu_travel_note from "@/assets/img/navbar/menu_travel_note.png";
 import menu_travel_project from "@/assets/img/navbar/menu_travel_project.png";
 import menu_visa from "@/assets/img/navbar/menu_visa.png";
 import menu_profile from "@/assets/img/navbar/menu_profile.png";
+import defaultAvatar from "~/assets/img/default_avatar.png";
 
 const visible = defineModel("visible");
 

+ 88 - 0
src/components/NavigationBar/index.client.vue

@@ -0,0 +1,88 @@
+<template>
+  <div
+    class="h-50 bg-white justify-between w-full fixed z-[999] border-b box-border"
+  >
+    <NuxtLink to="/" class="absolute top-1/2 -translate-y-1/2 left-15">
+      <img src="~/assets/img/logo.png" class="h-30 object-contain" />
+    </NuxtLink>
+
+    <div
+      class="absolute right-15 top-1/2 -translate-y-1/2 flex items-center space-x-20"
+    >
+      <template v-if="token">
+        <NuxtLink to="/profile" class="flex items-center text-base space-x-5">
+          <van-image
+            :src="userInfo.headImageUrl || defaultAvatar"
+            round
+            height="26"
+            width="26"
+          />
+          <span class="max-w-70 truncate text-black-6">{{
+            userInfo.showName
+          }}</span>
+        </NuxtLink>
+      </template>
+
+      <template v-else-if="!token">
+        <NuxtLink
+          :to="`/login?redirect=${route.fullPath}`"
+          class="flex items-center text-black-6 space-x-5"
+        >
+          <div
+            class="w-26 h-26 rounded-full bg-[#d9d9d9] text-black-6 flex items-center justify-center"
+          >
+            <span class="iconfont icon-profile"></span>
+          </div>
+          <span class="text-base">请登录</span>
+        </NuxtLink>
+      </template>
+      <img
+        @click="handleClickMenu"
+        src="~/assets/img/navbar/nav_menu.png"
+        class="w-24 h-24"
+      />
+    </div>
+
+    <van-popup
+      v-model:show="isMenuShow"
+      position="left"
+      :style="{ height: '100%', width: '70%' }"
+    >
+      <NavigationBarLeftMenu
+        v-if="isMenuShow"
+        v-model:visible="isMenuShow"
+        @on-hide="isMenuShow = false"
+      />
+    </van-popup>
+  </div>
+</template>
+
+<script setup>
+import defaultAvatar from "~/assets/img/default_avatar.png";
+
+const isMenuShow = ref(false);
+
+function handleClickMenu() {
+  isMenuShow.value = true;
+}
+
+const route = useRoute();
+
+const authStore = useAuthStore();
+const { token } = storeToRefs(authStore);
+
+const userInfoStore = useUserInfoStore();
+const { userInfo } = storeToRefs(userInfoStore);
+
+watch(
+  token,
+  () => {
+    if (token.value) {
+      userInfoStore.getUserInfo();
+    }
+  },
+  { immediate: true }
+);
+</script>
+
+<style lang="scss" scoped></style>

+ 0 - 39
src/components/NavigationBar/index.vue

@@ -1,39 +0,0 @@
-<template>
-  <div
-    class="h-50 bg-white justify-between w-full fixed z-[999] border-b box-border"
-  >
-    <NuxtLink to="/" class="absolute top-1/2 -translate-y-1/2 left-15">
-      <img src="~/assets/img/logo.png" class="h-36 object-contain" />
-    </NuxtLink>
-    <div
-      class="absolute right-15 top-1/2 -translate-y-1/2"
-      @click="handleClickMenu"
-    >
-      <span class="iconfont icon-menu" style="font-size: 24px"></span>
-    </div>
-
-    <van-popup
-      v-model:show="isMenuShow"
-      position="left"
-      :style="{ height: '100%', width: '70%' }"
-    >
-      <NavigationBarLeftMenu
-        v-if="isMenuShow"
-        v-model:visible="isMenuShow"
-        @on-hide="isMenuShow = false"
-      />
-    </van-popup>
-  </div>
-</template>
-
-<script setup>
-const isMenuShow = ref(false);
-
-function handleClickMenu() {
-  isMenuShow.value = true;
-}
-
-const route = useRoute();
-</script>
-
-<style lang="scss" scoped></style>

+ 1 - 3
src/pages/index.vue

@@ -5,9 +5,7 @@
       <HomeTravelMenu class="mt-10" />
       <!-- <HomeMenu class="mt-10" /> -->
     </div>
-    <div class="px-15 mt-15">
-      <HomeTravelNotes />
-    </div>
+    <HomeTravelNotes />
     <div class="bg-white mt-20 px-15 pt-15 pb-30">
       <HomeHotTravelProjects />
       <HomeHotCountry class="mt-30" />

+ 2 - 1
src/pages/profile/index.vue

@@ -6,7 +6,7 @@
       <div class="absolute left-20 bottom-10 right-20 text-black-3">
         <NuxtLink to="/profile/userInfo" class="flex items-center space-x-10">
           <van-image
-            :src="userInfo.headImageUrl"
+            :src="userInfo.headImageUrl || defaultAvatar"
             class="shrink-0"
             width="75px"
             height="75px"
@@ -40,6 +40,7 @@
 </template>
 
 <script setup>
+import defaultAvatar from "~/assets/img/default_avatar.png";
 import profile_travel_order from "~/assets/img/profile/profile_travel_order.png";
 import profile_labour_order from "~/assets/img/profile/profile_labour_order.png";
 import profile_travel_note from "~/assets/img/profile/profile_travel_note.png";

+ 21 - 20
src/utils/request.js

@@ -43,26 +43,27 @@ export function request(url, options = {}) {
 }
 
 const handleHttpError = (status) => {
-  switch (status) {
-    case 400:
-      showErrorMessage("参数错误");
-      break;
-    case 401:
-      showErrorMessage("没有访问权限");
-      break;
-    case 403:
-      showErrorMessage("服务器拒绝访问");
-      break;
-    case 404:
-      showErrorMessage("请求地址错误");
-      break;
-    case (502, 503):
-      showErrorMessage("系统升级中");
-      break;
-    default:
-      showErrorMessage("服务器出错了");
-      break;
-  }
+  showErrorMessage(`${status} 请求出错,请重试~`);
+  // switch (status) {
+  //   case 400:
+  //     showErrorMessage("参数错误");
+  //     break;
+  //   case 401:
+  //     showErrorMessage("请求出错401");
+  //     break;
+  //   case 403:
+  //     showErrorMessage("服务器拒绝访问");
+  //     break;
+  //   case 404:
+  //     showErrorMessage("请求地址错误");
+  //     break;
+  //   case (502, 503):
+  //     showErrorMessage("系统升级中");
+  //     break;
+  //   default:
+  //     showErrorMessage("服务器出错了");
+  //     break;
+  // }
 };
 
 const handleServerError = async (code, msg) => {