Your Name 3 yıl önce
ebeveyn
işleme
83cc0f70de

+ 1
- 1
config/dev.js Dosyayı Görüntüle

@@ -3,7 +3,7 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"http://192.168.89.147:9000"'
6
+    HOST: '"http://127.0.0.1:9000"'
7 7
   },
8 8
   mini: {},
9 9
   h5: {}

+ 2
- 0
config/index.js Dosyayı Görüntüle

@@ -18,6 +18,8 @@ const config = {
18 18
     '@/assets': path.resolve(__dirname, '..', 'src/assets'),
19 19
     '@/components': path.resolve(__dirname, '..', 'src/components'),
20 20
     '@/utils': path.resolve(__dirname, '..', 'src/utils'),
21
+    '@/store': path.resolve(__dirname, '..', 'src/store'),
22
+    '@/services': path.resolve(__dirname, '..', 'src/services'),
21 23
   },
22 24
   copy: {
23 25
     patterns: [

+ 0
- 16263
package-lock.json
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 22
- 0
src/components/Divider/index.jsx Dosyayı Görüntüle

@@ -0,0 +1,22 @@
1
+import { View } from '@tarojs/components'
2
+import { useMemo } from 'react'
3
+import './style.less'
4
+
5
+
6
+export default (props) => {
7
+
8
+  const lineStyle = useMemo(() => {
9
+    return {
10
+      height: '1px',
11
+      background: 'rgba(0,0,0,0.1)'
12
+    }
13
+  }, [])
14
+
15
+  return (
16
+    <View className='y-divider'>
17
+      <View style={lineStyle}></View>
18
+      <View>{props.children}</View>
19
+      <View style={lineStyle}></View>
20
+    </View>
21
+  )
22
+}

+ 17
- 0
src/components/Divider/style.less Dosyayı Görüntüle

@@ -0,0 +1,17 @@
1
+
2
+.y-divider {
3
+  display: flex;
4
+  align-items: center;
5
+  justify-content: center;
6
+
7
+  & > view:nth-child(1), & > view:nth-child(3) {
8
+    flex: 1;
9
+    height: 1px;
10
+  }
11
+
12
+  & > view:nth-child(2) {
13
+    flex: 'none';
14
+    box-sizing: border-box;
15
+    padding: 0 1em;
16
+  }
17
+}

+ 13
- 0
src/pages/index/components/Back.jsx Dosyayı Görüntüle

@@ -0,0 +1,13 @@
1
+import { View, Image } from '@tarojs/components'
2
+import waterLogo from '@/assets/water_logo.png'
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  return (
7
+    <View className='index-back'>
8
+      <View className='back-color-card'>
9
+        <Image src={waterLogo} />
10
+      </View>
11
+    </View>
12
+  )
13
+}

+ 45
- 0
src/pages/index/components/Footer.jsx Dosyayı Görüntüle

@@ -0,0 +1,45 @@
1
+import { useEffect, useMemo, useState } from 'react'
2
+import Taro from '@tarojs/taro'
3
+import { View } from '@tarojs/components'
4
+import Divider from '@/components/Divider'
5
+import dayjs from 'dayjs'
6
+import './style.less'
7
+
8
+export default (props) => {
9
+  const [height, setHeight] = useState(40)
10
+  const today = useMemo(() => dayjs().format('YYYY-MM-DD'), [])
11
+
12
+  const footerStyle = useMemo(() => {
13
+    return {
14
+      height: `${height}px`
15
+    }
16
+  }, [height])
17
+
18
+  useEffect(() => {
19
+    Taro.nextTick(() => {
20
+      const query = Taro.createSelectorQuery();
21
+      query.select('.index-footer').boundingClientRect((rect) => {
22
+        const { top } = rect || {}
23
+        if (!top) return;
24
+  
25
+        const { safeArea } = Taro.getSystemInfoSync()
26
+  
27
+        // 4 是随便给的一个允许误差范围
28
+        setHeight(safeArea.height - Math.ceil(top) - 4);
29
+      }).exec()
30
+    })
31
+  }, [])
32
+
33
+  return (
34
+    <View className='index-footer' style={footerStyle}>
35
+      <View>
36
+        <View className='footer-time'>{today}</View>
37
+        <View className='footer-copyright'>
38
+          <Divider>
39
+            南京云致提供技术支持
40
+          </Divider>
41
+        </View>
42
+      </View>
43
+    </View>
44
+  )
45
+}

+ 32
- 0
src/pages/index/components/Header.jsx Dosyayı Görüntüle

@@ -0,0 +1,32 @@
1
+import { useMemo } from 'react';
2
+import { View } from '@tarojs/components'
3
+import { Row, Col } from "@antmjs/vantui";
4
+import './style.less'
5
+
6
+export default (props) => {
7
+  const { person, onEdit } = props
8
+
9
+  const { title, dept } = useMemo(() => ({
10
+    title: `姓名: ${person?.personName || ''}`,
11
+    dept: `科室: ${person?.deptName || ''}`
12
+  }), [person])
13
+
14
+  return (
15
+    <View className='index-header'>
16
+      <Row gutter='24'>
17
+        <Col span='16'>
18
+          <View className='index-person-name'>{title}</View>
19
+        </Col>
20
+        <Col span='8' onClick={onEdit}>          
21
+          <View className='index-edit-btn'>修改信息</View>
22
+        </Col>
23
+      </Row>
24
+      <Row gutter='24'>
25
+        <Col span='16'>
26
+          <View className='index-person-dept'>{dept}</View>
27
+        </Col>
28
+        <Col span='8' />
29
+      </Row>
30
+    </View>
31
+  )
32
+}

+ 30
- 0
src/pages/index/components/History/index.jsx Dosyayı Görüntüle

@@ -0,0 +1,30 @@
1
+import { useEffect, useState } from 'react';
2
+import { View } from '@tarojs/components'
3
+import { getBarCodeList } from '@/services/user';
4
+
5
+import './style.less'
6
+
7
+export default (props) => {
8
+  const { person } = props
9
+  const [loading, setLoading] = useState(false)
10
+  const [list, setList] = useState([])
11
+
12
+  useEffect(() => {
13
+    if (person && person.personId) {
14
+      setLoading(true)
15
+      getBarCodeList(person.personId, { start, end }).then((res) => {
16
+        setList(res || [])
17
+        setLoading(false)
18
+      }).catch(err => {
19
+        console.error(err)
20
+        setLoading(false)
21
+      })
22
+    }
23
+  }, [person])
24
+
25
+  return (
26
+    <View>
27
+      
28
+    </View>
29
+  )
30
+}

+ 0
- 0
src/pages/index/components/History/style.less Dosyayı Görüntüle


+ 8
- 0
src/pages/index/components/Main.jsx Dosyayı Görüntüle

@@ -0,0 +1,8 @@
1
+import { View } from '@tarojs/components'
2
+import './style.less'
3
+
4
+export default (props) => {
5
+  return (
6
+    <View className='index-main-content'>{props.children}</View>
7
+  )
8
+}

+ 11
- 0
src/pages/index/components/QRBox.jsx Dosyayı Görüntüle

@@ -0,0 +1,11 @@
1
+
2
+import { View } from '@tarojs/components'
3
+import './style.less'
4
+
5
+export default (props) => {
6
+  return (
7
+    <View className='index-qrbox' style={props.style}>
8
+      {props.children}
9
+    </View>
10
+  )
11
+}

+ 46
- 0
src/pages/index/components/QRItem.jsx Dosyayı Görüntüle

@@ -0,0 +1,46 @@
1
+
2
+import React, { useMemo } from 'react'
3
+import { View } from '@tarojs/components'
4
+import { Tag } from "@antmjs/vantui"
5
+import './style.less'
6
+
7
+const TagStatus = {
8
+  0: '可采样',
9
+  1: '可采样',
10
+  2: '可采样',
11
+  3: '送出',
12
+  4: '接收',
13
+  5: '部分报告',
14
+  6: '确认报告',
15
+}
16
+
17
+export default (props) => {
18
+  const { barData } = props
19
+  
20
+  const { tagShow, tagText, tagPlain } = useMemo(() => {
21
+    let inx = barData?.reqStat
22
+    if (inx === undefined || inx === null) {
23
+      inx = -1
24
+    }
25
+
26
+    const t = TagStatus[inx]
27
+    return {
28
+      tagShow: !!barData?.barcode,
29
+      tagText: !t ? '' : t,
30
+      tagPlain: t >= 2
31
+    }
32
+  }, [barData])
33
+
34
+  return (
35
+    <View className='index-qr-item'>
36
+      {
37
+        tagShow && (
38
+          <View className='index-barcode-tag'>
39
+            <Tag plain={tagPlain} color='#03737b' size='large'>{tagText}</Tag>
40
+          </View>
41
+        )
42
+      }
43
+      {props.children}
44
+    </View>
45
+  )
46
+}

+ 102
- 0
src/pages/index/components/style.less Dosyayı Görüntüle

@@ -0,0 +1,102 @@
1
+
2
+.index-back {
3
+  position: absolute;
4
+  top: 0;
5
+  left: 0;
6
+  width: 100vw;
7
+  z-index: 0;
8
+
9
+  .back-color-card {
10
+    height: 32vh;
11
+    background-color: #03737b;
12
+    
13
+    image {
14
+      position: absolute;
15
+      top: 0;
16
+      right: 0;
17
+      opacity: 0.2;
18
+      width: 500px;
19
+      height: 500px;
20
+      z-index: 0;
21
+    }
22
+  }
23
+}
24
+
25
+
26
+.index-main-content {
27
+  position: relative;
28
+  z-index: 10;
29
+  box-sizing: border-box;
30
+  padding: 0 5vw;
31
+
32
+  .index-header {
33
+    padding-top: 1em;
34
+    color: #fff;
35
+    font-size: 36rpx;
36
+    line-height: 3em;
37
+
38
+    .index-person-name {
39
+      font-size: 1.33em;
40
+    }
41
+
42
+    .index-edit-btn {
43
+      font-size: 1em;
44
+    }
45
+
46
+    .index-person-dept {
47
+      font-size: 1.2em;
48
+    }
49
+  
50
+  }
51
+}
52
+
53
+.index-qrbox {
54
+  width: 100%;
55
+  background: #fff;
56
+  border-radius: 16rpx;
57
+  border: 1px solid rgba(0, 0, 0, 0.1);
58
+  padding: 4px;
59
+  box-sizing: border-box;
60
+
61
+  .index-qr-item {
62
+    margin-top: 6rpx;
63
+    border-top: 1px solid rgba(0, 0, 0, 0.05);
64
+    position: relative;
65
+    box-sizing: border-box;
66
+    padding: 2em;
67
+    display: flex;
68
+    align-items: center;
69
+    justify-content: center;
70
+    height: 36vh;
71
+
72
+    .index-barcode-tag {
73
+      position: absolute;
74
+      top: 40rpx;
75
+      left:20rpx;
76
+    }
77
+  }
78
+}
79
+
80
+.index-footer {
81
+  display: flex;
82
+  justify-content: center;
83
+  align-items: center;
84
+
85
+  & > view {
86
+    width: 100%;
87
+  }
88
+
89
+  .footer-time {
90
+    font-size: 34rpx;
91
+    color: rgba(0, 0, 0, 0.4);
92
+    text-align: center;
93
+    margin-bottom: 1em;
94
+  }
95
+
96
+  .footer-copyright {
97
+    font-size: 24rpx;
98
+    color: rgba(0, 0, 0, 0.2);
99
+    box-sizing: border-box;
100
+    padding: 0 16vw;
101
+  }
102
+}

+ 34
- 39
src/pages/index/index.jsx Dosyayı Görüntüle

@@ -1,21 +1,27 @@
1 1
 import { View, Text, Image } from '@tarojs/components'
2 2
 import { useEffect, useMemo, useRef, useState } from 'react'
3
-import dayjs from 'dayjs'
4
-import { Button, Icon, Dialog } from "@antmjs/vantui";
3
+import { SwipeCell, Dialog, Tabs, Tab } from "@antmjs/vantui";
5 4
 import Taro from '@tarojs/taro';
6 5
 import BarCode from '@/components/barcode'
7
-import logo from '@/assets/water_logo.png'
8
-import { useModel } from '../../store';
6
+import Back from './components/Back';
7
+import Main from './components/Main';
8
+import Header from './components/Header';
9
+import QRBox from './components/QRBox';
10
+import QRItem from './components/QRItem';
11
+import Footer from './components/Footer';
12
+import { useModel } from '@/store';
13
+import { getBarcode } from '@/services/user';
9 14
 
10 15
 import './style.less'
11
-import { getBarcode } from '../../services/user';
16
+
17
+const tabTitleStyle = {
18
+  fontSize: '36rpx'
19
+}
12 20
 
13 21
 export default (props) => {
14 22
   const { person, user } = useModel('userData')
15 23
   const [barData, setBarData] = useState({})
16 24
   const [idCardVisible, setIdCardVisible] = useState(false)
17
-  const [idCardBarVisible, setIdCardBarVisible] = useState(false)
18
-  const today = useMemo(() => dayjs().format('YYYY-MM-DD'))
19 25
   const goUserInfo = () => {
20 26
     Taro.navigateTo({
21 27
       url: '/pages/setUserInfo/index'
@@ -49,38 +55,27 @@ export default (props) => {
49 55
   }, [person, user])
50 56
 
51 57
   return (
52
-    <View className='index-UserQRcode'>
53
-      {/* <Text>Hello world!</Text> */}
54
-      {/* <View className='index-UserQRcode-headerInfo' style={{ backgroundImage: `url(${userBck})` }}> */}
55
-      <View className='index-UserQRcode-headerInfo' >
56
-        <View className='index-UserQRcode-headerInfo-User'>
57
-          <Image src={logo} />
58
-          <View className='index-UserQRcode-headerInfo-User-NameInfo'>姓名:{person?.personName}</View>
59
-          <View onClick={goUserInfo} className='index-UserQRcode-headerInfo-User-setNameInfo'><Icon name='edit' />修改信息</View>
60
-        </View>
61
-        <View className='index-UserQRcode-headerInfo-UserID'>科室:{person?.deptName}</View>
62
-      </View>
63
-      <View className='index-UserQRcode-cententQR'>
64
-        <View className='index-UserQRcode-cententQR-Barcode'>
65
-          <BarCode ratio={0.7} height={80} code={barData.barcode} />
66
-        </View>
67
-      </View>
68
-      <View className='index-UserQRcode-footer'>
69
-        <View>
70
-          <Button block plain hairline type='info' size='large' onClick={() => setIdCardBarVisible(true)}>
71
-            <View style={{ fontSize: '1.2em' }}>查看身份码</View>
72
-          </Button>
73
-          <View className='date-tip'>
74
-          {today}
75
-          </View>
76
-        </View>
77
-      </View>
78
-      <Dialog title='提示' message='未添加个人信息' show={idCardVisible} onConfirm={handleShowEditor} />
79
-      <Dialog show={idCardBarVisible} onConfirm={() => setIdCardBarVisible(false)}>
80
-        <View className='pop-idcard-bar'>
81
-          <BarCode ratio={0.7} height={80} code={person?.idNo} codeVisible />
82
-        </View>
83
-      </Dialog>
58
+    <View className='index-page'>
59
+      <Back />
60
+      <Main>
61
+        <Header person={person} onEdit={goUserInfo} />
62
+        <QRBox style={{ marginTop: '1.6em' }}>
63
+          <Tabs lineHeight={2} lineWidth={120} color='#03737b' titleActiveColor='#03737b'>
64
+            <Tab title='条码' titleStyle={tabTitleStyle}>
65
+              <QRItem barData={barData}>
66
+                <BarCode ratio={0.7} height={80} code={barData.barcode} />
67
+              </QRItem>
68
+            </Tab>
69
+            <Tab title='身份码' titleStyle={tabTitleStyle}>
70
+              <QRItem>
71
+                <BarCode ratio={0.7} height={80} code={person?.idNo} />
72
+              </QRItem>
73
+            </Tab>
74
+          </Tabs>
75
+        </QRBox>
76
+        <Dialog title='提示' message='未添加个人信息' show={idCardVisible} onConfirm={handleShowEditor} />
77
+      </Main>
78
+      <Footer />
84 79
     </View>
85 80
   )
86 81
 }

+ 4
- 109
src/pages/index/style.less Dosyayı Görüntüle

@@ -1,109 +1,4 @@
1
-.index-UserQRcode {
2
-  width: 100vw;
3
-  height: 100vh;
4
-  margin: 0 auto;
5
-  background-color: #f2f1f6;
6
-
7
-  &-headerInfo {
8
-    color: white;
9
-    height: 35vh;
10
-    background: no-repeat, center center;
11
-    background-size: 100% 100%;
12
-    background-color: #03737b;
13
-    padding: 0 7vw 0 7vw;
14
-
15
-    &-User {
16
-      display: flex;
17
-      justify-content: space-between;
18
-      letter-spacing: 1vw;
19
-
20
-      image {
21
-        position: absolute;
22
-        top: 0;
23
-        right: 0;
24
-        opacity: 0.2;
25
-        width: 500px;
26
-        height: 500px;
27
-        z-index: 0;
28
-      }
29
-
30
-      &-NameInfo {
31
-        font-weight: 600;
32
-        font-size: 48px;
33
-        margin: 5vw 0 3vw 0;
34
-      }
35
-      &-setNameInfo {
36
-        margin: 5vw 0 3vw 0;
37
-        z-index: 10;
38
-        font-size: 36px;
39
-      }
40
-    }
41
-    &-UserID {
42
-      letter-spacing: 0.3vw;
43
-      font-size: 40px;
44
-    }
45
-  }
46
-
47
-  &-cententQR {
48
-    box-sizing: border-box;
49
-    width: 90vw;
50
-    // box-shadow: 0px 8px 38px 0px rgba(0, 0, 0, 0.12);
51
-    border-radius: 15px;
52
-    background-color: white;
53
-    margin: 0 auto;
54
-    position: relative;
55
-    margin-top: -15vh;
56
-    padding: 2em;
57
-    border: 1px solid rgba(0, 0, 0, 0.1);
58
-
59
-    &-Times {
60
-      padding-top: 3vh;
61
-      text-align: center;
62
-      font-weight: bold;
63
-      font-size: 1.8em;
64
-    }
65
-    &-Barcode {
66
-      height: 40vh;
67
-      margin: 0 auto;
68
-      position: relative;
69
-      display: flex;
70
-      justify-content: center;
71
-      align-items: center;
72
-
73
-      & + & {
74
-        margin-top: 5vh;
75
-      }
76
-    }
77
-  }
78
-
79
-  &-footer {
80
-    height: calc(100% - 80vh);
81
-    display: flex;
82
-    justify-content: center;
83
-    align-items: center;
84
-    color: #888;
85
-    padding: 0 5vw;
86
-    box-sizing: border-box;
87
-
88
-    & > view {
89
-      flex: 1;
90
-    }
91
-
92
-    .date-tip {
93
-      margin-top: 2em;
94
-      text-align: center;
95
-    }
96
-
97
-    .van-button {
98
-      background: transparent;
99
-    }
100
-  }
101
-}
102
-
103
-.pop-idcard-bar {
104
-  display: flex;
105
-  align-items: center;
106
-  justify-content: center;
107
-  padding: 10vw 4vw;
108
-  box-sizing: border-box;
109
-}
1
+.index-page {
2
+  min-height: 100vh;
3
+  background-color: #f7f8fa;
4
+}

+ 6
- 3
src/services/user.js Dosyayı Görüntüle

@@ -34,8 +34,6 @@ export const getPhoneuser = (data) => request('/auth-phone', { data, method: 'PU
34 34
 export const setUserInfo = (data) => request('/person', { data, method: 'PUT' })
35 35
 
36 36
 
37
-
38
-
39 37
 /**
40 38
  * 获取条形码
41 39
  * @param {*} data 
@@ -43,5 +41,10 @@ export const setUserInfo = (data) => request('/person', { data, method: 'PUT' })
43 41
  */
44 42
 export const getBarcode = (id, data) => request(`/person/${id}/barcode`, { data, method: 'GET' })
45 43
 
46
-
44
+/**
45
+ * 获取条形码列表
46
+ * @param {*} data 
47
+ * @returns 
48
+ */
49
+ export const getBarCodeList = (id, params) => request(`/person/${id}/barcode`, { params, method: 'GET' })
47 50
 

+ 14509
- 10792
yarn.lock
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle