[baozhangchao] 3 年 前
コミット
e0950ee1db

+ 3
- 1
src/app.config.js ファイルの表示

@@ -4,7 +4,9 @@ export default {
4 4
     'pages/main/index',
5 5
     'pages/NoticeInfo/index',
6 6
     'pages/setUser/index',
7
-    'pages/setDogInfo/index',
7
+    'pages/setDogLicense/index',
8
+    'pages/dogLicenseList/index',
9
+    'pages/LicenseInfo/index',
8 10
   ],
9 11
   window: {
10 12
     backgroundTextStyle: 'light',

+ 3
- 3
src/app.js ファイルの表示

@@ -31,13 +31,13 @@ class App extends Component {
31 31
     })
32 32
     Taro.loadFontFace({
33 33
       family: 'iconfont',
34
-      source: 'url("//at.alicdn.com/t/font_3429358_afs07k49tq.ttf?t=1653537640226")',
34
+      source: 'url("//at.alicdn.com/t/font_3429358_8dmcqsujg73.ttf?t=1653555641856")',
35 35
       success () {
36
-        console.log('eeeeeeeeee');
36
+        console.log('字体加载完成👍');
37 37
 
38 38
       },
39 39
       fail (e) {
40
-        console.log(e);
40
+        console.log(e, '👈字体加载失败');
41 41
       }
42 42
     })
43 43
 

+ 5
- 1
src/components/ViewIcon/style.less ファイルの表示

@@ -1,6 +1,6 @@
1 1
 @font-face {
2 2
   font-family: "iconfont"; /* Project id 3429358 */
3
-  src: url("//at.alicdn.com/t/font_3429358_afs07k49tq.ttf?t=1653537640226")
3
+  src: url("//at.alicdn.com/t/font_3429358_8dmcqsujg73.ttf?t=1653555641856")
4 4
     format("truetype");
5 5
 }
6 6
 
@@ -12,6 +12,10 @@
12 12
   -moz-osx-font-smoothing: grayscale;
13 13
 }
14 14
 
15
+.icon-gou:before {
16
+  content: "\e60d";
17
+}
18
+
15 19
 .icon-bianji:before {
16 20
   content: "\e8ac";
17 21
 }

+ 11
- 0
src/pages/LicenseInfo/index.config.js ファイルの表示

@@ -0,0 +1,11 @@
1
+export default {
2
+  navigationBarTitleText: '证件详情',
3
+  disableScroll: true,
4
+  navigationBarBackgroundColor: "#FBD804",
5
+  navigationBarTextStyle: "black",
6
+  backgroundColor: "#FBD804",
7
+  usingComponents: {
8
+
9
+  }
10
+
11
+}

+ 24
- 0
src/pages/LicenseInfo/index.jsx ファイルの表示

@@ -0,0 +1,24 @@
1
+import { View, Text, Image } from '@tarojs/components'
2
+import Taro from '@tarojs/taro';
3
+import ViewIcon from '../../components/ViewIcon';
4
+
5
+
6
+import './style.less'
7
+
8
+export default (props) => {
9
+
10
+  const goDogList = () => {
11
+    console.log('e',);
12
+  }
13
+  const goLicenseInfo = (e) => {
14
+    Taro.navigateTo({
15
+      url: '/pages/setUser/index'
16
+    })
17
+  }
18
+  return (
19
+    <View className='user-box-Card'>
20
+
21
+    </View>
22
+  )
23
+}
24
+

+ 0
- 0
src/pages/LicenseInfo/style.less ファイルの表示


+ 11
- 0
src/pages/dogLicenseList/index.config.js ファイルの表示

@@ -0,0 +1,11 @@
1
+export default {
2
+  navigationBarTitleText: '证件列表',
3
+  disableScroll: true,
4
+  navigationBarBackgroundColor: "#FBD804",
5
+  navigationBarTextStyle: "black",
6
+  backgroundColor: "#FBD804",
7
+  usingComponents: {
8
+
9
+  }
10
+
11
+}

+ 82
- 0
src/pages/dogLicenseList/index.jsx ファイルの表示

