Przeglądaj źródła

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/miniapp-v3 into dev

# Conflicts:
#	src/pages/project/h5Page.js
傅行帆 5 lat temu
rodzic
commit
bc7671eec4

+ 4
- 4
config/prod.js Wyświetl plik

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

+ 1
- 1
project.config.json Wyświetl plik

@@ -2,7 +2,7 @@
2 2
 	"miniprogramRoot": "dist/",
3 3
 	"projectname": "mini-chengjiao",
4 4
 	"description": "知与行互动",
5
-	"appid": "wxd9ee3a9480a4e544",
5
+	"appid": "wxd6f47a9bb3052175",
6 6
 	"setting": {
7 7
 		"urlCheck": false,
8 8
 		"es6": false,

+ 142
- 122
src/components/taro-plugin-canvas/index.js Wyświetl plik

@@ -1,15 +1,10 @@
1
-import Taro, { Component } from '@tarojs/taro';
1
+import Taro, { Component } from "@tarojs/taro";
2 2
 // import PropTypes from 'prop-types';
3
-import { Canvas } from '@tarojs/components';
4
-import { randomString, getHeight, downloadImageAndInfo } from './utils/tools';
5
-import {
6
-  drawImage,
7
-  drawText,
8
-  drawBlock,
9
-  drawLine,
10
-} from './utils/draw';
11
-import './index.css';
12
-import rtLog from '@/utils/rtLog';
3
+import { Canvas } from "@tarojs/components";
4
+import { randomString, getHeight, downloadImageAndInfo } from "./utils/tools";
5
+import { drawImage, drawText, drawBlock, drawLine } from "./utils/draw";
6
+import "./index.css";
7
+import rtLog from "@/utils/rtLog";
13 8
 
14 9
 let count = 1;
15 10
 export default class CanvasDrawer extends Component {
@@ -26,8 +21,8 @@ export default class CanvasDrawer extends Component {
26 21
       pxWidth: 0,
27 22
       pxHeight: 0,
28 23
       debug: false,
29
-      factor: 0,
30
-    }
24
+      factor: 0
25
+    };
31 26
     this.canvasId = randomString(10);
32 27
     this.ctx = null;
33 28
     this.cache = {};
@@ -46,12 +41,12 @@ export default class CanvasDrawer extends Component {
46 41
       const screenWidth = sysInfo.screenWidth;
47 42
       this.setState({
48 43
         factor: screenWidth / 750
49
-      })
44
+      });
50 45
       this.onCreate();
51
-    }, 0)
46
+    }, 0);
52 47
   }
53 48
 
54
-  componentWillUnmount() { }
49
+  componentWillUnmount() {}
55 50
 
56 51
   /**
57 52
    * @description rpx => px 基础方法
@@ -65,7 +60,7 @@ export default class CanvasDrawer extends Component {
65 60
       return parseInt(rpx * factor);
66 61
     }
67 62
     return rpx * factor;
68
-  }
63
+  };
69 64
   /**
70 65
    * @description px => rpx
71 66
    * @param { number } px - 需要转换的数值
@@ -78,7 +73,7 @@ export default class CanvasDrawer extends Component {
78 73
       return parseInt(px / factor);
79 74
     }
80 75
     return px / factor;
81
-  }
76
+  };
82 77
 
83 78
   /**
84 79
    * @description 下载图片并获取图片信息
@@ -88,19 +83,22 @@ export default class CanvasDrawer extends Component {
88 83
   _downloadImageAndInfo = (image, index) => {
89 84
     return new Promise((resolve, reject) => {
90 85
       downloadImageAndInfo(image, index, this.toRpx)
91
-      .then(
92
-        (result) => {
86
+        .then(result => {
93 87
           this.drawArr.push(result);
94 88
           resolve();
95
-        }
96
-      )
97
-      .catch(err => {
98
-        console.log(err);
99
-        rtLog.error('下载图片失败, 图片地址 ('+ image +'), 错误消息: ' + ( err.message || err.errMsg || err))
100
-        reject(err)
101
-      });
102
-    })
103
-  }
89
+        })
90
+        .catch(err => {
91
+          console.log(err);
92
+          rtLog.error(
93
+            "下载图片失败, 图片地址 (" +
94
+              (image && image.url ? image.url : "无") +
95
+              "), 错误消息: " +
96
+              (err.message || err.errMsg || err)
97
+          );
98
+          reject(err);
99
+        });
100
+    });
101
+  };
104 102
   /**
105 103
    * @param  {} images=[]
106 104
    */
