Commit f1ac6dd5fd6dcb077cc416d34b76d13bc3589d7a
1 parent
0d0b154b
测试报告问题并标注黑眼圈优化
Showing
10 changed files
with
406 additions
and
219 deletions
packageD/pages/AI-test-skin/success_result/acne/acne.wxml
packageD/pages/AI-test-skin/success_result/blackhead/blackhead.wxml
packageD/pages/AI-test-skin/success_result/dark/dark.wxml
packageD/pages/AI-test-skin/success_result/pore/pore.wxml
packageD/pages/AI-test-skin/success_result/sensitive/sensitive.wxml
packageD/pages/AI-test-skin/success_result/speckle/speckle.wxml
packageD/pages/AI-test-skin/success_result/success_result.js
1 | 1 | /* |
2 | 2 | * @Author: abson |
3 | 3 | * @Date: 2022-02-16 15:36:47 |
4 | - * @LastEditTime: 2022-02-22 20:52:12 | |
4 | + * @LastEditTime: 2022-02-24 14:16:37 | |
5 | 5 | * @LastEditors: Please set LastEditors |
6 | 6 | * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
7 | 7 | * @FilePath: \MShopWeApp\packageB\pages\AI-test-skin\success_result\success_result.js |
... | ... | @@ -25,16 +25,21 @@ Page({ |
25 | 25 | */ |
26 | 26 | data: { |
27 | 27 | tab: [{ id: 'zong_he', name: '综合肤质' }, { id: 'mao_kong', name: '毛孔' }, { id: 'hei_tou', name: '黑头' }, { id: 'se_ban', name: '色斑' }, { id: 'zhou_wen', name: '皱纹' }, { id: 'hei_yan_quan', name: '黑眼圈' }, { id: 'cuo_chuang', name: '痤疮' }, { id: 'min_gan_du', name: '敏感度' }], |
28 | + zhouwen_arr: [{ id: 1, name: '全部皱纹' }, { id: 2, name: '泪沟' }, { id: 3, name: '法令纹' }, { id: 4, name: '口角纹' }, { id: 5, name: '眼部皱纹' }, { id: 6, name: '鱼尾纹' }, { id: 7, name: '抬头皱纹' }, { id: 8, name: '眉间纹' }], | |
29 | + cuochuang_arr: [{ id: 1, name: '全部痤疮' }, { id: 2, name: '痘印' }, { id: 3, name: '囊肿' }, { id: 4, name: '丘疹' }, { id: 5, name: '粉刺' }], | |
30 | + heitanquan_arr: [{ id: 1, name: '综合情况' }, { id: 2, name: '左眼' }, { id: 3, name: '右眼' }], | |
28 | 31 | currentIndex: 0, |
32 | + scroll_index: 0, | |
33 | + sex:'female', //female女 male男 | |
29 | 34 | tab_id: 'zong_he', |
30 | 35 | iurl: setting.imghost, |
31 | 36 | showDialog: false, |
32 | 37 | yanjing: true, //显示皮肤问题 |
33 | 38 | img_scale: true, //问题标注放大图片 |
34 | - | |
35 | - img_scale_icon:true, | |
36 | - show_problem:1, //问题标注显示问题 | |
37 | - ig_scale:1, //缩放问题 | |
39 | + heightRecord: [], | |
40 | + img_scale_icon: true, | |
41 | + show_problem: 1, //问题标注显示问题 | |
42 | + img_scale: 1, //缩放问题 | |
38 | 43 | }, |
39 | 44 | |
40 | 45 | /** |
... | ... | @@ -93,32 +98,68 @@ Page({ |
93 | 98 | m_top: (location.top - location.height / 2.5) * th.data.bili, |
94 | 99 | m_left: (location.left - location.width / 7) * th.data.bili, |
95 | 100 | bili: th.data.bili, |
96 | - sex:sex | |
101 | + sex: sex | |
97 | 102 | }) |
98 | - var sort=1; | |
103 | + var sort = 1; | |
99 | 104 | //-- 调用毛孔的推荐函数 -- |
100 | 105 | if (pore_num > 0) |
101 | - pore.get_goods(th, setting.stoid,sort++); | |
106 | + pore.get_goods(th, setting.stoid, sort++); | |
102 | 107 | //-- 调用黑头的推荐函数 -- |
103 | 108 | if (blackhead_num > 0) |
104 | - blackhead.get_goods(th, setting.stoid,sort++); | |
109 | + blackhead.get_goods(th, setting.stoid, sort++); | |
105 | 110 | //-- 调用色斑的推荐函数 -- |
106 | 111 | if (speckle_num > 0) |
107 | - speckle.get_goods(th, setting.stoid,sort++); | |
112 | + speckle.get_goods(th, setting.stoid, sort++); | |
108 | 113 | //-- 调用皱纹的推荐函数 -- |
109 | 114 | if (wrinkle_num > 0) |
110 | - wrinkle.get_goods(th, setting.stoid,sort++); | |
115 | + wrinkle.get_goods(th, setting.stoid, sort++); | |
111 | 116 | //-- 黑眼圈 -- |
112 | 117 | if (dark_type > -1) |
113 | - dark.get_goods(th, setting.stoid,sort++); | |
118 | + dark.get_goods(th, setting.stoid, sort++); | |
114 | 119 | //-- 黑眼圈 -- |
115 | 120 | if (acne_num > -0) |
116 | - acne.get_goods(th, setting.stoid,sort++); | |
121 | + acne.get_goods(th, setting.stoid, sort++); | |
117 | 122 | |
118 | 123 | //获取一下分享要用的图片 |
119 | 124 | th.set_share_img(); |
125 | + acne.get_goods(th, setting.stoid); | |
126 | + let { heightRecord, tab } = th.data; | |
127 | + tab.forEach(item => { | |
128 | + console.log(2); | |
129 | + var query = th.createSelectorQuery(); | |
130 | + let class_name = `.${item['id']}`; | |
131 | + query.select(class_name).boundingClientRect(function (rect) { | |
132 | + // let ratio = 750 / rect.width; | |
133 | + let height = parseInt(rect.height); //加上导航栏50px | |
134 | + heightRecord.push(height); | |
135 | + // item['top'] = top; | |
136 | + }).exec(); | |
137 | + }); | |
138 | + heightRecord.sort((a, b) => { | |
139 | + return a - b; | |
140 | + }); | |
141 | + th.setData({ | |
142 | + heightRecord, | |
143 | + }) | |
144 | + // setTimeout(() => { | |
145 | + // heightRecord.sort((a, b) => { | |
146 | + // return a - b; | |
147 | + // }) | |
148 | + // let new_arr = []; | |
149 | + // if (heightRecord.length > 0) { | |
150 | + // heightRecord.reduce((pre, cur) => { | |
151 | + // let sum = pre + cur; | |
152 | + // new_arr.push(sum); | |
153 | + // return sum; | |
154 | + // }) | |
155 | + // } | |
156 | + // th.setData({ | |
157 | + // heightRecord:new_arr, | |
158 | + // }) | |
159 | + // },1000) | |
120 | 160 | |
121 | 161 | }) |
162 | + | |
122 | 163 | }, |
123 | 164 | |
124 | 165 | //-- 初始等级卡 -- |
... | ... | @@ -177,7 +218,6 @@ Page({ |
177 | 218 | var url = "/api/weshop/face/storeSkinface/get/" + setting.stoid + "/" + this.data.id; |
178 | 219 | getApp().request.promiseGet(url, {}).then(res => { |
179 | 220 | if (res.data.code == 0) { |
180 | - console.log(res, 'dsffffff'); | |
181 | 221 | var json = JSON.parse(res.data.data.resultjson); |
182 | 222 | var json1 = JSON.parse(res.data.data.detectjson); |
183 | 223 | func(json, json1, res.data.data.img) |
... | ... | @@ -190,27 +230,53 @@ Page({ |
190 | 230 | /** |
191 | 231 | * 生命周期函数--监听页面初次渲染完成 |
192 | 232 | */ |
193 | - onReady: function () {}, | |
194 | - set_share_img:function () { | |
195 | - var th=this; | |
196 | - var path3=th.data.iurl+"/miniapp/images/skinimg/nan.png"; | |
197 | - if(this.data.sex=='female') | |
198 | - path3=th.data.iurl+"/miniapp/images/skinimg/nv.png"; | |
233 | + onReady: function () { }, | |
234 | + set_share_img() { | |
235 | + var th = this; | |
236 | + var path3 = th.data.iurl + "/miniapp/images/skinimg/nan.png"; | |
237 | + if (this.data.sex == 'female') | |
238 | + path3 = th.data.iurl + "/miniapp/images/skinimg/nv.png"; | |
199 | 239 | // 读取文件成功则OK-- |
200 | 240 | wx.getImageInfo({ |
201 | 241 | src: path3, |
202 | 242 | success: function (res) { |
203 | 243 | //获取到二维码的图片 |
204 | - th.data.share_head=res.path; | |
244 | + th.data.share_head = res.path; | |
205 | 245 | } |
206 | 246 | }) |
207 | 247 | |
208 | 248 | }, |
249 | + scroll_view(e) { | |
250 | + let scrollTop = e.detail.scrollTop; | |
251 | + let heightRecord = this.data.heightRecord; | |
252 | + if (heightRecord.length === 0) return; | |
253 | + let length = this.data.tab.length; | |
254 | + var index = 0; | |
255 | + if (scrollTop >= heightRecord[0]) { | |
256 | + for (let i = 0; i < length; i++) { | |
257 | + if (scrollTop >= heightRecord[i - 1] && scrollTop < heightRecord[i]) { | |
258 | + index = i; | |
259 | + break; | |
260 | + } | |
261 | + } | |
262 | + } | |
263 | + if (index !== this.data.currentIndex) { | |
264 | + // let tab_id = this.data.tab[index].id; | |
265 | + console.log(scrollTop); | |
266 | + this.setData({ | |
267 | + scrollTop, | |
268 | + // currentIndex: index, | |
269 | + }) | |
270 | + } | |
271 | + | |
272 | + }, | |
209 | 273 | |
210 | - binddragend(e) { | |
274 | + click_scroll(e) { | |
211 | 275 | console.log(e); |
276 | + let { index, scroll_id } = e.currentTarget.dataset; | |
212 | 277 | this.setData({ |
213 | - scrollTop: e.detail.scrollTop, | |
278 | + scroll_index: index, | |
279 | + scroll_id, | |
214 | 280 | }) |
215 | 281 | }, |
216 | 282 | |
... | ... | @@ -291,8 +357,8 @@ Page({ |
291 | 357 | close_dialog() { |
292 | 358 | this.setData({ |
293 | 359 | showDialog: false, |
294 | - share_flag:false, | |
295 | - img_scale:true, | |
360 | + share_flag: false, | |
361 | + img_scale: true, | |
296 | 362 | }) |
297 | 363 | }, |
298 | 364 | |
... | ... | @@ -370,6 +436,14 @@ Page({ |
370 | 436 | }) |
371 | 437 | }, |
372 | 438 | |
439 | + click_share() { | |
440 | + this.setData({ | |
441 | + share_flag: true, | |
442 | + img_scale: false, | |
443 | + showDialog: true, | |
444 | + }) | |
445 | + }, | |
446 | + | |
373 | 447 | //图片加载的时候,计算图片的像素大小 |
374 | 448 | face_img_load: function (e) { |
375 | 449 | var th = this; |
... | ... | @@ -386,82 +460,82 @@ Page({ |
386 | 460 | }, |
387 | 461 | |
388 | 462 | //-- 图片的拖拽缩放的功能 -- |
389 | - touchstartCallback: function(e) { | |
390 | - this.data.tc_end=0; | |
463 | + touchstartCallback: function (e) { | |
464 | + this.data.tc_end = 0; | |
391 | 465 | // 单手指缩放开始,也不做任何处理 |
392 | - if(e.touches.length>1) { | |
466 | + if (e.touches.length > 1) { | |
393 | 467 | // 一开始我并没有这个回调函数,会出现缩小的时候有瞬间被放大过程的bug |
394 | 468 | // 当两根手指放上去的时候,就将distance 初始化。 |
395 | 469 | let xMove = e.touches[1].clientX - e.touches[0].clientX; |
396 | 470 | let yMove = e.touches[1].clientY - e.touches[0].clientY; |
397 | 471 | let distance = Math.sqrt(xMove * xMove + yMove * yMove); |
398 | - this.data.img_distance=distance; | |
399 | - }else if(e.touches.length==1){ | |
400 | - this.data.img_x=e.touches[0].clientX; | |
401 | - this.data.img_y=e.touches[0].clientY; | |
472 | + this.data.img_distance = distance; | |
473 | + } else if (e.touches.length == 1) { | |
474 | + this.data.img_x = e.touches[0].clientX; | |
475 | + this.data.img_y = e.touches[0].clientY; | |
402 | 476 | } |
403 | 477 | |
404 | 478 | }, |
405 | - touchmoveCallback: function(e) { | |
406 | - if(this.data.tc_end) return false; | |
407 | - // 单手指缩放我们不做任何操作 | |
408 | - if(e.touches.length > 1){ | |
409 | - let xMove = e.touches[1].clientX - e.touches[0].clientX; | |
410 | - let yMove = e.touches[1].clientY - e.touches[0].clientY; | |
411 | - // 新的 ditance | |
412 | - let distance = Math.sqrt(xMove * xMove + yMove * yMove); | |
413 | - let distanceDiff = distance - this.data.img_distance; | |
414 | - | |
415 | - let newScale = this.data.ig_scale + 0.005 * distanceDiff | |
416 | - // 为了防止缩放得太大,所以scale需要限制,同理最小值也是 | |
417 | - if(newScale >= 2) { | |
418 | - newScale = 2 | |
419 | - } | |
420 | - if(newScale <= 0.6) { | |
421 | - newScale = 0.6 | |
422 | - } | |
479 | + touchmoveCallback: function (e) { | |
480 | + if (this.data.tc_end) return false; | |
481 | + // 单手指缩放我们不做任何操作 | |
482 | + if (e.touches.length > 1) { | |
483 | + let xMove = e.touches[1].clientX - e.touches[0].clientX; | |
484 | + let yMove = e.touches[1].clientY - e.touches[0].clientY; | |
485 | + // 新的 ditance | |
486 | + let distance = Math.sqrt(xMove * xMove + yMove * yMove); | |
487 | + let distanceDiff = distance - this.data.img_distance; | |
423 | 488 | |
424 | - this.data.img_distance=distance; | |
425 | - // 赋值 新的 => 旧的 | |
426 | - this.setData({ | |
427 | - 'ig_scale': newScale, | |
428 | - }) | |
429 | - }else if(e.touches.length==1){ | |
430 | - let xMove= e.touches[0].clientX- this.data.img_x; | |
431 | - let yMove= e.touches[0].clientY- this.data.img_y; | |
432 | - this.setData({ | |
433 | - 'img_top': yMove*0.8, | |
434 | - 'img_left': xMove*0.8, | |
435 | - }); | |
489 | + let newScale = this.data.ig_scale + 0.005 * distanceDiff | |
490 | + // 为了防止缩放得太大,所以scale需要限制,同理最小值也是 | |
491 | + if (newScale >= 2) { | |
492 | + newScale = 2 | |
493 | + } | |
494 | + if (newScale <= 0.6) { | |
495 | + newScale = 0.6 | |
436 | 496 | } |
437 | 497 | |
498 | + this.data.img_distance = distance; | |
499 | + // 赋值 新的 => 旧的 | |
500 | + this.setData({ | |
501 | + 'ig_scale': newScale, | |
502 | + }) | |
503 | + } else if (e.touches.length == 1) { | |
504 | + let xMove = e.touches[0].clientX - this.data.img_x; | |
505 | + let yMove = e.touches[0].clientY - this.data.img_y; | |
506 | + this.setData({ | |
507 | + 'img_top': yMove * 0.8, | |
508 | + 'img_left': xMove * 0.8, | |
509 | + }); | |
510 | + } | |
438 | 511 | |
439 | - }, | |
440 | 512 | |
441 | - touchendCallback:function (e) { | |
442 | - this.data.tc_end=1; | |
513 | + }, | |
514 | + touchendCallback: function (e) { | |
515 | + this.data.tc_end = 1; | |
443 | 516 | }, |
444 | 517 | |
445 | 518 | |
519 | + | |
446 | 520 | //--定义的保存图片方法,分享团--- |
447 | 521 | saveImageToPhotosAlbum: function () { |
448 | - var th=this; | |
449 | - var rpx = this.data.cWidth / 750 * 1.35; //基础单位, | |
522 | + var th = this; | |
523 | + var rpx = this.data.cWidth / 750 * 1.35; //基础单位, | |
450 | 524 | //--先判断会员状态-- |
451 | 525 | var user_info = getApp().globalData.userInfo; |
452 | 526 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
453 | - wx.navigateTo({url: '/pages/togoin/togoin',}) | |
527 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) | |
454 | 528 | return false; |
455 | 529 | } |
456 | 530 | if (this.data.share_hidden) { |
457 | - this.setData({share_hidden: false,}); | |
531 | + this.setData({ share_hidden: false, }); | |
458 | 532 | } |
459 | 533 | ; |
460 | 534 | |
461 | - wx.showLoading({title: '生成中...',}) | |
535 | + wx.showLoading({ title: '生成中...', }) | |
462 | 536 | var that = this, th = that; |
463 | 537 | //设置画板显示,才能开始绘图 |
464 | - that.setData({canvasHidden: false }) | |
538 | + that.setData({ canvasHidden: false }) | |
465 | 539 | |
466 | 540 | var app = getApp(); |
467 | 541 | var scene = this.data.id + ""; |
... | ... | @@ -477,106 +551,106 @@ Page({ |
477 | 551 | wx.getImageInfo({ |
478 | 552 | src: path3, |
479 | 553 | success: function (res) { |
480 | - var b=1.1; | |
481 | - //获取到二维码的图片 | |
482 | - var vpath = res.path; | |
483 | - var context = wx.createCanvasContext('share'); | |
484 | - // 先画背景 | |
485 | - context.fillStyle = '#ebf6f8'; | |
486 | - // 灰色实心矩形 | |
487 | - // 1. 语法: x坐标, y坐标, 宽度, 高度 | |
488 | - context.fillRect(0,0,750 * rpx,1338 * rpx); | |
489 | - | |
490 | - context.setFontSize(20* rpx) | |
491 | - context.setFillStyle("#00d8e9") | |
492 | - context.fillText("官方检测认证", 28*b* rpx, 80*b* rpx); | |
493 | - | |
494 | - //两个底部颜色 | |
495 | - context.fillStyle = '#a7ecf5'; | |
496 | - context.fillRect(28 *b* rpx,136 *b* rpx,262 *b* rpx,18 *b* rpx); | |
497 | - context.fillRect(28 *b* rpx,194 *b* rpx,262 *b* rpx,18 *b* rpx); | |
498 | - | |
499 | - context.setFontSize(42*b*rpx) | |
500 | - context.setFillStyle("#070609") | |
501 | - context.fillText("我的肌底强韧", 30*b* rpx, 140*b* rpx); | |
502 | - context.fillText("肌肤鲜活润泽", 30*b* rpx, 196*b* rpx); | |
503 | - | |
504 | - //先画一个圆形 | |
505 | - th.circle(context,110*b*rpx, 280*b*rpx,140*b*rpx,"#e7f3f8"); | |
506 | - th.circle(context,130*b*rpx, 300*b*rpx,120*b*rpx,"#c8f2fa"); | |
507 | - //绘制人脸 | |
508 | - context.drawImage(th.data.share_head, 132*b*rpx, 310*b*rpx, 230*b* rpx, 230 *b* rpx); | |
509 | - | |
510 | - //左右俩个框并填充文字 | |
511 | - th.darwRoundRect(38 *b* rpx,340*b*rpx,140*b*rpx,40*b*rpx,20*b*rpx,context); | |
512 | - th.darwRoundRect(324 *b* rpx,340*b*rpx,140*b*rpx,40*b*rpx,20*b*rpx,context); | |
513 | - context.setFontSize(20*b*rpx) | |
514 | - context.setFillStyle("black") | |
515 | - context.fillText("黑眼圈 重度", 50*b* rpx, 368*b* rpx); | |
516 | - context.fillText("毛孔 较粗大", 336*b* rpx, 368*b* rpx); | |
517 | - | |
518 | - //左右俩个框并填充文字 | |
519 | - th.darwRoundRect(40 *b* rpx,412*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); | |
520 | - th.darwRoundRect(348 *b* rpx,412*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); | |
521 | - context.setFillStyle("black") | |
522 | - context.fillText("黑头 重度", 52*b* rpx, 440*b* rpx); | |
523 | - context.fillText("色斑 轻度", 354*b* rpx, 440*b* rpx); | |
524 | - | |
525 | - //左右俩个框并填充文字 | |
526 | - th.darwRoundRect(60 *b* rpx,484*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); | |
527 | - th.darwRoundRect(328 *b* rpx,484*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); | |
528 | - context.setFillStyle("black") | |
529 | - context.fillText("皱纹 重度", 74*b* rpx, 510*b* rpx); | |
530 | - context.fillText("痤疮 轻度", 344*b* rpx, 510*b* rpx); | |
531 | - | |
532 | - //底部的绘制 | |
533 | - th.darwRoundRect(38 *b* rpx,650*b*rpx,430*b*rpx,160*b*rpx,10*b*rpx,context); | |
534 | - //绘制二维码 | |
535 | - context.drawImage(vpath, 60*b*rpx, 672*b*rpx, 120 *b* rpx, 120 *b* rpx); | |
536 | - context.setFillStyle("black") | |
537 | - context.setFontSize(32*b*rpx) | |
538 | - context.fillText("美肤管家AI测肤", 200*b* rpx, 726*b* rpx); | |
539 | - context.setFontSize(22*b*rpx) | |
540 | - context.fillText("科学了解皮肤的真实状态", 200*b* rpx, 766*b* rpx); | |
541 | - | |
542 | - //把画板内容绘制成图片,并回调 画板图片路径 | |
543 | - context.draw(false, function () { | |
544 | - setTimeout(function () { | |
545 | - wx.canvasToTempFilePath({ | |
546 | - x: 0, | |
547 | - y: 0, | |
548 | - width: 750, | |
549 | - height: 1338, | |
550 | - destWidth: 1.4 * 750 * 750 / th.data.screenWidth, | |
551 | - destHeight: 1.4 * 750 * 750 / th.data.screenWidth, | |
552 | - canvasId: 'share', | |
553 | - success: function (res) { | |
554 | - that.setData({ | |
555 | - shareImgPath: res.tempFilePath, | |
556 | - canvasHidden: true, | |
557 | - share_show:1 | |
554 | + var b = 1.1; | |
555 | + //获取到二维码的图片 | |
556 | + var vpath = res.path; | |
557 | + var context = wx.createCanvasContext('share'); | |
558 | + // 先画背景 | |
559 | + context.fillStyle = '#ebf6f8'; | |
560 | + // 灰色实心矩形 | |
561 | + // 1. 语法: x坐标, y坐标, 宽度, 高度 | |
562 | + context.fillRect(0, 0, 750 * rpx, 1338 * rpx); | |
563 | + | |
564 | + context.setFontSize(20 * rpx) | |
565 | + context.setFillStyle("#00d8e9") | |
566 | + context.fillText("官方检测认证", 28 * b * rpx, 80 * b * rpx); | |
567 | + | |
568 | + //两个底部颜色 | |
569 | + context.fillStyle = '#a7ecf5'; | |
570 | + context.fillRect(28 * b * rpx, 136 * b * rpx, 262 * b * rpx, 18 * b * rpx); | |
571 | + context.fillRect(28 * b * rpx, 194 * b * rpx, 262 * b * rpx, 18 * b * rpx); | |
572 | + | |
573 | + context.setFontSize(42 * b * rpx) | |
574 | + context.setFillStyle("#070609") | |
575 | + context.fillText("我的肌底强韧", 30 * b * rpx, 140 * b * rpx); | |
576 | + context.fillText("肌肤鲜活润泽", 30 * b * rpx, 196 * b * rpx); | |
577 | + | |
578 | + //先画一个圆形 | |
579 | + th.circle(context, 110 * b * rpx, 280 * b * rpx, 140 * b * rpx, "#e7f3f8"); | |
580 | + th.circle(context, 130 * b * rpx, 300 * b * rpx, 120 * b * rpx, "#c8f2fa"); | |
581 | + //绘制人脸 | |
582 | + context.drawImage(th.data.share_head, 132 * b * rpx, 310 * b * rpx, 230 * b * rpx, 230 * b * rpx); | |
583 | + | |
584 | + //左右俩个框并填充文字 | |
585 | + th.darwRoundRect(38 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | |
586 | + th.darwRoundRect(324 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | |
587 | + context.setFontSize(20 * b * rpx) | |
588 | + context.setFillStyle("black") | |
589 | + context.fillText("黑眼圈 重度", 50 * b * rpx, 368 * b * rpx); | |
590 | + context.fillText("毛孔 较粗大", 336 * b * rpx, 368 * b * rpx); | |
591 | + | |
592 | + //左右俩个框并填充文字 | |
593 | + th.darwRoundRect(40 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | |
594 | + th.darwRoundRect(348 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | |
595 | + context.setFillStyle("black") | |
596 | + context.fillText("黑头 重度", 52 * b * rpx, 440 * b * rpx); | |
597 | + context.fillText("色斑 轻度", 354 * b * rpx, 440 * b * rpx); | |
598 | + | |
599 | + //左右俩个框并填充文字 | |
600 | + th.darwRoundRect(60 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | |
601 | + th.darwRoundRect(328 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | |
602 | + context.setFillStyle("black") | |
603 | + context.fillText("皱纹 重度", 74 * b * rpx, 510 * b * rpx); | |
604 | + context.fillText("痤疮 轻度", 344 * b * rpx, 510 * b * rpx); | |
605 | + | |
606 | + //底部的绘制 | |
607 | + th.darwRoundRect(38 * b * rpx, 650 * b * rpx, 430 * b * rpx, 160 * b * rpx, 10 * b * rpx, context); | |
608 | + //绘制二维码 | |
609 | + context.drawImage(vpath, 60 * b * rpx, 672 * b * rpx, 120 * b * rpx, 120 * b * rpx); | |
610 | + context.setFillStyle("black") | |
611 | + context.setFontSize(32 * b * rpx) | |
612 | + context.fillText("美肤管家AI测肤", 200 * b * rpx, 726 * b * rpx); | |
613 | + context.setFontSize(22 * b * rpx) | |
614 | + context.fillText("科学了解皮肤的真实状态", 200 * b * rpx, 766 * b * rpx); | |
615 | + | |
616 | + //把画板内容绘制成图片,并回调 画板图片路径 | |
617 | + context.draw(false, function () { | |
618 | + setTimeout(function () { | |
619 | + wx.canvasToTempFilePath({ | |
620 | + x: 0, | |
621 | + y: 0, | |
622 | + width: 750, | |
623 | + height: 1338, | |
624 | + destWidth: 1.4 * 750 * 750 / th.data.screenWidth, | |
625 | + destHeight: 1.4 * 750 * 750 / th.data.screenWidth, | |
626 | + canvasId: 'share', | |
627 | + success: function (res) { | |
628 | + that.setData({ | |
629 | + shareImgPath: res.tempFilePath, | |
630 | + canvasHidden: true, | |
631 | + share_show: 1 | |
632 | + }) | |
633 | + | |
634 | + if (!res.tempFilePath) { | |
635 | + wx.showModal({ | |
636 | + title: '提示', | |
637 | + content: '图片绘制中,请稍后重试', | |
638 | + showCancel: false | |
558 | 639 | }) |
640 | + return false; | |
641 | + } | |
559 | 642 | |
560 | - if (!res.tempFilePath) { | |
561 | - wx.showModal({ | |
562 | - title: '提示', | |
563 | - content: '图片绘制中,请稍后重试', | |
564 | - showCancel: false | |
565 | - }) | |
566 | - return false; | |
567 | - } | |
568 | - | |
569 | - /*-- | |
570 | - wx.previewImage({ | |
571 | - //将图片预览出来 | |
572 | - ur--*/ | |
643 | + /*-- | |
644 | + wx.previewImage({ | |
645 | + //将图片预览出来 | |
646 | + ur--*/ | |
573 | 647 | |
574 | - wx.hideLoading(); | |
575 | - } | |
576 | - }) | |
577 | - }, 500) | |
648 | + wx.hideLoading(); | |
649 | + } | |
650 | + }) | |
651 | + }, 500) | |
578 | 652 | |
579 | - }); | |
653 | + }); | |
580 | 654 | |
581 | 655 | }, |
582 | 656 | fail: function (res) { |
... | ... | @@ -588,7 +662,7 @@ Page({ |
588 | 662 | |
589 | 663 | |
590 | 664 | // 圆形图片 |
591 | - circle: function (ctx, x, y, r,color){ | |
665 | + circle: function (ctx, x, y, r, color) { | |
592 | 666 | ctx.save() |
593 | 667 | ctx.beginPath(); |
594 | 668 | var cx = x + r; |
... | ... | @@ -596,7 +670,7 @@ Page({ |
596 | 670 | ctx.arc(cx, cy, r, 0, 2 * Math.PI); |
597 | 671 | ctx.clip(); |
598 | 672 | ctx.fillStyle = color; |
599 | - ctx.fillRect(x,y,2 * r,2 * r); | |
673 | + ctx.fillRect(x, y, 2 * r, 2 * r); | |
600 | 674 | ctx.restore() |
601 | 675 | ctx.closePath(); |
602 | 676 | }, |
... | ... | @@ -638,8 +712,8 @@ Page({ |
638 | 712 | ctx.setFillStyle('white') |
639 | 713 | ctx.fill() |
640 | 714 | }, |
641 | - close_share:function () { | |
642 | - this.setData({share_show:0}) | |
715 | + close_share: function () { | |
716 | + this.setData({ share_show: 0 }) | |
643 | 717 | }, |
644 | 718 | |
645 | 719 | |
... | ... | @@ -778,7 +852,7 @@ Page({ |
778 | 852 | pdata.guide_id = getApp().globalData.guide_id; |
779 | 853 | } |
780 | 854 | |
781 | - var app = getApp(),th = this; | |
855 | + var app = getApp(), th = this; | |
782 | 856 | wx.showLoading(); |
783 | 857 | app.request.post("/api/weshop/couponList/saveCouponList", { |
784 | 858 | data: pdata, |
... | ... | @@ -787,15 +861,15 @@ Page({ |
787 | 861 | if (res.data.code == 0) { |
788 | 862 | app.my_warnning("领取成功", 1, th); |
789 | 863 | lq_num++; |
790 | - var text = q_word+"[" + index + "].lqnum"; | |
791 | - var text2 = q_word+"[" + index + "].linging"; | |
864 | + var text = q_word + "[" + index + "].lqnum"; | |
865 | + var text2 = q_word + "[" + index + "].linging"; | |
792 | 866 | var obj = {}; |
793 | 867 | obj[text] = lq_num; |
794 | 868 | obj[text2] = 0; |
795 | 869 | th.setData(obj); |
796 | 870 | } else { |
797 | 871 | app.confirmBox(res.data.msg); |
798 | - var text2 = q_word+"[" + index + "].linging"; | |
872 | + var text2 = q_word + "[" + index + "].linging"; | |
799 | 873 | var obj = {}; |
800 | 874 | obj[text2] = 0; |
801 | 875 | th.setData(obj); | ... | ... |
packageD/pages/AI-test-skin/success_result/success_result.wxml
1 | 1 | <wxs module="s_filter" src="s_filter.wxs"></wxs> |
2 | - | |
2 | +<!-- <scroll-view enable-flex scroll-x> | |
3 | + <view style="padding: 0 50rpx 20rpx 20rpx">泪沟</view> | |
4 | + <view style="padding: 0 50rpx 20rpx 20rpx">泪沟</view> | |
5 | + <view style="padding: 0 50rpx 20rpx 20rpx">泪沟</view> | |
6 | + <view style="padding: 0 50rpx 20rpx 20rpx">泪沟</view> | |
7 | + <view style="padding: 0 50rpx 20rpx 20rpx">泪沟</view> | |
8 | + </scroll-view> --> | |
3 | 9 | <view style="height: 100rpx;"> |
4 | 10 | <scroll-view enable-flex scroll-into-view="{{tab_id}}" scroll-with-animation scroll-x class="tab_scroll"> |
5 | 11 | <view class="flex" style="height: 100%;"> |
... | ... | @@ -10,8 +16,8 @@ |
10 | 16 | </scroll-view> |
11 | 17 | </view> |
12 | 18 | |
13 | -<scroll-view enable-flex enhanced scroll-into-view="{{tab_id}}" scroll-with-animation bindscroll="binddragend" scroll-y style="height: calc(100% - 100rpx)"> | |
14 | - <view class="analyse_by_people" id="zong_he"> | |
19 | +<scroll-view enable-flex enhanced scroll-into-view="{{tab_id}}" scroll-with-animation bindscroll="scroll_view" scroll-y style="height: calc(100% - 100rpx)"> | |
20 | + <view class="analyse_by_people zong_he" id="zong_he"> | |
15 | 21 | <view class="analyse"> |
16 | 22 | <view class="analyse_left"> |
17 | 23 | <view class="mark">毛孔 {{pore_num}}</view> |
... | ... | @@ -68,7 +74,7 @@ |
68 | 74 | <view class="content"> |
69 | 75 | <!-- 毛孔 --> |
70 | 76 | <block wx:if="{{pore_num}}"> |
71 | - <include src="pore/pore.wxml" /> | |
77 | + <include src="pore/pore" /> | |
72 | 78 | </block> |
73 | 79 | <!-- 黑头 --> |
74 | 80 | <block wx:if="{{blackhead_num}}"> |
... | ... | @@ -106,7 +112,7 @@ |
106 | 112 | <view class="dialog {{img_scale?'scale':'fangda'}}" wx:if="{{showDialog}}"> |
107 | 113 | <!-- 局部放大的 --> |
108 | 114 | <block wx:if="{{img_scale}}"> |
109 | - <view class="dialog_img"> | |
115 | + <view class="dialog_img" style="{{show_type == 5?'height:60%':'height:75%'}}"> | |
110 | 116 | <view class="img_content"> |
111 | 117 | <view class="face_show_view" style="position: relative;width:{{iwidth}}px;height:{{iheight}}px;margin-top: -{{m_top}}px;margin-left: -{{m_left}}px"> |
112 | 118 | <image src="{{iurl}}{{face_img}}" bindload="face_img_load" style="width: 100%;height: 100%;"></image> |
... | ... | @@ -170,29 +176,61 @@ |
170 | 176 | <text catchtap="click_fangda" class="iconfont icon-fangda mgb20"></text> |
171 | 177 | </view> |
172 | 178 | </view> |
173 | - <view class="dialog_txt"> | |
174 | - <view class="fs28" style="margin-right:15rpx;"> | |
175 | - <text wx:if="{{show_type==1}}">毛孔较粗大</text> | |
176 | - <text wx:if="{{show_type==2}}">色斑轻度</text> | |
177 | - <text wx:if="{{show_type==3}}">皱纹轻度</text> | |
178 | - <text wx:if="{{show_type==4}}">黑头轻度</text> | |
179 | - <text wx:if="{{show_type==5}}">黑眼圈轻度</text> | |
180 | - <text wx:if="{{show_type==6}}">痤疮轻度</text> | |
181 | - <text wx:if="{{show_type==7}}">敏感度{{s_filter.get_nai_shou(skin_sensitive_check)}}</text> | |
179 | + <view class="dialog_txt" style="{{show_type == 5?'height:40%':'height:25%'}}"> | |
180 | + <block wx:if="{{show_type == 5}}"> | |
181 | + <view class="heiyanquan_img flex"> | |
182 | + <view class="img1 t-c"> | |
183 | + <image wx:if="{{sex === 'female' }}" style="width: 100%;height: 100rpx;" src="{{iurl}}/miniapp/images/skinimg/nv4.jpeg"></image> | |
184 | + <image wx:else style="width: 100%;height: 100rpx;" src="{{iurl}}/miniapp/images/skinimg/nan4.jpeg"></image> | |
185 | + <view class="fs24">血管型 无</view> | |
186 | + </view> | |
187 | + <view class="img1 t-c"> | |
188 | + <image wx:if="{{sex === 'female' }}" style="width: 100%;height: 100rpx;" src="{{iurl}}/miniapp/images/skinimg/nv5.jpeg"></image> | |
189 | + <image wx:else style="width: 100%;height: 100rpx;" src="{{iurl}}/miniapp/images/skinimg/nan5.jpeg"></image> | |
190 | + <view class="fs24">色素型 轻度</view> | |
191 | + </view> | |
192 | + <view class="img1 t-c"> | |
193 | + <image wx:if="{{sex === 'female' }}" style="width: 100%;height: 100rpx;" src="{{iurl}}/miniapp/images/skinimg/nv6.jpeg"></image> | |
194 | + <image wx:else style="width: 100%;height: 100rpx;" src="{{iurl}}/miniapp/images/skinimg/nan6.jpeg"></image> | |
195 | + <view class="fs24">阴影型 轻度</view> | |
196 | + </view> | |
182 | 197 | </view> |
183 | - <view style="margin-top:2rpx;display: flex;"> | |
184 | - <view class="pp"></view> | |
185 | - <view class="pp"></view> | |
186 | - <view class="pp"></view> | |
187 | - <view class="pp"></view> | |
188 | - <view class="pp"></view> | |
189 | - <view class="pp"></view> | |
190 | - <view class="pp"></view> | |
191 | - <view class="pp"></view> | |
192 | - <view class="pp"></view> | |
198 | + | |
199 | + </block> | |
200 | + <view class="dialog_progress"> | |
201 | + <view style="margin-right:7px;font-size:32rpx;"> | |
202 | + <text wx:if="{{show_type==1}}">毛孔较粗大</text> | |
203 | + <text wx:if="{{show_type==2}}">色斑轻度</text> | |
204 | + <text wx:if="{{show_type==3}}">皱纹轻度</text> | |
205 | + <text wx:if="{{show_type==4}}">黑头轻度</text> | |
206 | + <text wx:if="{{show_type==5}}">黑眼圈轻度</text> | |
207 | + <text wx:if="{{show_type==6}}">痤疮轻度</text> | |
208 | + <text wx:if="{{show_type==7}}">敏感度{{s_filter.get_nai_shou(skin_sensitive_check)}}</text> | |
209 | + </view> | |
210 | + <view style="margin-top:10rpx;display: flex;"> | |
211 | + <view class="pp"></view> | |
212 | + <view class="pp"></view> | |
213 | + <view class="pp"></view> | |
214 | + <view class="pp"></view> | |
215 | + <view class="pp"></view> | |
216 | + <view class="pp"></view> | |
217 | + <view class="pp"></view> | |
218 | + <view class="pp"></view> | |
219 | + <view class="pp"></view> | |
220 | + </view> | |
193 | 221 | </view> |
222 | + <scroll-view wx:if="{{show_type == 3|| show_type == 5|| show_type == 6}}" style="margin-top: 20rpx;" enable-flex scroll-into-view="scroll{{scroll_id}}" scroll-with-animation scroll-x> | |
223 | + <view class="flex fs28" style="height: 100%;"> | |
224 | + <view wx:for="{{show_type == 3?zhouwen_arr:(show_type == 5?heitanquan_arr:cuochuang_arr)}}" bindtap="click_scroll" data-scroll_id="{{item.id}}" data-index="{{index}}" wx:key="id" id="scroll{{item.id}}" class="dialog_item {{scroll_index==index?'active1':''}}"> | |
225 | + {{item.name}} | |
226 | + </view> | |
227 | + </view> | |
228 | + </scroll-view> | |
194 | 229 | </view> |
230 | + | |
231 | + | |
195 | 232 | </block> |
233 | + | |
196 | 234 | <!-- 全图的,能够自由拖拽和放大 --> |
197 | 235 | |
198 | 236 | <!-- 缩小 --> | ... | ... |
packageD/pages/AI-test-skin/success_result/success_result.wxss
... | ... | @@ -44,6 +44,21 @@ page { |
44 | 44 | background-color: #333333; |
45 | 45 | } |
46 | 46 | |
47 | +.dialog_item.active1 { | |
48 | + color: #45d4eb; | |
49 | +} | |
50 | + | |
51 | +.dialog_item.active1::after { | |
52 | + content: ''; | |
53 | + position: absolute; | |
54 | + bottom: 0; | |
55 | + left: 50%; | |
56 | + transform: translateX(-50%); | |
57 | + width: 25%; | |
58 | + height: 6rpx; | |
59 | + background-color: #45d4eb; | |
60 | +} | |
61 | + | |
47 | 62 | .analyse { |
48 | 63 | display: flex; |
49 | 64 | align-items: center; |
... | ... | @@ -51,6 +66,7 @@ page { |
51 | 66 | justify-content: center; |
52 | 67 | /* justify-content: space-evenly; */ |
53 | 68 | } |
69 | + | |
54 | 70 | .analyse1 { |
55 | 71 | display: flex; |
56 | 72 | align-items: center; |
... | ... | @@ -65,6 +81,7 @@ page { |
65 | 81 | background: #fff; |
66 | 82 | border-radius: 20rpx; |
67 | 83 | } |
84 | + | |
68 | 85 | .analyse1 .mark1 { |
69 | 86 | padding: 3rpx; |
70 | 87 | font-size: 24rpx; |
... | ... | @@ -85,6 +102,7 @@ page { |
85 | 102 | width: 400rpx; |
86 | 103 | height: 400rpx; |
87 | 104 | } |
105 | + | |
88 | 106 | .analyse1 .analyse_center1 { |
89 | 107 | position: relative; |
90 | 108 | background: #c9f0f9; |
... | ... | @@ -92,11 +110,13 @@ page { |
92 | 110 | width: 300rpx; |
93 | 111 | height: 300rpx; |
94 | 112 | } |
113 | + | |
95 | 114 | .analyse1 .analyse_left1 { |
96 | 115 | position: relative; |
97 | 116 | right: -25rpx; |
98 | 117 | z-index: 2; |
99 | 118 | } |
119 | + | |
100 | 120 | .analyse1 .analyse_right1 { |
101 | 121 | position: relative; |
102 | 122 | right: 25rpx; |
... | ... | @@ -338,6 +358,7 @@ page { |
338 | 358 | font-size: 38rpx; |
339 | 359 | font-weight: 600; |
340 | 360 | } |
361 | + | |
341 | 362 | .renzheng::after { |
342 | 363 | position: absolute; |
343 | 364 | content: ""; |
... | ... | @@ -427,7 +448,7 @@ page { |
427 | 448 | top: 50%; |
428 | 449 | right: 50%; |
429 | 450 | transform: translate(50%, -50%); |
430 | - height: 70%; | |
451 | + height: 80%; | |
431 | 452 | width: 80%; |
432 | 453 | border-top-left-radius: 12rpx; |
433 | 454 | border-top-right-radius: 12rpx; |
... | ... | @@ -436,16 +457,42 @@ page { |
436 | 457 | } |
437 | 458 | |
438 | 459 | .dialog .dialog_img { |
439 | - height: 84%; | |
460 | + height: 75%; | |
440 | 461 | position: relative; |
441 | 462 | } |
442 | 463 | |
443 | 464 | .dialog .dialog_txt { |
444 | 465 | display: flex; |
445 | - align-items: center; | |
446 | - justify-content: center; | |
466 | + flex-direction: column; | |
467 | + justify-content: space-evenly; | |
468 | + background-color: #fff; | |
469 | + min-height: 25%; | |
470 | +} | |
471 | + | |
472 | +.dialog_txt .heiyanquan_img { | |
473 | + justify-content: space-between; | |
474 | + padding: 2%; | |
475 | +} | |
476 | +.dialog_txt .heiyanquan_img .img1 { | |
477 | + width: 32%; | |
478 | +} | |
479 | + | |
480 | +.dialog .dialog_progress { | |
481 | + display: flex; | |
482 | + align-self: center; | |
483 | +} | |
484 | + | |
485 | +.dialog .dialog_bottom { | |
486 | + display: flex; | |
487 | + width: 130%; | |
488 | + background-color: #fff; | |
489 | +} | |
490 | + | |
491 | +.dialog_item { | |
492 | + position: relative; | |
493 | + padding: 3% 6%; | |
494 | + white-space: nowrap; | |
447 | 495 | background-color: #fff; |
448 | - min-height: 20%; | |
449 | 496 | } |
450 | 497 | |
451 | 498 | .dialog .dialog_icon { |
... | ... | @@ -471,8 +518,8 @@ page { |
471 | 518 | |
472 | 519 | .pp { |
473 | 520 | width: 8rpx; |
474 | - height: 35rpx; | |
475 | - margin-right: 5rpx; | |
521 | + height: 40rpx; | |
522 | + margin-right: 8rpx; | |
476 | 523 | border-radius: 3rpx; |
477 | 524 | background: #2cb344; |
478 | 525 | } |
... | ... | @@ -635,14 +682,42 @@ page { |
635 | 682 | border-radius: 20rpx; |
636 | 683 | } |
637 | 684 | |
638 | -.share_content{position: fixed;z-index: 999999;top: 50%; left: 50%; width: 70%;transform: translate(-50%, -50%);} | |
639 | -.share_save_btn{width: 100%; height: 80rpx;line-height: 80rpx; text-align: center;color: #fff;background-color:#c3172d } | |
640 | -.sh_close{ position: absolute; right: 20rpx;top: 20rpx;width: 70rpx; height: 70rpx; | |
641 | - display: flex;justify-content: center;align-items: center;font-size: 26rpx; | |
642 | - border-radius: 50%; background-color: grey;color: #fff} | |
685 | +.share_content { | |
686 | + position: fixed; | |
687 | + z-index: 999999; | |
688 | + top: 50%; | |
689 | + left: 50%; | |
690 | + width: 70%; | |
691 | + transform: translate(-50%, -50%); | |
692 | +} | |
693 | + | |
694 | +.share_save_btn { | |
695 | + width: 100%; | |
696 | + height: 80rpx; | |
697 | + line-height: 80rpx; | |
698 | + text-align: center; | |
699 | + color: #fff; | |
700 | + background-color: #c3172d | |
701 | +} | |
702 | + | |
703 | +.sh_close { | |
704 | + position: absolute; | |
705 | + right: 20rpx; | |
706 | + top: 20rpx; | |
707 | + width: 70rpx; | |
708 | + height: 70rpx; | |
709 | + display: flex; | |
710 | + justify-content: center; | |
711 | + align-items: center; | |
712 | + font-size: 26rpx; | |
713 | + border-radius: 50%; | |
714 | + background-color: grey; | |
715 | + color: #fff | |
716 | +} | |
643 | 717 | |
644 | 718 | @font-face { |
645 | - font-family: "iconfont"; /* Project id */ | |
719 | + font-family: "iconfont"; | |
720 | + /* Project id */ | |
646 | 721 | src: url('iconfont.ttf?t=1645607343376') format('truetype'); |
647 | 722 | } |
648 | 723 | ... | ... |