Ver código fonte

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

# Conflicts:
#	src/pages/project/h5Page.js
傅行帆 5 anos atrás
pai
commit
bc7671eec4

+ 4
- 4
config/prod.js Ver arquivo

3
     NODE_ENV: '"production"'
3
     NODE_ENV: '"production"'
4
   },
4
   },
5
   defineConstants: {
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
     OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",
10
     OSS_PATH: "https://njcj.oss-cn-shanghai.aliyuncs.com/",
11
     OSS_FAST_PATH: "https://njcj.oss-accelerate.aliyuncs.com/",
11
     OSS_FAST_PATH: "https://njcj.oss-accelerate.aliyuncs.com/",
12
     Version: "V3.5.29"
12
     Version: "V3.5.29"

+ 1
- 1
project.config.json Ver arquivo

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

+ 142
- 122
src/components/taro-plugin-canvas/index.js Ver arquivo

1
-import Taro, { Component } from '@tarojs/taro';
1
+import Taro, { Component } from "@tarojs/taro";
2
 // import PropTypes from 'prop-types';
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
 let count = 1;
9
 let count = 1;
15
 export default class CanvasDrawer extends Component {
10
 export default class CanvasDrawer extends Component {
26
       pxWidth: 0,
21
       pxWidth: 0,
27
       pxHeight: 0,
22
       pxHeight: 0,
28
       debug: false,
23
       debug: false,
29
-      factor: 0,
30
-    }
24
+      factor: 0
25
+    };
31
     this.canvasId = randomString(10);
26
     this.canvasId = randomString(10);
32
     this.ctx = null;
27
     this.ctx = null;
33
     this.cache = {};
28
     this.cache = {};
46
       const screenWidth = sysInfo.screenWidth;
41
       const screenWidth = sysInfo.screenWidth;
47
       this.setState({
42
       this.setState({
48
         factor: screenWidth / 750
43
         factor: screenWidth / 750
49
-      })
44
+      });
50
       this.onCreate();
45
       this.onCreate();
51
-    }, 0)
46
+    }, 0);
52
   }
47
   }
53
 
48
 
54
-  componentWillUnmount() { }
49
+  componentWillUnmount() {}
55
 
50
 
56
   /**
51
   /**
57
    * @description rpx => px 基础方法
52
    * @description rpx => px 基础方法
65
       return parseInt(rpx * factor);
60
       return parseInt(rpx * factor);
66
     }
61
     }
67
     return rpx * factor;
62
     return rpx * factor;
68
-  }
63
+  };
69
   /**
64
   /**
70
    * @description px => rpx
65
    * @description px => rpx
71
    * @param { number } px - 需要转换的数值
66
    * @param { number } px - 需要转换的数值
78
       return parseInt(px / factor);
73
       return parseInt(px / factor);
79
     }
74
     }
80
     return px / factor;
75
     return px / factor;
81
-  }
76
+  };
82
 
77
 
83
   /**
78
   /**
84
    * @description 下载图片并获取图片信息
79
    * @description 下载图片并获取图片信息
88
   _downloadImageAndInfo = (image, index) => {
83
   _downloadImageAndInfo = (image, index) => {
89
     return new Promise((resolve, reject) => {
84
     return new Promise((resolve, reject) => {
90
       downloadImageAndInfo(image, index, this.toRpx)
85
       downloadImageAndInfo(image, index, this.toRpx)
91
-      .then(
92
-        (result) => {
86
+        .then(result => {
93
           this.drawArr.push(result);
87
           this.drawArr.push(result);
94
           resolve();
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
    * @param  {} images=[]
103
    * @param  {} images=[]
106
    */
104
    */
108
     const drawList = [];
106
     const drawList = [];
109
     let imagesTemp = images;
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
     return Promise.all(drawList);
113
     return Promise.all(drawList);
114
-  }
114
+  };
115
 
115
 
116
   /**
116
   /**
117
    * @param
117
    * @param
124
           .then(() => {
124
           .then(() => {
125
             resolve();
125
             resolve();
126
           })
126
           })
127
-          .catch((e) => {
127
+          .catch(e => {
128
             console.log(e);
128
             console.log(e);
129
-            reject(e)
129
+            reject(e);
130
           });
130
           });
131
       } else {
131
       } else {
132
-        setTimeout(()=>{
132
+        setTimeout(() => {
133
           resolve(1);
133
           resolve(1);
134
-        }, 500)
134
+        }, 500);
135
       }
135
       }
136
-    })
137
-  }
136
+    });
137
+  };
138
 
138
 
139
   /**
139
   /**
140
    * @param  {} w
140
    * @param  {} w
142
    * @param  {} debug
142
    * @param  {} debug
143
    */
143
    */