@@ -0,0 +1,82 @@
1
+import { View, ScrollView, Image } from '@tarojs/components'
2
+import Taro from '@tarojs/taro';
3
+import './style.less'
4
+
5
+export default (props) => {
6
+
7
+  const goDogList = () => {
8
+    console.log('e',);
9
+  }
10
+  const goLicenseInfo = (e) => {
11
+    Taro.navigateTo({
12
+      url: '/pages/LicenseInfo/index'
13
+    })
14
+  }
15
+  const List = [
16
+    {
17
+      img: 'https://tse1-mm.cn.bing.net/th/id/R-C.20cb4bf5b22ca1b67f69ea29fb2af8fc?rik=XCvrM0gKEAHIVA&riu=http%3a%2f%2fnews.hainan.net%2fEditor%2fimg%2f201410%2f20141023%2fbig%2f2014102320332887_4718693.jpg&ehk=GnaUVphTAgEeLq%2b2rPn8qJnONF3aIPUKuw%2bVaECvyZo%3d&risl=&pid=ImgRaw&r=0',
18
+      dogNmae: '王小狗',
19
+      dogNum: 202221588650021,
20
+    },
21
+    {
22
+      img: 'https://tse1-mm.cn.bing.net/th/id/R-C.20cb4bf5b22ca1b67f69ea29fb2af8fc?rik=XCvrM0gKEAHIVA&riu=http%3a%2f%2fnews.hainan.net%2fEditor%2fimg%2f201410%2f20141023%2fbig%2f2014102320332887_4718693.jpg&ehk=GnaUVphTAgEeLq%2b2rPn8qJnONF3aIPUKuw%2bVaECvyZo%3d&risl=&pid=ImgRaw&r=0',
23
+      dogNmae: '王小狗',
24
+      dogNum: 202221588650021,
25
+    }, {
26
+      img: 'https://tse1-mm.cn.bing.net/th/id/R-C.20cb4bf5b22ca1b67f69ea29fb2af8fc?rik=XCvrM0gKEAHIVA&riu=http%3a%2f%2fnews.hainan.net%2fEditor%2fimg%2f201410%2f20141023%2fbig%2f2014102320332887_4718693.jpg&ehk=GnaUVphTAgEeLq%2b2rPn8qJnONF3aIPUKuw%2bVaECvyZo%3d&risl=&pid=ImgRaw&r=0',
27
+      dogNmae: '王小狗',
28
+      dogNum: 202221588650021,
29
+    }, {
30
+      img: 'https://tse1-mm.cn.bing.net/th/id/R-C.20cb4bf5b22ca1b67f69ea29fb2af8fc?rik=XCvrM0gKEAHIVA&riu=http%3a%2f%2fnews.hainan.net%2fEditor%2fimg%2f201410%2f20141023%2fbig%2f2014102320332887_4718693.jpg&ehk=GnaUVphTAgEeLq%2b2rPn8qJnONF3aIPUKuw%2bVaECvyZo%3d&risl=&pid=ImgRaw&r=0',
31
+      dogNmae: '王小狗',
32
+      dogNum: 202221588650021,
33
+    }, {
34
+      img: 'https://tse1-mm.cn.bing.net/th/id/R-C.20cb4bf5b22ca1b67f69ea29fb2af8fc?rik=XCvrM0gKEAHIVA&riu=http%3a%2f%2fnews.hainan.net%2fEditor%2fimg%2f201410%2f20141023%2fbig%2f2014102320332887_4718693.jpg&ehk=GnaUVphTAgEeLq%2b2rPn8qJnONF3aIPUKuw%2bVaECvyZo%3d&risl=&pid=ImgRaw&r=0',
35
+      dogNmae: '王小狗',
36
+      dogNum: 202221588650021,
37
+    }, {
38
+      img: 'https://tse1-mm.cn.bing.net/th/id/R-C.20cb4bf5b22ca1b67f69ea29fb2af8fc?rik=XCvrM0gKEAHIVA&riu=http%3a%2f%2fnews.hainan.net%2fEditor%2fimg%2f201410%2f20141023%2fbig%2f2014102320332887_4718693.jpg&ehk=GnaUVphTAgEeLq%2b2rPn8qJnONF3aIPUKuw%2bVaECvyZo%3d&risl=&pid=ImgRaw&r=0',
39
+      dogNmae: '王小狗',
40
+      dogNum: 202221588650021,
41
+    }, {
42
+      img: 'https://tse1-mm.cn.bing.net/th/id/R-C.20cb4bf5b22ca1b67f69ea29fb2af8fc?rik=XCvrM0gKEAHIVA&riu=http%3a%2f%2fnews.hainan.net%2fEditor%2fimg%2f201410%2f20141023%2fbig%2f2014102320332887_4718693.jpg&ehk=GnaUVphTAgEeLq%2b2rPn8qJnONF3aIPUKuw%2bVaECvyZo%3d&risl=&pid=ImgRaw&r=0',
43
+      dogNmae: '王小狗',
44
+      dogNum: 202221588650021,
45
+    },
46
+  ]
47
+  const widgetView = (value) => {
48
+    return (
49
+      <View className='user-box-DogListCard' onClick={goLicenseInfo}>
50
+        <View className='user-box-DogListCard-DogImage'>
51
+          {/* <ViewIcon icon='morentouxiang' size={50} color='#FBD804' /> */}
52
+          <Image src={value.img} />
53
+        </View>
54
+
55
+        <View className='user-box-DogListCard-DogImage'>
56
+          <View>姓名:{value.dogNmae}</View>
57
+          <View>证件号:{value.dogNum}</View>
58
+        </View>
59
+        <View className='user-box-DogListCard-right' >
60
+          <View style={{ paddingRight: '5px' }}>
61
+            {/* <ViewIcon icon='bianji' size={19} color='#2f2f2f' /> */}
62
+          </View>
63
+          &gt;
64
+        </View>
65
+      </View>
66
+    )
67
+  }
68
+
69
+  return (
70
+    <ScrollView scrollY style={{ height: '100vh' }}>
71
+      {
72
+        List.map((item, index) => {
73
+          return (
74
+            widgetView(item)
75
+
76
+          )
77
+        })
78
+      }
79
+    </ScrollView>
80
+  )
81
+}
82
+

