Ver código fonte

fix:接口数据联调

aamin 1 ano atrás
pai
commit
08adce839b

+ 0 - 3
components.d.ts

@@ -8,14 +8,11 @@ export {}
 declare module 'vue' {
   export interface GlobalComponents {
     IframePage: typeof import('./src/components/IframePage/index.vue')['default']
-    NoData: typeof import('./src/components/NoData/index.vue')['default']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
     SearchInput: typeof import('./src/components/SearchInput/index.vue')['default']
-    VanField: typeof import('vant/es')['Field']
     VanRadio: typeof import('vant/es')['Radio']
     VanRadioGroup: typeof import('vant/es')['RadioGroup']
-    VanSearch: typeof import('vant/es')['Search']
     VanSwipe: typeof import('vant/es')['Swipe']
     VanSwipeItem: typeof import('vant/es')['SwipeItem']
     VanTab: typeof import('vant/es')['Tab']

+ 1 - 0
src/api/api/activeBooking/index.ts

@@ -1,5 +1,6 @@
 import axiosInstance from '@/api/request'
 export const ActiveBookingApi = {
+  getTypeList: () => axiosInstance.get('show/activity/getDict'),
   getActiveList: (data: any) => axiosInstance.post('show/activity/pageList', data),
   getDetailById: (id: number) => axiosInstance.get(`show/activity/detail/${id}`)
 }

+ 2 - 0
src/api/api/dynamic/index.ts

@@ -1,5 +1,7 @@
 import axiosInstance from '@/api/request'
 export const DynamicApi = {
+  getTypeList: () => axiosInstance.get('show/news/getDict'),
   getDynamicList: (data: any) => axiosInstance.post('show/news/pageList', data),
   getDetailById: (id: number) => axiosInstance.get(`show/news/detail/${id}`)
+  
 }

+ 4 - 2
src/api/api/sceneBooking/index.ts

@@ -1,6 +1,8 @@
 import axiosInstance from '@/api/request'
 export const sceneBookingApi = {
-  getDisableDateAPi: () => axiosInstance.get(''),
+  getBookingListAPi: (data:any) => axiosInstance.get('cms/rule/pageList',data),
+  getDetailByIdAPI: (id:any) => axiosInstance.get(`cms/rule/detail/${id}`),
+  getCodeAPI:(code:any) => axiosInstance.get(`wx/wxLogin/${code}`),
+  submitBookingAPI: (data:any) => axiosInstance.post('cms/webUser/bookExhibition/save',data),
   getBookingTimeAPI: (date:string) => axiosInstance.get(`show/book/config?date=${date}`),
-  getCodeAPI:(code:any) => axiosInstance.get(`wx/wxLogin/${code}`)
 }

+ 21 - 8
src/api/request.ts

@@ -4,12 +4,26 @@ import axios from 'axios';
 //设置基地址
 // export const baseUrl = "https://wxfalangchang.4dage.com/api";
 // export const baseIMGUrl = "https://wxfalangchang.4dage.com";
-export const baseUrl = "http://192.168.20.61:8067/api/";
-export const baseIMGUrl = "";
+// export const baseUrl = "https://sit-ningguobwg.4dage.com/api/";
+// export const baseIMGUrl = "";
+export const baseIMGUrl = "https://sit-ningguobwg.4dage.com/";
+
+
+export const baseUrl =
+  // 线下的图片地址需要加上/api/
+  // process.env.NODE_ENV === "development"
+  //   ? "http://192.168.20.61:8063/api/"
+  //   : "";
+  process.env.NODE_ENV === "development"
+    ? "https://sit-ningguobwg.4dage.com"
+    : "";
 
 
 const instance = axios.create({
-  baseURL: baseUrl, // 使用环境变量设置API的基础URL
+  // 线下环境
+  // baseURL: baseUrl, // 使用环境变量设置API的基础URL
+  // 线上环境
+  baseURL: baseUrl + "/api/",
   timeout: 5000, // 可选,设置请求超时时间
   headers: {
     'Content-Type': 'application/json',
@@ -22,12 +36,11 @@ instance.interceptors.request.use(
     // 在这里执行请求发送前的预处理操作
 
     // 示例:添加全局请求头(如API版本、认证令牌等)(需要登录)
-    // const commonStore = useCommonStore(); // 假设有一个名为commonStore的Pinia store来管理全局状态
-    // const { accessToken } = storeToRefs(commonStore); // 从store中获取accessToken
+    const accessToken = localStorage.getItem('token')
 
-    // if (accessToken.value) {
-    //   config.headers.Authorization = `Bearer ${accessToken.value}`;
-    // }
+    if (accessToken) {
+      config.headers.Authorization = `Bearer ${accessToken}`;
+    }
 
     // 可以在此处添加其他通用请求逻辑,如:
     // - 统一处理请求参数序列化

+ 33 - 15
src/utils/weixin.ts

@@ -1,21 +1,21 @@
-export function getUserCode(backUrl: string) {
-   //此处的ID是在文档的开发-基本配置里面
-   const appid = "wx3255043d1b21a4f7";
-   window.location.href =
-     "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
-     appid +
-     "&redirect_uri=" +
-       encodeURIComponent(backUrl) +
-     "&response_type=code&scope=snsapi_userinfo&state=bc17befd6d5060f16de95e38f6eaf69c&connect_redirect=1#wechat_redirect";
-}
+// export function getUserCode(backUrl: string) {
+//   //此处的ID是在文档的开发-基本配置里面
+//   const appid = 'wx3255043d1b21a4f7'
+//   window.location.href =
+//     'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
+//     appid +
+//     '&redirect_uri=' +
+//     encodeURIComponent(backUrl) +
+//     '&response_type=code&scope=snsapi_userinfo&state=bc17befd6d5060f16de95e38f6eaf69c&connect_redirect=1#wechat_redirect'
+// }
 
 export function checkLoginStatus() {
-  const userInfo = localStorage.getItem("YFYC_userInfo");
+  const userInfo = localStorage.getItem('userInfo')
   if (userInfo) {
-    const nowTime = Date.now();
-    const data = JSON.parse(userInfo);
-    // 超过了6个小时
-    if (nowTime - data.time >= 1000 * 60 * 60 * 6) {
+    const nowTime = Date.now()
+    const data = JSON.parse(userInfo)
+    // 超过了santia
+    if (nowTime - data.time >= 1000 * 60 * 60 * 72) {
       return false
     } else {
       return true
@@ -24,3 +24,21 @@ export function checkLoginStatus() {
     return false
   }
 }
+
+export function getQueryCode(name: string) {
+  // 未传参,返回空
+  if (!name) return null
+  // 查询参数:先通过search取值,如果取不到就通过hash来取
+  let after = window.location.search
+  after = after.substr(1) || window.location.hash.split('?')[1]
+  // 地址栏URL没有查询参数,返回空
+  if (!after) return null
+  // 如果查询参数中没有"name",返回空
+  if (after.indexOf(name) === -1) return null
+
+  const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
+  // 当地址栏参数存在中文时,需要解码,不然会乱码
+  const r = decodeURI(after).match(reg)
+  // 如果url中"name"没有值,返回空
+  if (!r) return null
+}

+ 24 - 4
src/views/EnterNingguo/artwork.vue

@@ -3,6 +3,8 @@
 import { ArtworkApi } from '@/api/api/artwork'
 import { showToast } from 'vant'
 import SearchInput from '@/components/SearchInput/index.vue'
+import { baseIMGUrl } from '@/api/request.ts'
+
 
 export type artworkType = {
   createTime: string,
@@ -50,7 +52,7 @@ const iframeLink = ref('')
 
 
 onBeforeMount(() => {
-  // getList()
+  getList()
 })
 
 </script>
@@ -61,7 +63,7 @@ onBeforeMount(() => {
     <div class="search-list" v-if="searchList.length > 0">
       <div class="list-item" v-for="(item, index) in searchList" :key="index"
         @click="() => { isShowIframe = true, iframeLink = item.link }">
-        <img :src="item.thumb" alt="">
+        <img :src="baseIMGUrl + item.thumb" alt="">
         <div class="name">{{ item.name }}</div>
       </div>
     </div>
@@ -136,7 +138,7 @@ onBeforeMount(() => {
 
   .no-data {
     width: 100%;
-    height: calc(100% -7vh);
+    height: calc(100% - 7vh);
     display: flex;
     flex-direction: column;
     justify-content: center;
@@ -157,11 +159,29 @@ onBeforeMount(() => {
   }
 }
 
-.iframe {
+.iframe-box {
   width: 100%;
   height: 100%;
   position: absolute;
   top: 0;
   left: 0;
+  z-index: 10;
+
+  iframe {
+    width: 100%;
+    height: 100%;
+    position: absolute;
+    top: 0;
+    left: 0;
+  }
+
+  img {
+    width: 30px;
+    height: 30px;
+    position: absolute;
+    top: 3%;
+    left: 3%;
+    z-index: 11;
+  }
 }
 </style>

+ 17 - 13
src/views/EnterNingguo/dynamic-detail.vue

@@ -1,12 +1,12 @@
 <script setup lang='ts'>
 import { DynamicApi } from '@/api/api/dynamic';
 import { showToast } from 'vant';
+import {baseIMGUrl} from '@/api/request.ts'
 
 
 // import { DynamicApi } from "@/api/api/dynamic/index";
 // import { showToast } from "vant";
 
-const router = useRouter()
 const route = useRoute()
 
 
@@ -46,6 +46,10 @@ const getDetailById = async () => {
   }
 }
 
+const formatrtf = computed(() => {
+  return  dynamicDetail.value.rtf.replace(/<img /g, '<img style="width: 100%;" ');
+})
+
 onBeforeMount(async () => {
   getDetailById()
 })
@@ -53,17 +57,17 @@ onBeforeMount(async () => {
 
 <template>
   <div class='detail-box'>
-    <img class="themb-box" :src="dynamicDetail.thumb" alt="">
+    <img class="themb-box" :src="baseIMGUrl + dynamicDetail.thumb" alt="">
     <div class="content-box">
       <div class="title-box">{{ dynamicDetail.name }}</div>
       <div class="time-box">发布时间:{{ dynamicDetail.publishDate }}</div>
       <div class="abstract-box">{{ dynamicDetail.description }}</div>
-      <div class="mainbody-box" v-html="dynamicDetail.rtf"></div>
+      <div class="mainbody-box" v-html="formatrtf"></div>
       <div class="video-box">
-        <video :src="item" controls v-for="(item, index) in videos" :key="index"></video>
+        <video :src="baseIMGUrl + item.filePath" controls v-for="(item, index) in videos" :key="index"></video>
       </div>
     </div>
-    <img class="back-icon" @click="() => { router.back() }" src="@/assets/images/back.png" alt="">
+    <!-- <img class="back-icon" @click="() => { router.back() }" src="@/assets/images/back.png" alt=""> -->
   </div>
 </template>
 
@@ -119,8 +123,7 @@ onBeforeMount(async () => {
       margin-bottom: 10px;
       padding: 0 10px;
       font-family: 'SourceHanSansCN-Medium';
-
-
+      overflow-wrap: break-word; 
     }
 
     .mainbody-box {
@@ -136,6 +139,7 @@ onBeforeMount(async () => {
 
       video {
         width: 100%;
+        height: 30vh;
         margin-bottom: 10px;
       }
 
@@ -144,11 +148,11 @@ onBeforeMount(async () => {
   }
 
 
-  .back-icon {
-    width: 40px;
-    position: fixed;
-    right: 10px;
-    bottom: 10vh;
-  }
+  // .back-icon {
+  //   width: 40px;
+  //   position: fixed;
+  //   right: 10px;
+  //   bottom: 10vh;
+  // }
 }
 </style>

+ 76 - 20
src/views/EnterNingguo/dynamic.vue

@@ -13,8 +13,10 @@ const data = ref([] as DynamicType[])
 const searchParames = ref({
   pageNum: 0,
   pageSize: 0,
-  searchKey: ''
+  searchKey: '',
+  dictId: null
 } as {
+  dictId: number | null,
   pageNum: number,
   pageSize: number,
   searchKey: string
@@ -44,15 +46,39 @@ const goDetai = (id: number) => {
   router.push({ name: 'dynamicDetail', params: { id } });
 }
 
+const getTypeList = async () => {
+  // 获取珍藏类型
+  const resType: any = await DynamicApi.getTypeList()
+  if (resType.code == 0) {
+    typeList.value = resType.data
+    typeList.value.unshift({
+      createTime: null,
+      creatorId: null,
+      creatorName: '',
+      display: null,
+      id: null,
+      name: '全部',
+      parentId: null,
+      rtf: '',
+      sort: null,
+      type: '',
+      typeKey: '',
+      updateTime: null
+    })
+    console.log(typeList.value)
+  } else {
+    showToast(resType.msg)
+  }
+
+  getList()
+}
+
+
 const getList = async () => {
+  searchParames.value.dictId = active.value == 0 ? null : typeList.value[active.value].id!
   const res: any = await DynamicApi.getDynamicList(searchParames.value)
   if (res.code == 0) {
     allData.value = res.data.records
-    const types = res.data.records.map((item: any) => {
-      return item.type
-    })
-    typeList.value = [...new Set(types)]
-    typeList.value.unshift('全部')
     data.value = allData.value
   } else {
     showToast(res.msg)
@@ -60,18 +86,11 @@ const getList = async () => {
 }
 
 watch(active, () => {
-  if (active.value == 0) {
-    data.value = allData.value
-  } else {
-    data.value = allData.value.filter((item: any) => {
-      return item.type == typeList.value[active.value]
-    })
-  }
-
+  getList()
 })
 
 onMounted(() => {
-  getList()
+  getTypeList()
 })
 
 </script>
@@ -80,11 +99,11 @@ onMounted(() => {
   <div class='dynamic'>
 
     <div class="tabs">
-      <div class="tab-item" :class="{ active: index === active }" v-for="(item, index) in typeList" :key="item"
-        @click="active = index">{{ item }}</div>
+      <div class="tab-item" :class="{ active: index === active }" v-for="(item, index) in typeList" :key="item.id"
+        @click="active = index">{{ item.name }}</div>
     </div>
 
-    <div class="tab-content">
+    <div class="tab-content" v-if="data.length > 0">
       <div class="activity-card" v-for="(item, index) in data" :key="index" @click="goDetai(item.id)">
         <img v-show="item.thumb != ''" class="thumb" :src="item.thumb" alt="">
         <div class="title">{{ item.name }}</div>
@@ -94,7 +113,12 @@ onMounted(() => {
         </div>
       </div>
     </div>
+    <div class="no-data" v-else>
+      <img src="@/assets/images/no-data.png" alt="">
+      <div class="tips">暂时没有数据 ,请试一下其他关键字</div>
+    </div>
   </div>
+
 </template>
 
 <style lang='less' scoped>
@@ -116,11 +140,15 @@ onMounted(() => {
     // height: 40px;
     white-space: nowrap;
     overflow-x: auto;
-    padding: 15px 10px 10px 0px;
+    padding: 15px 10px 5px 0px;
+    // padding-top: 10px;
+  
+    margin: 0 10px;
+    
     font-family: 'SourceHanSansCN-Regular';
 
     &::-webkit-scrollbar {
-      display: none;
+      height: 0px
       /* 或 width: 0; */
     }
 
@@ -187,6 +215,12 @@ onMounted(() => {
         font-family: 'SourceHanSansCN-Regular';
         margin-bottom: 5px;
 
+        display: -webkit-box;
+        -webkit-box-orient: vertical;
+        -webkit-line-clamp: 2;
+        line-clamp: 2;
+        overflow: hidden;
+
       }
 
       .time {
@@ -202,6 +236,28 @@ onMounted(() => {
     }
   }
 
+  .no-data {
+    width: 100%;
+    height: calc(100% - 7vh);
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    margin-top: 10%;
+
+
+    img {
+      width: 40%;
+    }
+
+    .tips {
+      color: #88866F;
+      margin-top: 10px;
+      font-family: 'SourceHanSansCN-Regular';
+    }
+
+  }
+
 
 }
 </style>

+ 3 - 3
src/views/EnterNingguo/summarize.vue

@@ -2,7 +2,7 @@
 <script setup lang='ts'>
 import { SummarizeApi } from "@/api/api/summarize/index";
 import { showToast } from "vant";
-import {baseUrl} from '@/api/request.ts'
+import {baseIMGUrl} from '@/api/request.ts'
 
 const summarize = ref({} as any)
 
@@ -32,7 +32,7 @@ onBeforeMount(async () => {
   <div class='home'>
     <div class="video-box" v-if="videos.length > 0">
       <van-swipe class="my-swipe" indicator-color="white" lazy-render>
-        <van-swipe-item v-for="(item, index) in videos" :key="index"><video :src="baseUrl + item.filePath"
+        <van-swipe-item v-for="(item, index) in videos" :key="index"><video :src="baseIMGUrl + item.filePath"
             controls></video></van-swipe-item>
       </van-swipe>
     </div>
@@ -74,7 +74,7 @@ onBeforeMount(async () => {
       video {
         width: 100%;
         height: 100%;
-        object-fit: contain;
+        object-fit: cover;
       }
     }
   }

+ 10 - 3
src/views/ExhibitionService/active-detail.vue

@@ -1,6 +1,8 @@
 <script setup lang='ts'>
 import { ActiveBookingApi } from '@/api/api/activeBooking';
 import { showToast } from 'vant';
+import {baseIMGUrl} from '@/api/request.ts'
+
 
 const route = useRoute()
 const router = useRouter()
@@ -48,6 +50,11 @@ const goBooking = () => {
   })
 }
 
+
+const formatrtf = computed(() => {
+  return  activeDetail.value.rtf.replace(/<img /g, '<img style="width: 100%;" ');
+})
+
 onBeforeMount(() => {
   getDetailById()
 })
@@ -55,13 +62,13 @@ onBeforeMount(() => {
 
 <template>
   <div class='detail-box'>
-    <img class="themb-box" :src="activeDetail.thumb" alt="">
+    <img class="themb-box" :src=" baseIMGUrl + activeDetail.thumb" alt="">
     <div class="content-box">
       <div class="title-box">{{ activeDetail.name }}</div>
       <div class="time-box">发布时间:{{ activeDetail.publishDate }}</div>
-      <div class="rtf-box" v-html="activeDetail.rtf"></div>
+      <div class="rtf-box" v-html="formatrtf"></div>
       <div class="video-box">
-        <video :src="item" controls v-for="(item, index) in videos" :key="index"></video>
+        <video :src="baseIMGUrl + item.filePath" controls v-for="(item, index) in videos" :key="index"></video>
       </div>
     </div>
     <div class="booking-btn" v-if="activeDetail.isNeed" @click="goBooking()">

+ 41 - 21
src/views/ExhibitionService/activeBooking.vue

@@ -1,5 +1,6 @@
 <script setup lang='ts'>
 import { ActiveBookingApi } from '@/api/api/activeBooking';
+import { baseIMGUrl } from '@/api/request';
 import { showToast } from 'vant';
 
 const active = ref(0)
@@ -9,8 +10,10 @@ const router = useRouter()
 const searchParames = ref({
   pageNum: 0,
   pageSize: 0,
-  searchKey: ''
+  searchKey: '',
+  dictId: null
 } as {
+  dictId: number | null,
   pageNum: number,
   pageSize: number,
   searchKey: string
@@ -32,41 +35,57 @@ export type activeType = {
   updateTime: string
 }
 
-
-const data = ref([] as activeType[])
-
 const allData = ref([] as activeType[])
 
 const typeList = ref([] as any)
 
+
+const getTypeList = async () => {
+  // 获取珍藏类型
+  const resType: any = await ActiveBookingApi.getTypeList()
+  if (resType.code == 0) {
+    typeList.value = resType.data
+    typeList.value.unshift({
+      createTime: null,
+      creatorId: null,
+      creatorName: '',
+      display: null,
+      id: null,
+      name: '全部',
+      parentId: null,
+      rtf: '',
+      sort: null,
+      type: '',
+      typeKey: '',
+      updateTime: null
+    })
+    console.log(typeList.value)
+  } else {
+    showToast(resType.msg)
+  }
+
+  getList()
+}
+
 const getList = async () => {
+  searchParames.value.dictId = active.value == 0 ? null : typeList.value[active.value].id!
   const res: any = await ActiveBookingApi.getActiveList(searchParames.value)
   if (res.code == 0) {
     allData.value = res.data.records
-    const types = res.data.records.map((item: any) => {
-      return item.type
-    })
-    typeList.value = [...new Set(types)]
-    data.value = allData.value.filter((item: any) => {
-      return item.type == typeList.value[active.value]
-    })
   } else {
     showToast(res.msg)
   }
 }
 
-
 const goDetai = (id: number) => {
   router.push({ name: 'activeDetail', params: { id } });
 }
 watch(active, () => {
-  data.value = allData.value.filter((item: any) => {
-    return item.type == typeList.value[active.value]
-  })
+  getList()
 })
 
 onMounted(() => {
-  getList()
+  getTypeList()
 })
 
 </script>
@@ -76,11 +95,11 @@ onMounted(() => {
 
     <div class="tabs">
       <div class="tab-item" :class="{ active: index === active }" v-for="(item, index) in typeList" :key="index"
-        @click="active = index">{{ item }}</div>
+        @click="active = index">{{ item.name }}</div>
     </div>
-    <div class="tab-content" v-if="data.length > 0">
-      <div class="activity-card" v-for="(item, index) in data" :key="index" @click="goDetai(item.id)">
-        <img v-show="item.thumb != ''" class="thumb" :src="item.thumb" alt="">
+    <div class="tab-content" v-if="allData.length > 0">
+      <div class="activity-card" v-for="(item, index) in allData" :key="index" @click="goDetai(item.id)">
+        <img v-show="item.thumb != ''" class="thumb" :src="baseIMGUrl + item.thumb" alt="">
         <div class="bottom-box">
           <div class="name">{{ item.name }}</div>
           <div class="income">了解详情</div>
@@ -159,6 +178,7 @@ onMounted(() => {
 
       .thumb {
         width: 100%;
+        height: 25vh;
         border-radius: 15px 15px 0 0;
       }
 
@@ -197,7 +217,7 @@ onMounted(() => {
 
   .no-data {
     width: 100%;
-    height: calc(100% -7vh);
+    height: calc(100% - 7vh);
     display: flex;
     flex-direction: column;
     justify-content: center;

+ 11 - 2
src/views/ExhibitionService/bookInputInfo.vue

@@ -1,10 +1,13 @@
 <script setup lang='ts'>
+import { sceneBookingApi } from '@/api/api/sceneBooking';
 import { useStore } from '@/stores';
+import { showToast } from 'vant';
 
 const store = useStore()
 const personList = ref([
   {
     bookDate: store.selectDate,
+    bookId:'',
     name: '',
     num: '',
     phone: '',
@@ -20,6 +23,7 @@ const deleteFu = (index: number) => {
 const addPerson = () => {
   personList.value.push({
     bookDate: store.selectDate,
+    bookId:'',
     name: '',
     num: '',
     phone: '',
@@ -28,8 +32,13 @@ const addPerson = () => {
   })
 }
 
-const submit = () => {
-
+const submit = async() => {
+  const res:any = sceneBookingApi.submitBookingAPI(personList.value)
+  if(res.code === 0){
+    showToast('预约成功')
+  }else {
+    showToast('预约失败')
+  }
 }
 
 </script>

+ 14 - 15
src/views/ExhibitionService/booked-detail.vue

@@ -1,23 +1,22 @@
 <script setup lang='ts'>
+import { sceneBookingApi } from '@/api/api/sceneBooking';
+
 
 const bookedDetail = ref({} as any)
 
-onMounted(() => {
-  bookedDetail.value = {
-    bookDate: '2024-04-16',
-    bookId: '1',
-    createTime: '2024-04-16 16:46:00',
-    creatorId: null,
-    creatorName: '',
-    id: 1,
-    name: '小明',
-    pcs: 2,
-    phone: '',
-    rtf: JSON.parse('[{"bookDate":"2024-02-01","name":"小明","num":"1111111","time":"9:00-1:00","type":"身份证"},{"bookDate":"2024-02-01","name":"小明2","num":"222222","time":"9:00-1:00","type":"社保卡"}]'),
-    status: 0,
-    time: '9:00-1:00',
-    updateTime: '2024-04-16 16:46:00'
+const route = useRoute()
+
+const getDetailById = async() => {
+  const res:any = await sceneBookingApi.getDetailByIdAPI(route.params.id)
+
+  if(res.code === 0){
+    bookedDetail.value = res.data
   }
+}
+
+onMounted(() => {
+  getDetailById()
+
 })
 </script>
 

+ 86 - 36
src/views/ExhibitionService/bookedList.vue

@@ -1,5 +1,7 @@
 <script setup lang='ts'>
+import { sceneBookingApi } from '@/api/api/sceneBooking';
 import { useStore } from '@/stores';
+import { checkLoginStatus } from '@/utils/weixin'
 
 // import { json } from 'stream/consumers';
 // import BookingTime from './BookingTime.vue'
@@ -24,48 +26,96 @@ const goBookedDetail = (id: number) => {
   })
 }
 
-// 获取用户授权
-const userAuthorization = () => {
-  window.open('https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2d3e0c33702e34a6&redirect_uri=https://houseoss.4dkankan.com/project/yuanDaDu/index.html&response_type=code&scope=snsapi_userinfo&connect_redirect=1#wechat_redirect')
+
+// 用户授权成功
+const loginOnNeed = async() => {
+  const query = new URLSearchParams(location.search)
+  const code = query.get('code')
+  if (code) {
+    let res: any = await sceneBookingApi.getCodeAPI(code);
+    if (res.code === 0) {
+      localStorage.setItem("token", res.data.token);
+      localStorage.setItem(
+        "userInfo",
+        JSON.stringify({ ...res.data.wxUser, time: Date.now() })
+      );
+    } else {
+      console.error('登录结果异常!');
+    }
+    location.href = window.location.href
+  }
+}
+
+const searchParames = ref({
+  pageNum: 0,
+  pageSize: 0,
+  searchKey: ''
+} as {
+  pageNum: number,
+  pageSize: number,
+  searchKey: string
+})
+
+const getList = async() => {
+  const res:any = await sceneBookingApi.getBookingListAPi(searchParames)
+  if(res.code === 0) {
+    bookedList.value = res.data.records
+  }
 }
 
 onMounted(() => {
+
+
   // 清除之前的预约选择记录
   store.selectDate = ''
   store.selectTime = ''
-  bookedList.value = [
-    {
-      bookDate: '2024-04-16',
-      bookId: '1',
-      createTime: '2024-04-16 16:46:00',
-      creatorId: null,
-      creatorName: '',
-      id: 1,
-      name: '小明',
-      pcs: 2,
-      phone: '',
-      rtf: JSON.parse('[{"bookDate":"2024-02-01","name":"小明","num":"1111111","time":"9:00-1:00","type":"身份证"},{"bookDate":"2024-02-01","name":"小明2","num":"222222","time":"9:00-1:00","type":"社保卡"}]'),
-      status: 0,
-      time: '9:00-1:00',
-      updateTime: '2024-04-16 16:46:00'
-    },
-    {
-      bookDate: '2024-04-16',
-      bookId: '1',
-      createTime: '2024-04-16 16:46:00',
-      creatorId: null,
-      creatorName: '',
-      id: 1,
-      name: '小明',
-      pcs: 2,
-      phone: '12333',
-      rtf: JSON.parse('[{"bookDate":"2024-02-01","name":"小明","num":"1111111","time":"9:00-1:00","type":"身份证"},{"bookDate":"2024-02-01","name":"小明2","num":"222222","time":"9:00-1:00","type":"社保卡"}]'),
-      status: 1,
-      time: '9:00-1:00',
-      updateTime: '2024-04-16 16:46:00'
-    },
-
-  ]
+
+  loginOnNeed()
+
+  const loginStatus = checkLoginStatus()
+  if (loginStatus) {
+    // 处理我的预约数据
+    getList()
+    
+  } else {
+    // 发起我的授权
+    // getUserCode(`${baseIMGUrl.replace(/^api/, '')}booking`)
+  }
+
+
+  // bookedList.value = [
+  //   {
+  //     bookDate: '2024-04-16',
+  //     bookId: '1',
+  //     createTime: '2024-04-16 16:46:00',
+  //     creatorId: null,
+  //     creatorName: '',
+  //     id: 1,
+  //     name: '小明',
+  //     pcs: 2,
+  //     phone: '',
+  //     rtf: JSON.parse('[{"bookDate":"2024-02-01","name":"小明","num":"1111111","time":"9:00-1:00","type":"身份证"},{"bookDate":"2024-02-01","name":"小明2","num":"222222","time":"9:00-1:00","type":"社保卡"}]'),
+  //     status: 0,
+  //     time: '9:00-1:00',
+  //     updateTime: '2024-04-16 16:46:00'
+  //   },
+  //   {
+  //     bookDate: '2024-04-16',
+  //     bookId: '1',
+  //     createTime: '2024-04-16 16:46:00',
+  //     creatorId: null,
+  //     creatorName: '',
+  //     id: 1,
+  //     name: '小明',
+  //     pcs: 2,
+  //     phone: '12333',
+  //     rtf: JSON.parse('[{"bookDate":"2024-02-01","name":"小明","num":"1111111","time":"9:00-1:00","type":"身份证"},{"bookDate":"2024-02-01","name":"小明2","num":"222222","time":"9:00-1:00","type":"社保卡"}]'),
+  //     status: 1,
+  //     time: '9:00-1:00',
+  //     updateTime: '2024-04-16 16:46:00'
+  //   },
+
+  // ]
 
   // userAuthorization()
 

+ 12 - 5
src/views/SmartTour/exhibition-detail.vue

@@ -1,6 +1,8 @@
 <script setup lang='ts'>
 import { ExhibitionApi } from '@/api/api/exhibition';
 import { showToast } from 'vant';
+import { baseIMGUrl } from '@/api/request.ts'
+
 
 
 const route = useRoute()
@@ -41,6 +43,10 @@ const getDetailById = async () => {
   }
 }
 
+const formatrtf = computed(() => {
+  return exhibitionDetail.value.rtf.replace(/<img /g, '<img style="width: 100%;" ');
+})
+
 onBeforeMount(() => {
   getDetailById()
 })
@@ -49,18 +55,19 @@ onBeforeMount(() => {
 
 <template>
   <div class='detail-box'>
-    <img class="thumb-box" :src="exhibitionDetail.thumb" alt="">
+    <img class="thumb-box" :src="baseIMGUrl + exhibitionDetail.thumb" alt="">
     <div class="content-box">
       <div class="name-box">{{ exhibitionDetail.name }}</div>
       <div class="time-box">
         <div class="location-box"> {{ exhibitionDetail.location }}</div>
         <div>{{ exhibitionDetail.dateStart }} - {{ exhibitionDetail.dateEnd }}</div>
       </div>
-      <div class="rtf-box" v-html="exhibitionDetail.rtf"></div>
-      <video :src="item" v-for="(item, index) in exhibitionDetail.videos" :key="index" controls></video>
+      <div class="rtf-box" v-html="formatrtf"></div>
+      <video :src="baseIMGUrl + item.filePath" v-for="(item, index) in exhibitionDetail.videos" :key="index"
+        controls></video>
     </div>
 
-    <div class="online-box" @click="() => { isShowScene = true }">体验线上展厅</div>
+    <div class="online-box" @click="() => { isShowScene = true }" v-show="exhibitionDetail.link != ''">体验线上展厅</div>
     <div v-if="isShowScene" class="iframe-box">
       <img src="@/assets/images/sceneBack.png" @click="isShowScene = false" alt="">
       <iframe :src="exhibitionDetail.link" frameborder="0"></iframe>
@@ -93,7 +100,7 @@ onBeforeMount(() => {
     position: relative;
     z-index: 2;
     background: #F7F3E8;
-    padding: 25px 20px;
+    padding: 25px 20px 25% 20px;
     box-sizing: border-box;
 
 

+ 2 - 1
src/views/SmartTour/exhibition.vue

@@ -88,6 +88,7 @@ const getList = async () => {
       data.value.sort((a: any, b: any) => {
         const dateA = new Date(a.dateEnd);
         const dateB = new Date(b.dateEnd);
+        // @ts-ignore
         return dateB - dateA
       })
     }
@@ -223,7 +224,7 @@ onBeforeMount(() => {
 
     .no-data {
       width: 100%;
-      height: calc(100% -7vh);
+      height: calc(100% - 7vh);
       display: flex;
       flex-direction: column;
       justify-content: center;

+ 16 - 15
src/views/SmartTour/treasure-detail.vue

@@ -3,6 +3,8 @@ import playIcon from '@/assets/images/play.png';
 import pauseIcon from '@/assets/images/pause.png';
 import { showToast } from 'vant';
 import { TreasureApi } from '@/api/api/treasure';
+import { baseIMGUrl } from '@/api/request.ts'
+
 
 
 // import { DynamicApi } from "@/api/api/dynamic/index";
@@ -120,9 +122,9 @@ const getDetailById = async () => {
     })[0]
 
     //  模型链接
-    dynamicDetail.value.files.moduleUrl = res.data.file.filter((item: any) => {
-      return  item.type === 'model'
-    })[0]
+    dynamicDetail.value.files.moduleUrl = res.data.entity.modelLink
+
+    console.log('模型链接是',res.data.entity.modelLink,dynamicDetail.value.files.moduleUrl)
 
     initShowState()
 
@@ -132,10 +134,7 @@ const getDetailById = async () => {
   }
 }
 
-onBeforeMount(async () => {
-  getDetailById()
-
-})
+getDetailById()
 </script>
 
 <template>
@@ -146,13 +145,13 @@ onBeforeMount(async () => {
         src="@/assets/images/left.png" alt="">
       <img @click="() => { curMediaIndex++ }" v-show="curMediaIndex != curMediaList.length - 1"
         class="left-icon right-icon" src="@/assets/images/right.png" alt="">
-      <img v-if="curState === 'images'" :src="curMediaList[curMediaIndex]" alt="">
-      <video v-if="curState === 'videos'" :src="curMediaList[curMediaIndex]" controls></video>
-      <iframe v-if="curState === 'module'" :src="curMediaList[curMediaIndex]" frameborder="0"></iframe>
+      <img v-if="curState === 'images'" :src="baseIMGUrl + curMediaList[curMediaIndex].filePath" alt="">
+      <video v-if="curState === 'videos'" :src="baseIMGUrl + curMediaList[curMediaIndex].filePath" controls></video>
+      <iframe v-if="curState === 'module'" :src="dynamicDetail.files.moduleUrl" frameborder="0"></iframe>
 
-      <div class="option-box" >
-        <div v-if="dynamicDetail.files.moduleUrl" @click="initModule()"
-          :class="{ active: curState === 'module' }">模型</div>
+      <div class="option-box">
+        <div v-if="dynamicDetail.files.moduleUrl" @click="initModule()" :class="{ active: curState === 'module' }">模型
+        </div>
         <div v-if="dynamicDetail.files.images.length != 0" @click="initImages()"
           :class="{ active: curState === 'images' }">图片<span v-show="curState === 'images'">{{
             curMediaIndex + 1 + '/' + curMediaList.length
@@ -163,7 +162,7 @@ onBeforeMount(async () => {
           }}</span></div>
       </div>
     </div>
-    <div class="info-box" :style="{marginTop:curState != null ? '' :'0px'}">
+    <div class="info-box" :style="{ marginTop: curState != null ? '' : '0px' }">
       <div class="title">{{ dynamicDetail.name }}</div>
       <!-- <div class="age">{{ dynamicDetail.age + '·' + dynamicDetail.texture }}</div> -->
       <div class="age">
@@ -176,7 +175,7 @@ onBeforeMount(async () => {
       <div class="info">{{ dynamicDetail.description }}</div>
     </div>
 
-    <audio id="audioBg" :src="audioBgUrl" style="display: none;"></audio>
+    <audio v-if="audioBgUrl" id="audioBg" :src="baseIMGUrl + audioBgUrl.filePath" style="display: none;"></audio>
     <img v-if="audioBgUrl" class="playing-icon" :src="audioPlaying ? pauseIcon : playIcon" alt=""
       @click="audioChange()">
     <!-- <img class="back-icon" @click="() => { router.back() }" src="@/assets/images/back.png" alt=""> -->
@@ -220,6 +219,8 @@ onBeforeMount(async () => {
     video {
       width: 100%;
       height: 100%;
+      object-fit: cover;
+
     }
 
     iframe {

+ 4 - 4
src/views/SmartTour/treasure.vue

@@ -40,15 +40,15 @@ export type TreasureType = {
 
 
 const searchParames = ref({
+  dictId: null,
   pageNum: 0,
   pageSize: 0,
   searchKey: '',
-  type: ''
 } as {
+  dictId: number | null,
   pageNum: number,
   pageSize: number,
   searchKey: string,
-  type: string | null
 })
 
 const router = useRouter()
@@ -66,7 +66,7 @@ const goDetai = (id: number) => {
 
 
 const getList = async () => {
-  searchParames.value.type = activeIndex.value == 0 ? '' : typeList.value[activeIndex.value].name
+  searchParames.value.dictId = activeIndex.value == 0 ? null : typeList.value[activeIndex.value].id!
   // 获取指定类型的列表
   const res: any = await TreasureApi.getTreasureList(searchParames.value)
   if (res.code == 0) {
@@ -208,7 +208,7 @@ onBeforeMount(() => {
 
     .no-data {
       width: 100%;
-      height: calc(100% -7vh);
+      height: calc(100% - 7vh);
       display: flex;
       flex-direction: column;
       justify-content: center;

+ 8 - 3
src/views/VolunteerHome/detail.vue

@@ -3,6 +3,8 @@
 import { VolunteerApi } from '@/api/api/volunteerHome';
 import { showToast } from 'vant';
 // import volunteerType from './home.vue'
+import { baseIMGUrl } from '@/api/request.ts'
+
 
 const route = useRoute()
 // const router = useRouter()
@@ -38,6 +40,9 @@ const getDetailById = async () => {
   }
 }
 
+const formatrtf = computed(() => {
+  return  activeDetail.value.rtf.replace(/<img /g, '<img style="width: 100%;" ');
+})
 
 onBeforeMount(() => {
   getDetailById()
@@ -46,13 +51,13 @@ onBeforeMount(() => {
 
 <template>
   <div class='detail-box'>
-    <img class="thumb-box" :src="activeDetail.thumb" alt="">
+    <img class="thumb-box" :src="baseIMGUrl + activeDetail.thumb" alt="">
     <div class="content-box">
       <div class="name-box">{{ activeDetail.name }}</div>
-      <div class="mainbody-box" v-html="activeDetail.rtf"></div>
+      <div class="mainbody-box" v-html="formatrtf"></div>
       <div class="time-box">发布时间:{{ activeDetail.publishDate }}</div>
       <div class="video-box">
-        <video :src="item" controls v-for="(item, index) in videos" :key="index"></video>
+        <video :src="baseIMGUrl + item.filePath" controls v-for="(item, index) in videos" :key="index"></video>
       </div>
     </div>
     <!-- <img class="back-icon" @click="() => { router.back() }" src="@/assets/images/back.png" alt=""> -->

+ 4 - 2
src/views/VolunteerHome/home.vue

@@ -1,6 +1,7 @@
 <!-- eslint-disable vue/multi-word-component-names -->
 <script setup lang='ts'>
 import { VolunteerApi } from '@/api/api/volunteerHome';
+import { baseIMGUrl } from '@/api/request';
 import { showToast } from 'vant';
 
 const active = ref(0)
@@ -77,7 +78,7 @@ onBeforeMount(() => {
 
     <div class="tab-content" v-if="data.length > 0">
       <div class="activity-card" v-for="(item, index) in data" :key="index" @click="goDetai(item.id)">
-        <img v-show="item.thumb != ''" class="thumb" :src="item.thumb" alt="">
+        <img v-show="item.thumb != ''" class="thumb" :src="baseIMGUrl + item.thumb" alt="">
         <div class="bottom-box">
           <div class="name">{{ item.name }}</div>
           <div class="income">了解详情</div>
@@ -152,6 +153,7 @@ onBeforeMount(() => {
 
       .thumb {
         width: 100%;
+        height: 25vh;
         border-radius: 15px 15px 0 0;
       }
 
@@ -189,7 +191,7 @@ onBeforeMount(() => {
 
   .no-data {
     width: 100%;
-    height: calc(100% -7vh);
+    height: calc(100% - 7vh);
     display: flex;
     flex-direction: column;
     justify-content: center;