Yansen 5 年之前
父節點
當前提交
4a31db64a3

+ 5
- 5
config/dev.js 查看文件

@@ -3,14 +3,14 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"https://dev.fangdeal.cn"',//测试
6
+    HOST: '"https://dev.fangdeal.cn"', //测试
7 7
     WSS_HOST: '"wss://dev.fangdeal.cn"',
8 8
     // HOST: '"http://192.168.2.43:8080"',
9 9
     // WSS_HOST: '"ws://192.168.2.43:8080"',
10
-    OSS_PATH: 'https://njcj.oss-cn-shanghai.aliyuncs.com/',
11
-    OSS_FAST_PATH: 'https://njcj.oss-accelerate.aliyuncs.com/',
12
-    Version: 'V3.5.24'
10
+    OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",
11
+    OSS_FAST_PATH: "https://njcj.oss-accelerate.aliyuncs.com/",
12
+    Version: "V3.5.26"
13 13
   },
14 14
   weapp: {},
15 15
   h5: {}
16
-}
16
+};

+ 6
- 6
config/prod.js 查看文件

@@ -3,14 +3,14 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
-    // HOST: '"https://dev.fangdeal.cn"',//测试
6
+    // HOST: '"https://dev.fangdeal.cn"', //测试
7 7
     // WSS_HOST: '"wss://dev.fangdeal.cn"',
8
-    HOST: '"https://wx.fangdeal.cn"',//正式
8
+    HOST: '"https://wx.fangdeal.cn"', //正式
9 9
     WSS_HOST: '"wss://wx.fangdeal.cn"',
10
-    OSS_PATH: 'https://njcj.oss-cn-shanghai.aliyuncs.com/',
11
-    OSS_FAST_PATH: 'https://njcj.oss-accelerate.aliyuncs.com/',
12
-    Version: 'V3.5.24'
10
+    OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",
11
+    OSS_FAST_PATH: "https://njcj.oss-accelerate.aliyuncs.com/",
12
+    Version: "V3.5.26"
13 13
   },
14 14
   weapp: {},
15 15
   h5: {}
16
-}
16
+};

+ 7
- 1
src/app.scss 查看文件

@@ -61,4 +61,10 @@
61 61
 }
62 62
 .wxParse-inline {
63 63
   line-height: 50px;
64
-}
64
+}
65
+
66
+.water-mask-box {
67
+  position: absolute;
68
+  width: 100%;
69
+  height: 100%;
70
+}

+ 15
- 0
src/components/PhoneMask/index.jsx 查看文件

@@ -0,0 +1,15 @@
1
+import Taro, { useState } from '@tarojs/taro';
2
+import { maskPhone } from '@/utils/tools';
3
+
4
+export default function PhoneMask(props) {
5
+  const { phone, disable = false } = props
6
+  const [mask, setMask] = useState(true);
7
+
8
+  const toggle = () => setMask(!mask);
9
+  const text = mask ? maskPhone(phone || '') : phone;
10
+
11
+  return (
12
+    <Text>{text}</Text>
13
+  )
14
+}
15
+

+ 45
- 0
src/components/WaterMask/index.jsx 查看文件

@@ -0,0 +1,45 @@
1
+import Taro from '@tarojs/taro';
2
+import classNames from 'classnames';
3
+import { View, Text } from '@tarojs/components';
4
+import { times } from '@/utils/tools';
5
+
6
+import './style.scss';
7
+
8
+export default function WaterMask(props) {
9
+  const {
10
+    className,
11
+    style,
12
+    text,
13
+    textClassName,
14
+    image,
15
+    imageClassName,
16
+    repeat = 3,
17
+  } = props;
18
+
19
+  const mainClass = classNames('water-mask', className);
20
+  const textClass = classNames('water-mask-text', textClassName);
21
+
22
+  return (
23
+    <View
24
+      className={mainClass}
25
+      style={style}
26
+    >
27
+      {text ? (
28
+        <View className={textClass}>
29
+          {times(repeat).map((_, inx) => {
30
+            const key = `wt-${inx}`
31
+            return (
32
+              <View className="water-mask-text-item" key={key}>
33
+                <View className="aspect-ratio" />
34
+                <View className="inner-container">{text}</View>
35
+              </View>
36
+            )
37
+          })}
38
+        </View>) : null}
39
+    </View>
40
+  )
41
+}
42
+
43
+WaterMask.options = {
44
+  addGlobalClass: true
45
+}

+ 36
- 0
src/components/WaterMask/style.scss 查看文件

@@ -0,0 +1,36 @@
1
+
2
+.water-mask {
3
+  z-index: 0;
4
+  height: 100%;
5
+  width: 100%;
6
+  overflow: hidden;
7
+
8
+  &-text {
9
+    color: rgba($color: #000000, $alpha: 0.08);
10
+    font-size: 36rpx;
11
+    text-align: center;
12
+
13
+    &-item {
14
+      display: inline-block;
15
+      position: relative;
16
+      min-width: 25%;
17
+      line-height: 1.2em;
18
+      transform:rotate(300deg);
19
+      transform-origin: 100% 0%;
20
+
21
+      .aspect-ratio {
22
+        width: 100%;
23
+        height: 0;
24
+        padding-bottom: 100%;
25
+      }
26
+
27
+      .inner-container {
28
+        position: absolute;
29
+        top: 0;
30
+        right: 0;
31
+        bottom: 0;
32
+        left: 0;
33
+      }
34
+    }
35
+  }
36
+}

+ 139
- 91
src/useless/pages/agent/client/index.js 查看文件

@@ -1,106 +1,115 @@
1
-import Taro, { Component } from '@tarojs/taro';
2
-import './index.scss'
3
-import { getClientList } from '@/services/client'
4
-import { getItemList } from '@/services/item'
5
-import emptyImg from '@/assets/empty.png'
6
-import dayjs from 'dayjs'
7
-import { savePoint, updatePoint } from '@/services/common'
8
-import { connect } from '@tarojs/redux'
9
-import { transferImage } from '@/utils/tools'
10
-@connect(
11
-  state => ({ ...state.project, ...state.city }))
12
-export default class Index extends Component {
1
+import Taro, { Component } from "@tarojs/taro";
2
+import "./index.scss";
3
+import { getClientList } from "@/services/client";
4
+import { getItemList } from "@/services/item";
5
+import emptyImg from "@/assets/empty.png";
6
+import dayjs from "dayjs";
7
+import { savePoint, updatePoint } from "@/services/common";
8
+import { connect } from "@tarojs/redux";
9
+import { transferImage, maskPhone } from "@/utils/tools";
10
+import WaterMask from "@/components/WaterMask";
13 11
 
12
+@connect(state => ({ ...state.project, ...state.city, ...state.user }))
13
+export default class Index extends Component {
14 14
   config = {
15
-    navigationBarTitleText: '我的客户'
16
-  }
15
+    navigationBarTitleText: "我的客户"
16
+  };
17 17
 
18 18
   state = {
19 19
     list: [],
20
-    status: ['报备', '到访', '认购', '签约'],//报备客户状态
21
-    recomstatus: ['推荐', '到访', '认购', '签约'],//推荐客户状态
22
-    verifyStatus: ['待审核', '审核同意', '未通过'],
23
-    floorList: '',
24
-    floor: '',
20
+    status: ["报备", "到访", "认购", "签约"], //报备客户状态
21
+    recomstatus: ["推荐", "到访", "认购", "签约"], //推荐客户状态
22
+    verifyStatus: ["待审核", "审核同意", "未通过"],
23
+    floorList: "",
24
+    floor: "",
25 25
     recordId: null,
26
-    noRecord: false,
27
-  }
26
+    noRecord: false
27
+  };
28 28
   componentWillMount() {
29 29
     savePoint({
30
-      event: 'list',
31
-      eventType: 'agent',
32
-      propertyName: '我的客户',
33
-      data: '{}'
30
+      event: "list",
31
+      eventType: "agent",
32
+      propertyName: "我的客户",
33
+      data: "{}"
34 34
     }).then(res => {
35 35
       this.setState({
36 36
         recordId: res.recordId
37
-      })
38
-      console.log('我的客户')
39
-    })
37
+      });
38
+      console.log("我的客户");
39
+    });
40 40
   }
41 41
 
42
-
43 42
   componentWillUnmount() {
44
-    const { recordId } = this.state
45
-    recordId && updatePoint(recordId)
43
+    const { recordId } = this.state;
44
+    recordId && updatePoint(recordId);
46 45
   }
47 46
   componentDidMount() {
48
-    this.loadList()
47
+    this.loadList();
49 48
   }
50 49
   //获取楼盘列表
51 50
   loadGetFloor() {
52 51
     const params = {
53 52
       pageNumber: 1,
54 53
       pageSize: 50,
55
-      keywords: ''
56
-    }
54
+      keywords: ""
55
+    };
57 56
     getItemList(params).then(res => {
58 57
       this.setState({
59 58
         floorList: res
60
-      })
61
-    })
59
+      });
60
+    });
62 61
   }
63 62
   loadList() {
64 63
     var that = this;
65 64
     const params = {
66 65
       pageNumber: 1,
67 66
       pageSize: 50,
68
-      keywords: ''
69
-    }
70
-    this.loadGetFloor()
67
+      keywords: ""
68
+    };
69
+    this.loadGetFloor();
71 70
     getClientList(params).then(res => {
72
-      const list = res.records
73
-      that.setState({
74
-        list,
75
-        noRecord: (list || []).length ? false : true
76
-      }, () => {
77
-      })
78
-    })
71
+      const list = res.records;
72
+      that.setState(
73
+        {
74
+          list,
75
+          noRecord: (list || []).length ? false : true
76
+        },
77
+        () => {}
78
+      );
79
+    });
79 80
   }
80 81
 
81 82
   formatDate(value) {
82
-    return dayjs(value).format('YYYY-MM-DD')
83
+    return dayjs(value).format("YYYY-MM-DD");
83 84
   }
84 85
   navigateTo(id) {
85
-    Taro.navigateTo({ url: `/useless/pages/agent/progress/index?customerId=${id}` })
86
+    Taro.navigateTo({
87
+      url: `/useless/pages/agent/progress/index?customerId=${id}`
88
+    });
86 89
   }
87 90
   getName(dict, id) {
88
-    dict = dict.records || []
91
+    dict = dict.records || [];
89 92
     // let floorName = (dict.filter(({ buildingId: target }) => id === target)[0] || {}).name
90
-    return (dict.filter(({ buildingId: target }) => id === target)[0] || {}).buildingName
91
-
93
+    return (dict.filter(({ buildingId: target }) => id === target)[0] || {})
94
+      .buildingName;
92 95
   }
93 96
 
94 97
   toRecomonedPage() {
95
-    console.log(this.props, "this.props")
98
+    console.log(this.props, "this.props");
96 99
     Taro.navigateTo({
97
-      url: `/useless/pages/agent/recommend/index?type=index&cityId=` + this.props.curCity.id
98
-    })
100
+      url:
101
+        `/useless/pages/agent/recommend/index?type=index&cityId=` +
102
+        this.props.curCity.id
103
+    });
99 104
   }
