Przeglądaj źródła

登录bug修复、预约的提交

任一存 2 lat temu
rodzic
commit
ea42b051f6

+ 1 - 1
yfyc/package.json

@@ -1,6 +1,6 @@
 {
   "name": "yfyc",
-  "version": "0.1.0",
+  "version": "0.1.1128.2007",
   "private": true,
   "scripts": {
     "serve": "vue-cli-service serve",

+ 6 - 0
yfyc/public/index.html

@@ -11,10 +11,16 @@
     <title>一房一册</title>
   </head>
   <body>
+    <!-- <script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script> -->
+
     <noscript>
       <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
     </noscript>
     <div id="app"></div>
     <!-- built files will be auto injected -->
+
+    <!-- <script>
+      new VConsole()
+    </script> -->
   </body>
 </html>

+ 10 - 0
yfyc/src/api/interact.js

@@ -60,4 +60,14 @@ export const getInfoAPI = (id) => {
   return axios({
     url: `show/share/detail/${id}`,
   })
+}
+
+// 提交预约
+export function submitBooking(data) {
+  return axios({
+    method: 'post',
+    url: 'http://192.168.20.55:8037/api/cms/book/save',
+    // url: 'api/cms/book/save',
+    data,
+  })
 }

+ 1 - 0
yfyc/src/components/BookingSuccess.vue

@@ -5,6 +5,7 @@
       <div class="tip-1">预约成功</div>
       <div class="time-summary">
         <span class="key">预约时间:</span>
+        <span class="value">{{`${year}-${month}-${day} ${tiem}`}}</span>
         <span class="value">{{`${bookingYear}-${bookingMonth}-${bookingDay} ${bookingHour}:${bookingMinute}:${bookingSecond}`}}</span>
       </div>
       <div class="line">

+ 2 - 1
yfyc/src/utils/request.js

@@ -34,8 +34,9 @@ service.interceptors.response.use(function (response) {
   // console.log('触发相应拦截器', response)
   // 对响应数据做点什么--response就是发送每个请求的返回值
   if (response.data.code === 5001 || response.data.code === 5002) {
-    Toast.fail('登录失效!')
+    Toast.fail('登录失效')
     localStorage.removeItem('YFYC_token')
+    localStorage.removeItem('YFYC_userInfo')
   }
   if (axajInd === 0) document.querySelector('.loadingApp').style.display = 'none'
   return response.data

+ 32 - 22
yfyc/src/views/Serve/Booking.vue

@@ -98,6 +98,7 @@
 <script>
 import Swiper from "../../assets/libs/swiper.js";
 import BookingSuccess from "@/components/BookingSuccess.vue";
+import { submitBooking } from "@/api/interact.js";
 
 const weekDayList = [
   '周一',
@@ -115,28 +116,25 @@ export default {
   },
   data() {
     return {
-      bookingYear: 'null',
-      bookingMonth: 'null',
-      bookingDay: 'null',
-      bookingHour: 'null',
-      bookingMinute: 'null',
-      bookingSecond: 'null',
+      attractionId: 1,
+      bookingYear: null,
+      bookingMonth: null,
+      bookingDay: null,
+      bookingHour: null,
+      bookingMinute: null,
+      bookingSecond: null,
       year: null,
       month: null,
       day: null,
       weekDay: null,
       timeList: [
         {
-          time: '9:00-12:00',
-          remain: 0,
+          time: '8:30-12:00',
+          remain: 100,
         },
         {
-          time: '12:00-15:00',
-          remain: 120,
-        },
-        {
-          time: '15:00-18:00',
-          remain: 80,
+          time: '12:00-18:30',
+          remain: 100,
         },
       ],
       timeIdx: null,
@@ -186,14 +184,26 @@ export default {
       this.timeIdx = index
     },
     onClickSubmit() {
-      const now = new Date()
-      this.bookingYear = now.getFullYear()
-      this.bookingMonth = (now.getMonth() + 1).toString().padStart(2, '0')
-      this.bookingDay = now.getDate().toString().padStart(2, '0')
-      this.bookingHour = (now.getHours()).toString().padStart(2, '0')
-      this.bookingMinute = (now.getMinutes()).toString().padStart(2, '0')
-      this.bookingSecond = (now.getSeconds()).toString().padStart(2, '0')
-      this.isShowSuccess = true
+      submitBooking({
+        "buildId": this.attractionId,
+        "day": `${this.year}-${this.month}-${this.day}`,
+        "identity": this.idCard,
+        "name": this.name,
+        "num": this.number,
+        "phone": this.phone,
+        "timeStr": this.timeIdx === 0 ? 'AM' : this.timeIdx === 1 ? 'PM' : undefined,
+      }).then((res) => {
+        if (res.data.code === 0) {
+          const now = new Date()
+          this.bookingYear = now.getFullYear()
+          this.bookingMonth = (now.getMonth() + 1).toString().padStart(2, '0')
+          this.bookingDay = now.getDate().toString().padStart(2, '0')
+          this.bookingHour = (now.getHours()).toString().padStart(2, '0')
+          this.bookingMinute = (now.getMinutes()).toString().padStart(2, '0')
+          this.bookingSecond = (now.getSeconds()).toString().padStart(2, '0')
+          this.isShowSuccess = true
+        }
+      })
     },
   }
 }

+ 1 - 1
yfyc/src/views/Serve/index.vue

@@ -257,7 +257,7 @@ methods: {
     if (loginStatus) {
       this.$router.push({name: 'Booking'})
     } else {
-      globalUtils.getUserCode('https://yifangyice.4dage.com/web/index.html#/booking')
+      globalUtils.getUserCode('https://yifangyice.4dage.com/web/index.html#/layout/serve/booking')
     }
   },
   onClickPathItem(id) {