|
@@ -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()
|
|
|
|