+ 37
- 0
src/pages/dogLicenseList/style.less ファイルの表示

@@ -0,0 +1,37 @@
1
+.user-box-DogListCard {
2
+  background-color: #fff;
3
+  display: flex;
4
+  align-items: center;
5
+  padding: 25px 15px;
6
+  margin: 20px auto;
7
+  border-bottom-right-radius: 15px;
8
+  border-bottom-left-radius: 15px;
9
+  &-DogImage {
10
+    margin-left: 20px;
11
+    height: 130px;
12
+    line-height: 60px;
13
+    > Image {
14
+      width: 125px;
15
+      height: 125px;
16
+      border-radius: 10px;
17
+    }
18
+    > View:nth-child(1) {
19
+      font-size: 30px;
20
+      font-weight: 600;
21
+    }
22
+    > View:nth-child(2) {
23
+      color: rgb(175, 175, 175);
24
+      font-size: 25px;
25
+    }
26
+  }
27
+  &-right {
28
+    display: flex;
29
+    align-items: center;
30
+    text-align: center;
31
+    font-size: 28px;
32
+    position: relative;
33
+    left: 25vw;
34
+    font-size: 35px;
35
+    font-weight: bold;
36
+  }
37
+}

+ 19
- 13
src/pages/index/index.jsx ファイルの表示

@@ -28,9 +28,9 @@ export default (props) => {
28 28
     { text: '我是第3165656565' },
29 29
     { text: '我是第四条通知啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊' }
30 30
   ]
31
-  const onChangeGoNotice = (e) => {
31
+  const goDogLicense = (e) => {
32 32
     Taro.navigateTo({
33
-      url: '/pages/setDogInfo/index'
33
+      url: '/pages/setDogLicense/index'
34 34
     })
35 35
   }
36 36
   const goMain = (e) => {
@@ -38,7 +38,13 @@ export default (props) => {
38 38
       url: '/pages/main/index'
39 39
     })
40 40
   }
41
-  goMain
41
+
42
+  const goDogLicenseList = (e) => {
43
+    Taro.navigateTo({
44
+      url: '/pages/dogLicenseList/index'
45
+    })
46
+  }
47
+
42 48
 