100 105
   render() {
101
-    const { list, status, floorList, noRecord } = this.state
106
+    const { list, status, floorList, noRecord } = this.state;
107
+    const { userInfo } = this.props;
108
+    const { person = {} } = userInfo || {};
109
+    const waterText = person.nickname;
110
+
102 111
     return (
103
-      <View className='myClient'>
112
+      <View className="myClient">
104 113
         {/* <View className='search__box'>
105 114
           <Search placeholder='搜索客户姓名/手机号'></Search>
106 115
         </View> */}
@@ -108,14 +117,18 @@ export default class Index extends Component {
108 117
         {/*<View className='client__status'>
109 118
              <Text>{status[item.status - 1]}</Text>
110 119
           </View>*/}
111
-        {noRecord &&
120
+        {noRecord && (
112 121
           <View className="empty">
113
-            <Image className="empty__img" mode="widthFix" src={emptyImg}></Image>
122
+            <Image
123
+              className="empty__img"
124
+              mode="widthFix"
125
+              src={emptyImg}
126
+            ></Image>
114 127
             <View className="empty__text">暂无我的客户数据~</View>
115 128
           </View>
116
-        }
117
-        {!noRecord &&
118
-          <View className='client__content'>
129
+        )}
130
+        {!noRecord && (
131
+          <View className="client__content">
119 132
             <ScrollView
120 133
               scrollY
121 134
               scroll-with-animation
@@ -123,48 +136,83 @@ export default class Index extends Component {
123 136
               className="list"
124 137
               style={{
125 138
                 height: "100vh"
126
-              }}>
127
-              {
128
-                list.map((item, index) => {
129
-                  return (
130
-                    <View className='client__list' key={index + 'client'} onClick={this.navigateTo.bind(this, item.customerId)}>
131
-                      <Image className='bg' src={item.verifyStatus == 2 ? transferImage(require('@/assets/person/card1.png')) : transferImage(require('@/assets/person/card2.png'))}></Image>
132
-                      <View className='client'>
133
-                        <View className='client__status2'>
134
-                          {
135
-                            //报备1 ,推荐2
136
-                            item.reportRecommendStatus == 1 ? (<Text>{status[item.status - 1]}</Text>) : (<Text>{item.verifyStatus == 1 ? recomstatus[item.status - 1] : verifyStatus[item.verifyStatus]}</Text>)
137
-                          }
138
-                          {/* <Text>{item.verifyStatus==1?status[item.status-1]:verifyStatus[item.verifyStatus]}</Text> */}
139
-                        </View>
140
-                        <View className='client__top'>
141
-                          <View className='client__infor'>
142
-                            <Text className='client__name'>{item.name} </Text>
143
-                            <Image className='sex' src={item.sex == 1 ? require('@/assets/person/guest/man.png') : require('@/assets/person/guest/women.png')} mode='widthFix'></Image>
144
-                          </View>
139
+              }}
140
+            >
141
+              {list.map((item, index) => {
142
+                return (
143
+                  <View
144
+                    className="client__list"
145
+                    key={index + "client"}
146
+                    onClick={this.navigateTo.bind(this, item.customerId)}
147
+                  >
148
+                    <Image
149
+                      className="bg"
150
+                      src={
151
+                        item.verifyStatus == 2
152
+                          ? transferImage(require("@/assets/person/card1.png"))
153
+                          : transferImage(require("@/assets/person/card2.png"))
154
+                      }
155
+                    ></Image>
145 156
 
157
+                    <View className="water-mask-box">
158
+                      <WaterMask text={waterText} />
159
+                    </View>
146 160
 
161
+                    <View className="client">
162
+                      <View className="client__status2">
163
+                        {//报备1 ,推荐2
164
+                        item.reportRecommendStatus == 1 ? (
165
+                          <Text>{status[item.status - 1]}</Text>
166
+                        ) : (
167
+                          <Text>
168
+                            {item.verifyStatus == 1
169
+                              ? recomstatus[item.status - 1]
170
+                              : verifyStatus[item.verifyStatus]}
171
+                          </Text>
172
+                        )}
173
+                        {/* <Text>{item.verifyStatus==1?status[item.status-1]:verifyStatus[item.verifyStatus]}</Text> */}
174
+                      </View>
175
+                      <View className="client__top">
176
+                        <View className="client__infor">
177
+                          <Text className="client__name">{item.name} </Text>
178
+                          <Image
179
+                            className="sex"
180
+                            src={
181
+                              item.sex == 1
182
+                                ? require("@/assets/person/guest/man.png")
183
+                                : require("@/assets/person/guest/women.png")
184
+                            }
185
+                            mode="widthFix"
186
+                          ></Image>
147 187
                         </View>
188
+                      </View>
148 189
 
149
-                        <View className='phone'>手机: {item.phone}</View>
150
-                        <View className='phone'>意向楼盘: {item.intention ? item.intention : '暂无'}</View>
151
-
190
+                      <View className="phone">
191
+                        手机: {maskPhone(item.phone)}
192
+                      </View>
193
+                      <View className="phone">
194
+                        意向楼盘: {item.intention ? item.intention : "暂无"}
152 195
                       </View>
153
-                      <View className='time'>{dayjs(item.createDate).format('YYYY-MM-DD HH:mm:ss')}</View>
154 196
                     </View>
155
-                  )
156
-                })
157
-              }
197
+                    <View className="time">
198
+                      {dayjs(item.createDate).format("YYYY-MM-DD HH:mm:ss")}
199
+                    </View>
200
+                  </View>
201
+                );
202
+              })}
158 203
             </ScrollView>
159 204
           </View>
160
-        }
205
+        )}
161 206
 
162 207
         {/* <View className='recommend' onClick={this.toRecomonedPage}>123</View> */}
163
-        <View className="recommend" onClick={this.toRecomonedPage}  >
164
-          <Image src={transferImage(require('@/assets/tuijiankehu.png'))} className='home-img'></Image>
208
+        <View className="recommend" onClick={this.toRecomonedPage}>
209
+          <Image
210
+            src={transferImage(require("@/assets/tuijiankehu.png"))}
211
+            className="home-img"
212
+          ></Image>
165 213
           <Text className="text">推荐</Text>
166 214
         </View>
167 215
       </View>
168 216
     );
169 217
   }
170
-}
218
+}

+ 166
- 117
src/useless/pages/agent/progress/index.js 查看文件

@@ -1,68 +1,74 @@
1
-import Taro, { Component } from '@tarojs/taro';
2
-import './index.scss'
3
-import buildImg from '@/assets/agent/build.png'
4
-import phoneImg from '@/assets/agent/Iphone.png'
5
-import { clientProgress } from '@/services/client'
6
-import { getItemList } from '@/services/item'
7
-import { getCardList } from '@/services/card'
8
-import { savePoint, updatePoint } from '@/services/common'
1
+import Taro, { Component } from "@tarojs/taro";
2
+import "./index.scss";
3
+import buildImg from "@/assets/agent/build.png";
4
+import phoneImg from "@/assets/agent/Iphone.png";
5
+import { clientProgress } from "@/services/client";
6
+import { getItemList } from "@/services/item";
7
+import { getCardList } from "@/services/card";
8
+import { savePoint, updatePoint } from "@/services/common";
9
+// import { maskPhone } from "@/utils/tools";
10
+import WaterMask from "@/components/WaterMask";
11
+import { connect } from "@tarojs/redux";
12
+
9 13
 // import { zhuge } from '@/utils/zhuge-wx-mpvue.min'
10 14
 
15
+@connect(state => ({ ...state.user }))
11 16
 export default class Index extends Component {
12
-
13 17
   config = {
14
-    navigationBarTitleText: '客户进度'
15
-  }
18
+    navigationBarTitleText: "客户进度"
19
+  };
16 20
   // console.log(this.$router.params)//链接参数
17 21
   state = {
18
-    processData: [{
19
-      icon: 'waiting',
20
-      color: 'rgba(0,0,0,0.1)',
21
-      state: 1
22
-    },
23
-    {
24
-      icon: 'waiting',
25
-      color: 'rgba(0,0,0,0.1)',
26
-      state: 2
27
-    },
28
-    {
29
-      icon: 'waiting',
30
-      color: 'rgba(0,0,0,0.1)',
31
-      state: 3
32
-    },
33
-    {
34
-      icon: 'waiting',
35
-      color: 'rgba(0,0,0,0.1)',
36
-      state: 4
37
-    }],
22
+    processData: [
23
+      {
24
+        icon: "waiting",
25
+        color: "rgba(0,0,0,0.1)",
26
+        state: 1
27
+      },
28
+      {
29
+        icon: "waiting",
30
+        color: "rgba(0,0,0,0.1)",
31
+        state: 2
32
+      },
33
+      {
34
+        icon: "waiting",
35
+        color: "rgba(0,0,0,0.1)",
36
+        state: 3
37
+      },
38
+      {
39
+        icon: "waiting",
40
+        color: "rgba(0,0,0,0.1)",
41
+        state: 4
42
+      }
43
+    ],
38 44
     detail: {},
39
-    floorList: '',//楼盘信息
40
-    adviserList: '',//置业顾问信息
41
-    floor: '',
42
-    adviser: '',
43
-    adviserPhone: '',
44
-    phone: '',
45
-    recordId:null
46
-  }
45
+    floorList: "", //楼盘信息
46
+    adviserList: "", //置业顾问信息
47
+    floor: "",
48
+    adviser: "",
49
+    adviserPhone: "",
50
+    phone: "",
51
+    recordId: null
52
+  };
47 53
   componentWillMount() {
48 54
     // this.setPeocessIcon()
49 55
 
50
-    this.loadList()
56
+    this.loadList();
51 57
     savePoint({
52
-      event: 'progress',
53
-      eventType: 'agent',
54
-      propertyName: '客户进度',
55
-      data:'{}'
58
+      event: "progress",
59
+      eventType: "agent",
60
+      propertyName: "客户进度",
61
+      data: "{}"
56 62
     }).then(res => {
57 63
       this.setState({
58
-        recordId:res.recordId
59
-      })
60
-      console.log('客户进度')
61
-    })
64
+        recordId: res.recordId
65
+      });
66
+      console.log("客户进度");
67
+    });
62 68
   }
63
-  componentWillUnmount(){
64
-    const { recordId } = this.state
65
-    recordId && updatePoint(recordId)
69
+  componentWillUnmount() {
70
+    const { recordId } = this.state;
71
+    recordId && updatePoint(recordId);
66 72
   }
67 73
   loadList() {
68 74
     var that = this;
@@ -70,61 +76,69 @@ export default class Index extends Component {
70 76
     getItemList().then(res => {
71 77
       that.setState({
72 78
         floorList: res
73
-      })
74
-    })
79
+      });
80
+    });
75 81
     // 获取置业顾问列表
76 82
     const params = {
77 83
       pageNumber: 1,
78 84
       pageSize: 50
79
-    }
85
+    };
80 86
     getCardList(params).then(res => {
81
-      that.setState({
82
-        adviserList: res.records
83
-      }, () => {
84
-        that.getClientData()
85
-      })
86
-    })
87
+      that.setState(
88
+        {
89
+          adviserList: res.records
90
+        },
91
+        () => {
92
+          that.getClientData();
93
+        }
94
+      );
95
+    });
87 96
   }
88 97
   getName(dict, id, data) {
89
-    dict = dict.records || []
98
+    dict = dict.records || [];
90 99
     var that = this;
91
-    if (data == 'floor') {
92
-      return  (dict.filter(({ buildingId: target }) => id === target)[0] || {}).buildingName
93
-      
100
+    if (data == "floor") {
101
+      return (dict.filter(({ buildingId: target }) => id === target)[0] || {})
102
+        .buildingName;
94 103
     } else {
95
-      var adviserName = (dict.filter(({ id: target }) => id === target)[0] || {}).name
96
-      var phone = (dict.filter(({ id: target }) => id === target)[0] || {}).phone
97
-      var photo = (dict.filter(({ id: target }) => id === target)[0] || {}).photo
104
+      var adviserName = (
105
+        dict.filter(({ id: target }) => id === target)[0] || {}
106
+      ).name;
107
+      var phone = (dict.filter(({ id: target }) => id === target)[0] || {})
108
+        .phone;
109
+      var photo = (dict.filter(({ id: target }) => id === target)[0] || {})
110
+        .photo;
98 111
       that.setState({
99 112
         adviser: adviserName,
100 113
         adviserPhone: phone,
101 114
         photo: photo
102
-      })
115
+      });
103 116
     }
104
-
105 117
   }
106 118
   getClientData() {
107 119
     var that = this;
108
-    console.log('customerId:' + this.$router.params.customerId)
109
-    let { customerId = '4c6077cd39dd2a4b3caa10a7539c0a94' } = this.$router.params
120
+    console.log("customerId:" + this.$router.params.customerId);
121
+    let {
122
+      customerId = "4c6077cd39dd2a4b3caa10a7539c0a94"
123
+    } = this.$router.params;
110 124
     clientProgress(customerId).then(res => {
111
-      console.log(res)
112
-      that.getName(that.state.floorList, parseInt(res.intention), 'floor')
113
-      that.getName(that.state.adviserList, res.realtyConsultant, 'adviser')
125
+      console.log(res);
126
+      that.getName(that.state.floorList, parseInt(res.intention), "floor");
127
+      that.getName(that.state.adviserList, res.realtyConsultant, "adviser");
114 128
       // that.getName(that.state.adviserList, 'b6ca865fb4b1cd1b159f415a8b3ea774')//测试
115 129
 
116
-      var index = res.status//记录状态为1的最后的位置
130
+      var index = res.status; //记录状态为1的最后的位置
117 131
       //进度条的状态
118
-      var processArr = this.state.processData
132
+      var processArr = this.state.processData;
119 133
       for (var i = 0; i < processArr.length; i++) {
120
-        var item = processArr[i]
121
-        console.log('item' + item)
134
+        var item = processArr[i];
135
+        console.log("item" + item);
122 136
         if (item.state == index) {
123
-          processArr[i].icon = 'success'
124
-          processArr[i].color = 'rgba(255,0,0,1)'
137
+          processArr[i].icon = "success";
138
+          processArr[i].color = "rgba(255,0,0,1)";
125 139
         } else {
126
-          processArr[i].icon = 'waiting'
127
-          processArr[i].color = 'rgba(0,0,0,0.1)'
140
+          processArr[i].icon = "waiting";
141
+          processArr[i].color = "rgba(0,0,0,0.1)";
128 142
         }
129 143
       }
130 144
 
@@ -140,54 +154,89 @@ export default class Index extends Component {
140 154
       that.setState({
141 155
         processData: processArr,
142 156
         detail: res
143
-      })
144
-    })
157
+      });
158
+    });
145 159
   }
146 160
 
