Procházet zdrojové kódy

feat:增加封装的微信登录接口

aamin před 1 rokem
rodič
revize
f39e8a027d

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

@@ -1,5 +1,6 @@
 import axiosInstance from '@/api/request'
 export const sceneBookingApi = {
   getDisableDateAPi: () => axiosInstance.get(''),
-  getBookingTimeAPI: (date:string) => axiosInstance.get(`show/book/config?date=${date}`)
+  getBookingTimeAPI: (date:string) => axiosInstance.get(`show/book/config?date=${date}`),
+  getCodeAPI:(code:any) => axiosInstance.get(`wx/wxLogin/${code}`)
 }

+ 26 - 0
src/utils/weixin.ts

@@ -0,0 +1,26 @@
+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");
+  if (userInfo) {
+    const nowTime = Date.now();
+    const data = JSON.parse(userInfo);
+    // 超过了6个小时
+    if (nowTime - data.time >= 1000 * 60 * 60 * 6) {
+      return false
+    } else {
+      return true
+    }
+  } else {
+    return false
+  }
+}

+ 2 - 1
src/views/ExhibitionService/BookingTime.vue

@@ -227,12 +227,13 @@ onBeforeMount(() => {
 
 .online-box {
   width: 80%;
+  max-width: 400px;
   height: 60px;
   border-radius: 50px;
   background: url(@/assets/images/onlineBg.png);
   background-size: 100% 100%;
   color: #F1E9D4;
-  position: absolute;
+  position: fixed;
   left: 50%;
   transform: translateX(-50%);
   bottom: 3vh;

+ 2 - 1
src/views/ExhibitionService/active-detail.vue

@@ -30,7 +30,7 @@ const getDetailById = async () => {
   if (res.code == 0) {
     activeDetail.value = res.data.entity
 
-    videos.value = res.data.entity.filter((item: any) => {
+    videos.value = res.data.file.filter((item: any) => {
       return item.filePath.includes('mp4')
     })
   } else {
@@ -148,6 +148,7 @@ onBeforeMount(() => {
 
   .booking-btn {
     width: 80%;
+    max-width: 400px;
     height: 60px;
     border-radius: 50px;
     background: url(@/assets/images/onlineBg.png);

+ 1 - 0
src/views/ExhibitionService/active-info.vue

@@ -199,6 +199,7 @@ const submit = async () => {
     position: fixed;
     bottom: 0;
     width: calc(100% - 40px);
+    max-width: calc(500px - 40px);
 
     .tips {
       color: #88866F;

+ 2 - 1
src/views/ExhibitionService/bookedList.vue

@@ -181,12 +181,13 @@ onMounted(() => {
 
   .online-box {
     width: 80%;
+    max-width: 400px;
     height: 60px;
     border-radius: 50px;
     background: url(@/assets/images/onlineBg.png);
     background-size: 100% 100%;
     color: #F1E9D4;
-    position: absolute;
+    position: fixed;
     left: 50%;
     transform: translateX(-50%);
     bottom: 3vh;

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

@@ -135,12 +135,13 @@ onBeforeMount(() => {
 
   .online-box {
     width: 80%;
+    max-width: 400px;
     height: 60px;
     border-radius: 50px;
     background: url(@/assets/images/onlineBg.png);
     background-size: 100% 100%;
     color: #F1E9D4;
-    position: absolute;
+    position: fixed;
     left: 50%;
     transform: translateX(-50%);
     bottom: 3vh;

+ 1 - 1
src/views/VolunteerHome/detail.vue

@@ -2,7 +2,7 @@
 <script setup lang='ts'>
 import { VolunteerApi } from '@/api/api/volunteerHome';
 import { showToast } from 'vant';
-import volunteerType from './home.vue'
+// import volunteerType from './home.vue'
 
 const route = useRoute()
 // const router = useRouter()

+ 1 - 0
src/views/VolunteerHome/home.vue

@@ -211,6 +211,7 @@ onBeforeMount(() => {
 
   .apply-btn {
     width: 80%;
+    max-width: 400px;
     height: 60px;
     border-radius: 50px;
     background: url(@/assets/images/onlineBg.png);