李志伟 3 년 전
부모
커밋
0cf4e31ebc

+ 20
- 0
src/pages/bankCard/Card/index.jsx 파일 보기

@@ -0,0 +1,20 @@
1
+import { View,Image } from "@tarojs/components"
2
+import ABCImg from '@/assets/bank/ABCbank.png'
3
+import BOCImg from '@/assets/bank/BOCbank.png'
4
+import CCBImg from '@/assets/bank/CCBbank.png'
5
+
6
+export default (props) => {
7
+  const {type,value,onChange}=props
8
+  return (
9
+    <View className='bankCard' >
10
+      <Image src={
11
+        type==='abc'?ABCImg:
12
+        type==='boc'?BOCImg:
13
+        type==='ccb'?CCBImg:''
14
+        } className='CardImg'
15
+      />
16
+      <View className='cCode'>{value}</View>
17
+      <View className='unBind' onClick={onChange}>解除绑定</View>
18
+    </View>
19
+  )
20
+}

+ 11
- 0
src/pages/bankCard/Card/style.less 파일 보기

@@ -0,0 +1,11 @@
1
+.bankCard{
2
+  width: 100%;
3
+  height: calc( calc(100vw - 60px) * 0.36);
4
+  border-radius: 40px;
5
+  .CardImg{
6
+    width: 100%;
7
+    height: calc( calc(100vw - 60px) * 0.36);
8
+    position: absolute;
9
+  }
10
+  
11
+}

+ 7
- 0
src/pages/bankCard/index.config.js 파일 보기

@@ -0,0 +1,7 @@
1
+export default {
2
+  navigationBarTitleText: '我的银行卡',
3
+  navigationStyle: 'custom',
4
+  styleIsolation: 'shared',
5
+  enableShareAppMessage: true,
6
+  disableScroll: true,
7
+}

+ 21
- 0
src/pages/bankCard/index.jsx 파일 보기

@@ -0,0 +1,21 @@
1
+import { View } from "@tarojs/components"
2
+import withLayout from '@/layouts'
3
+import CustomNav from "@/components/CustomNav"
4
+import BankCard from './Card'
5
+import './style.less'
6
+
7
+export default withLayout((props) => {
8
+  const unBind=(val)=>{
9
+    console.log(val)
10
+  }
11
+  return (
12
+    <View className='page-index'>
13
+      <View className='index-navbar'>
14
+        <CustomNav title='我的银行卡' />
15
+      </View>
16
+      <View className='index-container bankCardBox'>
17
+        <BankCard type='abc' value='6217001700003637161' onChange={()=>unBind(6)} />
18
+      </View>
19
+    </View>
20
+  )
21
+})

+ 3
- 0
src/pages/bankCard/style.less 파일 보기

@@ -0,0 +1,3 @@
1
+.bankCardBox{
2
+  margin: 30px;
3
+}

+ 4
- 2
src/pages/index/components/User/index.jsx 파일 보기