147 161
   render() {
148
-    const { detail,floorList} = this.state
162
+    const { detail, floorList } = this.state;
163
+    const { userInfo } = this.props;
164
+    const { person = {} } = userInfo || {};
165
+    const waterText = person.nickname;
166
+
149 167
     return (
150
-      <View className='client__progress'>
151
-        <View className='client__infor'>
152
-          <View className='clieng__name'>{detail.name}</View>
153
-          <View className='clieng__build'><Image mode="widthFix" className='build__img' src={buildImg}></Image>意向楼盘:{detail.intention || '暂无'}</View>
154
-          <View className='clieng__phone'><Image mode="widthFix" className='phone__img' src={phoneImg}></Image>{detail.phone || '暂无'}</View>
168
+      <View className="client__progress">
169
+        <View className="client__infor">
170
+          <View className="clieng__name">{detail.name}</View>
171
+          <View className="clieng__build">
172
+            <Image
173
+              mode="widthFix"
174
+              className="build__img"
175
+              src={buildImg}
176
+            ></Image>
177
+            意向楼盘:{detail.intention || "暂无"}
178
+          </View>
179
+          <View className="clieng__phone">
180
+            <Image
181
+              mode="widthFix"
182
+              className="phone__img"
183
+              src={phoneImg}
184
+            ></Image>
185
+            {detail.phone || "暂无"}
186
+          </View>
155 187
           {/* <Image className='client__img' src={headImg}></Image> */}
156 188
         </View>
157
-        <View className='progress__infor'>
158
-          <View className='recommended__progress'>推荐进度</View>
159
-          <View className='recommended__step'>
160
-            <View className='step'>
161
-              {
162
-                this.state.processData.map((item, index) => {
163
-                  return (
164
-                    <View className='step_tip' key={index+'step'}>
165
-                      <Icon type={item.icon} size="20" color={item.color} />
166
-                      <Text className={index === 3 ? 'strip hide' : 'strip'}></Text>
167
-                    </View>
168
-                  )
169
-                })
170
-              }
189
+        <View className="progress__infor">
190
+          <View className="water-mask-box">
191
+            <WaterMask text={waterText} repeat={20} />
192
+          </View>
193
+
194
+          <View className="recommended__progress">推荐进度</View>
195
+          <View className="recommended__step">
196
+            <View className="step">
197
+              {this.state.processData.map((item, index) => {
198
+                return (
199
+                  <View className="step_tip" key={index + "step"}>
200
+                    <Icon type={item.icon} size="20" color={item.color} />
201
+                    <Text
202
+                      className={index === 3 ? "strip hide" : "strip"}
203
+                    ></Text>
204
+                  </View>
205
+                );
206
+              })}
171 207
             </View>
172
-            <View className='step__txt'>
173
-              <View className='txt'>{item.reportRecommendStatus == 1 ? '报备' : '推荐'}<View className='tip'></View></View>
174
-              <View className='txt'>到访<View className='tip'></View></View>
175
-              <View className='txt'>认购<View className='tip'></View></View>
176
-              <View className='txt'>签约<View className='tip'></View></View>
208
+            <View className="step__txt">
209
+              <View className="txt">
210
+                {item.reportRecommendStatus == 1 ? "报备" : "推荐"}
211
+                <View className="tip"></View>
212
+              </View>
213
+              <View className="txt">
214
+                到访<View className="tip"></View>
215
+              </View>
216
+              <View className="txt">
217
+                认购<View className="tip"></View>
218
+              </View>
219
+              <View className="txt">
220
+                签约<View className="tip"></View>
221
+              </View>
177 222
             </View>
178 223
           </View>
179
-          <View className='reception__consultant'>接待顾问</View>
180
-          <View className='consultant__info'>
224
+          <View className="reception__consultant">接待顾问</View>
225
+          <View className="consultant__info">
181 226
             {/* <Image className='consultant__img' src={photo} mode="widthFix"></Image> */}
182
-            <View className='infor consultant__name'>姓名:{detail.consultants.name}</View>
183
-            <View className='infor consultant__tel'>手机号码:{detail.consultants.phone}</View>
227
+            <View className="infor consultant__name">
228
+              姓名:{detail.consultants.name}
229
+            </View>
230
+            <View className="infor consultant__tel">
231
+              手机号码:{detail.consultants.phone}
232
+            </View>
184 233
           </View>
185
-          <View className='remarks'>客户说明</View>
186
-          <View className='remarks__txt'>
187
-            {detail.describe ? detail.describe : '暂无说明'}
234
+          <View className="remarks">客户说明</View>
235
+          <View className="remarks__txt">
236
+            {detail.describe ? detail.describe : "暂无说明"}
188 237
           </View>
189 238
         </View>
190 239
       </View>
191 240
     );
192 241
   }
193
-}
242
+}

+ 230
- 154
src/useless/pages/person/customerAnalysis/followUpCustomer/index.js 查看文件

@@ -1,252 +1,276 @@
1
-import Taro, { Component } from '@tarojs/taro';
2
-import Authorize from '@/components/authorize'
3
-import ListView from '@/components/ListView'
4
-import './index.scss'
5
-import { savePoint, updatePoint } from '@/services/common'
6
-import { connect } from '@tarojs/redux'
7
-import { View, Text, Picker } from '@tarojs/components';
8
-import { queryCustomerList, addFollowRecord } from '@/services/person'
9
-import { transferImage } from '@/utils/tools'
10
-import * as noticeType from '@/constants/common.js'
1
+import Taro, { Component } from "@tarojs/taro";
2
+import ListView from "@/components/ListView";
3
+import "./index.scss";
4
+import { savePoint, updatePoint } from "@/services/common";
5
+import { connect } from "@tarojs/redux";
6
+import { View, Text, Picker } from "@tarojs/components";
7
+import { queryCustomerList, addFollowRecord } from "@/services/person";
8
+import { transferImage, maskPhone } from "@/utils/tools";
9
+import * as noticeType from "@/constants/common.js";
10
+import WaterMask from "@/components/WaterMask";
11 11
 
12
-const maleImg = require('@/assets/person/male.png')
13
-const femaleImg = require('@/assets/person/female.png')
14
-const phoneImg = require('@/assets/person/dianhua.png')
15
-const communicateImg = require('@/assets/person/communicate.png')
12
+const maleImg = require("@/assets/person/male.png");
13
+const femaleImg = require("@/assets/person/female.png");
14
+const phoneImg = require("@/assets/person/dianhua.png");
15
+const communicateImg = require("@/assets/person/communicate.png");
16 16
 
17 17
 @connect(({ user, city }) => ({ user, city }))
18 18
 export default class followUpCustomer extends Taro.Component {
19
+  static options = {
20
+    addGlobalClass: true
21
+  };
19 22
 
20 23
   config = {
21
-    navigationBarTitleText: '跟进客户'
22
-  }
23
-
24
+    navigationBarTitleText: "跟进客户"
25
+  };
24 26
 
25 27
   state = {
26 28
     recordId: undefined, // 埋点ID
27 29
     customerList: [],
28
-    inputValue: '',
30
+    inputValue: "",
29 31
     screenVisible: false,
30
-    statusList: ['全部状态', '报备', '到访', '认筹'],
32
+    statusList: ["全部状态", "报备", "到访", "认筹"],
31 33
     statusIndex: -1,
32
-    startArrivalDate: '',
33
-    endArrivalDate: '',
34
-    startReportDate: '',
35
-    endReportDate: '',
34
+    startArrivalDate: "",
35
+    endArrivalDate: "",
36
+    startReportDate: "",
37
+    endReportDate: "",
36 38
     hasMore: true,
37 39
     isEmpty: false,
38 40
     pageIndex: 1
39
-  }
41
+  };
40 42
 
41 43
   componentWillUnmount() {
42
-    const { recordId } = this.state
43
-    recordId && updatePoint(recordId)
44
+    const { recordId } = this.state;
45
+    recordId && updatePoint(recordId);
44 46
   }
45 47
   componentDidShow() {
46
-    Taro.showLoading()
47
-    const pageSize = (Taro.getStorageSync('followPageIndex') || 1) * 10
48
-    this.loadList(1, pageSize)
49
-
48
+    Taro.showLoading();
49
+    const pageSize = (Taro.getStorageSync("followPageIndex") || 1) * 10;
50
+    this.loadList(1, pageSize);
50 51
   }
51 52
   componentDidHide() {
52 53
     const { pageIndex } = this.state;
53
-    Taro.setStorageSync('followPageIndex', pageIndex)
54
+    Taro.setStorageSync("followPageIndex", pageIndex);
54 55
   }
55 56
 
56 57
   loadList(page = 0, pageSize = 10) {
57
-    const currentPage = page || this.state.pageIndex
58
+    const currentPage = page || this.state.pageIndex;
58 59
     const payload = {
59
-      type: 'follow',
60
+      type: "follow",
60 61
       pageSize,
61
-      pageNumber: currentPage,
62
-    }
62
+      pageNumber: currentPage
63
+    };
63 64
 
64 65
     queryCustomerList(payload.type, payload).then(res => {
65
-      const { records, list, total, current, pages, size } = res || {}
66
-      const _list = records || list || []
67
-      const newList = current <= 1 ? _list : this.state.customerList.concat(_list)
68
-      const pageNum = Math.max(Taro.getStorageSync('followPageIndex'), current)
66
+      const { records, list, total, current, pages, size } = res || {};
67
+      const _list = records || list || [];
68
+      const newList =
69
+        current <= 1 ? _list : this.state.customerList.concat(_list);
70
+      const pageNum = Math.max(Taro.getStorageSync("followPageIndex"), current);
69 71
       this.setState({
70 72
         customerList: newList,
71 73
         isEmpty: total == 0,
72 74
         hasMore: current * size < total,
73
-        pageIndex: pageNum,
75
+        pageIndex: pageNum
74 76
         // hasMore: current < pages,
75 77
         // pageIndex: current >= pages ? pages : current
76
-      })
77
-      Taro.hideLoading()
78
-    })
78
+      });
79
+      Taro.hideLoading();
80
+    });
79 81
   }
80 82
 
81
-  onScrollToLower = async (fn) => {
83
+  onScrollToLower = async fn => {
82 84
     const { pageIndex } = this.state;
83
-    this.loadList(pageIndex + 1)
85
+    this.loadList(pageIndex + 1);
84 86
     fn && fn();
85
-  }
86
-  onPullDownRefresh = (rest) => {
87
+  };
88
+  onPullDownRefresh = rest => {
87 89
     // debugger
88
-    if (this.refreshing) return
89
-    this.refreshing = true
90
-    this.loadList(1)
91
-    rest && rest()
92
-    this.refreshing = false
93
-  }
94
-
90
+    if (this.refreshing) return;
91
+    this.refreshing = true;
92
+    this.loadList(1);
93
+    rest && rest();
94
+    this.refreshing = false;
95
+  };
95 96
 
96 97
   changeInput = e => {
97 98
     this.setState({
98 99
       inputValue: e.detail.value
99
-    })
100
-  }
100
+    });
101
+  };
101 102
   // 查询
102 103
   searchBtn() {
103
-
104 104
     this.filterCustomerList();
105
-
106 105
   }
107 106
   // 筛查跟进客户
108 107
   filterCustomerList() {
109
-
110
-
111 108
     const payload = {
112
-      type: 'follow',
109
+      type: "follow",
113 110
       pageNumber: 1,
114 111
       pageSize: 9999,
115 112
       name: this.state.inputValue,
116
-      status: (this.state.statusIndex == 0 || this.state.statusIndex == -1) ? '' : this.state.statusIndex,
113
+      status:
114
+        this.state.statusIndex == 0 || this.state.statusIndex == -1
115
+          ? ""
116
+          : this.state.statusIndex,
117 117
       startArrivalDate: this.state.startArrivalDate,
118 118
       endArrivalDate: this.state.endArrivalDate,
119 119
       startReportDate: this.state.startReportDate,
120
-      endReportDate: this.state.endReportDate,
121
-    }
120
+      endReportDate: this.state.endReportDate
121
+    };
122 122
     queryCustomerList(payload.type, payload).then(res => {
123
-      const { records, total, current, pages, size } = res || {}
123
+      const { records, total, current, pages, size } = res || {};
124
+      const pageIndex = 1;
124 125
       this.setState({
125
-
126 126
         customerList: records || [],
127 127
         isEmpty: total == 0,
128 128
         hasMore: current * size < total,
129
-        pageIndex: pageNum,
130
-      })
131
-      Taro.hideLoading()
132
-    })
129
+        pageIndex
130
+      });
131
+      Taro.setStorageSync("followPageIndex", pageIndex);
132
+      Taro.hideLoading();
133
+    });
133 134
   }
134 135
   saveBtn() {
135 136
     this.filterCustomerList();
136 137
     this.setState({
137
-      screenVisible: false,
138
-    })
138
+      screenVisible: false
139
+    });
139 140
   }
140 141
   // 显示筛查弹框
141 142
   screenShow() {
142 143
     this.setState({
143
-      screenVisible: true,
144
-    })
144
+      screenVisible: true
145
+    });
145 146
   }
146 147
   // 选择状态
147 148
   chooseStatus(item, inx) {
148 149
     this.setState({
149
-      statusIndex: inx,
150
-    })
150
+      statusIndex: inx
151
+    });
151 152
   }
152 153
   // 到访开始时间
153 154
   onVisitDateChange = e => {
154 155
     this.setState({
155 156
       startArrivalDate: e.detail.value
156
-    })
157
-  }
157
+    });
158
+  };
158 159
   // 到访结束时间
