Commit 42f8786ac02d64dc4aac0d558a3bc49eee7037fb
1 parent
d100d629
测肤自测的bug优化
Showing
7 changed files
with
320 additions
and
297 deletions
packageD/pages/AI-test-skin/analyse/analyse.js
@@ -315,7 +315,7 @@ Page({ | @@ -315,7 +315,7 @@ Page({ | ||
315 | 315 | ||
316 | //跳转到错误页面 | 316 | //跳转到错误页面 |
317 | go_error:function (msg) { | 317 | go_error:function (msg) { |
318 | - let url = "/packageB/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页 | 318 | + let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页 |
319 | wx.redirectTo({ | 319 | wx.redirectTo({ |
320 | url: url | 320 | url: url |
321 | }); | 321 | }); |
@@ -339,7 +339,7 @@ Page({ | @@ -339,7 +339,7 @@ Page({ | ||
339 | //要保存一下分析的结果 | 339 | //要保存一下分析的结果 |
340 | th.json_post("/api/weshop/face/storeSkinface/save",req_data,function (res) { | 340 | th.json_post("/api/weshop/face/storeSkinface/save",req_data,function (res) { |
341 | if(res.data.code==0){ | 341 | if(res.data.code==0){ |
342 | - let url = "/packageB/pages/AI-test-skin/success_result/success_result?id="+res.data.data.id; //跳到分析页 | 342 | + let url = "/packageD/pages/AI-test-skin/success_result/success_result?id="+res.data.data.id; //跳到分析页 |
343 | wx.redirectTo({ | 343 | wx.redirectTo({ |
344 | url: url | 344 | url: url |
345 | }) | 345 | }) |
@@ -349,7 +349,7 @@ Page({ | @@ -349,7 +349,7 @@ Page({ | ||
349 | }) | 349 | }) |
350 | }else{ | 350 | }else{ |
351 | var msg=th.data.err_map[res.data.code+""]; | 351 | var msg=th.data.err_map[res.data.code+""]; |
352 | - let url = "/packageB/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页 | 352 | + let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg="+msg; //跳到分析页 |
353 | wx.redirectTo({ | 353 | wx.redirectTo({ |
354 | url: url | 354 | url: url |
355 | }) | 355 | }) |
packageD/pages/AI-test-skin/analyse/analyse.wxml
1 | <view class="content"> | 1 | <view class="content"> |
2 | - <view class="img" style="margin-left: -38rpx"></view> | 2 | + <view style="width: 750rpx; display: flex;justify-content: center; height: autuo"> |
3 | + <view class="img" style="background-image: url({{iurl}}/miniapp/images/skinimg/11.png);"></view> | ||
4 | + </view> | ||
3 | <view style="text-align: center;margin-top: -20%;"> | 5 | <view style="text-align: center;margin-top: -20%;"> |
4 | <text style="color: #fff;">正在分析...</text> | 6 | <text style="color: #fff;">正在分析...</text> |
5 | <progress border-radius="6" percent="{{per}}" activeColor="#fff" backgroundColor="#85898a" class="progress"></progress> | 7 | <progress border-radius="6" percent="{{per}}" activeColor="#fff" backgroundColor="#85898a" class="progress"></progress> |
packageD/pages/AI-test-skin/analyse/analyse.wxss
@@ -25,12 +25,11 @@ page { | @@ -25,12 +25,11 @@ page { | ||
25 | } | 25 | } |
26 | 26 | ||
27 | .img { | 27 | .img { |
28 | - background: url("https://mshopimg.yolipai.net//miniapp/images/skinimg/11.png"); | ||
29 | margin-top: 15%; | 28 | margin-top: 15%; |
30 | display: inline-block; | 29 | display: inline-block; |
31 | width: 350px; | 30 | width: 350px; |
32 | height: 350px; | 31 | height: 350px; |
33 | - transform: scale(0.55); | 32 | + transform: scale(0.5); |
34 | animation: 1s mymove infinite steps(27, end); | 33 | animation: 1s mymove infinite steps(27, end); |
35 | } | 34 | } |
36 | 35 |
packageD/pages/AI-test-skin/fail_result/fail_result.js
@@ -53,7 +53,7 @@ Page({ | @@ -53,7 +53,7 @@ Page({ | ||
53 | }, | 53 | }, |
54 | //从相册中选择图片 | 54 | //从相册中选择图片 |
55 | back_to:function () { | 55 | back_to:function () { |
56 | - let url = "/packageB/pages/AI-test-skin/shoot_notice/shoot_notice"; | 56 | + let url = "/packageD/pages/AI-test-skin/shoot_notice/shoot_notice"; |
57 | app.goto(url); | 57 | app.goto(url); |
58 | }, | 58 | }, |
59 | 59 |
packageD/pages/AI-test-skin/select_photo/select_photo.js
@@ -66,7 +66,7 @@ Page({ | @@ -66,7 +66,7 @@ Page({ | ||
66 | getApp().globalData.face_img=e.data.data.img; | 66 | getApp().globalData.face_img=e.data.data.img; |
67 | getApp().globalData.face_SourceImg=e.data.data.SourceImg; | 67 | getApp().globalData.face_SourceImg=e.data.data.SourceImg; |
68 | 68 | ||
69 | - let url = "/packageB/pages/AI-test-skin/analyse/analyse"; //跳到分析页 | 69 | + let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 |
70 | app.goto(url); | 70 | app.goto(url); |
71 | 71 | ||
72 | } else { | 72 | } else { |
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js
@@ -73,7 +73,7 @@ Page({ | @@ -73,7 +73,7 @@ Page({ | ||
73 | success (res) { | 73 | success (res) { |
74 | let imgArr = res.tempFilePaths; | 74 | let imgArr = res.tempFilePaths; |
75 | getApp().globalData.skin_img=imgArr[0]; | 75 | getApp().globalData.skin_img=imgArr[0]; |
76 | - let url = "/packageB/pages/AI-test-skin/select_photo/select_photo"; | 76 | + let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; |
77 | app.goto(url); | 77 | app.goto(url); |
78 | } | 78 | } |
79 | }) | 79 | }) |
packageD/pages/AI-test-skin/success_result/success_result.js
@@ -61,6 +61,17 @@ Page({ | @@ -61,6 +61,17 @@ Page({ | ||
61 | acne_num4: 0, //结节 | 61 | acne_num4: 0, //结节 |
62 | }, | 62 | }, |
63 | 63 | ||
64 | + onReady:function () { | ||
65 | + //用异步的获取比较准一点 | ||
66 | + wx.getSystemInfo({ | ||
67 | + success (res) { | ||
68 | + console.log(111); | ||
69 | + console.log(res.windowWidth); | ||
70 | + console.log(res.windowHeight); | ||
71 | + } | ||
72 | + }) | ||
73 | + }, | ||
74 | + | ||
64 | /** | 75 | /** |
65 | * 生命周期函数--监听页面加载 | 76 | * 生命周期函数--监听页面加载 |
66 | */ | 77 | */ |
@@ -73,210 +84,222 @@ Page({ | @@ -73,210 +84,222 @@ Page({ | ||
73 | //var face_data=face_result.face_list[0]; | 84 | //var face_data=face_result.face_list[0]; |
74 | this.data.id = options.id; | 85 | this.data.id = options.id; |
75 | 86 | ||
76 | - //计算图片要显示的大小 | ||
77 | - th.data.cWidth = wx.getSystemInfoSync().windowWidth; | ||
78 | - th.data.cHeight = wx.getSystemInfoSync().windowHeight; | ||
79 | - th.data.face_height = th.data.cHeight * 0.8 * 0.75; | ||
80 | - | ||
81 | - var bi1 = (th.data.cHeight * 0.8 * 0.8) / (th.data.cWidth * 0.8); | ||
82 | - this.get_data(function (json, json1, img) { | ||
83 | - //-- 数据先存着 -- | ||
84 | - var face_data = th.data.face_data = json.face_list[0]; | ||
85 | - var face_data1 = th.data.face_data1 = json1.face_list[0]; | ||
86 | - var sex = face_data1.gender.type; | ||
87 | - //痤疮数 | ||
88 | - var acne_num = face_data.acnespotmole.acne_num; | ||
89 | - //色斑数 | ||
90 | - var speckle_num = face_data.acnespotmole.speckle_num; | ||
91 | - //皱纹数 | ||
92 | - var wrinkle_num = face_data.wrinkle.wrinkle_num; | ||
93 | - //黑头数 | ||
94 | - var blackhead_num = face_data.blackheadpore.blackhead_num; | ||
95 | - //毛孔数 | ||
96 | - var pore_num = face_data.blackheadpore.pore_num; | ||
97 | - //黑眼圈的严重程度 | ||
98 | - var dark_type = face_data.eyesattr.dark_circle_left_type.length > 0 ? face_data.eyesattr.dark_circle_left_type[0] : -1; | ||
99 | - var dark_type1 = face_data.eyesattr.dark_circle_right_type.length > 0 ? face_data.eyesattr.dark_circle_right_type[0] : -1; | ||
100 | - | ||
101 | - var dk_type1 = dark_type; | ||
102 | - var dk_type2 = dark_type1; | ||
103 | - if (dark_type1 > dark_type) { | ||
104 | - dark_type = dark_type1; | ||
105 | - } | ||
106 | - var skin_sensitive_check = parseInt(face_data.skinquality.skin_sensitive_check[0]); | ||
107 | - var skin_dryoil_check = face_data.skinquality.skin_dryoil_check; | ||
108 | - | ||
109 | - var location = face_data.location; | ||
110 | - var bili = th.data.face_height / (location.height + location.height / 2.3); | ||
111 | - | ||
112 | - //获取眼睛的画图比例 | ||
113 | - var eye_data1 = face_data1.landmark150.eye_left_corner_right; | ||
114 | - var eye_data2 = face_data1.landmark150.eye_left_corner_left; | ||
115 | - var eye_data3 = face_data1.landmark150.eye_right_corner_left; | ||
116 | - | ||
117 | - var hei1 = Math.abs(eye_data1.x - eye_data2.x); | ||
118 | - var bili_eye = th.data.face_height / (2 * hei1 * bi1); | ||
119 | - var eye_top = eye_data1.y - hei1 * 3 / 4 | ||
120 | - var eye_left1 = eye_data1.x - hei1 / 2; | ||
121 | - var eye_left2 = eye_data3.x - hei1 - hei1 / 2; | ||
122 | - | ||
123 | - var skin_dryoil_check_type = 0;//干性 | ||
124 | - var skin_dryoil_check_arr = [] | ||
125 | - for (let i in skin_dryoil_check) { | ||
126 | - let item = skin_dryoil_check[i]; | ||
127 | - if (item != '1' && skin_dryoil_check_arr.indexOf(item) == -1) { | ||
128 | - skin_dryoil_check_arr.push(item); | ||
129 | - } | ||
130 | - } | ||
131 | - //皮肤干油性的判断 | ||
132 | - if (skin_dryoil_check_arr.length == 0) skin_dryoil_check_type = 1; | ||
133 | - else if (skin_dryoil_check_arr.length == 1) skin_dryoil_check_type = parseInt(skin_dryoil_check_arr[0]); | ||
134 | - else skin_dryoil_check_type = 3; | ||
135 | - | ||
136 | - var wrinkle_types = face_data.wrinkle.wrinkle_types; | ||
137 | - var w_arr = wrinkle_types.filter(function (e) { | ||
138 | - return e == 1; | ||
139 | - }) | ||
140 | - th.data.wrinkle_num1 = w_arr.length; | 87 | + //用异步的获取比较准一点 |
88 | + wx.getSystemInfo({ | ||
89 | + success (res) { | ||
90 | + //计算图片要显示的大小 | ||
91 | + th.data.cWidth = res.windowWidth; | ||
92 | + th.data.cHeight = res.windowHeight; | ||
93 | + | ||
94 | + console.log(222); | ||
95 | + console.log(res.windowWidth); | ||
96 | + console.log(res.windowHeight); | ||
97 | + | ||
98 | + | ||
99 | + th.data.face_height = th.data.cHeight * 0.8 * 0.75; | ||
100 | + | ||
101 | + var bi1= (th.data.cHeight * 0.8 * 0.8)/(th.data.cWidth*0.8); | ||
102 | + th.get_data(function (json, json1, img) { | ||
103 | + //-- 数据先存着 -- | ||
104 | + var face_data = th.data.face_data = json.face_list[0]; | ||
105 | + var face_data1 = th.data.face_data1 = json1.face_list[0]; | ||
106 | + var sex = face_data1.gender.type; | ||
107 | + //痤疮数 | ||
108 | + var acne_num = face_data.acnespotmole.acne_num; | ||
109 | + //色斑数 | ||
110 | + var speckle_num = face_data.acnespotmole.speckle_num; | ||
111 | + //皱纹数 | ||
112 | + var wrinkle_num = face_data.wrinkle.wrinkle_num; | ||
113 | + //黑头数 | ||
114 | + var blackhead_num = face_data.blackheadpore.blackhead_num; | ||
115 | + //毛孔数 | ||
116 | + var pore_num = face_data.blackheadpore.pore_num; | ||
117 | + //黑眼圈的严重程度 | ||
118 | + var dark_type = face_data.eyesattr.dark_circle_left_type.length > 0 ? face_data.eyesattr.dark_circle_left_type[0] : -1; | ||
119 | + var dark_type1 = face_data.eyesattr.dark_circle_right_type.length > 0 ? face_data.eyesattr.dark_circle_right_type[0] : -1; | ||
120 | + | ||
121 | + var dk_type1=dark_type; | ||
122 | + var dk_type2=dark_type1; | ||
123 | + if (dark_type1 > dark_type) { | ||
124 | + dark_type = dark_type1; | ||
125 | + } | ||
126 | + var skin_sensitive_check = parseInt(face_data.skinquality.skin_sensitive_check[0]); | ||
127 | + var skin_dryoil_check = face_data.skinquality.skin_dryoil_check; | ||
128 | + | ||
129 | + var location = face_data.location; | ||
130 | + var bili = th.data.face_height*0.76/location.height; | ||
131 | + | ||
132 | + //获取眼睛的画图比例 | ||
133 | + var eye_data1=face_data1.landmark150.eye_left_corner_right; | ||
134 | + var eye_data2=face_data1.landmark150.eye_left_corner_left; | ||
135 | + var eye_data3=face_data1.landmark150.eye_right_corner_right; | ||
136 | + | ||
137 | + var hei1=Math.abs(eye_data1.x-eye_data2.x); | ||
138 | + var bili_eye = th.data.face_height*0.56/hei1; | ||
139 | + var eye_top=eye_data1.y-hei1/2 | ||
140 | + var eye_left1=eye_data1.x-hei1/6; | ||
141 | + var eye_left2=eye_data3.x-hei1/6; | ||
142 | + | ||
143 | + var skin_dryoil_check_type=0;//干性 | ||
144 | + var skin_dryoil_check_arr=[] | ||
145 | + for(let i in skin_dryoil_check){ | ||
146 | + let item=skin_dryoil_check[i]; | ||
147 | + if(item!='1' && skin_dryoil_check_arr.indexOf(item)==-1){ | ||
148 | + skin_dryoil_check_arr.push(item); | ||
149 | + } | ||
150 | + } | ||
151 | + //皮肤干油性的判断 | ||
152 | + if(skin_dryoil_check_arr.length==0) skin_dryoil_check_type=1; | ||
153 | + else if(skin_dryoil_check_arr.length==1) skin_dryoil_check_type=parseInt(skin_dryoil_check_arr[0]); | ||
154 | + else skin_dryoil_check_type=3; | ||
155 | + | ||
156 | + var wrinkle_types=face_data.wrinkle.wrinkle_types; | ||
157 | + var w_arr=wrinkle_types.filter(function (e) { | ||
158 | + return e==1; | ||
159 | + }) | ||
160 | + th.data.wrinkle_num1=w_arr.length; | ||
141 | 161 | ||
142 | - //皱纹的数量的统计 | ||
143 | - w_arr = wrinkle_types.filter(function (e) { | ||
144 | - return e == 2; | ||
145 | - }) | ||
146 | - th.data.wrinkle_num2 = w_arr.length; | ||
147 | - w_arr = wrinkle_types.filter(function (e) { | ||
148 | - return e == 3; | ||
149 | - }) | ||
150 | - th.data.wrinkle_num3 = w_arr.length; | ||
151 | - w_arr = wrinkle_types.filter(function (e) { | ||
152 | - return e == 4; | ||
153 | - }) | ||
154 | - th.data.wrinkle_num4 = w_arr.length; | ||
155 | - w_arr = wrinkle_types.filter(function (e) { | ||
156 | - return e == 5; | ||
157 | - }) | ||
158 | - th.data.wrinkle_num5 = w_arr.length; | ||
159 | - w_arr = wrinkle_types.filter(function (e) { | ||
160 | - return e == 6; | ||
161 | - }) | ||
162 | - th.data.wrinkle_num6 = w_arr.length; | 162 | + //皱纹的数量的统计 |
163 | + w_arr=wrinkle_types.filter(function (e) { | ||
164 | + return e==2; | ||
165 | + }) | ||
166 | + th.data.wrinkle_num2=w_arr.length; | ||
167 | + w_arr=wrinkle_types.filter(function (e) { | ||
168 | + return e==3; | ||
169 | + }) | ||
170 | + th.data.wrinkle_num3=w_arr.length; | ||
171 | + w_arr=wrinkle_types.filter(function (e) { | ||
172 | + return e==4; | ||
173 | + }) | ||
174 | + th.data.wrinkle_num4=w_arr.length; | ||
175 | + w_arr=wrinkle_types.filter(function (e) { | ||
176 | + return e==5; | ||
177 | + }) | ||
178 | + th.data.wrinkle_num5=w_arr.length; | ||
179 | + w_arr=wrinkle_types.filter(function (e) { | ||
180 | + return e==6; | ||
181 | + }) | ||
182 | + th.data.wrinkle_num6=w_arr.length; | ||
163 | 183 | ||
164 | - //痘痘的不同的统计 | ||
165 | - var acne_list = face_data.acnespotmole.acne_list; | ||
166 | - var a_arr = acne_list.filter(function (e) { | ||
167 | - return e.type == 0; | ||
168 | - }) | ||
169 | - th.data.acne_num1 = a_arr.length; | ||
170 | - a_arr = acne_list.filter(function (e) { | ||
171 | - return e.type == 1; | ||
172 | - }) | ||
173 | - th.data.acne_num2 = a_arr.length; | ||
174 | - a_arr = acne_list.filter(function (e) { | ||
175 | - return e.type == 2; | ||
176 | - }) | ||
177 | - th.data.acne_num3 = a_arr.length; | ||
178 | - a_arr = acne_list.filter(function (e) { | ||
179 | - return e.type == 3; | ||
180 | - }) | ||
181 | - th.data.acne_num4 = a_arr.length; | ||
182 | - | ||
183 | - th.setData({ | ||
184 | - acne_num: acne_num, | ||
185 | - speckle_num: speckle_num, | ||
186 | - wrinkle_num: wrinkle_num, | ||
187 | - wrinkle_types: wrinkle_types, //皱纹类型 | ||
188 | - blackhead_num: blackhead_num, | ||
189 | - pore_num: pore_num, | ||
190 | - dark_type: dark_type, | ||
191 | - dark_typ1: dk_type1, | ||
192 | - dark_type2: dk_type2, | ||
193 | - skin_sensitive_check: skin_sensitive_check, | ||
194 | - skin_dryoil_check: skin_dryoil_check, | ||
195 | - skin_dryoil_check_type: skin_dryoil_check_type, | ||
196 | - face_img: img, | ||
197 | - m_top: (location.top - location.height / 2.5) * bili, | ||
198 | - m_left: (location.left - location.width / 7) * bili, | ||
199 | - bili: bili, | ||
200 | - bili_eye: bili_eye, | ||
201 | - sex: sex, | ||
202 | - skin_dryoil_check_type: skin_dryoil_check_type, | ||
203 | - eye_top: eye_top, | ||
204 | - eye_left1: eye_left1 * bili_eye, | ||
205 | - eye_left2: eye_left2 * bili_eye, | ||
206 | - | ||
207 | - wrinkle_num1: th.data.wrinkle_num1, //抬头纹 | ||
208 | - wrinkle_num2: th.data.wrinkle_num2, //川字纹 | ||
209 | - wrinkle_num3: th.data.wrinkle_num3, //眼周细纹 | ||
210 | - wrinkle_num4: th.data.wrinkle_num4, //鱼尾纹 | ||
211 | - wrinkle_num5: th.data.wrinkle_num5, //法令纹 | ||
212 | - wrinkle_num6: th.data.wrinkle_num6, //口周纹 | ||
213 | - | ||
214 | - acne_num1: th.data.acne_num1, //粉刺 | ||
215 | - acne_num2: th.data.acne_num2, //痘印 | ||
216 | - acne_num3: th.data.acne_num3, //脓包 | ||
217 | - acne_num4: th.data.acne_num4, //结节 | ||
218 | - }) | ||
219 | - var sort = 1; | ||
220 | - //-- 调用毛孔的推荐函数 -- | ||
221 | - if (pore_num > 0) | ||
222 | - pore.get_goods(th, setting.stoid, sort++); | ||
223 | - //-- 调用黑头的推荐函数 -- | ||
224 | - if (blackhead_num > 0) | ||
225 | - blackhead.get_goods(th, setting.stoid, sort++); | ||
226 | - //-- 调用色斑的推荐函数 -- | ||
227 | - if (speckle_num > 0) | ||
228 | - speckle.get_goods(th, setting.stoid, sort++); | ||
229 | - //-- 调用皱纹的推荐函数 -- | ||
230 | - if (wrinkle_num > 0) | ||
231 | - wrinkle.get_goods(th, setting.stoid, sort++); | ||
232 | - //-- 黑眼圈 -- | ||
233 | - if (dark_type > -1) | ||
234 | - dark.get_goods(th, setting.stoid, sort++); | ||
235 | - //-- 黑眼圈 -- | ||
236 | - if (acne_num > -0) | ||
237 | - acne.get_goods(th, setting.stoid, sort++); | ||
238 | - | ||
239 | - //-- 获取一下分享要用的图片 -- | ||
240 | - th.set_share_img(); | ||
241 | - acne.get_goods(th, setting.stoid); | ||
242 | - // let { heightRecord, tab } = th.data; | ||
243 | - // tab.forEach(item => { | ||
244 | - // console.log(2); | ||
245 | - // var query = th.createSelectorQuery(); | ||
246 | - // let class_name = `.${item['id']}`; | ||
247 | - // query.select(class_name).boundingClientRect(function (rect) { | ||
248 | - // // let ratio = 750 / rect.width; | ||
249 | - // let height = parseInt(rect.height); //加上导航栏50px | ||
250 | - // heightRecord.push(height); | ||
251 | - // // item['top'] = top; | ||
252 | - // }).exec(); | ||
253 | - // }); | ||
254 | - // heightRecord.sort((a, b) => { | ||
255 | - // return a - b; | ||
256 | - // }); | ||
257 | - // th.setData({ | ||
258 | - // heightRecord, | ||
259 | - // }) | ||
260 | - // setTimeout(() => { | ||
261 | - // heightRecord.sort((a, b) => { | ||
262 | - // return a - b; | ||
263 | - // }) | ||
264 | - // let new_arr = []; | ||
265 | - // if (heightRecord.length > 0) { | ||
266 | - // heightRecord.reduce((pre, cur) => { | ||
267 | - // let sum = pre + cur; | ||
268 | - // new_arr.push(sum); | ||
269 | - // return sum; | ||
270 | - // }) | ||
271 | - // } | ||
272 | - // th.setData({ | ||
273 | - // heightRecord:new_arr, | ||
274 | - // }) | ||
275 | - // },1000) | 184 | + //痘痘的不同的统计 |
185 | + var acne_list = face_data.acnespotmole.acne_list; | ||
186 | + var a_arr=acne_list.filter(function (e) { | ||
187 | + return e.type==0; | ||
188 | + }) | ||
189 | + th.data.acne_num1=a_arr.length; | ||
190 | + a_arr=acne_list.filter(function (e) { | ||
191 | + return e.type==1; | ||
192 | + }) | ||
193 | + th.data.acne_num2=a_arr.length; | ||
194 | + a_arr=acne_list.filter(function (e) { | ||
195 | + return e.type==2; | ||
196 | + }) | ||
197 | + th.data.acne_num3=a_arr.length; | ||
198 | + a_arr=acne_list.filter(function (e) { | ||
199 | + return e.type==3; | ||
200 | + }) | ||
201 | + th.data.acne_num4=a_arr.length; | ||
202 | + | ||
203 | + th.setData({ | ||
204 | + acne_num: acne_num, | ||
205 | + speckle_num: speckle_num, | ||
206 | + wrinkle_num: wrinkle_num, | ||
207 | + wrinkle_types:wrinkle_types, //皱纹类型 | ||
208 | + blackhead_num: blackhead_num, | ||
209 | + pore_num: pore_num, | ||
210 | + dark_type: dark_type, | ||
211 | + dark_typ1: dk_type1, | ||
212 | + dark_type2: dk_type2, | ||
213 | + skin_sensitive_check: skin_sensitive_check, | ||
214 | + skin_dryoil_check: skin_dryoil_check, | ||
215 | + skin_dryoil_check_type:skin_dryoil_check_type, | ||
216 | + face_img: img, | ||
217 | + m_top: (location.top-location.height/3)* bili, | ||
218 | + m_left:Math.abs(th.data.cWidth*0.8-(location.width+location.left*2)* bili)/2, | ||
219 | + bili: bili, | ||
220 | + bili_eye:bili_eye, | ||
221 | + sex:sex, | ||
222 | + skin_dryoil_check_type:skin_dryoil_check_type, | ||
223 | + eye_top:eye_top* bili_eye, | ||
224 | + eye_left1:eye_left1* bili_eye, | ||
225 | + eye_left2:eye_left2* bili_eye, | ||
226 | + | ||
227 | + wrinkle_num1:th.data.wrinkle_num1, //抬头纹 | ||
228 | + wrinkle_num2:th.data.wrinkle_num2, //川字纹 | ||
229 | + wrinkle_num3:th.data.wrinkle_num3, //眼周细纹 | ||
230 | + wrinkle_num4:th.data.wrinkle_num4, //鱼尾纹 | ||
231 | + wrinkle_num5:th.data.wrinkle_num5, //法令纹 | ||
232 | + wrinkle_num6:th.data.wrinkle_num6, //口周纹 | ||
233 | + | ||
234 | + acne_num1:th.data.acne_num1, //粉刺 | ||
235 | + acne_num2:th.data.acne_num2, //痘印 | ||
236 | + acne_num3:th.data.acne_num3, //脓包 | ||
237 | + acne_num4:th.data.acne_num4, //结节 | ||
238 | + }) | ||
239 | + var sort = 1; | ||
240 | + //-- 调用毛孔的推荐函数 -- | ||
241 | + if (pore_num > 0) | ||
242 | + pore.get_goods(th, setting.stoid, sort++); | ||
243 | + //-- 调用黑头的推荐函数 -- | ||
244 | + if (blackhead_num > 0) | ||
245 | + blackhead.get_goods(th, setting.stoid, sort++); | ||
246 | + //-- 调用色斑的推荐函数 -- | ||
247 | + if (speckle_num > 0) | ||
248 | + speckle.get_goods(th, setting.stoid, sort++); | ||
249 | + //-- 调用皱纹的推荐函数 -- | ||
250 | + if (wrinkle_num > 0) | ||
251 | + wrinkle.get_goods(th, setting.stoid, sort++); | ||
252 | + //-- 黑眼圈 -- | ||
253 | + if (dark_type > -1) | ||
254 | + dark.get_goods(th, setting.stoid, sort++); | ||
255 | + //-- 黑眼圈 -- | ||
256 | + if (acne_num > -0) | ||
257 | + acne.get_goods(th, setting.stoid, sort++); | ||
258 | + | ||
259 | + //-- 获取一下分享要用的图片 -- | ||
260 | + th.set_share_img(); | ||
261 | + acne.get_goods(th, setting.stoid); | ||
262 | + // let { heightRecord, tab } = th.data; | ||
263 | + // tab.forEach(item => { | ||
264 | + // console.log(2); | ||
265 | + // var query = th.createSelectorQuery(); | ||
266 | + // let class_name = `.${item['id']}`; | ||
267 | + // query.select(class_name).boundingClientRect(function (rect) { | ||
268 | + // // let ratio = 750 / rect.width; | ||
269 | + // let height = parseInt(rect.height); //加上导航栏50px | ||
270 | + // heightRecord.push(height); | ||
271 | + // // item['top'] = top; | ||
272 | + // }).exec(); | ||
273 | + // }); | ||
274 | + // heightRecord.sort((a, b) => { | ||
275 | + // return a - b; | ||
276 | + // }); | ||
277 | + // th.setData({ | ||
278 | + // heightRecord, | ||
279 | + // }) | ||
280 | + // setTimeout(() => { | ||
281 | + // heightRecord.sort((a, b) => { | ||
282 | + // return a - b; | ||
283 | + // }) | ||
284 | + // let new_arr = []; | ||
285 | + // if (heightRecord.length > 0) { | ||
286 | + // heightRecord.reduce((pre, cur) => { | ||
287 | + // let sum = pre + cur; | ||
288 | + // new_arr.push(sum); | ||
289 | + // return sum; | ||
290 | + // }) | ||
291 | + // } | ||
292 | + // th.setData({ | ||
293 | + // heightRecord:new_arr, | ||
294 | + // }) | ||
295 | + // },1000) | ||
276 | 296 | ||
277 | - }) | ||
278 | 297 | ||
298 | + }) | ||
299 | + } | ||
300 | + }) | ||
279 | }, | 301 | }, |
302 | + | ||
280 | 303 | ||
281 | //-- 初始等级卡 -- | 304 | //-- 初始等级卡 -- |
282 | init: function () { | 305 | init: function () { |
@@ -684,7 +707,7 @@ Page({ | @@ -684,7 +707,7 @@ Page({ | ||
684 | if (this.data.share_hidden) { | 707 | if (this.data.share_hidden) { |
685 | this.setData({ share_hidden: false, }); | 708 | this.setData({ share_hidden: false, }); |
686 | } | 709 | } |
687 | - ; | 710 | + |
688 | 711 | ||
689 | wx.showLoading({ title: '生成中...', }) | 712 | wx.showLoading({ title: '生成中...', }) |
690 | var that = this, th = that; | 713 | var that = this, th = that; |
@@ -705,94 +728,93 @@ Page({ | @@ -705,94 +728,93 @@ Page({ | ||
705 | wx.getImageInfo({ | 728 | wx.getImageInfo({ |
706 | src: path3, | 729 | src: path3, |
707 | success: function (res) { | 730 | success: function (res) { |
708 | - var b = 1.1; | ||
709 | - //获取到二维码的图片 | ||
710 | - var vpath = res.path; | ||
711 | - var context = wx.createCanvasContext('share'); | ||
712 | - // 先画背景 | ||
713 | - context.fillStyle = '#ebf6f8'; | ||
714 | - // 灰色实心矩形 | ||
715 | - // 1. 语法: x坐标, y坐标, 宽度, 高度 | ||
716 | - context.fillRect(0, 0, 750 * rpx, 1338 * rpx); | ||
717 | - | ||
718 | - context.setFontSize(20 * rpx) | ||
719 | - context.setFillStyle("#00d8e9") | ||
720 | - context.fillText("官方检测认证", 28 * b * rpx, 80 * b * rpx); | ||
721 | - | ||
722 | - //两个底部颜色 | ||
723 | - context.fillStyle = '#a7ecf5'; | ||
724 | - context.fillRect(28 * b * rpx, 136 * b * rpx, 262 * b * rpx, 18 * b * rpx); | ||
725 | - context.fillRect(28 * b * rpx, 194 * b * rpx, 262 * b * rpx, 18 * b * rpx); | ||
726 | - | ||
727 | - context.setFontSize(42 * b * rpx) | ||
728 | - context.setFillStyle("#070609") | ||
729 | - context.fillText("我的肌底强韧", 30 * b * rpx, 140 * b * rpx); | ||
730 | - context.fillText("肌肤鲜活润泽", 30 * b * rpx, 196 * b * rpx); | ||
731 | - | ||
732 | - //先画一个圆形 | ||
733 | - th.circle(context, 110 * b * rpx, 280 * b * rpx, 140 * b * rpx, "#e7f3f8"); | ||
734 | - th.circle(context, 130 * b * rpx, 300 * b * rpx, 120 * b * rpx, "#c8f2fa"); | ||
735 | - //绘制人脸 | ||
736 | - context.drawImage(th.data.share_head, 132 * b * rpx, 310 * b * rpx, 230 * b * rpx, 230 * b * rpx); | ||
737 | - | ||
738 | - //左右俩个框并填充文字 | ||
739 | - th.darwRoundRect(38 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | ||
740 | - th.darwRoundRect(324 * b * rpx, 340 * b * rpx, 140 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | ||
741 | - context.setFontSize(20 * b * rpx) | ||
742 | - context.setFillStyle("black") | ||
743 | - context.fillText("黑眼圈 重度", 50 * b * rpx, 368 * b * rpx); | ||
744 | - context.fillText("毛孔 " + th.data.pore_num, 336 * b * rpx, 368 * b * rpx); | ||
745 | - | ||
746 | - //左右俩个框并填充文字 | ||
747 | - th.darwRoundRect(40 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | ||
748 | - th.darwRoundRect(348 * b * rpx, 412 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | ||
749 | - context.setFillStyle("black") | ||
750 | - context.fillText("黑头 " + th.data.blackhead_num, 52 * b * rpx, 440 * b * rpx); | ||
751 | - context.fillText("色斑 " + th.data.speckle_num, 354 * b * rpx, 440 * b * rpx); | ||
752 | - | ||
753 | - //左右俩个框并填充文字 | ||
754 | - th.darwRoundRect(60 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | ||
755 | - th.darwRoundRect(328 * b * rpx, 484 * b * rpx, 116 * b * rpx, 40 * b * rpx, 20 * b * rpx, context); | ||
756 | - context.setFillStyle("black") | ||
757 | - context.fillText("皱纹 " + th.data.wrinkle_num, 74 * b * rpx, 510 * b * rpx); | ||
758 | - context.fillText("痤疮 " + th.data.acne_num, 344 * b * rpx, 510 * b * rpx); | ||
759 | - | ||
760 | - //底部的绘制 | ||
761 | - th.darwRoundRect(38 * b * rpx, 650 * b * rpx, 430 * b * rpx, 160 * b * rpx, 10 * b * rpx, context); | ||
762 | - //绘制二维码 | ||
763 | - context.drawImage(vpath, 60 * b * rpx, 672 * b * rpx, 120 * b * rpx, 120 * b * rpx); | ||
764 | - context.setFillStyle("black") | ||
765 | - context.setFontSize(32 * b * rpx) | ||
766 | - context.fillText("美肤管家AI测肤", 200 * b * rpx, 726 * b * rpx); | ||
767 | - context.setFontSize(22 * b * rpx) | ||
768 | - context.fillText("科学了解皮肤的真实状态", 200 * b * rpx, 766 * b * rpx); | ||
769 | - | ||
770 | - //把画板内容绘制成图片,并回调 画板图片路径 | ||
771 | - context.draw(false, function () { | ||
772 | - setTimeout(function () { | ||
773 | - wx.canvasToTempFilePath({ | ||
774 | - x: 0, | ||
775 | - y: 0, | ||
776 | - width: 750, | ||
777 | - height: 1338, | ||
778 | - destWidth: 1.4 * 750 * 750 / th.data.screenWidth, | ||
779 | - destHeight: 1.4 * 750 * 750 / th.data.screenWidth, | ||
780 | - canvasId: 'share', | ||
781 | - success: function (res) { | ||
782 | - that.setData({ | ||
783 | - shareImgPath: res.tempFilePath, | ||
784 | - canvasHidden: true, | ||
785 | - share_show: 1 | ||
786 | - }) | ||
787 | - return false; | ||
788 | - | ||
789 | - /*-- | ||
790 | - wx.previewImage({ | ||
791 | - //将图片预览出来 | ||
792 | - ur--*/ | ||
793 | - | ||
794 | - wx.hideLoading(); | ||
795 | - } | 731 | + |
732 | + var b=1.1; | ||
733 | + //获取到二维码的图片 | ||
734 | + var vpath = res.path; | ||
735 | + var context = wx.createCanvasContext('share'); | ||
736 | + // 先画背景 | ||
737 | + context.fillStyle = '#ebf6f8'; | ||
738 | + // 灰色实心矩形 | ||
739 | + // 1. 语法: x坐标, y坐标, 宽度, 高度 | ||
740 | + context.fillRect(0,0,750 * rpx,1338 * rpx); | ||
741 | + | ||
742 | + context.setFontSize(20* rpx) | ||
743 | + context.setFillStyle("#00d8e9") | ||
744 | + context.fillText("官方检测认证", 28*b* rpx, 80*b* rpx); | ||
745 | + | ||
746 | + //两个底部颜色 | ||
747 | + context.fillStyle = '#a7ecf5'; | ||
748 | + context.fillRect(28 *b* rpx,136 *b* rpx,262 *b* rpx,18 *b* rpx); | ||
749 | + context.fillRect(28 *b* rpx,194 *b* rpx,262 *b* rpx,18 *b* rpx); | ||
750 | + | ||
751 | + context.setFontSize(42*b*rpx) | ||
752 | + context.setFillStyle("#070609") | ||
753 | + context.fillText("我的肌底强韧", 30*b* rpx, 140*b* rpx); | ||
754 | + context.fillText("肌肤鲜活润泽", 30*b* rpx, 196*b* rpx); | ||
755 | + | ||
756 | + //先画一个圆形 | ||
757 | + th.circle(context,110*b*rpx, 280*b*rpx,140*b*rpx,"#e7f3f8"); | ||
758 | + th.circle(context,130*b*rpx, 300*b*rpx,120*b*rpx,"#c8f2fa"); | ||
759 | + //绘制人脸 | ||
760 | + context.drawImage(th.data.share_head, 132*b*rpx, 310*b*rpx, 230*b* rpx, 230 *b* rpx); | ||
761 | + | ||
762 | + //左右俩个框并填充文字 | ||
763 | + th.darwRoundRect(38 *b* rpx,340*b*rpx,140*b*rpx,40*b*rpx,20*b*rpx,context); | ||
764 | + th.darwRoundRect(324 *b* rpx,340*b*rpx,140*b*rpx,40*b*rpx,20*b*rpx,context); | ||
765 | + context.setFontSize(20*b*rpx) | ||
766 | + context.setFillStyle("black") | ||
767 | + context.fillText("黑眼圈 重度", 50*b* rpx, 368*b* rpx); | ||
768 | + context.fillText("毛孔 "+th.data.pore_num, 336*b* rpx, 368*b* rpx); | ||
769 | + | ||
770 | + //左右俩个框并填充文字 | ||
771 | + th.darwRoundRect(40 *b* rpx,412*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); | ||
772 | + th.darwRoundRect(348 *b* rpx,412*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); | ||
773 | + context.setFillStyle("black") | ||
774 | + context.fillText("黑头 "+th.data.blackhead_num, 52*b* rpx, 440*b* rpx); | ||
775 | + context.fillText("色斑 "+th.data.speckle_num, 354*b* rpx, 440*b* rpx); | ||
776 | + | ||
777 | + //左右俩个框并填充文字 | ||
778 | + th.darwRoundRect(60 *b* rpx,484*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); | ||
779 | + th.darwRoundRect(328 *b* rpx,484*b*rpx,116*b*rpx,40*b*rpx,20*b*rpx,context); | ||
780 | + context.setFillStyle("black") | ||
781 | + context.fillText("皱纹 "+th.data.wrinkle_num, 74*b* rpx, 510*b* rpx); | ||
782 | + context.fillText("痤疮 "+th.data.acne_num, 344*b* rpx, 510*b* rpx); | ||
783 | + | ||
784 | + //底部的绘制 | ||
785 | + th.darwRoundRect(38 *b* rpx,650*b*rpx,430*b*rpx,160*b*rpx,10*b*rpx,context); | ||
786 | + //绘制二维码 | ||
787 | + context.drawImage(vpath, 60*b*rpx, 672*b*rpx, 120 *b* rpx, 120 *b* rpx); | ||
788 | + context.setFillStyle("black") | ||
789 | + context.setFontSize(32*b*rpx) | ||
790 | + context.fillText("美肤管家AI测肤", 200*b* rpx, 726*b* rpx); | ||
791 | + context.setFontSize(22*b*rpx) | ||
792 | + context.fillText("科学了解皮肤的真实状态", 200*b* rpx, 766*b* rpx); | ||
793 | + | ||
794 | + //把画板内容绘制成图片,并回调 画板图片路径 | ||
795 | + context.draw(false, function () { | ||
796 | + setTimeout(function () { | ||
797 | + wx.canvasToTempFilePath({ | ||
798 | + x: 0, | ||
799 | + y: 0, | ||
800 | + width: 750, | ||
801 | + height: 1338, | ||
802 | + destWidth: 1.4 * 750 * 750 / th.data.screenWidth, | ||
803 | + destHeight: 1.4 * 750 * 750 / th.data.screenWidth, | ||
804 | + canvasId: 'share', | ||
805 | + success: function (res) { | ||
806 | + that.setData({ | ||
807 | + shareImgPath: res.tempFilePath, | ||
808 | + canvasHidden: true, | ||
809 | + share_show:1 | ||
810 | + }) | ||
811 | + /*-- | ||
812 | + wx.previewImage({ | ||
813 | + //将图片预览出来 | ||
814 | + ur--*/ | ||
815 | + | ||
816 | + wx.hideLoading(); | ||
817 | + } | ||
796 | }) | 818 | }) |
797 | }, 500) | 819 | }, 500) |
798 | 820 |