Browse Source

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

suwenjiang 3 months ago
parent
commit
0ee9d25d3d

+ 7 - 0
nuxt.config.ts

@@ -53,6 +53,13 @@ export default defineNuxtConfig({
         },
       ],
       link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.svg" }],
+      // script: [
+      //   {
+      //     src: "//unpkg.com/vconsole@latest/dist/vconsole.min.js",
+      //     type: "text/javascript",
+      //   },
+      //   { innerHTML: "new VConsole()" },
+      // ],
     },
   },
   css: ["@/assets/css/tailwind.css", "./src/assets/iconfont/iconfont.css"],

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

@@ -12,8 +12,8 @@
       <span class="text-black-6 text-base">登录</span>
     </NuxtLink>
 
-    <NuxtLink
-      to="/profile"
+    <div
+      @click="handleToProfile"
       v-else-if="token"
       class="flex items-center space-x-15"
     >
@@ -25,13 +25,17 @@
         class="shrink-0"
       ></van-image>
       <div class="flex-1 flex flex-col">
-        <div class="text-black-3 text-base">{{ userInfo.showName }}</div>
+        <div class="text-black-3 text-base break-all">
+          {{ userInfo.showName }}
+        </div>
         <div v-if="userInfo.personalSign" class="text-black-6 text-sm">
           <span class="text-black-6">个性签名:</span>
-          <span class="text-black-3">{{ userInfo.personalSign }}</span>
+          <span class="text-black-3 break-all">{{
+            userInfo.personalSign
+          }}</span>
         </div>
       </div>
-    </NuxtLink>
+    </div>
 
     <div class="flex flex-col mt-20 divide-y flex-1 overflow-scroll">
       <div
@@ -69,6 +73,8 @@ import menu_profile from "@/assets/img/navbar/menu_profile.png";
 
 const visible = defineModel("visible");
 
+const route = useRoute();
+
 const authStore = useAuthStore();
 const { token } = storeToRefs(authStore);
 
@@ -154,6 +160,13 @@ function handleClickMenu(item) {
   });
 }
 