159 160
   onVisitDateChange2 = e => {
160 161
     this.setState({
161 162
       endArrivalDate: e.detail.value
162
-    })
163
-  }
163
+    });
164
+  };
164 165
   // 报备开始时间
165 166
   onReportDateChange = e => {
166 167
     this.setState({
167 168
       startReportDate: e.detail.value
168
-    })
169
-  }
169
+    });
170
+  };
170 171
   // 报备结束时间
171 172
   onReportDateChange2 = e => {
172 173
     this.setState({
173 174
       endReportDate: e.detail.value
174
-    })
175
-  }
175
+    });
176
+  };
176 177
   // 取消筛查
177 178
   cancelBtn() {
178 179
     this.setState({
179 180
       screenVisible: false,
180 181
       statusIndex: -1,
181
-      startArrivalDate: '',
182
-      endArrivalDate: '',
183
-      startReportDate: '',
184
-      endReportDate: '',
185
-    })
182
+      startArrivalDate: "",
183
+      endArrivalDate: "",
184
+      startReportDate: "",
185
+      endReportDate: ""
186
+    });
186 187
   }
187 188
   // 跳转我的客户详情
188 189
   toMyCustomer(customerId) {
189 190
     Taro.navigateTo({
190
-      url: `/useless/pages/person/customerAnalysis/myCustomer?customerId=` + customerId
191
-    })
191
+      url:
192
+        `/useless/pages/person/customerAnalysis/myCustomer?customerId=` +
193
+        customerId
194
+    });
192 195
   }
193 196
   // 拨打电话
194 197
   handleTelClick(item, e) {
195
-    e.stopPropagation()
198
+    e.stopPropagation();
196 199
     Taro.makePhoneCall({
197 200
       phoneNumber: item.phone
198
-    })
201
+    });
199 202
     const params = {
200
-      recordType: '拨打电话',
203
+      recordType: "拨打电话",
201 204
       customerSex: item.sex,
202
-      customerId: item.customerId,
203
-    }
204
-    addFollowRecord(params).then(res => {
205
-
206
-    })
205
+      customerId: item.customerId
206
+    };
207
+    addFollowRecord(params).then(res => {});
207 208
     this.setState({
208
-      followVisible: false,
209
-    })
209
+      followVisible: false
210
+    });
210 211
   }
211 212
 
212 213
   renderScreenBox() {
213
-    const { statusList, statusIndex, startArrivalDate, endArrivalDate, startReportDate, endReportDate } = this.state
214
+    const {
215
+      statusList,
216
+      statusIndex,
217
+      startArrivalDate,
218
+      endArrivalDate,
219
+      startReportDate,
220
+      endReportDate
221
+    } = this.state;
214 222
     return (
215 223
       <View className="mask">
216 224
         <View className="content">
217 225
           <View style="color:#333;font-size:14px">精准筛选</View>
218 226
           <View className="status-box">
219
-            {
220
-              statusList.map((item, index) => (
221
-                <View key={index + 'status'} className={index == statusIndex ? 'checked' : 'status-item'} onClick={this.chooseStatus.bind(this, item, index)}>{item}</View>
222
-              ))
223
-            }
227
+            {statusList.map((item, index) => (
228
+              <View
229
+                key={index + "status"}
230
+                className={index == statusIndex ? "checked" : "status-item"}
231
+                onClick={this.chooseStatus.bind(this, item, index)}
232
+              >
233
+                {item}
234
+              </View>
235
+            ))}
224 236
           </View>
225 237
           <View className="time-box">
226 238
             到访时间:
227
-              <Picker mode='date' onChange={this.onVisitDateChange}>
228
-              <View className='picker'>
239
+            <Picker mode="date" onChange={this.onVisitDateChange}>
240
+              <View className="picker">
229 241
                 {startArrivalDate}
230
-                {!startArrivalDate && <Text className="placeholder">起始时间</Text>}
242
+                {!startArrivalDate && (
243
+                  <Text className="placeholder">起始时间</Text>
244
+                )}
231 245
               </View>
232
-            </Picker>-<Picker mode='date' onChange={this.onVisitDateChange2}>
233
-              <View className='picker'>
246
+            </Picker>
247
+            -
248
+            <Picker mode="date" onChange={this.onVisitDateChange2}>
249
+              <View className="picker">
234 250
                 {endArrivalDate}
235
-                {!endArrivalDate && <Text className="placeholder">结束时间</Text>}
251
+                {!endArrivalDate && (
252
+                  <Text className="placeholder">结束时间</Text>
253
+                )}
236 254
               </View>
237 255
             </Picker>
238 256
           </View>
239 257
           <View className="time-box" style="margin-top:16px">
240 258
             报备时间:
241
-              <Picker mode='date' onChange={this.onReportDateChange}>
242
-              <View className='picker'>
259
+            <Picker mode="date" onChange={this.onReportDateChange}>
260
+              <View className="picker">
243 261
                 {startReportDate}
244
-                {!startReportDate && <Text className="placeholder">起始时间</Text>}
262
+                {!startReportDate && (
263
+                  <Text className="placeholder">起始时间</Text>
264
+                )}
245 265
               </View>
246
-            </Picker>-<Picker mode='date' onChange={this.onReportDateChange2}>
247
-              <View className='picker'>
266
+            </Picker>
267
+            -
268
+            <Picker mode="date" onChange={this.onReportDateChange2}>
269
+              <View className="picker">
248 270
                 {endReportDate}
249
-                {!endReportDate && <Text className="placeholder">结束时间</Text>}
271
+                {!endReportDate && (
272
+                  <Text className="placeholder">结束时间</Text>
273
+                )}
250 274
               </View>
251 275
             </Picker>
252 276
           </View>
@@ -256,45 +280,72 @@ export default class followUpCustomer extends Taro.Component {
256 280
             </View>
257 281
             <View className="cancel" onClick={this.cancelBtn}>
258 282
               取消
259
-          </View>
260
-            <View>
261 283
             </View>
284
+            <View></View>
262 285
           </View>
263 286
         </View>
264 287
       </View>
265
-    )
288
+    );
266 289
   }
267 290
   handleChatClick(item, e) {
268
-    e.stopPropagation()
291
+    e.stopPropagation();
292
+
293
+    const {
294
+      user: {
295
+        userInfo: {
296
+          miniApp: { tpls },
297
+          person: { personId, nickname, name }
298
+        }
299
+      }
300
+    } = this.props;
301
+    const tplId = (
302
+      tpls.filter(
303
+        x => x.tplType == noticeType.TPL_NOTICE && x.isSubscribe == true
304
+      )[0] || {}
305
+    ).tplId;
269 306
 
270
-    const { user: { userInfo: { miniApp: { tpls }, person: { personId, nickname, name } } } } = this.props
271
-    const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_NOTICE && x.isSubscribe == true)[0] || {}).tplId
272 307
     wx.requestSubscribeMessage({
273 308
       tmplIds: [tplId],
274
-      success(res) {
275
-      },
276
-      fail(res) {
277
-
278
-      },
309
+      success(res) {},
310
+      fail(res) {},
279 311
       complete() {
280 312
         Taro.navigateTo({
281
-          url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.name || item.nickname)}`
282
-        })
313
+          url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(
314
+            name || nickname
315
+          )}&receiverId=${item.personId}&receiverName=${encodeURIComponent(
316
+            item.name || item.nickname
317
+          )}`
318
+        });
283 319
       }
284
-    })
320
+    });
285 321
   }
286 322
   render() {
287
-    const { customerList, screenVisible, isEmpty, hasMore } = this.state
323
+    const { customerList, screenVisible, isEmpty, hasMore } = this.state;
324
+    const { user } = this.props;
325
+    const { person = {} } = (user || {}).userInfo || {};
326
+    const waterText = person.nickname;
288 327
 
289 328
     return (
290 329
       <View>
291 330
         <View className="top-screen" onClick={this.screenShow}>
292
-          精准筛选<Image src={require('@/assets/person/screen.png')} className="screen-img"></Image>
331
+          精准筛选
332
+          <Image
333
+            src={require("@/assets/person/screen.png")}
334
+            className="screen-img"
335
+          ></Image>
293 336
         </View>
294 337
         {screenVisible && this.renderScreenBox()}
295 338
         <View className="search-box">
296
-          <Input class="input" placeholderClass='placeholder' autoFocus onInput={this.changeInput} placeholder="请输入用户名/手机号" />
297
-          <Button className="btn" onClick={this.searchBtn} >搜索</Button>
339
+          <Input
340
+            class="input"
341
+            placeholderClass="placeholder"
342
+            autoFocus
343
+            onInput={this.changeInput}
344
+            placeholder="请输入用户名/手机号"
345
+          />
346
+          <Button className="btn" onClick={this.searchBtn}>
347
+            搜索
348
+          </Button>
298 349
         </View>
299 350
         <View style="padding:0 10px 10px 10px">
300 351
           <ListView
@@ -308,31 +359,56 @@ export default class followUpCustomer extends Taro.Component {
308 359
             onScrollToLower={fn => this.onScrollToLower(fn)}
309 360
           >
310 361
             <View className="list">
311
-              {
312
-                customerList.length &&
362
+              {customerList.length &&
313 363
                 customerList.map((item, index) => (
314
-                  <View class="item" key={index + 'customerList'} onClick={this.toMyCustomer.bind(this, item.customerId)}>
315
-                    <Image src={transferImage(item.picture) || require('@/assets/default-avatar.png')} className='img'></Image>
364
+                  <View
365
+                    className="item"
366
+                    key={index + "customerList"}
367
+                    onClick={this.toMyCustomer.bind(this, item.customerId)}
368
+                  >
369
+                    <View className="water-mask-box">
370
+                      <WaterMask text={waterText} />
371
+                    </View>
372
+                    <Image
373
+                      src={
374
+                        transferImage(item.picture) ||
375
+                        require("@/assets/default-avatar.png")
376
+                      }
377
+                      className="img"
378
+                    ></Image>
316 379
                     <View className="name">
317 380
                       <Text class="name-text">{item.name}</Text>
318
-                      {
319
-                        item.sex == '1' && <Image style="width:36rpx;height:38rpx;margin-left:10rpx" src={maleImg} />
320
-                      }
321
-                      {
322
-                        item.sex == '2' && <Image src={femaleImg} style="width:36rpx;height:36rpx;margin-left:10rpx" />
323
-                      }
381
+                      {item.sex == "1" && (
382
+                        <Image
383
+                          style="width:36rpx;height:38rpx;margin-left:10rpx"
384
+                          src={maleImg}
385
+                        />
386
+                      )}
387
+                      {item.sex == "2" && (
388
+                        <Image
389
+                          src={femaleImg}
390
+                          style="width:36rpx;height:36rpx;margin-left:10rpx"
391
+                        />
392
+                      )}
324 393
                     </View>
325
-                    <View className="phone" >{item.phone}</View>
326
-                    <Image className="phone-icon" onClick={this.handleTelClick.bind(this, item)} src={phoneImg} />
327
-                    <Image className="goutong-icon" onClick={this.handleChatClick.bind(this, item)} src={communicateImg}></Image>
394
+                    <View className="phone">{maskPhone(item.phone)}</View>
395
+                    <Image
396
+                      className="phone-icon"
397
+                      onClick={this.handleTelClick.bind(this, item)}
398
+                      src={phoneImg}
399
+                    />
400
+                    <Image
401
+                      className="goutong-icon"
402
+                      onClick={this.handleChatClick.bind(this, item)}
403
+                      src={communicateImg}
404
+                    ></Image>
328 405
                     {/* <View className="status">{item.status == 1 ? '报备' : item.status == 2 ? '到访' : item.status == 3 ? '认筹' : '签约'}</View> */}
329 406
                   </View>
330
-                ))
331
-              }
407
+                ))}
332 408
             </View>
333 409
           </ListView>
334 410
         </View>
335 411
       </View>
336
-    )
412
+    );
337 413
   }
338
-}
414
+}

+ 37
- 37
src/useless/pages/person/customerAnalysis/index.js 查看文件

@@ -1,70 +1,71 @@
1
-import Taro, { Component } from '@tarojs/taro';
2
-import Authorize from '@/components/authorize'
3
-import './index.scss'
4
-import { AtTabs, AtTabsPane } from 'taro-ui'
5
-import "taro-ui/dist/style/components/tabs.scss"
6
-import { savePoint, updatePoint } from '@/services/common'
7
-import { queryMyCustomer } from '@/services/person'
8
-import { connect } from '@tarojs/redux'
1
+import Taro, { Component } from "@tarojs/taro";
2
+import Authorize from "@/components/authorize";
3
+import "./index.scss";
4
+import { AtTabs, AtTabsPane } from "taro-ui";
5
+import "taro-ui/dist/style/components/tabs.scss";
6
+import { savePoint, updatePoint } from "@/services/common";
7
+import { queryMyCustomer } from "@/services/person";
8
+import { connect } from "@tarojs/redux";
9 9
 // import Analysis from './analysis'