144
   initCanvas = (w, h, debug) => {
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
    * @param  { boolean }
161
    * @param  { boolean }
159
    */
162
    */
160
   onCreate = () => {
163
   onCreate = () => {
161
     const { onCreateFail, config } = this.props;
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
       .then(() => {
168
       .then(() => {
166
-        console.debug('-----finish download images---')
169
+        console.debug("-----finish download images---");
167
         this.create(config);
170
         this.create(config);
168
       })
171
       })
169
-      .catch((err) => {
172
+      .catch(err => {
170
         Taro.hideLoading();
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
         console.error(err);
178
         console.error(err);
173
         if (!onCreateFail) {
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
         onCreateFail && onCreateFail(err);
184
         onCreateFail && onCreateFail(err);
177
-      })
178
-  }
185
+      });
186
+  };
179
 
187
 
180
   /**
188
   /**
181
    * @param  { object } config
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
     this.ctx = Taro.createCanvasContext(this.canvasId, this.$scope);
193
     this.ctx = Taro.createCanvasContext(this.canvasId, this.$scope);
186
-    console.debug('-----finish create canvas---')
194
+    console.debug("-----finish create canvas---");
187
     const height = getHeight(config);
195
     const height = getHeight(config);
188
-    console.debug('-----ready to init canvas---')
196
+    console.debug("-----ready to init canvas---");
189
     this.initCanvas(config.width, height, config.debug)
197
     this.initCanvas(config.width, height, config.debug)
190
       .then(() => {
198
       .then(() => {
191
-        console.debug('-----finish init canvas---')
199
+        console.debug("-----finish init canvas---");
192
         // 设置画布底色
200
         // 设置画布底色
193
         if (config.backgroundColor) {
201
         if (config.backgroundColor) {
194
           this.ctx.save();
202
           this.ctx.save();
200
           texts = [],
208
           texts = [],
201
           // images = [],
209
           // images = [],
202
           blocks = [],
210
           blocks = [],
203
-          lines = [],
211
+          lines = []
204
         } = config;
212
         } = config;
205
         const queue = this.drawArr
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
         queue.sort((a, b) => a.zIndex - b.zIndex);
236
         queue.sort((a, b) => a.zIndex - b.zIndex);
223
 
237
 
224
-        queue.forEach((item) => {
238
+        queue.forEach(item => {
225
           let drawOptions = {
239
           let drawOptions = {
226
             ctx: this.ctx,
240
             ctx: this.ctx,
227
             toPx: this.toPx,
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
         const res = Taro.getSystemInfoSync();
255
         const res = Taro.getSystemInfoSync();
242
         const platform = res.platform;
256
         const platform = res.platform;
243
         let time = 0;
257
         let time = 0;
244
-        if (platform === 'android') {
258
+        if (platform === "android") {
245
           // 在安卓平台,经测试发现如果海报过于复杂在转换时需要做延时,要不然样式会错乱
259
           // 在安卓平台,经测试发现如果海报过于复杂在转换时需要做延时,要不然样式会错乱
246
           time = 300;
260
           time = 300;
247
         }
261
         }
248
-        console.debug('-----start to draw---')
262
+        console.debug("-----start to draw---");
249
         this.ctx.draw(false, () => {
263
         this.ctx.draw(false, () => {
250
-          console.debug('-----finish draw---')
264
+          console.debug("-----finish draw---");
251
           setTimeout(() => {
265
           setTimeout(() => {
252
-            console.debug('-----ready to read file---')
266
+            console.debug("-----ready to read file---");
253
             this.getTempFile();
267
             this.getTempFile();
254
           }, time);
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
         console.error(err);
273
         console.error(err);
260
       });
274
       });
261
-  }
275
+  };
262
 
276
 
263
-  getTempFile = (otherOptions) => {
277
+  getTempFile = otherOptions => {
264
     const { onCreateSuccess, onCreateFail } = this.props;
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
   render() {
313
   render() {
293
     const { pxWidth, pxHeight, debug } = this.state;
314
     const { pxWidth, pxHeight, debug } = this.state;
294
-    if(pxWidth && pxHeight){
315
+    if (pxWidth && pxHeight) {
295
       return (
316
       return (
296
         <Canvas
317
         <Canvas
297
           canvas-id={this.canvasId}
318
           canvas-id={this.canvasId}
298
           style={`width:${pxWidth}px; height:${pxHeight}px;`}
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
     return null;
324
     return null;
304
   }
325
   }
305
 }
326
 }
306
-

+ 6
- 6
src/pages/person/spread/index.js Ver arquivo

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

+ 1
- 2
src/pages/project/h5Page.js Ver arquivo

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

+ 43
- 0
src/pages/project/pay.js Ver arquivo

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 Ver arquivo

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

+ 27
- 23
src/utils/tools.js Ver arquivo

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