@@ -18,7 +18,7 @@ import './style.less'
18 18
 export default (props) => {
19 19
   const { isLogin } = props
20 20
   const handleAccount = () => { 
21
-    
21
+    Taro.navigateTo({ url: '/pages/userInfo/index' });
22 22
    }
23 23
   const handleAboutUs = () => { }
24 24
   const handleUpdate = () => { }
@@ -32,7 +32,9 @@ export default (props) => {
32 32
   const goWallet = () => {
33 33
     Taro.navigateTo({ url: '/pages/wallet/index?balance=2022.56' });
34 34
    }
35
-  const goBank = () => { }
35
+  const goBank = () => {
36
+    Taro.navigateTo({ url: '/pages/bankCard/index' });
37
+   }
36 38
   const signOut = () => { 
37 39
     Taro.reLaunch({ url: '/pages/index/index?tab=2' });
38 40
   }

+ 7
- 0
src/pages/userInfo/index.config.js 파일 보기

@@ -0,0 +1,7 @@
1
+export default {
2
+  navigationBarTitleText: '个人信息',
3
+  navigationStyle: 'custom',
4
+  styleIsolation: 'shared',
5
+  enableShareAppMessage: true,
6
+  disableScroll: true,
7
+}

+ 83
- 0
src/pages/userInfo/index.jsx 파일 보기

@@ -0,0 +1,83 @@
1
+import { useState } from "react"
2
+import Taro from "@tarojs/taro"
3
+import { Input, View, Image } from "@tarojs/components"
4
+import withLayout from '@/layouts'
5
+import CustomNav from "@/components/CustomNav"
6
+import MyButton from "@/components/MyButton"
7
+import banner1 from '@/assets/banner/1.jpg'
8
+import resetImg from '@/assets/user/cancel.png'
9
+import './style.less'
10
+
11
+export default withLayout((props) => {
12
+  const [name, setName] = useState()
13
+  const [phone, setPhone] = useState()
14
+  const [avatar, setAvatar] = useState(banner1)
15
+  const changeName = (e) => {
16
+    setName(e.detail.value)
17
+  }
18
+  const changePhone = (e) => {
19
+    setPhone(e.detail.value)
20
+  }
21
+  const handleSave = () => {
22
+    console.log('保存成功')
23
+    Taro.navigateBack({delta:1})
24
+  }
25
+  const resetName=()=>{
26
+    setName()
27
+  }
28
+  const resetPhone=()=>{
29
+    setPhone()
30
+  }
31
+  const changeAvatar=()=>{
32
+    Taro.chooseImage({
33
+      count: 1,
34
+      success: function (res) {
35
+        setAvatar(res.tempFilePaths[0])
36
+        // uploadFile(res.tempFilePaths[0]).then((res2) => {
37
+        //   const date = {
38
+        //     targetId: roomId,
39
+        //     targetType: 'room',
40
+        //     content: res2,
41
+        //     contentType: 'image'
42
+        //   }
43
+        //   saveExtend(date)
44
+        //   setReset(!reset)
45
+        // })
46
+      }
47
+    })
48
+  }
49
+  return (
50
+    <View className='page-index'>
51
+      <View className='index-navbar'>
52
+        <CustomNav title='个人信息' />
53
+      </View>
54
+      <View className='index-container userCard'>
55
+        <View className='avatar' onClick={changeAvatar}>
56
+          <Image src={avatar} className='avatarImg' />
57
+          <View className='change'>更换头像</View>
58
+        </View>
59
+        <View className='userCell'>
60
+          <View>姓名:</View>
61
+          <View style={{ display: 'flex', alignItems: 'center', height: '54px' }}>
62
+            <Input type='text' placeholder='请输入您的姓名' value={name} onBlur={changeName} className='userName' />
63
+            <View className='reset' onClick={resetName}>
64
+              <Image src={resetImg} className='close' />
65
+            </View>
66
+          </View>
67
+        </View>
68
+        <View className='userCell'>
69
+          <View>手机号:</View>
70
+          <View style={{ display: 'flex', alignItems: 'center', height: '54px' }}>
71
+            <Input type='text' placeholder='请输入您的手机号' value={phone} onBlur={changePhone} className='userName' />
72
+            <View className='reset' onClick={resetPhone}>
73
+              <Image src={resetImg} className='close' />
74
+            </View>
75
+          </View>
76
+        </View>
77
+        <View className='bottomBtn'>
78
+          <MyButton value='保存' onClick={handleSave} />
79
+        </View>
80
+      </View>
81
+    </View>
82
+  )
83
+})

+ 54
- 0
src/pages/userInfo/style.less 파일 보기

@@ -0,0 +1,54 @@
1
+.userCard{
2
+  margin: 30px;
3
+  .avatar{
4
+    height: 184px;
5
+    background: #FFF;
6
+    box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.12);
7
+    display: flex;
8
+    align-items: center;
9
+    .avatarImg{
10
+      width: 124px;
11
+      height: 124px;
12
+      background: #F2F2F2;
13
+      border: 4px solid #FFFFFF;
14
+      border-radius: 50%;
15
+    }
16
+    .change{
17
+      font-size: 34px;
18
+      font-weight: 500;
19
+      color: #333333;
20
+      position: absolute;
21
+      right: 0;
22
+    }
23
+  }
24
+  .userCell{
25
+    background: #FFF;
26
+    box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.12);
27
+    font-size: 34px;
28
+    font-weight: bold;
29
+    color: #333333;
30
+    margin-top: 80px;
31
+    .userName{
32
+      height: 108px;
33
+      flex: 1;
34
+    }
35
+    .reset{
36
+      flex: none;
37
+      width: 100px;
38
+      height: 100%;
39
+      display: flex;
40
+      align-items: center;
41
+      .close{
42
+        width: 36px;
43
+        height: 36px;
44
+        margin: auto;
45
+      }
46
+    }
47
+  }
48
+  .bottomBtn{
49
+    margin-bottom: 30px;
50
+    position: absolute;
51
+    bottom: 0;
52
+    width: 100%;
53
+  }
54
+}

+ 8
- 0
src/routes.js 파일 보기

@@ -34,6 +34,14 @@ const mainPages = [
34 34
     title: '提现',
35 35
     page: 'pages/withdrawal/index',
36 36
   },
37
+  {
38
+    title: '我的银行卡',
39
+    page: 'pages/bankCard/index',
40
+  },
41
+  {
42
+    title: '个人信息',
43
+    page: 'pages/userInfo/index',
44
+  },
37 45
   
38 46
 ];
39 47