瀏覽代碼

Merge branch 'master' of http://git.ycjcjy.com/pet_identity/miniapp

[baozhangchao] 3 年之前
父節點
當前提交
368468e8b5

+ 1
- 1
project.config.json 查看文件

@@ -4,7 +4,7 @@
4 4
     "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
5 5
     "appid": "wxe44244d1a5ea3364",
6 6
     "setting": {
7
-        "urlCheck": true,
7
+        "urlCheck": false,
8 8
         "es6": false,
9 9
         "postcss": false,
10 10
         "minified": false,

+ 1
- 0
src/app.config.js 查看文件

@@ -10,6 +10,7 @@ export default {
10 10
     'pages/LicenseInfo/index',
11 11
     'pages/dogList/index',
12 12
     'pages/setDogInfo/index',
13
+    'pages/dogCardDetail/index',
13 14
   ],
14 15
   window: {
15 16
     backgroundTextStyle: 'light',

+ 0
- 61
src/components/Picker/index.jsx 查看文件

@@ -1,61 +0,0 @@
1
-import Taro from '@tarojs/taro';
2
-import { Picker, View } from '@tarojs/components';
3
-import { useMemo, useState } from 'react';
4
-import PropTypes from 'prop-types';
5
-
6
-// 暂时只支持单列普通选择器
7
-const XPicker = (props) => {
8
-  const { bindchange, onChange, range, value : propValue, rangeKey, rangeValue, placeholder = '请选择', ...leftProps } = props
9
-
10
-  const [innerValue, setInnerValue] = useState()
11
-
12
-  const handleChange = (e) => {
13
-    const data = range[e.detail.value]
14
-    const val = data[rangeValue]
15
-    e.detail.value = val
16
-    setInnerValue(data)
17
-
18
-    console.log('-----bindchange----->', bindchange)
19
-    console.log('-----onChange----->', onChange)
20
-
21
-    if (bindchange) {
22
-      bindchange(e, data)
23
-    }
24
-    if (onChange) {
25
-      onChange(e, data)
26
-    }
27
-  }
28
-
29
-  const value = useMemo(() => {
30
-    if (propValue === undefined || propValue === null) {
31
-      return undefined
32
-    }
33
-
34
-    for (let i in range) {
35
-      if (range[i][rangeValue] === propValue) {
36
-        setInnerValue(range[i])
37
-        return i;
38
-      }
39
-    }
40
-
41
-    return undefined;
42
-  }, [propValue, range, rangeValue])
43
-
44
-  const childViewStyle = useMemo(() => {
45
-    return innerValue ? {} : { color: '#858585' }
46
-  }, [innerValue])
47
-
48
-  return (
49
-    <Picker {...leftProps} mode='selector' range={range} value={value} rangeKey={rangeKey} onChange={handleChange}>
50
-      <View style={childViewStyle}>{innerValue === undefined ? placeholder : innerValue[rangeKey]}</View>
51
-    </Picker>
52
-  )
53
-}
54
-
55
-XPicker.behaviors = ['wx://form-field']
56
-XPicker.propTypes = {
57
-  behaviors: PropTypes.array
58
-}
59
-
60
-
61
-export default XPicker

+ 48
- 0
src/components/s-picker/index.js 查看文件

@@ -0,0 +1,48 @@
1
+Component({
2
+  behaviors: ['wx://form-field'],
3
+  options: {
4
+    addGlobalClass: true,
5
+  },
6
+  properties: {
7
+    name: {
8
+      type: String
9
+    },
10
+    value: {
11
+      type: undefined,
12
+    },
13
+    range: {
14
+      type: Array,
15
+    },
16
+    rangeKey: {
17
+      type: String,
18
+    },
19
+    rangeValue: {
20
+      type: String,
21
+    },
22
+    placeholder: {
23
+      type: String,
24
+      value: '请选择'
25
+    },
26
+  },
27
+  data: {
28
+    text: undefined,
29
+    index: undefined,
30
+  },
31
+  methods: {
32
+    bindChange: function(e) {
33
+
34
+      const index = e.detail.value
35
+      const data = this.data.range[index]
36
+      const value = data[this.data.rangeValue]
37
+      const text = data[this.data.rangeKey]
38
+
39
+      this.setData({
40
+        index,
41
+        text,
42
+        value,
43
+      })
44
+
45
+      this.triggerEvent('change', { value, data })
46
+    }
47
+  }
48
+})

+ 3
- 0
src/components/s-picker/index.json 查看文件

@@ -0,0 +1,3 @@
1
+{
2
+  "component": true
3
+}

+ 4
- 0
src/components/s-picker/index.wxml 查看文件

@@ -0,0 +1,4 @@
1
+<picker mode="selector" range="{{range}}" value="{{index}}" range-key="{{rangeKey}}" bindchange="bindChange" >
2
+  <view class="s-picker-placeholder" wx:if="{{index == undefined}}">{{placeholder}}</view>
3
+  <view wx:else>{{text}}</view>
4
+</picker>

+ 3
- 0
src/components/s-picker/index.wxss 查看文件

@@ -0,0 +1,3 @@
1
+.s-picker-placeholder {
2
+  color: #858585
3
+}

+ 10
- 0
src/pages/dogCardDetail/index.config.js 查看文件

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

+ 62
- 0
src/pages/dogCardDetail/index.jsx 查看文件

@@ -0,0 +1,62 @@
1
+import { View, Image, ScrollView } from '@tarojs/components'
2
+import './style.less'
3
+
4
+export default (props) => {
5
+  const status = 2;
6
+  return (
7
+    <ScrollView scrollY style={{ height: '100vh' }}>
8
+      <View className='dogCardDetail'>
9
+        <View className='card'>
10
+          <View className='title'>电&nbsp;&nbsp;&nbsp;子&nbsp;&nbsp;&nbsp;版&nbsp;&nbsp;&nbsp;犬&nbsp;&nbsp;&nbsp;证</View>
11
+          <View className='body'>
12
+            <View className='cardLeft'>
13
+              <View className='cell'>
14
+                <View className='lable'>犬主</View>:
15
+                <View className='content'>六花</View>
16
+              </View>
17
+              <View className='cell'>
18
+                <View className='lable'>电话</View>:
19
+                <View className='content'>18544446868</View>
20
+              </View>
21
+              <View className='cell'>
22
+                <View className='lable'>犬名</View>:
23
+                <View className='content'>噬嗥</View>
24
+              </View>
25
+            </View>
26
+            <View className='cardRight'>
27
+              <Image
28
+                className='thumb'
29
+                src='https://gimg2.baidu.com/image_search/src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fq_70%2Cc_zoom%2Cw_640%2Fimages%2F20181228%2Ff22539cd34044f5f821e9893f508765d.jpeg&refer=http%3A%2F%2F5b0988e595225.cdn.sohucs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1656163682&t=bec14da4c530bf5f0ae04ff8488a9ebd'
30
+              ></Image>
31
+            </View>
32
+          </View>
33
+          <View className='cell' style={{ marginTop: '0' }}>
34
+            <View className='lable'>状态</View>:
35
+            <View className={['state', 'color' + status]}>{status == 1 ? '正常' : status == 2 ? '过期' : '挂失'}</View>
36
+            {/* 挂失 续期 */}
37
+          </View>
38
+          <View className='cell'>
39
+            <View className='lable'>犬种</View>:
40
+            <View className='content'>银月狼神一族</View>
41
+          </View>
42
+          <View className='cell'>
43
+            <View className='lable'>毛色</View>:
44
+            <View className='content'>米白</View>
45
+          </View>
46
+          <View className='cell'>
47
+            <View className='lable'>证件号</View>:
48
+            <View className='content'>36559948485522</View>
49
+          </View>
50
+          <View className='cell'>
51
+            <View className='lable'>有效期</View>:
52
+            <View className='content'>2021-12-20~2022-12-20</View>
53
+          </View>
54
+          <View className='cell'>
55
+            <View className='lable'>住址</View>:
56
+            <View className='content'>江苏省南京市江宁区南京南站城际空间站旁边第一个小区的一期的219栋3304房最里面那间</View>
57
+          </View>
58
+        </View>
59
+      </View>
60
+    </ScrollView>
61
+  )
62
+}

+ 61
- 0
src/pages/dogCardDetail/style.less 查看文件

@@ -0,0 +1,61 @@
1
+.dogCardDetail{
2
+  padding: 32px;
3
+  .card{
4
+    background-color: rgb(251, 216, 4);
5
+    border-radius: 16px;
6
+    padding: 32px 16px;
7
+    .title{
8
+      font-size: 48px;
9
+      font-weight: bold;
10
+      text-align: center;
11
+      margin-bottom: 32px;
12
+    }
13
+    .cell{
14
+      margin: 16px 0;
15
+      display: flex;
16
+      .lable{
17
+        width: 3em;
18
+        display: inline-block;
19
+        text-align: justify;
20
+        text-align-last: justify;
21
+        padding: 8px 0;
22
+      }
23
+      .content{
24
+        flex: 1;
25
+        padding: 8px 16px;
26
+        background-color: white;
27
+      }
28
+      .state{
29
+        flex: 1;
30
+        padding: 8px 16px;
31
+        text-align: center;
32
+        letter-spacing: 0.5em;
33
+      }
34
+      .color1{
35
+        background-color: yellowgreen;
36
+      }
37
+      .color2{
38
+        background-color:red;
39
+      }
40
+      .color3{
41
+        background-color:rgb(170, 168, 168);
42
+      }
43
+    }
44
+    .cardLeft{
45
+      width: 60%;
46
+      display: inline-block;
47
+    }
48
+    .cardRight{
49
+      width: 40%;
50
+      display: inline-block;
51
+      text-align: center;
52
+      vertical-align: top;
53
+      .thumb{
54
+        width: 30vw;
55
+        height: 30vw;
56
+        margin: 16px 0 0 16px;
57
+      }
58
+      // 100vw-64px-32px*0.4
59
+    }
60
+  }
61
+}

+ 4
- 1
src/pages/index/index.jsx 查看文件

@@ -46,8 +46,11 @@ export default (props) => {
46 46
     Taro.navigateTo({url:'/pages/noticeInfo/index'})
47 47
   }
48 48
   const goDogLicenseList = (e) => {
49
+    // Taro.navigateTo({
50
+    //   url: '/pages/dogLicenseList/index'
51
+    // })
49 52
     Taro.navigateTo({
50
-      url: '/pages/dogLicenseList/index'
53
+      url: '/pages/dogCardDetail/index'
51 54
     })
52 55
   }
53 56
   return (

+ 2
- 1
src/pages/setUser/index.config.js 查看文件

@@ -8,7 +8,8 @@ export default {
8 8
     "mp-cells": "weui-miniprogram/cells/cells",
9 9
     "mp-cell": "weui-miniprogram/cell/cell",
10 10
     "mp-form-page": "weui-miniprogram/form-page/form-page",
11
-    "mp-form": "weui-miniprogram/form/form"
11
+    "mp-form": "weui-miniprogram/form/form",
12
+    "s-picker": "../../components/s-picker/index"
12 13
   }
13 14
 
14 15
 }

+ 1
- 2
src/pages/setUser/index.jsx 查看文件

@@ -5,7 +5,6 @@ import { setPersons } from '@/services/dogAPI';
5 5
 import { useModel } from '@/store';
6 6
 import { uploadFile } from '@/utils/request';
7 7
 import Form from '@/components/Form';
8
-import Picker from '@/components/Picker';
9 8
 
10 9
 import './style.less'
11 10
 
@@ -103,7 +102,7 @@ export default (props) => {
103 102
               </mp-cell>
104 103
               <mp-cell title='性别' extClass=''>
105 104
                 {/* <Input name='sex' placeholder='请输入卡号' /> */}
106
-                <Picker name='sex' rangeKey='text' rangeValue='value' range={userSex} />
105
+                <s-picker name='sex' rangeKey='text' rangeValue='value' range={userSex} value={person?.sex} />
107 106
               </mp-cell>
108 107
               <mp-cell title='手机号' extClass=''>
109 108
                 <Input name='phone' type='number' placeholder='请输入手机号' maxlength={11} value={person?.phone} />