10
-import Followup from './followUpCustomer'
11
-import TransactionCustomer from './transactionCustomer'
10
+import Followup from "./followUpCustomer";
11
+import TransactionCustomer from "./transactionCustomer";
12 12
 @connect(({ user, city }) => ({ user, city }))
13 13
 export default class customer extends Taro.Component {
14
-
15 14
   config = {
16
-    navigationBarTitleText: '盘客工具'
17
-  }
15
+    navigationBarTitleText: "盘客工具"
16
+  };
18 17
 
19 18
   state = {
20 19
     current: 0,
21 20
     recordId: undefined, // 埋点ID
22
-    customerNum: {},
23
-  }
21
+    customerNum: {}
22
+  };
24 23
 
25 24
   componentWillUnmount() {
26
-    const { recordId } = this.state
27
-    recordId && updatePoint(recordId)
25
+    const { recordId } = this.state;
26
+    recordId && updatePoint(recordId);
28 27
   }
29 28
   componentDidShow() {
30
-    Taro.showLoading()
31
-    this.loadInfo()
32
-
29
+    Taro.showLoading();
30
+    this.loadInfo();
33 31
   }
34 32
 
35 33
   loadInfo() {
36 34
     queryMyCustomer().then(res => {
37
-
38 35
       this.setState({
39 36
         customerNum: res || {}
40
-      })
41
-      Taro.hideLoading()
42
-    })
37
+      });
38
+      Taro.hideLoading();
39
+    });
43 40
   }
44 41
 
45
-
46 42
   handleClick(value) {
47 43
     this.setState({
48 44
       current: value
49
-    })
45
+    });
50 46
   }
51 47
   toTransactionCustomer() {
52 48
     Taro.navigateTo({
53 49
       url: `/pages/person/customerAnalysis/transactionCustomer/index`
54
-    })
50
+    });
55 51
   }
56 52
   toFollowUpCustomer() {
57 53
     Taro.navigateTo({
58 54
       url: `/pages/person/customerAnalysis/followUpCustomer/index`
59
-    })
55
+    });
60 56
   }
61 57
 
62 58
   render() {
63
-
64
-    const tabList = [{ title: '跟进客户' }, { title: '成交客户' }]
65
-    const { customerNum, current } = this.state
59
+    const tabList = [{ title: "跟进客户" }, { title: "成交客户" }];
60
+    const { customerNum, current } = this.state;
66 61
     return (
67
-      <AtTabs className="tab-customer" current={current} tabList={tabList} onClick={this.handleClick.bind(this)} swipeable={false}>
62
+      <AtTabs
63
+        className="tab-customer"
64
+        current={current}
65
+        tabList={tabList}
66
+        onClick={this.handleClick.bind(this)}
67
+        swipeable={false}
68
+      >
68 69
         <AtTabsPane current={current} index={0}>
69 70
           <Followup />
70 71
           {/* <View style="padding:10px 20px; display: flex;flex-wrap: wrap;align-content: flex-start;justify-content: space-between;">
@@ -80,13 +81,12 @@ export default class customer extends Taro.Component {
80 81
             </View>
81 82
           </View> */}
82 83
         </AtTabsPane>
83
-        <AtTabsPane current={current} index={1} >
84
-          <View >
84
+        <AtTabsPane current={current} index={1}>
85
+          <View>
85 86
             <TransactionCustomer />
86 87
           </View>
87 88
         </AtTabsPane>
88
-
89 89
       </AtTabs>
90
-    )
90
+    );
91 91
   }
92
-}
92
+}

+ 421
- 276
src/useless/pages/person/customerAnalysis/myCustomer.js
文件差異過大導致無法顯示
查看文件


+ 126
- 83
src/useless/pages/person/customerAnalysis/transactionCustomer/index.js 查看文件

@@ -1,23 +1,26 @@
1
-import Taro, { Component } from '@tarojs/taro';
2
-import ListView from '@/components/ListView'
3
-import './index.scss'
4
-import { connect } from '@tarojs/redux'
5
-import { queryCustomerList, addFollowRecord } from '@/services/person'
6
-import { transferImage } from '@/utils/tools'
7
-import * as noticeType from '@/constants/common.js'
8
-
9
-const maleImg = require('@/assets/person/male.png')
10
-const femaleImg = require('@/assets/person/female.png')
11
-const phoneImg = require('@/assets/person/dianhua.png')
12
-const communicateImg = require('@/assets/person/communicate.png')
1
+import Taro, { Component } from "@tarojs/taro";
2
+import ListView from "@/components/ListView";
3
+import WaterMask from "@/components/WaterMask";
4
+import "./index.scss";
5
+import { connect } from "@tarojs/redux";
6
+import { queryCustomerList, addFollowRecord } from "@/services/person";
7
+import { transferImage, maskPhone } from "@/utils/tools";
8
+import * as noticeType from "@/constants/common.js";
13 9
 
10
+const maleImg = require("@/assets/person/male.png");
11
+const femaleImg = require("@/assets/person/female.png");
12
+const phoneImg = require("@/assets/person/dianhua.png");
13
+const communicateImg = require("@/assets/person/communicate.png");
14 14
 
15 15
 @connect(({ user, city }) => ({ user, city }))
16 16
 export default class transactionCustomer extends Taro.Component {
17
+  static options = {
18
+    addGlobalClass: true
19
+  };
17 20
 
18 21
   config = {
19
-    navigationBarTitleText: '成交客户'
20
-  }
22
+    navigationBarTitleText: "成交客户"
23
+  };
21 24
 
22 25
   state = {
23 26
     recordId: undefined, // 埋点ID
@@ -25,100 +28,116 @@ export default class transactionCustomer extends Taro.Component {
25 28
     hasMore: true,
26 29
     isEmpty: false,
27 30
     pageIndex: 1
28
-  }
31
+  };
29 32
 
30 33
   componentDidShow() {
31
-    Taro.showLoading()
32
-    const pageSize = (Taro.getStorageSync('clinchPageIndex') || 1) * 10
33
-    this.loadList(1, pageSize)
34
+    Taro.showLoading();
35
+    const pageSize = (Taro.getStorageSync("clinchPageIndex") || 1) * 10;
36
+    this.loadList(1, pageSize);
34 37
   }
35 38
   componentDidHide() {
36 39
     const { pageIndex } = this.state;
37
-    Taro.setStorageSync('clinchPageIndex', pageIndex)
40
+    Taro.setStorageSync("clinchPageIndex", pageIndex);
38 41
   }
39 42
 
40 43
   loadList(page = 0, pageSize = 10) {
41
-    const currentPage = page || this.state.pageIndex
44
+    const currentPage = page || this.state.pageIndex;
42 45
     const payload = {
43
-      type: 'clinch',
46
+      type: "clinch",
44 47
       pageSize,
45
-      pageNumber: currentPage,
46
-    }
48
+      pageNumber: currentPage
49
+    };
47 50
     queryCustomerList(payload.type, payload).then(res => {
48
-      const { records, list, total, current, pages, size } = res || {}
49
-      const _list = records || list || []
50
-      const newList = current <= 1 ? _list : this.state.customerList.concat(_list)
51
-      const pageNum = Math.max(Taro.getStorageSync('clinchPageIndex'), current)
51
+      const { records, list, total, current, pages, size } = res || {};
52
+      const _list = records || list || [];
53
+      const newList =
54
+        current <= 1 ? _list : this.state.customerList.concat(_list);
55
+      const pageNum = Math.max(Taro.getStorageSync("clinchPageIndex"), current);
52 56
       this.setState({
53 57
         customerList: newList,
54 58
         isEmpty: total == 0,
55 59
         hasMore: current * size < total,
56
-        pageIndex: pageNum,
60
+        pageIndex: pageNum
57 61
         // hasMore: current < pages,
58 62
         // pageIndex: current >= pages ? pages : current
59
-      })
60
-      Taro.hideLoading()
61
-    })
63
+      });
64
+      Taro.hideLoading();
65
+    });
62 66
   }
63
-  onScrollToLower = async (fn) => {
67
+  onScrollToLower = async fn => {
64 68
     const { pageIndex } = this.state;
65
-    this.loadList(pageIndex + 1)
69
+    this.loadList(pageIndex + 1);
66 70
     fn && fn();
67
-  }
68
-  onPullDownRefresh = (rest) => {
71
+  };
72
+  onPullDownRefresh = rest => {
69 73
     // debugger
70
-    if (this.refreshing) return
71
-    this.refreshing = true
72
-    this.loadList(1)
73
-    rest && rest()
74
-    this.refreshing = false
75
-  }
74
+    if (this.refreshing) return;
75
+    this.refreshing = true;
76
+    this.loadList(1);
77
+    rest && rest();
78
+    this.refreshing = false;
79
+  };
76 80
   // 跳转我的客户详情
77 81
   toMyCustomer(customerId) {
78 82
     Taro.navigateTo({
79
-      url: `/useless/pages/person/customerAnalysis/myCustomer?customerId=` + customerId
80
-    })
83
+      url:
84
+        `/useless/pages/person/customerAnalysis/myCustomer?customerId=` +
85
+        customerId
86
+    });
81 87
   }
82 88
   // 拨打电话
83 89
   handleTelClick(item, e) {
84
-    e.stopPropagation()
90
+    e.stopPropagation();
85 91
     Taro.makePhoneCall({
86 92
       phoneNumber: item.phone
87
-    })
93
+    });
88 94
     const params = {
89
-      recordType: '拨打电话',
95
+      recordType: "拨打电话",
90 96
       customerSex: item.sex,
91
-      customerId: item.customerId,
92
-    }
93
-    addFollowRecord(params).then(res => {
94
-
95
-    })
97
+      customerId: item.customerId
98
+    };
99
+    addFollowRecord(params).then(res => {});
96 100
     this.setState({
97
-      followVisible: false,
98
-    })
101
+      followVisible: false
102
+    });
99 103
   }
