Sfoglia il codice sorgente

更新使用dayjs

tags/AL.0.8.0_20240113_base
yuan 1 anno fa
parent
commit
cdd3c09355
6 ha cambiato i file con 28 aggiunte e 43 eliminazioni
  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 Vedi File

@@ -26,9 +26,9 @@
"@tarojs/shared": "3.6.20", "@tarojs/shared": "3.6.20",
"@tarojs/taro": "3.6.20", "@tarojs/taro": "3.6.20",
"chinese2pinyin": "^1.0.1", "chinese2pinyin": "^1.0.1",
"dayjs": "^1.11.10",
"graphql": "^16.8.1", "graphql": "^16.8.1",
"graphql-tag": "^2.12.6", "graphql-tag": "^2.12.6",
"moment": "^2.29.4",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"taro-icons": "^0.4.0", "taro-icons": "^0.4.0",
"tarojs-router-next": "^3.4.0", "tarojs-router-next": "^3.4.0",
@@ -7951,6 +7951,11 @@
"node": ">=14" "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": { "node_modules/debug": {
"version": "4.3.4", "version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "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", "resolved": "https://registry.npmjs.org/mobile-detect/-/mobile-detect-1.4.5.tgz",
"integrity": "sha512-yc0LhH6tItlvfLBugVUEtgawwFU2sIe+cSdmRJJCTMZ5GEJyLxNyC/NIOAOGk67Fa8GNpOttO3Xz/1bHpXFD/g==" "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": { "node_modules/ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",


+ 1
- 1
package.json Vedi File

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


+ 1
- 3
src/components/notification/index.vue Vedi File

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


</script> </script>




+ 1
- 1
src/pages/index/index.config.ts Vedi File

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

+ 13
- 22
src/pages/index/index.vue Vedi File

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


import './index.scss' 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 {weappAuth} from "../../utils";
import {useContactsStore} from "../../stores/contacts";
import {GroupedPassRecords, usePassRecordsStore} from "../../stores/pass-records"; import {GroupedPassRecords, usePassRecordsStore} from "../../stores/pass-records";


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


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


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




<template> <template>
<!-- <view class="h-25 bg-danger">22222222</view>-->
<view class="h-100 d-flex flex-column"> <view class="h-100 d-flex flex-column">
<BackgroundBasic/> <BackgroundBasic/>
<NutNavbar title=""></NutNavbar> <NutNavbar title=""></NutNavbar>
@@ -107,20 +110,8 @@ const onAuthErrorRefresh = () => {
</View> </View>
<View class="scroll 100vh" v-else> <View class="scroll 100vh" v-else>
<view class="scroll 100vh" v-if="!state.isPageDataLoading"> <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 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="container pt-5 pb-3">
<view class="row"> <view class="row">


+ 6
- 7
src/stores/pass-records.ts Vedi File

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


export interface PassRecords { export interface PassRecords {
key: string key: string
@@ -68,8 +67,8 @@ export const usePassRecordsStore = defineStore('pass-records', () => {
function loadPassRecordsFromServer () { function loadPassRecordsFromServer () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const items: PassRecords[] = [] 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) console.log(startDate, endDate)
return GQLRequest.query(GQL_QUERY_30_DAYS_PASS_RECORDS, {startDate, endDate}) return GQLRequest.query(GQL_QUERY_30_DAYS_PASS_RECORDS, {startDate, endDate})
.then(result => { .then(result => {
@@ -82,7 +81,7 @@ export const usePassRecordsStore = defineStore('pass-records', () => {
for (let item of result.data[groupName]) { for (let item of result.data[groupName]) {
// console.log(item) // console.log(item)
items.push({ 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, id: item.id,
userName: item.userName, userName: item.userName,
userId: item.userId, userId: item.userId,
@@ -93,8 +92,8 @@ export const usePassRecordsStore = defineStore('pass-records', () => {
company: item.visitor ? item.visitor.visitorCompany : "", company: item.visitor ? item.visitor.visitorCompany : "",
isVIP: item.visitor ? item.visitor.isVip: false, isVIP: item.visitor ? item.visitor.isVip: false,
isBlock: item.visitor ? item.visitor.isBlock : 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) } as PassRecords)
} }
} }


Caricamento…
Annulla
Salva