@@ -108,10 +106,12 @@ export default class CanvasDrawer extends Component {
108 106
     const drawList = [];
109 107
     let imagesTemp = images;
110 108
 
111
-    imagesTemp.forEach((image, index) => drawList.push(this._downloadImageAndInfo(image, index)));
109
+    imagesTemp.forEach((image, index) =>
110
+      drawList.push(this._downloadImageAndInfo(image, index))
111
+    );
112 112
 
113 113
     return Promise.all(drawList);
114
-  }
114
+  };
115 115
 
116 116
   /**
117 117
    * @param
@@ -124,17 +124,17 @@ export default class CanvasDrawer extends Component {
124 124
           .then(() => {
125 125
             resolve();
126 126
           })
127
-          .catch((e) => {
127
+          .catch(e => {
128 128
             console.log(e);
129
-            reject(e)
129
+            reject(e);
130 130
           });
131 131
       } else {
132
-        setTimeout(()=>{
132
+        setTimeout(() => {
133 133
           resolve(1);
134
-        }, 500)
134
+        }, 500);
135 135
       }
136
-    })
137
-  }
136
+    });
137
+  };
138 138
 
139 139
   /**
140 140
    * @param  {} w
@@ -142,53 +142,61 @@ export default class CanvasDrawer extends Component {
142 142
    * @param  {} debug
143 143
    */
144 144
   initCanvas = (w, h, debug) => {
145
-    return new Promise((resolve) => {
146
-      console.debug('-----------start to init canvas state------------')
147
-      this.setState({
148
-        pxWidth: this.toPx(w),
149
-        pxHeight: this.toPx(h),
150
-        debug,
151
-      }, () => {
152
-        console.debug('-----------finish init canvas state------------')
153
-        resolve()
154
-      });
145
+    return new Promise(resolve => {
146
+      console.debug("-----------start to init canvas state------------");
147
+      this.setState(
148
+        {
149
+          pxWidth: this.toPx(w),
150
+          pxHeight: this.toPx(h),
151
+          debug
152
+        },
153
+        () => {
154
+          console.debug("-----------finish init canvas state------------");
155
+          resolve();
156
+        }
157
+      );
155 158
     });
156
-  }
159
+  };
157 160
   /**
158 161
    * @param  { boolean }
159 162
    */
160 163
   onCreate = () => {
161 164
     const { onCreateFail, config } = this.props;
162
-    Taro.showLoading({ mask: true, title: '生成中...' });
163
-    console.debug('-----start to download images---')
164
-      return this.downloadResourceTransit()
165
+    Taro.showLoading({ mask: true, title: "生成中..." });
166
+    console.debug("-----start to download images---");
167
+    return this.downloadResourceTransit()
165 168
       .then(() => {
166
-        console.debug('-----finish download images---')
169
+        console.debug("-----finish download images---");
167 170
         this.create(config);
168 171
       })
169
-      .catch((err) => {
172
+      .catch(err => {
170 173
         Taro.hideLoading();
171
-        Taro.showToast({ icon: 'none', title: err.message || err.errMsg || '下载图片失败' });
174
+        Taro.showToast({
175
+          icon: "none",
176
+          title: err.message || err.errMsg || "下载图片失败"
177
+        });
172 178
         console.error(err);
173 179
         if (!onCreateFail) {
174
-          console.warn('您必须实现 taro-plugin-canvas 组件的 onCreateFail 方法,详见文档 https://github.com/chuyun/taro-plugin-canvas#fail');
180
+          console.warn(
181
+            "您必须实现 taro-plugin-canvas 组件的 onCreateFail 方法,详见文档 https://github.com/chuyun/taro-plugin-canvas#fail"
182
+          );
175 183
         }
176 184
         onCreateFail && onCreateFail(err);
177
-      })
178
-  }
185
+      });
186
+  };
179 187
 
