Переглянути джерело

更新使用dayjs

tags/AL.0.8.0_20240113_base
yuan 1 рік тому
джерело
коміт
cdd3c09355
6 змінених файлів з 28 додано та 43 видалено
  1. +6
    -9
      package-lock.json
  2. +1
    -1
      package.json
  3. +1
    -3
      src/components/notification/index.vue
  4. +1
    -1
      src/pages/index/index.config.ts
  5. +13
    -22
      src/pages/index/index.vue
  6. +6
    -7
      src/stores/pass-records.ts

+ 6
- 9
package-lock.json Переглянути файл

@@ -26,9 +26,9 @@
"@tarojs/shared": "3.6.20",
"@tarojs/taro": "3.6.20",
"chinese2pinyin": "^1.0.1",
"dayjs": "^1.11.10",
"graphql": "^16.8.1",
"graphql-tag": "^2.12.6",
"moment": "^2.29.4",
"pinia": "^2.1.7",
"taro-icons": "^0.4.0",
"tarojs-router-next": "^3.4.0",
@@ -7951,6 +7951,11 @@
"node": ">=14"
}
},
"node_modules/dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -13825,14 +13830,6 @@
"resolved": "https://registry.npmjs.org/mobile-detect/-/mobile-detect-1.4.5.tgz",
"integrity": "sha512-yc0LhH6tItlvfLBugVUEtgawwFU2sIe+cSdmRJJCTMZ5GEJyLxNyC/NIOAOGk67Fa8GNpOttO3Xz/1bHpXFD/g=="
},
"node_modules/moment": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
"engines": {
"node": "*"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",


+ 1
- 1
package.json Переглянути файл

@@ -53,9 +53,9 @@
"@tarojs/shared": "3.6.20",
"@tarojs/taro": "3.6.20",
"chinese2pinyin": "^1.0.1",
"dayjs": "^1.11.10",
"graphql": "^16.8.1",
"graphql-tag": "^2.12.6",
"moment": "^2.29.4",
"pinia": "^2.1.7",
"taro-icons": "^0.4.0",
"tarojs-router-next": "^3.4.0",


+ 1
- 3
src/components/notification/index.vue Переглянути файл

@@ -9,10 +9,8 @@ import { BjxHelper } from "../../utils";
const props = defineProps(['item'])
const item = props.item.passRecords[0]
const otherItems = props.item.passRecords.slice(1)
console.log(item.userName, otherItems.length , otherItems)
// console.log(item.userName, otherItems.length , otherItems)
let lastName = BjxHelper.getBJXFirstChar(item.userName)
// let isVIP = props.isVip
// let todayPassJsonObject = JSON.parse(props.todayPassTime)

</script>



+ 1
- 1
src/pages/index/index.config.ts Переглянути файл

@@ -2,5 +2,5 @@ export default definePageConfig({
navigationBarTitleText: '',
navigationStyle: 'custom',
disableScroll: true,
usingComponents: {}
usingComponents: {},
})

+ 13
- 22
src/pages/index/index.vue Переглянути файл

@@ -1,15 +1,9 @@
<script setup lang="ts">
import { reactive } from 'vue'
import { View, Text } from '@tarojs/components'
import { View } from '@tarojs/components'

import './index.scss'
import Counter from '../../components/Counter.vue'
import { ref } from 'vue'
import {useDidShow, useLoad} from "@tarojs/taro";
import { Date } from '@nutui/icons-vue-taro';
import Notification from "../../components/notification";
import {weappAuth} from "../../utils";
import {useContactsStore} from "../../stores/contacts";
import {GroupedPassRecords, usePassRecordsStore} from "../../stores/pass-records";

const state = reactive<{
@@ -19,7 +13,7 @@ const state = reactive<{
}>({
isPageDataLoading: true,
isAuthError: false,
groupedPassRecords: []
groupedPassRecords: [],
})
const passRecords = usePassRecordsStore()

@@ -52,6 +46,16 @@ function init() {
const onAuthErrorRefresh = () => {
init()
}
// const onPullDownRefresh = () => {
// console.log("onPullDownRefresh")
// state.isRefresherTriggered = false
// }
function onPullDownRefresh (e) {
console.log("onPullDownRefresh", e)
// state.isRefresherTriggered = false
}


//
//
// const show = ref(false);
@@ -82,7 +86,6 @@ const onAuthErrorRefresh = () => {


<template>
<!-- <view class="h-25 bg-danger">22222222</view>-->
<view class="h-100 d-flex flex-column">
<BackgroundBasic/>
<NutNavbar title=""></NutNavbar>
@@ -107,20 +110,8 @@ const onAuthErrorRefresh = () => {
</View>
<View class="scroll 100vh" v-else>
<view class="scroll 100vh" v-if="!state.isPageDataLoading">
<Scroll-View :scroll-y="true">
<Scroll-View style="height: 100vh" :scrollY="true">
<Notification v-for="item in state.groupedPassRecords" :item="item"/>
<!-- <Notification name="王远" company="joydata科技" is-vip="true" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='[]'/>-->
<!-- <Notification name="华雨" company="joydata科技" is-vip="false" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='["22:22:21"]'/>-->
<!-- <Notification name="邸为荣" company="" is-vip="false" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='["22:22:21","22:22:20"]'/>-->

<!-- <Notification name="邸为荣" company="" is-vip="false" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='["22:22:21","22:22:20"]'/>-->
<!-- <Notification name="邸为荣" company="" is-vip="false" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='["22:22:21","22:22:20"]'/>-->
<!-- <Notification name="邸为荣" company="" is-vip="false" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='["22:22:21","22:22:20"]'/>-->


<!-- <Notification name="邸为荣" company="" is-vip="false" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='["22:22:21","22:22:20"]'/>-->
<!-- <Notification name="邸为荣" company="" is-vip="false" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='["22:22:21","22:22:20"]'/>-->
<!-- <Notification name="邸为荣" company="" is-vip="false" pass-date="2023-12-25" pass-time="22:22:22" today-pass-time='["22:22:21","22:22:20"]'/>-->

<view class="container pt-5 pb-3">
<view class="row">


+ 6
- 7
src/stores/pass-records.ts Переглянути файл

@@ -3,8 +3,7 @@ import { defineStore } from 'pinia'
import {GQLRequest, PinyinHelper, Session} from "../utils";
import {gql} from "graphql-tag";
import {ref, Ref, UnwrapRef} from "vue";
import Taro from "@tarojs/taro";
import moment from "moment";
import dayjs from "dayjs";

export interface PassRecords {
key: string
@@ -68,8 +67,8 @@ export const usePassRecordsStore = defineStore('pass-records', () => {
function loadPassRecordsFromServer () {
return new Promise((resolve, reject) => {
const items: PassRecords[] = []
const startDate = moment().subtract(30, "days" ).format("YYYY-MM-DD")
const endDate = moment().add(1, "days").format("YYYY-MM-DD")
const startDate = dayjs().subtract(30, "days" ).format("YYYY-MM-DD")
const endDate = dayjs().add(1, "days").format("YYYY-MM-DD")
console.log(startDate, endDate)
return GQLRequest.query(GQL_QUERY_30_DAYS_PASS_RECORDS, {startDate, endDate})
.then(result => {
@@ -82,7 +81,7 @@ export const usePassRecordsStore = defineStore('pass-records', () => {
for (let item of result.data[groupName]) {
// console.log(item)
items.push({
key: moment(item.recognizedTime, "YYYY-MM-DDTHH:mm:ss").format("YYYY-MM-DD")+item.userId,
key: dayjs(item.recognizedTime, "YYYY-MM-DDTHH:mm:ss").format("YYYY-MM-DD")+item.userId,
id: item.id,
userName: item.userName,
userId: item.userId,
@@ -93,8 +92,8 @@ export const usePassRecordsStore = defineStore('pass-records', () => {
company: item.visitor ? item.visitor.visitorCompany : "",
isVIP: item.visitor ? item.visitor.isVip: false,
isBlock: item.visitor ? item.visitor.isBlock : false,
date: moment(item.recognizedTime, "YYYY-MM-DDTHH:mm:ss").format("YYYY-MM-DD"),
time: moment(item.recognizedTime, "YYYY-MM-DDTHH:mm:ss").format("HH:mm:ss"),
date: dayjs(item.recognizedTime, "YYYY-MM-DDTHH:mm:ss").format("YYYY-MM-DD"),
time: dayjs(item.recognizedTime, "YYYY-MM-DDTHH:mm:ss").format("HH:mm:ss"),
} as PassRecords)
}
}


Завантаження…
Відмінити
Зберегти