100 104
   handleChatClick(item, e) {
101
-    e.stopPropagation()
105
+    e.stopPropagation();
102 106
 
103
-    const { user: { userInfo: { miniApp: { tpls }, person: { personId, nickname, name } } } } = this.props
104
-    const tplId = (tpls.filter(x => x.tplType == noticeType.TPL_NOTICE && x.isSubscribe == true)[0] || {}).tplId
107
+    const {
108
+      user: {
109
+        userInfo: {
110
+          miniApp: { tpls },
111
+          person: { personId, nickname, name }
112
+        }
113
+      }
114
+    } = this.props;
115
+    const tplId = (
116
+      tpls.filter(
117
+        x => x.tplType == noticeType.TPL_NOTICE && x.isSubscribe == true
118
+      )[0] || {}
119
+    ).tplId;
105 120
     wx.requestSubscribeMessage({
106 121
       tmplIds: [tplId],
107
-      success(res) {
108
-      },
109
-      fail(res) {
110
-
111
-      },
122
+      success(res) {},
123
+      fail(res) {},
112 124
       complete() {
113 125
         Taro.navigateTo({
114
-          url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(name || nickname)}&receiverId=${item.personId}&receiverName=${encodeURIComponent(item.name || item.nickname)}`
115
-        })
126
+          url: `/pages/im/index?sendId=${personId}&sendName=${encodeURIComponent(
127
+            name || nickname
128
+          )}&receiverId=${item.personId}&receiverName=${encodeURIComponent(
129
+            item.name || item.nickname
130
+          )}`
131
+        });
116 132
       }
117
-    })
133
+    });
118 134
   }
119 135
 
120 136
   render() {
121
-    const { customerList, isEmpty, hasMore } = this.state
137
+    const { customerList, isEmpty, hasMore } = this.state;
138
+    const { user } = this.props;
139
+    const { person = {} } = (user || {}).userInfo || {};
140
+    const waterText = person.nickname;
122 141
 
123 142
     return (
124 143
       <View style="padding:0 10px 10px 10px">
@@ -133,30 +152,54 @@ export default class transactionCustomer extends Taro.Component {
133 152
           onScrollToLower={fn => this.onScrollToLower(fn)}
134 153
         >
135 154
           <View className="list">
136
-            {
137
-              customerList.length &&
155
+            {customerList.length &&
138 156
               customerList.map((item, index) => (
139
-                <View class="item" key={index + 'transaction'} onClick={this.toMyCustomer.bind(this, item.customerId)}>
140
-                  <Image src={transferImage(item.picture) || require('@/assets/default-avatar.png')} className='img'></Image>
157
+                <View
158
+                  className="item"
159
+                  key={index + "transaction"}
160
+                  onClick={this.toMyCustomer.bind(this, item.customerId)}
161
+                >
162
+                  <View className="water-mask-box">
163
+                    <WaterMask text={waterText} />
164
+                  </View>
165
+                  <Image
166
+                    src={
167
+                      transferImage(item.picture) ||
168
+                      require("@/assets/default-avatar.png")
169
+                    }
170
+                    className="img"
171
+                  ></Image>
141 172
                   <View className="name">
142 173
                     <Text class="name-text">{item.name}</Text>
143
-                    {
144
-                      item.sex == '1' && <Image style="width:36rpx;height:38rpx;margin-left:20rpx" src={maleImg} />
145
-                    }
146
-                    {
147
-                      item.sex == '2' && <Image style="width:36rpx;height:36rpx;margin-left:20rpx" src={femaleImg} />
148
-                    }
174
+                    {item.sex == "1" && (
175
+                      <Image
176
+                        style="width:36rpx;height:38rpx;margin-left:20rpx"
177
+                        src={maleImg}
178
+                      />
179
+                    )}
180
+                    {item.sex == "2" && (
181
+                      <Image
182
+                        style="width:36rpx;height:36rpx;margin-left:20rpx"
183
+                        src={femaleImg}
184
+                      />
185
+                    )}
149 186
                   </View>
150
-                  <View className="phone">{item.phone} </View>
151
-                  <Image className="phone-icon" src={phoneImg} onClick={this.handleTelClick.bind(this, item)} />
152
-                  <Image className="goutong-icon" onClick={this.handleChatClick.bind(this, item)} src={communicateImg} ></Image>
153
-
187
+                  <View className="phone">{maskPhone(item.phone)}</View>
188
+                  <Image
189
+                    className="phone-icon"
190
+                    src={phoneImg}
191
+                    onClick={this.handleTelClick.bind(this, item)}
192
+                  />
193
+                  <Image
194
+                    className="goutong-icon"
195
+                    onClick={this.handleChatClick.bind(this, item)}
196
+                    src={communicateImg}
197
+                  ></Image>
154 198
                 </View>
155
-              ))
156
-            }
199
+              ))}
157 200
           </View>
158 201
         </ListView>
159 202
       </View>
160
-    )
203
+    );
161 204
   }
162
-}
205
+}

+ 333
- 278
src/utils/tools.js 查看文件

@@ -1,31 +1,31 @@
1
-import Taro from '@tarojs/taro';
2
-import store from '../store'
3
-import rtLog from './rtLog';
1
+import Taro from "@tarojs/taro";
2
+import store from "../store";
3
+import rtLog from "./rtLog";
4 4
 
5 5
 /**
6 6
  * 是否为空
7
- * @param {*} o 
7
+ * @param {*} o
8 8
  */
9 9
 export function isEmpty(o) {
10
-  if (typeof o === 'string') {
11
-    if (!o || o === 'null' || o === 'undefined') {
12
-      return true
10
+  if (typeof o === "string") {
11
+    if (!o || o === "null" || o === "undefined") {
12
+      return true;
13 13
     }
14 14
   }
15 15
 
16
-  if (typeof o === 'object') {
17
-    return !Object.keys(o).length
16
+  if (typeof o === "object") {
17
+    return !Object.keys(o).length;
18 18
   }
19 19
 
20 20
   if (Array.isArray(o)) {
21
-    return !o.length
21
+    return !o.length;
22 22
   }
23 23
 
24 24
   if (o === null || o === undefined) {
25
-    return true
25
+    return true;
26 26
   }
27 27
 
28
-  return false
28
+  return false;
29 29
 }
30 30
 
31 31
 export function ifNull(o, def) {
@@ -34,104 +34,127 @@ export function ifNull(o, def) {
34 34
 
35 35
 /**
36 36
  * 是否函数
37
- * @param {*} f 
37
+ * @param {*} f
38 38
  */
39 39
 export function isFunction(f) {
40
-  return typeof f === 'function'
40
+  return typeof f === "function";
41 41
 }
42 42
 
43 43
 /**
44 44
  * 是否分享场景(含扫码)
45
- * @param {*} scene 
45
+ * @param {*} scene
46 46
  */
47 47
 export function sceneInShare(scene) {
48
-  return [1007, 1008, 1011, 1012, 1013, 1031, 1032, 1036, 1047, 1048, 1049].indexOf(scene) > -1
48
+  return (
49
+    [1007, 1008, 1011, 1012, 1013, 1031, 1032, 1036, 1047, 1048, 1049].indexOf(
50
+      scene
51
+    ) > -1
52
+  );
49 53
 }
50 54
 
51 55
 /**
52 56
  * 造空数组
53
- * @param {int}} n 
57
+ * @param {int}} n
54 58
  */
55 59
 export function times(n) {
56
-  return n > 0 ? '*'.repeat(n - 1).split('*') : []
60
+  return n > 0 ? "*".repeat(n - 1).split("*") : [];
61
+}
62
+
63
+/**
64
+ * 屏蔽手机中间 4 位
65
+ * @param {*} phone
66
+ */
67
+export function maskPhone(phone) {
68
+  return phone.replace(/^(\d{3})(\d{4})/, "$1****");
57 69
 }
58 70
 
59 71
 /**
60 72
  * 将 b 中不为 null 或者 undefined 的值合并到 a 中
61
- * @param {*} a 
62
- * @param {*} b 
73
+ * @param {*} a
74
+ * @param {*} b
63 75
  */
64 76
 export function mergeNotNull(a, b) {
65
-  const bKeys = Object.keys(b || {})
77
+  const bKeys = Object.keys(b || {});
66 78
   if (!bKeys.length) {
67
-    return a
79
+    return a;
68 80
   }
69 81
 
70
-  let res = { ...(a || {}) }
82
+  let res = { ...(a || {}) };
71 83
 
72 84
   bKeys.forEach(k => {
73
-    const v = b[k]
85
+    const v = b[k];
74 86
     if (v === null || v === undefined) {
75
-      return
87
+      return;
76 88
     }
77 89
 
78
-    res[k] = v
79
-  })
90
+    res[k] = v;
91
+  });
80 92
 
81
-  return res
93
+  return res;
82 94
 }
83 95
 
84
-const ossPath = OSS_PATH
85
-const ossFastPath = OSS_FAST_PATH
96
+const ossPath = OSS_PATH;
97
+const ossFastPath = OSS_FAST_PATH;
86 98
 
87 99
 /**
88
- * 
89
- * @param {*} img 
100
+ *
101
+ * @param {*} img
90 102
  * @param {*} quality  仅支持 70,50,30,5
91 103
  */
92 104
 export function getThumbnail(img, quality) {
93
-  if (!img) return img
105
+  if (!img) return img;
94 106
 
95 107
   if (img.indexOf(ossPath) === 0 || img.indexOf(ossFastPath) === 0) {
96
-    return `${img.replace(ossPath, ossFastPath)}?x-oss-process=style/compress${quality || 30}`
108
+    return `${img.replace(
109
+      ossPath,
110
+      ossFastPath
111
+    )}?x-oss-process=style/compress${quality || 30}`;
97 112
   }
98 113
 
99
-  return img
114
+  return img;
100 115
 }
101 116
 
102
-
103 117
 export function resizeImage(img, size) {
104
-  if (!img) return img
118
+  if (!img) return img;
105 119
 
106 120
   if (img.indexOf(ossPath) === 0 || img.indexOf(ossFastPath) === 0) {
107
-    return `${img.replace(ossPath, ossFastPath)}?x-oss-process=style/resize${size || 750}`
121
+    return `${img.replace(
122
+      ossPath,
123
+      ossFastPath
124
+    )}?x-oss-process=style/resize${size || 750}`;
108 125
   }
109 126
 
110
-  return img
127
+  return img;
111 128
 }
112 129
 
113 130
 /**
114 131
  * 压缩图片 80%, 最大宽度 750
115
- * @param {*} img 
132
+ * @param {*} img
116 133
  */
117 134
 export function transferImage(img) {
118
-  if (!img) return img
135
+  if (!img) return img;
119 136
 
120 137
   if (img.indexOf(ossPath) === 0 || img.indexOf(ossFastPath) === 0) {
121
-    if (store.getState().system.systemInfo.platform !== 'ios') {
138
+    if (store.getState().system.systemInfo.platform !== "ios") {
122 139
       // ios 暂时不支持 webp
123
-      return `${img.replace(ossPath, ossFastPath)}?x-oss-process=style/transwebp`
140
+      return `${img.replace(
141
+        ossPath,
142
+        ossFastPath
143
+      )}?x-oss-process=style/transwebp`;
124 144
     }
125 145
 
126
-    return `${img.replace(ossPath, ossFastPath)}?x-oss-process=image/resize,m_lfit,w_750/quality,Q_80`
146
+    return `${img.replace(
147
+      ossPath,
148
+      ossFastPath
149
+    )}?x-oss-process=image/resize,m_lfit,w_750/quality,Q_80`;
127 150
   }
128 151
 
129
-  return img
152
+  return img;
130 153
 }
131 154
 
132 155
 /**
133 156
  * 简易版解析 url
134
- * @param {*} url 
157
+ * @param {*} url
135 158
  */
136 159
 export function parseURL(url) {
137 160
   if (!url) return undefined;
@@ -140,48 +163,55 @@ export function parseURL(url) {
140 163
   let query;
141 164
   let hash;
142 165
 
143
-  const gotHash = url.split('#')
144
-  strTmp = gotHash[0]
166
+  const gotHash = url.split("#");
167
+  strTmp = gotHash[0];
145 168
   if (gotHash.length > 1) {
146
-    hash = gotHash[1]
169
+    hash = gotHash[1];
147 170
   }
148
-  
149
-  const gotQuery = strTmp.split('?')
150
-  strTmp = gotQuery[0]
171
+
172
+  const gotQuery = strTmp.split("?");
173
+  strTmp = gotQuery[0];
151 174
   if (gotQuery.length > 1) {
152
-    query = gotQuery[1]
175
+    query = gotQuery[1];
153 176
   }
154 177
 
155 178
   // 小程序只支持 https 开头
156
-  const [_, origin, path] = /(https:\/\/[^/]+)(.*)/.exec(strTmp)
179
+  const [_, origin, path] = /(https:\/\/[^/]+)(.*)/.exec(strTmp);
157 180
 
158 181
   return {
159 182
     origin,
160 183
     path,
161 184
     query,
162 185
     hash
163
-  }
186
+  };
164 187
 }
165 188
 
166
-
167 189
 /**
168 190
  * 解析 queryString   a=b&c=d  ==> { a:b, c:d }
169
- * @param {*} queryString 
191
+ * @param {*} queryString
170 192
  */
171 193
 export function parseQueryString(queryString) {
172
-  if (!queryString || '?' === queryString) return undefined
173
-
174
-  const query = queryString.indexOf('?') === 0 ? queryString.replace(/^\?/, '') : queryString
175
-  
176
-  return query.split('&').filter(x => x).reduce((acc, it) => {
177
-    const [k, v] = it.split('=')
178
-    const val = Object.prototype.hasOwnProperty.call(acc, k) ? [...([].concat(acc[k])), v] : v
179
-
180
-    return {
181
-      ...acc,
182
-      [`${k}`]: val,
183
-    }
184
-  }, {})
194
+  if (!queryString || "?" === queryString) return undefined;
195
+
196
+  const query =
197
+    queryString.indexOf("?") === 0
198
+      ? queryString.replace(/^\?/, "")
199
+      : queryString;
200
+
201
+  return query
202
+    .split("&")
203
+    .filter(x => x)
204
+    .reduce((acc, it) => {
205
+      const [k, v] = it.split("=");
206
+      const val = Object.prototype.hasOwnProperty.call(acc, k)
207
+        ? [...[].concat(acc[k]), v]
208
+        : v;
209
+
210
+      return {
211
+        ...acc,
212
+        [`${k}`]: val
213
+      };
214
+    }, {});
185 215
 }
186 216
 
187 217
 /**
@@ -195,26 +225,28 @@ export function formateLeftTime(leftTime, unit) {
195 225
   const ns = 1000;
196 226
 
197 227
   const day = Math.floor(leftTime / nd);
198
-  const hour = Math.floor(leftTime % nd / nh);
199
-  const min = Math.floor(leftTime % nd % nh / nm);
200
-  const sec = Math.floor(leftTime % nd % nh % nm / ns);
228
+  const hour = Math.floor((leftTime % nd) / nh);
229
+  const min = Math.floor(((leftTime % nd) % nh) / nm);
230
+  const sec = Math.floor((((leftTime % nd) % nh) % nm) / ns);
201 231
 
202 232
   switch (unit) {
203
-    case 'min':
204
-      return `${day}天${hour}小时${min}分`
233
+    case "min":
234
+      return `${day}天${hour}小时${min}分`;
205 235
     default:
206
-      return `${day}天${hour}小时${min}分${sec}秒`
236
+      return `${day}天${hour}小时${min}分${sec}秒`;
207 237
   }
208 238
 }
209 239
 
210 240
 export function getDownloadURL(url, type) {
211
-  if (!url) return url
241
+  if (!url) return url;
212 242
 
213 243
   switch (type) {
214
-    case 'avatar':
215
-      return url.replace('https://wx.qlogo.cn/', `${HOST}/qlogo/`);
216
-    case 'alioss':
217
-      return url.replace(ossPath, `${HOST}/alioss/`).replace(ossFastPath, `${HOST}/alioss/`);
244
+    case "avatar":
245
+      return url.replace("https://wx.qlogo.cn/", `${HOST}/qlogo/`);
246
+    case "alioss":
247
+      return url
248
+        .replace(ossPath, `${HOST}/alioss/`)
249
+        .replace(ossFastPath, `${HOST}/alioss/`);
218 250
     default:
219 251
       return url;
220 252
   }
@@ -224,20 +256,20 @@ export function getDownloadURL(url, type) {
224 256
  * @description 获取当前页url
225 257
  */
226 258
 export const getCurrentPageUrl = () => {
227
-  let pages = Taro.getCurrentPages()
228
-  let currentPage = pages[pages.length - 1]
229
-  let url = currentPage.route
230
-  return url
259
+  let pages = Taro.getCurrentPages();
260
+  let currentPage = pages[pages.length - 1];
261
+  let url = currentPage.route;
262
+  return url;
231 263
 };
232 264
 
233 265
 export const pageToLogin = () => {
234
-  let path = getCurrentPageUrl()
235
-  if (!path.includes('login')) {
266
+  let path = getCurrentPageUrl();
267
+  if (!path.includes("login")) {
236 268
     Taro.navigateTo({
237 269
       url: "/pages/login/login"
238 270
     });
239 271
   }
240
-}
272
+};
241 273
 
242 274
 let endTime;
243 275
 export function throttle(callback, time = 500) {
@@ -248,7 +280,7 @@ export function throttle(callback, time = 500) {
248 280
   }
249 281
 }
250 282
 
251
-export const wait = function (time = 500) {
283
+export const wait = function(time = 500) {
252 284
   return new Promise(res => {
253 285
     setTimeout(() => {
254 286
       res();
@@ -256,142 +288,152 @@ export const wait = function (time = 500) {
256 288
   });
257 289
 };
258 290
 
259
-export const getQueryString = function (str, name) {
291
+export const getQueryString = function(str, name) {
260 292
   var regex = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
261 293
   var r = str.match(regex);
262 294
   if (r != null) return unescape(r[2]);
263 295
   return null;
264
-}
296
+};
265 297
 // 项目详情海报
266
-export const makeProjectPoster = (res) => {
298
+export const makeProjectPoster = res => {
267 299
   return new Promise(resolve => {
268
-
269
-    const { poster, qrcode, nickname, avatarurl, canvasName } = res
300
+    const { poster, qrcode, nickname, avatarurl, canvasName } = res;
270 301
     const ctx = Taro.createCanvasContext(canvasName);
271
-    const _avatarurl = getDownloadURL(avatarurl, 'avatar');
272
-    const _poster = getDownloadURL(poster, 'alioss');
302
+    const _avatarurl = getDownloadURL(avatarurl, "avatar");
303
+    const _poster = getDownloadURL(poster, "alioss");
273 304
 
274 305
     Promise.all([
275 306
       Taro.downloadFile({ url: _poster }),
276 307
       Taro.downloadFile({ url: qrcode }),
277 308
       Taro.downloadFile({ url: _avatarurl })
278
-    ]).then(list => {
279
-
280
-
281
-      ctx.setFillStyle("#ffffff")
282
-      ctx.fillRect(0, 0, 640, 1136)
283
-
284
-      // 背景海报
285
-      ctx.drawImage(list[0].tempFilePath, 0, 0, 640, 1136);
286
-
287
-
288
-      //绘制名字
289
-      ctx.setFontSize(30);
290
-      ctx.setFillStyle('#fff');
291
-      ctx.setTextAlign('left');
292
-      ctx.fillText(nickname, 160, 920, 250);
293
-      ctx.stroke();
294
-      ctx.save();
295
-      ctx.arc(500, 910, 60, 0, 2 * Math.PI)
296
-      ctx.strokeStyle = "#ffffff";
297
-      ctx.setFillStyle('#fff');
298
-      ctx.fill();
299
-      ctx.clip(); //裁剪上面的圆形
300
-      ctx.drawImage(list[1].tempFilePath, 0, 0, 430, 430, 440, 850, 120, 120);
301
-      ctx.restore()
302
-
303
-      //绘制头像
304
-      ctx.arc(96, 906, 50, 0, 2 * Math.PI) //画出圆
305
-      ctx.strokeStyle = "#ffffff";
306
-      ctx.clip(); //裁剪上面的圆形
307
-      ctx.drawImage(list[2].tempFilePath, 46, 856, 100, 100);
308
-      ctx.draw(false, function () {
309
-        Taro.canvasToTempFilePath({
310
-          canvasId: canvasName, success: function ({ tempFilePath }) {
311
-            resolve(tempFilePath)
312
-          }
313
-        })
309
+    ])
310
+      .then(list => {
311
+        ctx.setFillStyle("#ffffff");
312
+        ctx.fillRect(0, 0, 640, 1136);
313
+
314
+        // 背景海报
315
+        ctx.drawImage(list[0].tempFilePath, 0, 0, 640, 1136);
316
+
317
+        //绘制名字
318
+        ctx.setFontSize(30);
319
+        ctx.setFillStyle("#fff");
320
+        ctx.setTextAlign("left");
321
+        ctx.fillText(nickname, 160, 920, 250);
322
+        ctx.stroke();
323
+        ctx.save();
324
+        ctx.arc(500, 910, 60, 0, 2 * Math.PI);
325
+        ctx.strokeStyle = "#ffffff";
326
+        ctx.setFillStyle("#fff");
327
+        ctx.fill();
328
+        ctx.clip(); //裁剪上面的圆形
329
+        ctx.drawImage(list[1].tempFilePath, 0, 0, 430, 430, 440, 850, 120, 120);
330
+        ctx.restore();
331
+
332
+        //绘制头像
333
+        ctx.arc(96, 906, 50, 0, 2 * Math.PI); //画出圆
334
+        ctx.strokeStyle = "#ffffff";
335
+        ctx.clip(); //裁剪上面的圆形
336
+        ctx.drawImage(list[2].tempFilePath, 46, 856, 100, 100);
337
+        ctx.draw(false, function() {
338
+          Taro.canvasToTempFilePath({
339
+            canvasId: canvasName,
340
+            success: function({ tempFilePath }) {
341
+              resolve(tempFilePath);
342
+            }
343
+          });
344
+        });
345
+      })
346
+      .catch(err => {
347
+        rtLog.error(
348
+          "下载图片失败, 图片地址 (" +
349
+            `${_poster} , ${qrcode}, ${_avatarurl}` +
350
+            "), 错误消息: " +
351
+            (err.message || err.errMsg || err)
352
+        );
314 353
       });
315
-    }).catch((err) => {
316
-      rtLog.error('下载图片失败, 图片地址 ('+ `${_poster} , ${qrcode}, ${_avatarurl}` +'), 错误消息: ' + ( err.message || err.errMsg || err))
317
-    })
318
-  })
319
-}
354
+  });
355
+};
320 356
 
321 357
 // 删除本地缓存文件
322
-export const removeLocalFile = (callback) => {
358
+export const removeLocalFile = callback => {
323 359
   Taro.getSavedFileList().then(res => {
324 360
     if (res.fileList.length > 0) {
325 361
       res.fileList.map(file => {
326
-        Taro.removeSavedFile({ filePath: file.filePath })
327
-      })
328
-      callback && callback()
362
+        Taro.removeSavedFile({ filePath: file.filePath });
363
+      });
364
+      callback && callback();
329 365
     } else {
330
-      callback && callback()
366
+      callback && callback();
331 367
     }
332
-  })
333
-}
334
-
368
+  });
369
+};
335 370
 
336 371
 // 把当前画布指定区域的内容导出生成指定大小的图片
337 372
 export const canvasToTempFilePath = (canvasName, callback) => {
338 373
   Taro.canvasToTempFilePath({
339 374
     canvasId: canvasName,
340
-    success: function (data) {
341
-      var tempFilePath = data.tempFilePath
342
-      callback(tempFilePath)
375
+    success: function(data) {
376
+      var tempFilePath = data.tempFilePath;
377
+      callback(tempFilePath);
343 378
     },
344
-    fail: function (res) {
379
+    fail: function(res) {
345 380
       console.log(res);
346 381
     }
347 382
   });
348
-}
383
+};
349 384
 // 保存文件到本地
350 385
 export const saveFile = (tempFilePath, callback) => {
351 386
   Taro.saveFile({
352 387
     tempFilePath,
353 388
     success(res1) {
354
-      Taro.hideLoading()
355
-      console.log('成功' + res1.savedFilePath)
389
+      Taro.hideLoading();
390
+      console.log("成功" + res1.savedFilePath);
356 391
       callback(res1.savedFilePath);
357 392
     },
358
-    fail: function (res) {
359
-      console.log('失败');
393
+    fail: function(res) {
394
+      console.log("失败");
360 395
     }
361
-  })
362
-}
396
+  });
397
+};
363 398
 // 下载文件
364 399
 export const downloadFile = (imgUrl, callback) => {
365 400
   Taro.downloadFile({
366 401
     url: imgUrl,
367
-    success: function (param) {
402
+    success: function(param) {
368 403
       if (param.statusCode === 200) {
369
-
370
-        callback(param)
404
+        callback(param);
371 405
       }
372 406
     },
373
-    fail: function (res) {
374
-      console.log('生成失败请稍候重试');
407
+    fail: function(res) {
408
+      console.log("生成失败请稍候重试");
375 409
     }
376
-  })
377
-}
410
+  });
411
+};
378 412
 
379 413
 // 生成名片海报
380
-export const makeCardPoster = (data) => {
414
+export const makeCardPoster = data => {
381 415
   return new Promise(resolve => {
382
-    const { bgImg, qrcodeImg, name, nickname, avatarurl, company, post, canvasName } = data
416
+    const {
417
+      bgImg,
418
+      qrcodeImg,
419
+      name,
420
+      nickname,
421
+      avatarurl,
422
+      company,
423
+      post,
424
+      canvasName
425
+    } = data;
383 426
     const ctx = Taro.createCanvasContext(canvasName);
384
-    const _qrcodeImg = getDownloadURL(qrcodeImg, 'alioss');
385
-    const _avatarurl = getDownloadURL(avatarurl, 'avatar');
427
+    const _qrcodeImg = getDownloadURL(qrcodeImg, "alioss");
428
+    const _avatarurl = getDownloadURL(avatarurl, "avatar");
386 429
 
387 430
     Promise.all([
388 431
       Taro.downloadFile({ url: _avatarurl }),
389
-      Taro.downloadFile({ url: _qrcodeImg }),
432
+      Taro.downloadFile({ url: _qrcodeImg })
390 433
     ]).then(list => {
391
-
392 434
       // 绘制背景
393
-      ctx.setFillStyle("#ffe200")
394
-      ctx.fillRect(0, 0, 640, 1040)
435
+      ctx.setFillStyle("#ffe200");
436
+      ctx.fillRect(0, 0, 640, 1040);
395 437
       ctx.drawImage(bgImg, 0, 0, 640, 1040);
396 438
 
397 439
       // 绘制小程序码
@@ -399,85 +441,87 @@ export const makeCardPoster = (data) => {
399 441
 
400 442
       //绘制名字
401 443
       ctx.setFontSize(35);
402
-      ctx.setFillStyle('#000');
403
-      ctx.setTextAlign('center');
444
+      ctx.setFillStyle("#000");
445
+      ctx.setTextAlign("center");
404 446
       ctx.fillText(name, 320, 356, 450);
405 447
       ctx.stroke();
406 448
 
407 449
       // 绘制圆角矩形
408 450
       roundRect(ctx, 220, 180, 320, 80, 10);
409 451
       ctx.strokeStyle = "#7ff724";
410
-      ctx.setFillStyle("#7ff724")
452
+      ctx.setFillStyle("#7ff724");
411 453
       ctx.fill();
412
-      ctx.stroke()
454
+      ctx.stroke();
413 455
 
414 456
       //推荐语
415 457
       ctx.setFontSize(20);
416
-      ctx.setFillStyle('#000');
417
-      ctx.setTextAlign('left');
458
+      ctx.setFillStyle("#000");
459
+      ctx.setTextAlign("left");
418 460
 
419 461
       // 文字换行
420
-      var str = nickname + ':给你推荐个人,Ta特别靠谱~'
462
+      var str = nickname + ":给你推荐个人,Ta特别靠谱~";
421 463
       var lineWidth = 0;
422
-      var canvasWidth = 260;//文字宽度
423
-      var initHeight = 213;//绘制字体距离canvas顶部初始的高度
464
+      var canvasWidth = 260; //文字宽度
465
+      var initHeight = 213; //绘制字体距离canvas顶部初始的高度
424 466
       var lastSubStrIndex = 0; //每次开始截取的字符串的索引
425 467
       for (let i = 0; i < str.length; i++) {
426 468
         lineWidth += ctx.measureText(str[i]).width;
427 469
         if (lineWidth > canvasWidth) {
428
-          ctx.fillText(str.substring(lastSubStrIndex, i), 250, initHeight);//绘制截取部分
429
-          initHeight += 30;//20为字体的高度
470
+          ctx.fillText(str.substring(lastSubStrIndex, i), 250, initHeight); //绘制截取部分
471
+          initHeight += 30; //20为字体的高度
430 472
           lineWidth = 0;
431 473
           lastSubStrIndex = i;
432 474
         }
433
-        if (i == str.length - 1) {//绘制剩余部分
475
+        if (i == str.length - 1) {
476
+          //绘制剩余部分
434 477
           ctx.fillText(str.substring(lastSubStrIndex, i + 1), 250, initHeight);
435 478
         }
436 479
       }
437 480
       ctx.stroke();
438 481
       //绘制职位
439 482
       ctx.setFontSize(25);
440
-      ctx.setFillStyle('#606060');
441
-      ctx.setTextAlign('center');
483
+      ctx.setFillStyle("#606060");
484
+      ctx.setTextAlign("center");
442 485
       ctx.fillText(post, 320, 446, 450);
443 486
       ctx.stroke();
444 487
       //绘制公司
445 488
       ctx.setFontSize(25);
446
-      ctx.setFillStyle('#606060');
447
-      ctx.setTextAlign('center');
489
+      ctx.setFillStyle("#606060");
490
+      ctx.setTextAlign("center");
448 491
       ctx.fillText(company, 320, 500, 450);
449 492
       ctx.stroke();
450 493
       //长按或扫一扫了解Ta
451 494
       ctx.setFontSize(20);
452
-      ctx.setFillStyle('#a5a5a5');
453
-      ctx.setTextAlign('center');
454
-      ctx.fillText('长按或扫一扫了解Ta', 320, 860, 450);
495
+      ctx.setFillStyle("#a5a5a5");
496
+      ctx.setTextAlign("center");
497
+      ctx.fillText("长按或扫一扫了解Ta", 320, 860, 450);
455 498
       ctx.stroke();
456
-      ctx.save()
499
+      ctx.save();
457 500
 
458 501
       // 绘制头像
459
-      ctx.arc(146, 216, 50, 0, 2 * Math.PI) //画出圆
502
+      ctx.arc(146, 216, 50, 0, 2 * Math.PI); //画出圆
460 503
       ctx.strokeStyle = "#ffffff";
461 504
       ctx.clip(); //裁剪上面的圆形
462 505
       ctx.drawImage(list[0].tempFilePath, 96, 166, 100, 100);
463
-      ctx.restore()
506
+      ctx.restore();
464 507
 
465 508
       // 绘制二维码
466
-      ctx.save()
467
-      ctx.arc(315, 675, 65, 0, 2 * Math.PI) //画出圆
509
+      ctx.save();
510
+      ctx.arc(315, 675, 65, 0, 2 * Math.PI); //画出圆
468 511
       ctx.strokeStyle = "#ffffff";
469 512
       ctx.clip();
470 513
       ctx.drawImage(list[1].tempFilePath, 50, 0, 400, 400, 249, 610, 130, 130);
471
-      ctx.draw(false, function () {
514
+      ctx.draw(false, function() {
472 515
         Taro.canvasToTempFilePath({
473
-          canvasId: canvasName, success: function ({ tempFilePath }) {
474
-            resolve(tempFilePath)
516
+          canvasId: canvasName,
517
+          success: function({ tempFilePath }) {
518
+            resolve(tempFilePath);
475 519
           }
476
-        })
520
+        });
477 521
       });
478
-    })
479
-  })
480
-}
522
+    });
523
+  });
524
+};
481 525
 
482 526
 // 圆角矩形
483 527
 export const roundRect = (ctx, x, y, w, h, r) => {
@@ -490,20 +534,26 @@ export const roundRect = (ctx, x, y, w, h, r) => {
490 534
   ctx.arcTo(x, y + h, x, y, r);
491 535
   ctx.arcTo(x, y, x + w, y, r);
492 536
   ctx.closePath();
493
-}
537
+};
494 538
 
495
-export const makeCardShareImg = (data) => {
539
+export const makeCardShareImg = data => {
496 540
   return new Promise(resolve => {
497
-
498
-    const { bgImg, post, name, phoneImg, phone, picture, addrImg, company, canvasName } = data
541
+    const {
542
+      bgImg,
543
+      post,
544
+      name,
545
+      phoneImg,
546
+      phone,
547
+      picture,
548
+      addrImg,
549
+      company,
550
+      canvasName
551
+    } = data;
499 552
     const ctx = Taro.createCanvasContext(canvasName);
500
-    const _picture = getDownloadURL(picture, 'alioss');
501
-    Promise.all([
502
-      Taro.downloadFile({ url: _picture })
503
-    ]).then(list => {
504
-
505
-      ctx.setFillStyle("#ffffff")
506
-      ctx.fillRect(0, 0, 750, 400)
553
+    const _picture = getDownloadURL(picture, "alioss");
554
+    Promise.all([Taro.downloadFile({ url: _picture })]).then(list => {
555
+      ctx.setFillStyle("#ffffff");
556
+      ctx.fillRect(0, 0, 750, 400);
507 557
 
508 558
       // 背景海报
509 559
       ctx.drawImage(bgImg, 0, 0, 750, 600);
@@ -526,55 +576,56 @@ export const makeCardShareImg = (data) => {
526 576
       // 手机图片
527 577
       ctx.drawImage(phoneImg, 48, 450, 36, 36);
528 578
       //手机号码
529
-      ctx.fillText('TEL: ' + phone, 100, 478);
579
+      ctx.fillText("TEL: " + phone, 100, 478);
530 580
 
531 581
       //绘制头像
532
-      ctx.arc(550, 200, 100, 0, 2 * Math.PI) //画出圆
582
+      ctx.arc(550, 200, 100, 0, 2 * Math.PI); //画出圆
533 583
       ctx.strokeStyle = "#ffffff";
534
-      ctx.stroke()
584
+      ctx.stroke();
535 585
 
536 586
       ctx.clip(); //裁剪上面的圆形
537 587
       ctx.drawImage(list[0].tempFilePath, 450, 100, 200, 200, 400, 100);
538 588
 
539
-      ctx.draw(false, function () {
540
-        Taro.canvasToTempFilePath({ canvasId: canvasName, quality: 1 }).then(({ tempFilePath }) => {
541
-          resolve(tempFilePath)
542
-        })
589
+      ctx.draw(false, function() {
590
+        Taro.canvasToTempFilePath({ canvasId: canvasName, quality: 1 }).then(
591
+          ({ tempFilePath }) => {
592
+            resolve(tempFilePath);
593
+          }
594
+        );
543 595
       });
544
-    })
545
-  })
546
-}
596
+    });
597
+  });
598
+};
547 599
 
548
-export const isObject = function (value) {
600
+export const isObject = function(value) {
549 601
   var type = typeof value;
550
-  return value != null && type === 'object';
551
-}
602
+  return value != null && type === "object";
603
+};
552 604
 
553 605
 //使用递归的方式实现数组、对象的深拷贝
554
-export const deepClone = function (obj) {
606
+export const deepClone = function(obj) {
555 607
   if (!isObject(obj)) {
556
-    throw new Error('obj 不是一个对象!')
608
+    throw new Error("obj 不是一个对象!");
557 609
   }
558
-  let isArray = Array.isArray(obj)
559
-  let cloneObj = isArray ? [] : {}
610
+  let isArray = Array.isArray(obj);
611
+  let cloneObj = isArray ? [] : {};
560 612
   for (let key in obj) {
561
-    cloneObj[key] = isObject(obj[key]) ? deepClone(obj[key]) : obj[key]
613
+    cloneObj[key] = isObject(obj[key]) ? deepClone(obj[key]) : obj[key];
562 614
   }
563 615
 
564
-  return cloneObj
565
-}
566
-
616
+  return cloneObj;
617
+};
567 618
 
568
-export const validateAuth = function (name, callback) {
619
+export const validateAuth = function(name, callback) {
569 620
   Taro.getSetting().then(res => {
570
-    const hasAuth = res.authSetting[name]
621
+    const hasAuth = res.authSetting[name];
571 622
     if (hasAuth) {
572
-      callback && callback(true)
623
+      callback && callback(true);
573 624
     } else {
574
-      callback && callback(false)
625
+      callback && callback(false);
575 626
     }
576
-  })
577
-}
627
+  });
628
+};
578 629
 
579 630
 /**
580 631
  * 检测 `phoneNumber` 是否是中国的手机号码。
@@ -583,12 +634,15 @@ export const validateAuth = function (name, callback) {
583 634
  * @param strict 是否严格模式
584 635
  * @returns `phoneNumber` 是中国的手机号码返回 `true`,否则返回 `false`
585 636
  */
586
-export const isChineseMobilePhoneNumber = function (phoneNumber, strict) {
637
+export const isChineseMobilePhoneNumber = function(phoneNumber, strict) {
587 638
   if (strict === undefined) {
588 639
     strict = false;
589 640
   }
590
-  return (strict ? /^1(?:3[0-9]|4[5-9]|5[0-9]|6[12456]|7[0-8]|8[0-9]|9[0-9])[0-9]{8}$/ : /^1[3-9][0-9]{9}$/).test(phoneNumber.toString());
591
-}
641
+  return (strict
642
+    ? /^1(?:3[0-9]|4[5-9]|5[0-9]|6[12456]|7[0-8]|8[0-9]|9[0-9])[0-9]{8}$/
643
+    : /^1[3-9][0-9]{9}$/
644
+  ).test(phoneNumber.toString());
645
+};
592 646
 
593 647
 /**
594 648
  * 检查 `value` 是否是一个邮件地址。
@@ -597,87 +651,88 @@ export const isChineseMobilePhoneNumber = function (phoneNumber, strict) {
597 651
  * @returns `value` 是邮件地址返回 `true`,否则返回 `false`
598 652
  * @see http://emailregex.com/
599 653
  */
600
-export const isEmail = function (value) {
654
+export const isEmail = function(value) {
601 655
   var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
602 656
   return re.test(value);
603
-}
657
+};
604 658
 
605 659
 /**
606 660
  * 转换海报的数据库配置为可用配置
607
- * @param {*} config 
608
- * @param {*} params 
661
+ * @param {*} config
662
+ * @param {*} params
609 663
  */
610 664
 export function getCanvasConfig(config, params) {
611 665
   if (!config || !params) {
612
-    throw new Error('转换海报配置出错: config 或 params 不能为空')
666
+    throw new Error("转换海报配置出错: config 或 params 不能为空");
613 667
   }
614 668
 
615
-  const { basic, items } = typeof config === 'string' ? JSON.parse(config) : config
669
+  const { basic, items } =
670
+    typeof config === "string" ? JSON.parse(config) : config;
616 671
 
617 672
   const itemConf = items.reduce((conf, item) => {
618
-    const { type, remark, value, variable, ...others } = item
619
-    const settingOfType = conf[type] || []
620
-    let val = variable ? params[variable] : value
673
+    const { type, remark, value, variable, ...others } = item;
674
+    const settingOfType = conf[type] || [];
675
+    let val = variable ? params[variable] : value;
621 676
 
622
-    let mainVal = {}
677
+    let mainVal = {};
623 678
     switch (type) {
624
-      case 'texts':
625
-        mainVal = { text: val }
679
+      case "texts":
680
+        mainVal = { text: val };
626 681
         break;
627
-      case 'images':
628
-        mainVal = { url: val }
682
+      case "images":
683
+        mainVal = { url: val };
629 684
         break;
630 685
       default:
631
-        val = true
686
+        val = true;
632 687
         break;
633 688
     }
634 689
 
635 690
     if (val) {
636 691
       settingOfType.push({
637 692
         ...mainVal,
638
-        ...others,
639
-      })
640
-      conf[type] = settingOfType
693
+        ...others
694
+      });
695
+      conf[type] = settingOfType;
641 696
     }
642
-    
643
-    return conf
644
-  }, {})
697
+
698
+    return conf;
699
+  }, {});
645 700
 
646 701
   return {
647 702
     ...basic,
648
-    ...itemConf,
649
-  }
703
+    ...itemConf
704
+  };
650 705
 }
651 706
 
652 707
 /**
653 708
  * 身份证校验
654
- * 
709
+ *
655 710
  * https://blog.csdn.net/gqzydh/article/details/90295842
656
- * 
657
- * @param {*} idcode 
711
+ *
712
+ * @param {*} idcode
658 713
  */
659
-export function checkIDCard(idcode){
714
+export function checkIDCard(idcode) {
660 715
   // 加权因子
661
-  var weight_factor = [7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];
716
+  var weight_factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
662 717
   // 校验码
663
-  var check_code = ['1', '0', 'X' , '9', '8', '7', '6', '5', '4', '3', '2'];
718
+  var check_code = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
664 719
 
665 720
   var code = idcode + "";
666
-  var last = idcode[17];//最后一位
721
+  var last = idcode[17]; //最后一位
667 722
 
668
-  var seventeen = code.substring(0,17);
723
+  var seventeen = code.substring(0, 17);
669 724
 
670 725
   // ISO 7064:1983.MOD 11-2
671 726
   // 判断最后一位校验码是否正确
672 727
   var arr = seventeen.split("");
673 728
   var len = arr.length;
674 729
   var num = 0;
675
-  for(var i = 0; i < len; i++){
676
-      num = num + arr[i] * weight_factor[i];
730
+  for (var i = 0; i < len; i++) {
731
+    num = num + arr[i] * weight_factor[i];
677 732
   }
678
-  
733
+
679 734
   // 获取余数
680
-  var resisue = num%11;
735
+  var resisue = num % 11;
681 736
   var last_no = check_code[resisue];
682 737
 
683 738
   // 格式的正则