43 49
   return (
44 50
     <ScrollView scrollY style={{
@@ -51,28 +57,28 @@ export default (props) => {
51 57
         </View>
52 58
         <View className='border-card-group'>
53 59
           <View class='weui-flex'>
54
-            <View class='weui-flex__item'>
60
+            <View class='weui-flex__item' onClick={goDogLicense}>
55 61
               <MenuItem title='办证申请' subtitle='Registration application' icon='dog'>
56 62
                 <View>您有<Text>1</Text>条办证申请记录</View>
57 63
               </MenuItem>
58 64
             </View>
59
-            <View class='weui-flex__item' style={ml16}>
65
+            <View class='weui-flex__item' style={ml16} onClick={goDogLicenseList}>
60 66
               <MenuItem title='证件查看' subtitle='Certificate check' icon='certificate'>
61 67
                 <View>您有<Text>1</Text>条办证申请记录</View>
62 68
               </MenuItem>
63 69
             </View>
64 70
           </View>
65 71
           <View class='weui-flex' style={pt16}>
66
-              <View class='weui-flex__item'>
67
-                <MenuItem title='个人中心' subtitle='Personal center' ratio='470:452' icon='personal' />
68
-              </View>
69
-              <View class='weui-flex__item' style={ml16}>
70
-                <MenuItem title='证件续期' subtitle='Certificate renewal' ratio='470:206' icon='renewal' iconSize={72} />
72
+            <View class='weui-flex__item' onClick={goMain}>
73
+              <MenuItem title='个人中心' subtitle='Personal center' ratio='470:452' icon='personal' />
74
+            </View>
75
+            <View class='weui-flex__item' style={ml16} onClick={goDogLicense}>
76
+              <MenuItem title='证件续期' subtitle='Certificate renewal' ratio='470:206' icon='renewal' iconSize={72} />
71 77
 
72
-                <View style={pt16}>
73
-                  <MenuItem title='证件补办' subtitle='Replacement certificate' ratio='470:206' icon='replacement' iconSize={72} />
74
-                </View>
78
+              <View style={pt16} onClick={goDogLicense}>
79
+                <MenuItem title='证件补办' subtitle='Replacement certificate' ratio='470:206' icon='replacement' iconSize={72} />
75 80
               </View>
81
+            </View>
76 82
           </View>
77 83
         </View>
78 84
 

+ 10
- 2
src/pages/main/index.jsx ファイルの表示

@@ -17,14 +17,13 @@ export default (props) => {
17 17
   }
18 18
   return (
19 19
     <View className='user-box'>
20
-
21 20
       <View className='user-box-Card'>
22 21
         <View className='user-box-Card-useImage'>
23 22
           <ViewIcon icon='morentouxiang' size={50} color='#FBD804' />
24 23
         </View>
25 24
 
26 25
         <View className='user-box-Card-NameCard'>
27
-          <View>姓名:王王王</View>
26
+          <View>王王王</View>
28 27
           <View>文明养狗,遵纪守法</View>
29 28
         </View>
30 29
         <View className='user-box-Card-right' onClick={goSetUser}>
@@ -43,6 +42,15 @@ export default (props) => {
43 42
           </View>
44 43
         </mp-cell>
45 44
       </mp-cells>
45
+
46
+      <mp-cells ext-class='my-cells' >
47
+        <mp-cell link hover>
48
+          <View className='iconCell'>
49
+            <ViewIcon icon='gou' size={22} />
50
+            <View onClick={goDogList} style='padding-left:5px;width:80%'>我的狗狗</View>
51
+          </View>
52
+        </mp-cell>
53
+      </mp-cells>
46 54
     </View >
47 55
   )
48 56
 }

+ 37
- 118
src/pages/setDogInfo/index.jsx ファイルの表示

@@ -1,15 +1,15 @@
1 1
 import { View, Button, Form, Text, RadioGroup, Picker, Image, Input, Radio, Label, ScrollView } from '@tarojs/components'
2 2
 import Taro from '@tarojs/taro';
3 3
 import { useState } from 'react';
4
-import { addDogInfo } from '../../services/dogAPI';
5
-
6 4
 import './style.less'
7 5
 
8 6
 export default (props) => {
9
-  const [dogDate, setDogDate] = useState({ petBirthday: '请选择生日', petSex: '请选择性别', petType: '请选择犬种' })
10
-  const [imgUrl, setImgUrl] = useState({ img1: null, immunization: null })
11
-
7
+  const [dogDate, setDogDate] = useState({ birthday: '请选择生日', sex: '请选择性别', petType: '请选择犬种' })
8
+  const [imgUrl, setImgUrl] = useState()
12 9
 
10
+  const formSubmit = (res) => {
11
+    console.log('formVlue', res);
12
+  }
13 13
   const onDateChange = (type, value) => {
14 14
     switch (type) {
15 15
       case 'petSex':
@@ -39,99 +39,44 @@ export default (props) => {
39 39
 
40 40
   ]
41 41
 
42
-  const modeList = [
43
-    {
44
-      value: 1,
45
-      text: '邮寄',
46
-    },
47
-    {
48
-      value: 2,
49
-      text: '自取',
50
-    },
51 42
 
52
-  ]
43
+  const addImage = () => {
44
+
45
+    Taro.chooseImage({
46
+      count: 1, // 默认9
47
+      sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
48
+      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
49
+      success: function (res) {
50
+        // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
51
+        var tempFilePaths = res.tempFilePaths
52
+        setImgUrl(tempFilePaths[0])
53
+      },
54
+      fail () {
55
+        Taro.showToast({
56
+          title: '上传失败请重试',
57
+          icon: 'error',
58
+          duration: 1000
59
+        })
60
+      }
61
+    })
53 62
 
54
-  const addImage = (e) => {
55
-    console.log("🚀 ~ file: index.jsx ~ line 94 ~ addImage ~ e", e)
56
-
57
-    if (e == 'img1') {
58
-      Taro.chooseImage({
59
-        count: 1, // 默认9
60
-        sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
61
-        sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
62
-        success: function (res) {
63
-          // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
64
-          var tempFilePaths = res.tempFilePaths
65
-          setImgUrl({ ...imgUrl, img1: tempFilePaths[0] })
66
-        },
67
-        fail () {
68
-          Taro.showToast({
69
-            title: '上传失败请重试',
70
-            icon: 'error',
71
-            duration: 1000
72
-          })
73
-        }
74
-      })
75
-
76
-    } else {
77
-      Taro.chooseImage({
78
-        count: 1, // 默认9
79
-        sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
80
-        sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
81
-        success: function (res) {
82
-          // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
83
-          var tempFilePaths = res.tempFilePaths
84
-          setImgUrl({ ...imgUrl, immunization: tempFilePaths[0] })
85
-        },
86
-        fail () {
87
-          Taro.showToast({
88
-            title: '上传失败请重试',
89
-            icon: 'error',
90
-            duration: 1000
91
-          })
92
-        }
93
-      })
94
-    }
95 63
 
96
-    console.log("🚀 ~ file: index.jsx ~ line 61 ~ addImage ~ tempFilePaths", imgUrl)
97 64
 
98 65
 
99
-  }
100
-  const formSubmit = e => {
101
-    console.log(e)
102
-    const value = e.detail.value
103
-    addDogInfo({ ...value, ...dogDate, ...imgUrl }).then((res) => {
104
-      console.log('dogInfo xinwe', res);
105
-    })
106
-  }
107 66
 
108
-  const formReset = e => {
109
-    console.log(e)
110 67
   }
111
-  const rules = [
112
-    {
113
-      name: 'name',
114
-      rules: { required: true, message: '请填写收货人姓名' },
115
-    },
116
-    {
117
-      name: 'telNumber',
118
-      rules: [{ required: true, message: '请填写收货人电话' }, { mobile: true, message: '电话格式不对' }]
119
-    },
120
-  ]
68
+
121 69
   return (
122
-    <ScrollView scrollY style={{
123
-      height: '100vh'
124
-    }}
125
-    >
70
+    <ScrollView scrollY style={{ height: '100vh' }}>
126 71
       <View class='page' >
127
-        <Form onSubmit={formSubmit} onReset={formReset} >
128
-          <mp-form rules={rules} >
72
+        <Form onSubmit={formSubmit}  >
73
+          <mp-form  >
129 74
             <mp-cells title=''>
130 75
               <mp-cell title='宠物名称' extClass=''>
131
-                <Input name='petName' placeholder='请输入宠养区域' />
76
+                <Input name='name' placeholder='请输入宠养区域' />
132 77
               </mp-cell>
133 78
               <mp-cell title='宠物性别' extClass=''>
134
-                <Picker name='petSex' mode='selector' range={selector} onChange={(e) => { onDateChange('petSex', e.detail.value) }}>
79
+                <Picker name='sex' mode='selector' range={selector} onChange={(e) => { onDateChange('petSex', e.detail.value) }}>
135 80
                   <View className='picker'>
136 81
                     {dogDate.petSex}
137 82
                   </View>
@@ -145,58 +90,32 @@ export default (props) => {
145 90
                 </Picker>
146 91
               </mp-cell>
147 92
               <mp-cell title='生日' extClass=''>
148
-                <Picker name='petBirthday' mode='date' onChange={(e) => { onDateChange('petBirthday', e.detail.value) }}>
93
+                <Picker name='birthday' mode='date' onChange={(e) => { onDateChange('petBirthday', e.detail.value) }}>
149 94
                   <View className='picker'>
150 95
                     {dogDate.petBirthday}
151 96
                   </View>
152 97
                 </Picker>
153 98
               </mp-cell>
154 99
               <mp-cell title='毛色' extClass=''>
155
-                <Input name='petColor' placeholder='请输入宠养区域' />
100
+                <Input name='color' placeholder='请输入宠养区域' />
156 101
               </mp-cell>
157 102
               <mp-cell title='宠物照片' extClass=''>
158 103
                 {
159
-                  !imgUrl.img1 ?
160
-                    <View className='addImage' onClick={() => addImage('img1')} >
104
+                  !imgUrl.image ?
105
+                    <View className='addImage' onClick={addImage} >
161 106
                       <Text>+</Text>
162 107
                     </View>
163 108
                     :
164
-                    <Image className='dogImg1' name='img1' src={imgUrl.img1} onClick={() => addImage('img1')} />
109
+                    <Image className='dogImg1' name='image' src={imgUrl.img1} onClick={addImage} />
165 110
                 }
166 111
 
167 112
               </mp-cell>
168
-              <mp-cell title='免疫证明' extClass=''>
169
-                {
170
-                  !imgUrl.immunization ?
171
-                    <View className='addImage' onClick={() => addImage('immunization')} >
172
-                      <Text>+</Text>
173
-                    </View>
174
-                    :
175
-                    <Image className='dogImg1' name='immunization' src={imgUrl.immunization} onClick={() => addImage('immunization')} />
176
-                }
177
-                {/* <Input name='immunization' placeholder='请输入身份证号' type='idcard' /> */}
178
-              </mp-cell>
179
-              <mp-cell title='详细地址' extClass=''>
180
-                <Input name='address' placeholder='请输入详细地址' />
181
-              </mp-cell>
182
-              <mp-cell title='申领方式' extClass=''>
183
-                <View className='radio-list'>
184
-                  <RadioGroup name='applyMethod'>
185
-                    {modeList.map((item, i) => {
186
-                      return (
187
-                        <Label className='radio-list__label' for={i} key={i}>
188
-                          <Radio color='#FCD905' className='radio-list__radio' value={item.value} >{item.text}</Radio>
189
-                        </Label>
190
-                      )
191
-                    })}
192
-                  </RadioGroup>
193
-                </View>
194
-              </mp-cell>
113
+
195 114
 
196 115
             </mp-cells>
197 116
           </mp-form>
198 117
           <View slot='button' style={{ margin: '4em 0 2em 0' }}>
199
-            <Button class='weui-btn' type='primary' loading={false} formType='submit'>确定</Button>
118
+            <Button style={{ backgroundColor: '#fbd804', borderRadius: '40px', color: '#000', border: '0px' }} class='weui-btn' type='primary' loading={false} formType='submit'>确定</Button>
200 119
           </View>
201 120
         </Form>
202 121
       </View>

+ 0
- 22
src/pages/setDogInfo/style.less ファイルの表示

@@ -1,22 +0,0 @@
1
-.addImage {
2
-  width: 100px;
3
-  height: 100px;
4
-  border: 1px dashed #666;
5
-  display: flex;
6
-  align-items: center;
7
-  > Text {
8
-    text-align: center;
9
-    margin: 0 auto;
10
-    font-size: 60px;
11
-    font-weight: bold;
12
-  }
13
-}
14
-.dogImg1 {
15
-  width: 200px;
16
-  height: 150px;
17
-}
18
-.radio-list__radio {
19
-  width: 140px;
20
-  font-size: 35px;
21
-  transform: scale(0.9);
22
-}

+ 14
- 0
src/pages/setDogLicense/index.config.js ファイルの表示

@@ -0,0 +1,14 @@
1
+export default {
2
+  navigationBarTitleText: '办证申请',
3
+  disableScroll: true,
4
+  navigationBarBackgroundColor: "#FBD804",
5
+  navigationBarTextStyle: "black",
6
+  backgroundColor: "#FBD804",
7
+  usingComponents: {
8
+    "mp-cells": "weui-miniprogram/cells/cells",
9
+    "mp-cell": "weui-miniprogram/cell/cell",
10
+    "mp-form-page": "weui-miniprogram/form-page/form-page",
11
+    "mp-form": "weui-miniprogram/form/form"
12
+  }
13
+
14
+}

+ 209
- 0
src/pages/setDogLicense/index.jsx ファイルの表示

@@ -0,0 +1,209 @@
1
+import { View, Button, Form, Text, RadioGroup, Picker, Image, Input, Radio, Label, ScrollView } from '@tarojs/components'
2
+import Taro from '@tarojs/taro';
3
+import { useState } from 'react';
4
+import { addDogInfo } from '../../services/dogAPI';
5
+
6
+import './style.less'
7
+
8
+export default (props) => {
9
+  const [dogDate, setDogDate] = useState({ petBirthday: '请选择生日', petSex: '请选择性别', petType: '请选择犬种' })
10
+  const [imgUrl, setImgUrl] = useState({ img1: null, immunization: null })
11
+
12
+
13
+  const onDateChange = (type, value) => {
14
+    switch (type) {
15
+      case 'petSex':
16
+        setDogDate({ ...dogDate, petSex: selector[value] })
17
+        break;
18
+      case 'petBirthday':
19
+        setDogDate({ ...dogDate, petBirthday: value })
20
+        break;
21
+      case 'petType':
22
+        setDogDate({ ...dogDate, petType: dogType[value].text })//value 01  text 文字
23
+        break;
24
+      default:
25
+        break;
26
+    }
27
+
28
+  }
29
+  const selector = ['雄', '雌']
30
+  const dogType = [
31
+    {
32
+      value: 0,
33
+      text: '金毛',
34
+    },
35
+    {
36
+      value: 1,
37
+      text: '拉布拉多',
38
+    },
39
+
40
+  ]
41
+
42
+  const modeList = [
43
+    {
44
+      value: 1,
45
+      text: '邮寄',
46
+    },
47
+    {
48
+      value: 2,
49
+      text: '自取',
50
+    },
51
+
52
+  ]
53
+
54
+  const addImage = (e) => {
55
+    console.log("🚀 ~ file: index.jsx ~ line 94 ~ addImage ~ e", e)
56
+
57
+    if (e == 'img1') {
58
+      Taro.chooseImage({
59
+        count: 1, // 默认9
60
+        sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
61
+        sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
62
+        success: function (res) {
63
+          // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
64
+          var tempFilePaths = res.tempFilePaths
65
+          setImgUrl({ ...imgUrl, img1: tempFilePaths[0] })
66
+        },
67
+        fail () {
68
+          Taro.showToast({
69
+            title: '上传失败请重试',
70
+            icon: 'error',
71
+            duration: 1000
72
+          })
73
+        }
74
+      })
75
+
76
+    } else {
77
+      Taro.chooseImage({
78
+        count: 1, // 默认9
79
+        sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
80
+        sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
81
+        success: function (res) {
82
+          // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
83
+          var tempFilePaths = res.tempFilePaths
84
+          setImgUrl({ ...imgUrl, immunization: tempFilePaths[0] })
85
+        },
86
+        fail () {
87
+          Taro.showToast({
88
+            title: '上传失败请重试',
89
+            icon: 'error',
90
+            duration: 1000
91
+          })
92
+        }
93
+      })
94
+    }
95
+
96
+    console.log("🚀 ~ file: index.jsx ~ line 61 ~ addImage ~ tempFilePaths", imgUrl)
97
+
98
+
99
+  }
100
+  const formSubmit = e => {
101
+    console.log(e)
102
+    const value = e.detail.value
103
+    addDogInfo({ ...value, ...dogDate, ...imgUrl }).then((res) => {
104
+      console.log('dogInfo xinwe', res);
105
+    })
106
+  }
107
+
108
+  const formReset = e => {
109
+    console.log(e)
110
+  }
111
+  const rules = [
112
+    {
113
+      name: 'name',
114
+      rules: { required: true, message: '请填写收货人姓名' },
115
+    },
116
+    {
117
+      name: 'telNumber',
118
+      rules: [{ required: true, message: '请填写收货人电话' }, { mobile: true, message: '电话格式不对' }]
119
+    },
120
+  ]
121
+  return (
122
+    <ScrollView scrollY style={{
123
+      height: '100vh'
124
+    }}
125
+    >
126
+      <View class='page' >
127
+        <Form onSubmit={formSubmit} onReset={formReset} >
128
+          <mp-form rules={rules} >
129
+            <mp-cells title=''>
130
+              <mp-cell title='宠物名称' extClass=''>
131
+                <Input name='petName' placeholder='请输入宠养区域' />
132
+              </mp-cell>
133
+              <mp-cell title='宠物性别' extClass=''>
134
+                <Picker name='petSex' mode='selector' range={selector} onChange={(e) => { onDateChange('petSex', e.detail.value) }}>
135
+                  <View className='picker'>
136
+                    {dogDate.petSex}
137
+                  </View>
138
+                </Picker>
139
+              </mp-cell>
140
+              <mp-cell title='犬种' extClass=''>
141
+                <Picker name='petType' mode='selector' range={dogType} rangeKey='text' onChange={(e) => { onDateChange('petType', e.detail.value) }}>
142
+                  <View className='picker'>
143
+                    {dogDate.petType}
144
+                  </View>
145
+                </Picker>
146
+              </mp-cell>
147
+              <mp-cell title='生日' extClass=''>
148
+                <Picker name='petBirthday' mode='date' onChange={(e) => { onDateChange('petBirthday', e.detail.value) }}>
149
+                  <View className='picker'>
150
+                    {dogDate.petBirthday}
151
+                  </View>
152
+                </Picker>
153
+              </mp-cell>
154
+              <mp-cell title='毛色' extClass=''>
155
+                <Input name='petColor' placeholder='请输入宠养区域' />
156
+              </mp-cell>
157
+              <mp-cell title='宠物照片' extClass=''>
158
+                {
159
+                  !imgUrl.img1 ?
160
+                    <View className='addImage' onClick={() => addImage('img1')} >
161
+                      <Text>+</Text>
162
+                    </View>
163
+                    :
164
+                    <Image className='dogImg1' name='img1' src={imgUrl.img1} onClick={() => addImage('img1')} />
165
+                }
166
+
167
+              </mp-cell>
168
+              <mp-cell title='免疫证明' extClass=''>
169
+                {
170
+                  !imgUrl.immunization ?
171
+                    <View className='addImage' onClick={() => addImage('immunization')} >
172
+                      <Text>+</Text>
173
+                    </View>
174
+                    :
175
+                    <Image className='dogImg1' name='immunization' src={imgUrl.immunization} onClick={() => addImage('immunization')} />
176
+                }
177
+                {/* <Input name='immunization' placeholder='请输入身份证号' type='idcard' /> */}
178
+              </mp-cell>
179
+              <mp-cell title='详细地址' extClass=''>
180
+                <Input name='address' placeholder='请输入详细地址' />
181
+              </mp-cell>
182
+              <mp-cell title='申领方式' extClass=''>
183
+                <View className='radio-list'>
184
+                  <RadioGroup name='applyMethod'>
185
+                    {modeList.map((item, i) => {
186
+                      return (
187
+                        <Label className='radio-list__label' for={i} key={i}>
188
+                          <Radio color='#FCD905' className='radio-list__radio' value={item.value} >{item.text}</Radio>
189
+                        </Label>
190
+                      )
191
+                    })}
192
+                  </RadioGroup>
193
+                </View>
194
+              </mp-cell>
195
+
196
+            </mp-cells>
197
+          </mp-form>
198
+          <View slot='button' style={{ margin: '4em 0 2em 0' }}>
199
+            <Button style={{ backgroundColor: '#fbd804', borderRadius: '40px', color: '#000', border: '0px' }} class='weui-btn' type='primary' loading={false} formType='submit'>确定</Button>
200
+          </View>
201
+        </Form>
202
+      </View>
203
+    </ScrollView >
204
+  )
205
+}
206
+
207
+
208
+
209
+

+ 22
- 0
src/pages/setDogLicense/style.less ファイルの表示

@@ -0,0 +1,22 @@
1
+.addImage {
2
+  width: 100px;
3
+  height: 100px;
4
+  border: 1px dashed #666;
5
+  display: flex;
6
+  align-items: center;
7
+  > Text {
8
+    text-align: center;
9
+    margin: 0 auto;
10
+    font-size: 60px;
11
+    font-weight: bold;
12
+  }
13
+}
14
+.dogImg1 {
15
+  width: 200px;
16
+  height: 150px;
17
+}
18
+.radio-list__radio {
19
+  width: 140px;
20
+  font-size: 35px;
21
+  transform: scale(0.9);
22
+}

+ 1
- 1
src/pages/setUser/index.jsx ファイルの表示

@@ -114,7 +114,7 @@ export default (props) => {
114 114
             </mp-cells>
115 115
           </mp-form>
116 116
           <View slot='button' style={{ margin: '4em 0 2em 0' }}>
117
-            <Button class='weui-btn' type='primary' loading={false} formType='submit'>确定</Button>
117
+            <Button style={{ backgroundColor: '#fbd804', borderRadius: '40px', color: '#000', border: '0px' }} class='weui-btn' type='primary' loading={false} formType='submit'>确定</Button>
118 118
           </View>
119 119
         </Form>
120 120
       </View>

+ 3
- 0
src/pages/setUser/style.less ファイルの表示

@@ -18,3 +18,6 @@
18 18
   width: 200px;
19 19
   height: 150px;
20 20
 }
21
+
22
+.botBottom {
23
+}