+function handleToProfile() {
+  visible.value = false;
+  navigateTo({
+    path: "/profile",
+  });
+}
+
 function handleLogout() {
   try {
     request("/website/web/doLogout", { method: "post" });

+ 3 - 3
src/pages/profile/index.vue

@@ -3,7 +3,7 @@
     <div
       class="h-250 relative w-full bg-[url('~/assets/img/profile/profile_banner.png')] bg-no-repeat bg-cover"
     >
-      <div class="absolute left-20 bottom-10">
+      <div class="absolute left-20 bottom-10 right-20">
         <NuxtLink to="/profile/userInfo" class="flex items-center space-x-10">
           <van-image
             :src="userInfo.headImageUrl"
@@ -12,11 +12,11 @@
             fit="cover"
             radius="37.5px"
           />
-          <span class="text-2xl font-semibold text-white">
+          <span class="text-2xl break-all font-semibold text-white">
             {{ userInfo.showName }}</span
           >
         </NuxtLink>
-        <div class="text-xl text-white font-semibold mt-15">
+        <div class="text-xl break-all text-white font-semibold mt-15">
           个性签名:{{ userInfo.personalSign || "暂未填写" }}
         </div>
       </div>

+ 47 - 43
src/pages/profile/userInfo.vue

@@ -4,24 +4,16 @@
       <van-cell-group inset>
         <van-field name="uploader" label="头像">
           <template #input>
-            <div @click="handleChangeAvatar">
-              <van-image
-                v-if="userInfo.headImageUrl"
-                :src="userInfo.headImageUrl"
-                width="75px"
-                height="75px"
-                radius="37.5px"
-              />
-              <div
-                v-else
-                class="w-75 h-75 rounded-full bg-black-d flex items-center justify-center"
-              >
-                <span
-                  class="iconfont icon-profile text-black-6"
-                  style="font-size: 36px"
-                ></span>
-              </div>
-            </div>
+            <van-uploader
+              style="--van-uploader-border-radius: 40px"
+              :after-read="afterRead"
+              v-model="fileList"
+              :max-count="1"
+              :deletable="false"
+              :multiple="false"
+              accept="image/*"
+              reupload
+            />
           </template>
         </van-field>
         <van-field
@@ -29,6 +21,7 @@
           name="昵称"
           label="昵称"
           placeholder="昵称"
+          maxlength="20"
           :rules="[{ required: true, message: '请填写昵称' }]"
         />
         <van-field name="radio" label="性别">
@@ -44,18 +37,27 @@
           name="邮箱"
           label="邮箱"
           placeholder="邮箱"
-          :rules="[{ required: true, message: '请填写邮箱' }]"
+          maxlength="100"
+          :rules="[
+            {
+              required: true,
+              validator: validatorEmail,
+              message: '请填写正确的邮箱',
+            },
+          ]"
         />
         <van-field
           v-model="userInfo.job"
           name="职业"
           label="职业"
           placeholder="职业"
+          maxlength="100"
         />
         <van-field
           v-model="userInfo.address"
           name="居住地"
           label="居住地"
+          maxlength="100"
           placeholder="居住地"
         />
         <van-field
@@ -87,6 +89,8 @@
 const userInfoStore = useUserInfoStore();
 const { userInfo } = storeToRefs(userInfoStore);
 
+const fileList = ref([]);
+
 const form = reactive({
   showName: null,
   email: null,
@@ -98,6 +102,27 @@ const form = reactive({
   personalSign: null,
 });
 
+const validatorEmail = (val) =>
+  /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
+    val
+  );
+
+async function afterRead(file) {
+  console.log(file);
+  const formData = new FormData();
+  formData.append("uploadFile", file.file);
+  formData.append("asImage", true);
+  formData.append("fieldName", "headImageUrl");
+  try {
+    const { data } = await request("/website/tourism/user/upload", {
+      method: "post",
+      body: formData,
+    });
+    form.headImageUrl = data.fileUrl;
+    userInfoStore.getUserInfo();
+  } catch (error) {}
+}
+
 watch(
   userInfo,
   () => {
@@ -105,6 +130,9 @@ watch(
     form.email = userInfo.value.email;
     form.sex = userInfo.value.sex;
     form.headImageUrl = userInfo.value.headImageUrl;
+    fileList.value[0] = {
+      url: userInfo.value.headImageUrl,
+    };
     form.address = userInfo.value.address;
     form.job = userInfo.value.job;
     form.personalSign = userInfo.value.personalSign;
@@ -119,30 +147,6 @@ onMounted(() => {
   userInfoStore.getUserInfo();
 });
 
-const { open, onChange } = useFileDialog({
-  accept: ".png,.png,.jpeg,.JPG,Png ",
-});
-
-function handleChangeAvatar() {
-  open();
-}
-
-onChange(async (files) => {
-  if (!files.length) return;
-  const formData = new FormData();
-  formData.append("uploadFile", files[0]);
-  formData.append("asImage", true);
-  formData.append("fieldName", "headImageUrl");
-  try {
-    const { data } = await request("/website/tourism/user/upload", {
-      method: "post",
-      body: formData,
-    });
-    form.headImageUrl = data.fileUrl;
-    userInfoStore.getUserInfo();
-  } catch (error) {}
-});
-
 async function handleSubmit() {
   try {
     await request("/website/tourism/user/update", {

+ 4 - 2
src/pages/t/[id].client.vue

@@ -116,12 +116,14 @@ function handleSubmitInfo() {
       if (data === 1) {
         showDialog({
           title: "预定成功",
-          message: "恭喜预定成功我们会尽快和您取得联系",
+          message:
+            "因为旅游预定涉及较多的环节,我们需要线下和您沟通,我们会尽快与你联系并为您提供最真诚的服务。",
         }).then(() => {});
       } else if (data === 2) {
         showDialog({
           title: "您已预定",
-          message: "我们会尽快和您取得联系",
+          message:
+            "因为旅游预定涉及较多的环节,我们需要线下和您沟通,我们会尽快与你联系并为您提供最真诚的服务。",
         }).then(() => {
           // on close
         });

+ 30 - 7
src/pages/travel-notes/index.vue

@@ -48,8 +48,11 @@
 </template>
 
 <script setup>
+const router = useRoute()
 const AREA_TEXT = '地域'
 
+const areaId = useRouteParam("area")
+
 const filterList = ref([])//地域列表
 
 const curFilter = ref({})//当前筛选条件(国家)
@@ -66,19 +69,37 @@ const dropDownMenuRef = ref(null)
 // 获取筛选列表
 async function getFilters() {
   const { data } = await request(`website/tourism/projectTravelNotes/travelNotesDirectoryList`).finally(()=>{closeToast()})
-  if (!Array.isArray(data)) return
+  
+  if (!Array.isArray(data)) return getList()
+  const routerAreaId = null
   data.map((item, index) => {
     data[index].id = item.areaId
     data[index].text = item.areaName
+
+    // 处理地址栏带area参数的情况
+    if(router.query.area == item.areaId){
+      curFilter.value.areaId = router.query.area
+      document.title = item.areaName
+      areaIndex.value = index + 1
+      curFilter.value.id = item.areaId+',all'
+      areaFilterTitle.value = item.areaName
+    }
+
     if (Array.isArray(item.children)) {
+      data[index].children.unshift({countryName:'全部',countryId:item.areaId+',all'})
       item.children.map((item2, index2) => {
         data[index].children[index2].id = item2.countryId
         data[index].children[index2].text = item2.countryName
         data[index].children[index2].areaId = item.areaId
+        data[index].children[index2].areaName = item.areaName
       })
     }
   })
+  if(routerAreaId){
+
+  }
   filterList.value = [{ id: 0, text: '全部', children: [{ id: 0, text: '全部' }] }, ...data]
+  getList()
 }
 
 // 监听地域筛选框收起
@@ -114,10 +135,13 @@ async function getList() {
     pageSize: pageSize.value,
   }
 
-  if (curFilter.value.id) {
-    param.areaId = curFilter.value.areaId
-    param.countryId = curFilter.value.id
+  if(curFilter.value.areaId) param.areaId = curFilter.value.areaId
+
+  if(curFilter.value.id) {
+    const countryId = curFilter.value.id.split(',')
+    if(!countryId[1]) param.countryId = curFilter.value.id
   }
+  
   if (travelWriteType.value) {
     param.travelWriteType = travelWriteType.value
   }
@@ -150,7 +174,7 @@ function handleFilterClick(item) {
   dataList.value = []
   getList()
   dropDownMenuRef.value && dropDownMenuRef.value.close()
-  document.title=`${item.id?'游记-'+item.text:'旅游笔记'}`
+  document.title=`${item.id?'游记-'+item.areaName+'-'+item.text:'旅游笔记'}`
 }
 
 function transferCount(num=0){
@@ -170,8 +194,7 @@ function convertTag(str=''){
   return str.split('&')
 }
 
-onMounted(() => {
-  getList()
+onMounted( async () => {
   getFilters()
 })
 

+ 10 - 1
src/pages/yj/[id].vue

@@ -124,7 +124,7 @@
           </div>
           <div class="flex items-center ml-15">
             <img src="~/assets/img/yj/leftArrow.png" class="w-[28px]" alt="">
-            <div class="text-[#666666] text-[16px]">扫码添加好友</div>
+            <div class="text-[#666666] text-[12px]">长按保存图片,扫码添加好友</div>
           </div>
         </div>
         <template v-if="commentList.length">
@@ -293,6 +293,15 @@ async function isCollectTravelNotes() {
 
 // 收藏/取消收藏
 async function handleCollect() {
+  if (!token.value) {
+    showConfirmDialog({
+      showConfirmDialog: true,
+      title: '提示',
+      message: '登录后可以收藏游记',
+      theme: 'round-button',
+    }).then(async () => { navigateTo({ path: '/login' }) })
+    return
+  }
   const type = isCollect.value ? 0 : 1
   showLoadingToast({
     forbidClick: true,