180 188
   /**
181 189
    * @param  { object } config
182 190
    */
183
-  create = (config) => {
184
-    console.debug('-----create canvas---', this.canvasId, this.$scope)
191
+  create = config => {
192
+    console.debug("-----create canvas---", this.canvasId, this.$scope);
185 193
     this.ctx = Taro.createCanvasContext(this.canvasId, this.$scope);
186
-    console.debug('-----finish create canvas---')
194
+    console.debug("-----finish create canvas---");
187 195
     const height = getHeight(config);
188
-    console.debug('-----ready to init canvas---')
196
+    console.debug("-----ready to init canvas---");
189 197
     this.initCanvas(config.width, height, config.debug)
190 198
       .then(() => {
191
-        console.debug('-----finish init canvas---')
199
+        console.debug("-----finish init canvas---");
192 200
         // 设置画布底色
193 201
         if (config.backgroundColor) {
194 202
           this.ctx.save();
@@ -200,107 +208,119 @@ export default class CanvasDrawer extends Component {
200 208
           texts = [],
201 209
           // images = [],
202 210
           blocks = [],
203
-          lines = [],
211
+          lines = []
204 212
         } = config;
205 213
         const queue = this.drawArr
206
-          .concat(texts.map((item) => {
207
-            item.type = 'text';
208
-            item.zIndex = item.zIndex || 0;
209
-            return item;
210
-          }))
211
-          .concat(blocks.map((item) => {
212
-            item.type = 'block';
213
-            item.zIndex = item.zIndex || 0;
214
-            return item;
215
-          }))
216
-          .concat(lines.map((item) => {
217
-            item.type = 'line';
218
-            item.zIndex = item.zIndex || 0;
219
-            return item;
220
-          }));
214
+          .concat(
215
+            texts.map(item => {
216
+              item.type = "text";
217
+              item.zIndex = item.zIndex || 0;
218
+              return item;
219
+            })
220
+          )
221
+          .concat(
222
+            blocks.map(item => {
223
+              item.type = "block";
224
+              item.zIndex = item.zIndex || 0;
225
+              return item;
226
+            })
227
+          )
228
+          .concat(
229
+            lines.map(item => {
230
+              item.type = "line";
231
+              item.zIndex = item.zIndex || 0;
232
+              return item;
233
+            })
234
+          );
221 235
         // 按照顺序排序
222 236
         queue.sort((a, b) => a.zIndex - b.zIndex);
223 237
 
224
-        queue.forEach((item) => {
238
+        queue.forEach(item => {
225 239
           let drawOptions = {
226 240
             ctx: this.ctx,
227 241
             toPx: this.toPx,
228
-            toRpx: this.toRpx,
229
-          }
230
-          if (item.type === 'image') {
231
-            drawImage(item,drawOptions)
232
-          } else if (item.type === 'text') {
233
-            drawText(item,drawOptions)
234
-          } else if (item.type === 'block') {
235
-            drawBlock(item,drawOptions)
236
-          } else if (item.type === 'line') {
237
-            drawLine(item,drawOptions)
242
+            toRpx: this.toRpx
243
+          };
244
+          if (item.type === "image") {
245
+            drawImage(item, drawOptions);
246
+          } else if (item.type === "text") {
247
+            drawText(item, drawOptions);
248
+          } else if (item.type === "block") {
249
+            drawBlock(item, drawOptions);
250
+          } else if (item.type === "line") {
251
+            drawLine(item, drawOptions);
238 252
           }
239 253
         });
240 254
 
241 255
         const res = Taro.getSystemInfoSync();
242 256
         const platform = res.platform;
243 257
         let time = 0;
244
-        if (platform === 'android') {
258
+        if (platform === "android") {
245 259
           // 在安卓平台,经测试发现如果海报过于复杂在转换时需要做延时,要不然样式会错乱
246 260
           time = 300;
247 261
         }
248
-        console.debug('-----start to draw---')
262
+        console.debug("-----start to draw---");
249 263
         this.ctx.draw(false, () => {
250
-          console.debug('-----finish draw---')
264
+          console.debug("-----finish draw---");
251 265
           setTimeout(() => {
252
-            console.debug('-----ready to read file---')
266
+            console.debug("-----ready to read file---");
253 267
             this.getTempFile();
254 268
           }, time);
255 269
         });
256 270
       })
257
-      .catch((err) => {
258
-        Taro.showToast({ icon: 'none', title: err.errMsg || '生成失败' });
271
+      .catch(err => {
272
+        Taro.showToast({ icon: "none", title: err.errMsg || "生成失败" });
259 273
         console.error(err);
260 274
       });
261
-  }
275
+  };
262 276
 
263
-  getTempFile = (otherOptions) => {
277
+  getTempFile = otherOptions => {
264 278
     const { onCreateSuccess, onCreateFail } = this.props;
265
-    Taro.canvasToTempFilePath({
266
-      canvasId: this.canvasId,
267
-      success: (result) => {
268
-        console.debug('-----read file success---')
269
-        if (!onCreateSuccess) {
270
-          console.warn('您必须实现 taro-plugin-canvas 组件的 onCreateSuccess 方法,详见文档 https://github.com/chuyun/taro-plugin-canvas#success');
271
-        }
272
-        onCreateSuccess && onCreateSuccess(result);
273
-      },
274
-      fail: (error) => {
275
-        const { errMsg } = error;
276
-        console.log(errMsg)
277
-        if (errMsg === 'canvasToTempFilePath:fail:create bitmap failed') {
278
-          count += 1;
279
-          if (count <= 3) {
280
-            this.getTempFile(otherOptions);
281
-          } else {
282
-            if (!onCreateFail) {
283
-              console.warn('您必须实现 taro-plugin-canvas 组件的 onCreateFail 方法,详见文档 https://github.com/chuyun/taro-plugin-canvas#fail');
279
+    Taro.canvasToTempFilePath(
280
+      {
281
+        canvasId: this.canvasId,
282
+        success: result => {
283
+          console.debug("-----read file success---");
284
+          if (!onCreateSuccess) {
285
+            console.warn(
286
+              "您必须实现 taro-plugin-canvas 组件的 onCreateSuccess 方法,详见文档 https://github.com/chuyun/taro-plugin-canvas#success"
287
+            );
288
+          }
289
+          onCreateSuccess && onCreateSuccess(result);
290
+        },
291
+        fail: error => {
292
+          const { errMsg } = error;
293
+          console.log(errMsg);
294
+          if (errMsg === "canvasToTempFilePath:fail:create bitmap failed") {
295
+            count += 1;
296
+            if (count <= 3) {
297
+              this.getTempFile(otherOptions);
298
+            } else {
299
+              if (!onCreateFail) {
300
+                console.warn(
301
+                  "您必须实现 taro-plugin-canvas 组件的 onCreateFail 方法,详见文档 https://github.com/chuyun/taro-plugin-canvas#fail"
302
+                );
303
+              }
304
+              onCreateFail && onCreateFail(error);
284 305
             }
285
-            onCreateFail && onCreateFail(error);
286 306
           }
287 307
         }
288 308
       },
289
-    }, this.$scope);
290
-  }
309
+      this.$scope
310
+    );
311
+  };
291 312
 
292 313
   render() {
293 314
     const { pxWidth, pxHeight, debug } = this.state;
294
-    if(pxWidth && pxHeight){
315
+    if (pxWidth && pxHeight) {
295 316
       return (
296 317
         <Canvas
297 318
           canvas-id={this.canvasId}
298 319
           style={`width:${pxWidth}px; height:${pxHeight}px;`}
299
-          className={`${debug ? 'debug' : 'pro'} canvas`}
320
+          className={`${debug ? "debug" : "pro"} canvas`}
300 321
         />
301 322
       );
302 323
     }
303 324
     return null;
304 325
   }
305 326
 }
306
-

+ 6
- 6
src/pages/person/spread/index.js Wyświetl plik

@@ -37,12 +37,12 @@ export default class Index extends Component {
37 37
       }
38 38
 
39 39
       getMiniQrcode(payload).then(qrcode => {
40
-        rtLog.error(qrcode, "qrcodeqrcodeqrcodeqrcodeqrcodeqrcode")
40
+        console.log(qrcode, "qrcodeqrcodeqrcodeqrcodeqrcodeqrcode")
41 41
         let data = {
42 42
           qrcode,//小程序二维码
43 43
           nickname,//访问者名字
44 44
           avatarurl: avatarurl,//访问者头像
45
-          tip:personType == ROLE_CODE['CONSULTANT'] ? '扫一扫上面的二维码图案,成为我的客户' : '扫一扫上面的二维码图案,成为独立经纪人'
45
+          tip: personType == ROLE_CODE['CONSULTANT'] ? '扫一扫上面的二维码图案,成为我的客户' : '扫一扫上面的二维码图案,成为独立经纪人'
46 46
         }
47 47
         this.setState({
48 48
           qrcode
@@ -57,7 +57,7 @@ export default class Index extends Component {
57 57
     if (flag) {
58 58
       rtLog.error(flag, "flagflagflagflag,true")
59 59
       this.getPosterData().then(posterData => {
60
-        rtLog.error(posterData,"posterDataposterDataposterDataposterDataposterData")
60
+        rtLog.error(posterData, "posterDataposterDataposterDataposterDataposterData")
61 61
         this.setState({
62 62
           makePosterStatus: !!flag,
63 63
           posterData,
@@ -65,7 +65,7 @@ export default class Index extends Component {
65 65
         })
66 66
       })
67 67
     } else {
68
-      rtLog.error(flag,"flagflagflagflag,false")
68
+      rtLog.error(flag, "flagflagflagflag,false")
69 69
       this.setState({
70 70
         makePosterStatus: !!flag
71 71
       })
@@ -88,9 +88,9 @@ export default class Index extends Component {
88 88
             {
89 89
               personType == ROLE_CODE['CONSULTANT'] ? <View className='spread-code-tip'>扫一扫上面的二维码图案,成为我的客户</View> : <View className='spread-code-tip'>扫一扫上面的二维码图案,成为独立经纪人</View>
90 90
             }
91
-            
91
+
92 92
           </View>
93
-          <View className='save_btn'  onClick={() => { this.toggleVisiblePoster(true) }}>保存到手机</View>
93
+          <View className='save_btn' onClick={() => { this.toggleVisiblePoster(true) }}>保存到手机</View>
94 94
         </View>
95 95
       </Block>
96 96
 

+ 1
- 2
src/pages/project/h5Page.js Wyświetl plik

@@ -510,8 +510,7 @@ export default class Index extends Component {
510 510
       `${originURL.origin}${originURL.path}?${queryString}`,
511 511
       originURL.hash
512 512
     ].join("#");
513
-    console.log(webURL, "webURLwebURLwebURLwebURLwebURLwebURLwebURLwebURLwebURLwebURLwebURL")
514
-
513
+    console.log(webURL,"webURLwebURLwebURLwebURLwebURLwebURLwebURLwebURL")
515 514
     return (
516 515
       <Block>
517 516
         {this.renderMaskBanner()}

+ 43
- 0
src/pages/project/pay.js Wyświetl plik

@@ -0,0 +1,43 @@
1
+import Taro, { Component } from "@tarojs/taro";
2
+import ready from "@/utils/ready";
3
+
4
+export default class Index extends Component {
5
+  state = {
6
+
7
+  };
8
+
9
+  componentDidShow() {
10
+    ready.queue(() => {
11
+
12
+      console.log(this.$router, '支付中间页路径this.$routerthis.$router')
13
+
14
+      const queryParams = this.$router.params
15
+
16
+      Taro.requestPayment({
17
+        timeStamp: String(queryParams.timeStamp),
18
+        nonceStr: queryParams.nonceStr,
19
+        package: queryParams.package,
20
+        signType: queryParams.signType,
21
+        paySign: queryParams.sign,
22
+
23
+        success(res) {
24
+          Taro.navigateBack({ delta: 1 })
25
+        },
26
+        fail(err) {
27
+          Taro.navigateBack({ delta: 1 })
28
+        }
29
+      })
30
+    });
31
+  }
32
+
33
+
34
+  render() {
35
+
36
+    return (
37
+      <Block>
38
+
39
+
40
+      </Block>
41
+    );
42
+  }
43
+}

+ 6
- 0
src/routes.js Wyświetl plik

@@ -311,6 +311,12 @@ const routes = [
311 311
     pkg: 'main',
312 312
     type: 'other',
313 313
   },
314
+  {
315
+    name: '支付',
316
+    page: 'pages/project/pay',
317
+    pkg: 'main',
318
+    type: 'other',
319
+  },
314 320
   {
315 321
     name: '授权',
316 322
     page: 'pages/auth/index',

+ 27
- 23
src/utils/tools.js Wyświetl plik

@@ -215,8 +215,10 @@ export function parseQueryString(queryString) {
215 215
 }
216 216
 
217 217
 export function toQueryString(o) {
218
-  const obj = o || {}
219
-  return Object.keys(obj).map(key => `${key}=${obj[key]}`).join('&');
218
+  const obj = o || {};
219
+  return Object.keys(obj)
220
+    .map(key => `${key}=${obj[key]}`)
221
+    .join("&");
220 222
 }
221 223
 
222 224
 /**
@@ -264,7 +266,9 @@ export function getDownloadURL(url, type) {
264 266
 
265 267
   switch (type) {
266 268
     case "avatar":
267
-      return url.replace("https://wx.qlogo.cn/", `${HOST}/qlogo/`);
269
+      return url
270
+        .replace("https://wx.qlogo.cn/", `${HOST}/qlogo/`)
271
+        .replace("https://thirdwx.qlogo.cn/", `${HOST}/thirdwx/`);
268 272
     case "alioss":
269 273
       return url
270 274
         .replace(ossPath, `${HOST}/alioss/`)
@@ -302,7 +306,7 @@ export function throttle(callback, time = 500) {
302 306
   }
303 307
 }
304 308
 
305
-export const wait = function (time = 500) {
309
+export const wait = function(time = 500) {
306 310
   return new Promise(res => {
307 311
     setTimeout(() => {
308 312
       res();
@@ -310,7 +314,7 @@ export const wait = function (time = 500) {
310 314
   });
311 315
 };
312 316
 
313
-export const getQueryString = function (str, name) {
317
+export const getQueryString = function(str, name) {
314 318
   var regex = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
315 319
   var r = str.match(regex);
316 320
   if (r != null) return unescape(r[2]);
@@ -356,10 +360,10 @@ export const makeProjectPoster = res => {
356 360
         ctx.strokeStyle = "#ffffff";
357 361
         ctx.clip(); //裁剪上面的圆形
358 362
         ctx.drawImage(list[2].tempFilePath, 46, 856, 100, 100);
359
-        ctx.draw(false, function () {
363
+        ctx.draw(false, function() {
360 364
           Taro.canvasToTempFilePath({
361 365
             canvasId: canvasName,
362
-            success: function ({ tempFilePath }) {
366
+            success: function({ tempFilePath }) {
363 367
               resolve(tempFilePath);
364 368
             }
365 369
           });
@@ -368,9 +372,9 @@ export const makeProjectPoster = res => {
368 372
       .catch(err => {
369 373
         rtLog.error(
370 374
           "下载图片失败, 图片地址 (" +
371
-          `${_poster} , ${qrcode}, ${_avatarurl}` +
372
-          "), 错误消息: " +
373
-          (err.message || err.errMsg || err)
375
+            `${_poster} , ${qrcode}, ${_avatarurl}` +
376
+            "), 错误消息: " +
377
+            (err.message || err.errMsg || err)
374 378
         );
375 379
       });
376 380
   });
@@ -394,11 +398,11 @@ export const removeLocalFile = callback => {
394 398
 export const canvasToTempFilePath = (canvasName, callback) => {
395 399
   Taro.canvasToTempFilePath({
396 400
     canvasId: canvasName,
397
-    success: function (data) {
401
+    success: function(data) {
398 402
       var tempFilePath = data.tempFilePath;
399 403
       callback(tempFilePath);
400 404
     },
401
-    fail: function (res) {
405
+    fail: function(res) {
402 406
       console.log(res);
403 407
     }
404 408
   });
@@ -412,7 +416,7 @@ export const saveFile = (tempFilePath, callback) => {
412 416
       console.log("成功" + res1.savedFilePath);
413 417
       callback(res1.savedFilePath);
414 418
     },
415
-    fail: function (res) {
419
+    fail: function(res) {
416 420
       console.log("失败");
417 421
     }
418 422
   });
@@ -421,12 +425,12 @@ export const saveFile = (tempFilePath, callback) => {
421 425
 export const downloadFile = (imgUrl, callback) => {
422 426
   Taro.downloadFile({
423 427
     url: imgUrl,
424
-    success: function (param) {
428
+    success: function(param) {
425 429
       if (param.statusCode === 200) {
426 430
         callback(param);
427 431
       }
428 432
     },
429
-    fail: function (res) {
433
+    fail: function(res) {
430 434
       console.log("生成失败请稍候重试");
431 435
     }
432 436
   });
@@ -533,10 +537,10 @@ export const makeCardPoster = data => {
533 537
       ctx.strokeStyle = "#ffffff";
534 538
       ctx.clip();
535 539
       ctx.drawImage(list[1].tempFilePath, 50, 0, 400, 400, 249, 610, 130, 130);
536
-      ctx.draw(false, function () {
540
+      ctx.draw(false, function() {
537 541
         Taro.canvasToTempFilePath({
538 542
           canvasId: canvasName,
539
-          success: function ({ tempFilePath }) {
543
+          success: function({ tempFilePath }) {
540 544
             resolve(tempFilePath);
541 545
           }
542 546
         });
@@ -608,7 +612,7 @@ export const makeCardShareImg = data => {
608 612
       ctx.clip(); //裁剪上面的圆形
609 613
       ctx.drawImage(list[0].tempFilePath, 450, 100, 200, 200, 400, 100);
610 614
 
611
-      ctx.draw(false, function () {
615
+      ctx.draw(false, function() {
612 616
         Taro.canvasToTempFilePath({ canvasId: canvasName, quality: 1 }).then(
613 617
           ({ tempFilePath }) => {
614 618
             resolve(tempFilePath);
@@ -619,13 +623,13 @@ export const makeCardShareImg = data => {
619 623
   });
620 624
 };
621 625
 
622
-export const isObject = function (value) {
626
+export const isObject = function(value) {
623 627
   var type = typeof value;
624 628
   return value != null && type === "object";
625 629
 };
626 630
 
627 631
 //使用递归的方式实现数组、对象的深拷贝
628
-export const deepClone = function (obj) {
632
+export const deepClone = function(obj) {
629 633
   if (!isObject(obj)) {
630 634
     throw new Error("obj 不是一个对象!");
631 635
   }
@@ -638,7 +642,7 @@ export const deepClone = function (obj) {
638 642
   return cloneObj;
639 643
 };
640 644
 
641
-export const validateAuth = function (name, callback) {
645
+export const validateAuth = function(name, callback) {
642 646
   Taro.getSetting().then(res => {
643 647
     const hasAuth = res.authSetting[name];
644 648
     if (hasAuth) {
@@ -656,7 +660,7 @@ export const validateAuth = function (name, callback) {
656 660
  * @param strict 是否严格模式
657 661
  * @returns `phoneNumber` 是中国的手机号码返回 `true`,否则返回 `false`
658 662
  */
659
-export const isChineseMobilePhoneNumber = function (phoneNumber, strict) {
663
+export const isChineseMobilePhoneNumber = function(phoneNumber, strict) {
660 664
   if (strict === undefined) {
661 665
     strict = false;
662 666
   }
@@ -673,7 +677,7 @@ export const isChineseMobilePhoneNumber = function (phoneNumber, strict) {
673 677
  * @returns `value` 是邮件地址返回 `true`,否则返回 `false`
674 678
  * @see http://emailregex.com/
675 679
  */
676
-export const isEmail = function (value) {
680
+export const isEmail = function(value) {
677 681
   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,}))$/;
678 682
   return re.test(value);
679 683
 };