Commit 09bba83054574ab93582d5a3e646bb4db9d18cfa

Authored by yvan.ni
1 parent 2df8ec7f

增加会员帮忙测试的传参功能

packageD/pages/AI-test-skin/analyse/analyse.js
@@ -25,6 +25,7 @@ Page({ @@ -25,6 +25,7 @@ Page({
25 sourceimg: null, 25 sourceimg: null,
26 err_map: null, 26 err_map: null,
27 skin_type: 0, 27 skin_type: 0,
  28 + ce_user_id:0,
28 }, 29 },
29 30
30 /** 31 /**
@@ -35,6 +36,10 @@ Page({ @@ -35,6 +36,10 @@ Page({
35 var plugin = requirePlugin('mtSkinSdk') 36 var plugin = requirePlugin('mtSkinSdk')
36 plugin.setConfig(pluginGD) 37 plugin.setConfig(pluginGD)
37 } 38 }
  39 +
  40 + if(options.ce_user_id)
  41 + this.data.ce_user_id=options.ce_user_id;
  42 +
38 var th = this; 43 var th = this;
39 //设置错误码分析 44 //设置错误码分析
40 this.set_err_map(); 45 this.set_err_map();
@@ -212,13 +217,14 @@ Page({ @@ -212,13 +217,14 @@ Page({
212 //检查图片有没有OK 百度 217 //检查图片有没有OK 百度
213 img_check_bd: function (func) { 218 img_check_bd: function (func) {
214 var th = this; 219 var th = this;
  220 + var user_id=this.data.ce_user_id || getApp().globalData.user_id;
215 var data = { 221 var data = {
216 "appid": "25521854", 222 "appid": "25521854",
217 "image": getApp().globalData.face_SourceImg, 223 "image": getApp().globalData.face_SourceImg,
218 "face_field": "age,expression,face_shape,gender,glasses,landmark,landmark150,quality,eye_status,emotion,face_type,mask,spoofing", 224 "face_field": "age,expression,face_shape,gender,glasses,landmark,landmark150,quality,eye_status,emotion,face_type,mask,spoofing",
219 "image_type": "URL", 225 "image_type": "URL",
220 "store_id":setting.stoid, 226 "store_id":setting.stoid,
221 - "user_id":getApp().globalData.user_id 227 + "user_id":user_id
222 } 228 }
223 //开始调用百度接口,进行对图片进行判断是否符合标准 229 //开始调用百度接口,进行对图片进行判断是否符合标准
224 this.json_post("/api/weshop/baidubce/face/skindetect", data, function (res) { 230 this.json_post("/api/weshop/baidubce/face/skindetect", data, function (res) {
@@ -536,13 +542,14 @@ Page({ @@ -536,13 +542,14 @@ Page({
536 //百度测肤接口 542 //百度测肤接口
537 analyse_by_bd: function (data) { 543 analyse_by_bd: function (data) {
538 var th = this; 544 var th = this;
  545 + var user_id=this.data.ce_user_id || getApp().globalData.user_id;
539 //开始调用接口,进行分析 546 //开始调用接口,进行分析
540 this.json_post("/api/weshop/baidubce/face/skinAnalyze", data, function (res) { 547 this.json_post("/api/weshop/baidubce/face/skinAnalyze", data, function (res) {
541 if (res.data.code == 0) { 548 if (res.data.code == 0) {
542 getApp().globalData.face_result = res.data.data; 549 getApp().globalData.face_result = res.data.data;
543 var req_data = { 550 var req_data = {
544 store_id: setting.stoid, 551 store_id: setting.stoid,
545 - user_id: getApp().globalData.user_id, 552 + user_id: user_id,
546 img: getApp().globalData.face_img, 553 img: getApp().globalData.face_img,
547 sourceimg: getApp().globalData.face_SourceImg, 554 sourceimg: getApp().globalData.face_SourceImg,
548 addtime: ut.gettimestamp(), 555 addtime: ut.gettimestamp(),
@@ -553,7 +560,12 @@ Page({ @@ -553,7 +560,12 @@ Page({
553 //要保存一下分析的结果 560 //要保存一下分析的结果
554 th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) { 561 th.json_post("/api/weshop/face/storeSkinface/save", req_data, function (res) {
555 if (res.data.code == 0) { 562 if (res.data.code == 0) {
  563 + console.log('---ce_id----');
  564 + console.log(res.data.data.id);
556 let url = "/packageD/pages/AI-test-skin/success_result/success_result?id=" + res.data.data.id; //跳到分析页 565 let url = "/packageD/pages/AI-test-skin/success_result/success_result?id=" + res.data.data.id; //跳到分析页
  566 + if(th.data.ce_user_id)
  567 + url+="&ce_user_id="+th.data.ce_user_id;
  568 +
557 wx.redirectTo({ 569 wx.redirectTo({
558 url: url 570 url: url
559 }) 571 })
@@ -564,6 +576,9 @@ Page({ @@ -564,6 +576,9 @@ Page({
564 } else { 576 } else {
565 var msg = th.data.err_map[res.data.code + ""]; 577 var msg = th.data.err_map[res.data.code + ""];
566 let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页 578 let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页
  579 + if(this.data.ce_user_id)
  580 + url+="&ce_user_id="+this.data.ce_user_id;
  581 +
567 wx.redirectTo({ 582 wx.redirectTo({
568 url: url 583 url: url
569 }) 584 })
@@ -573,6 +588,9 @@ Page({ @@ -573,6 +588,9 @@ Page({
573 //跳转到错误页面 美图 588 //跳转到错误页面 美图
574 go_error: function (fail_result) { 589 go_error: function (fail_result) {
575 let url = `/packageD/pages/AI-test-skin/fail_result/fail_result?fail_result=${fail_result}`; //跳到分析页 590 let url = `/packageD/pages/AI-test-skin/fail_result/fail_result?fail_result=${fail_result}`; //跳到分析页
  591 + if(this.data.ce_user_id)
  592 + url+="&ce_user_id="+this.data.ce_user_id;
  593 +
576 wx.redirectTo({ 594 wx.redirectTo({
577 url: url 595 url: url
578 }); 596 });
@@ -580,6 +598,8 @@ Page({ @@ -580,6 +598,8 @@ Page({
580 //跳转到错误页面 598 //跳转到错误页面
581 go_error1: function (msg) { 599 go_error1: function (msg) {
582 let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页 600 let url = "/packageD/pages/AI-test-skin/fail_result/fail_result?msg=" + msg; //跳到分析页
  601 + if(this.data.ce_user_id)
  602 + url+="&ce_user_id="+this.data.ce_user_id;
583 wx.redirectTo({ 603 wx.redirectTo({
584 url: url 604 url: url
585 }); 605 });
packageD/pages/AI-test-skin/fail_result/fail_result.js
@@ -21,6 +21,7 @@ Page({ @@ -21,6 +21,7 @@ Page({
21 iurl: setting.imghost, 21 iurl: setting.imghost,
22 msg:null, 22 msg:null,
23 fail_result:new Array(), //失败原因 23 fail_result:new Array(), //失败原因
  24 + ce_user_id:0
24 }, 25 },
25 26
26 /** 27 /**
@@ -38,6 +39,9 @@ Page({ @@ -38,6 +39,9 @@ Page({
38 msg:options.msg 39 msg:options.msg
39 }) 40 })
40 } 41 }
  42 +
  43 + if(options.ce_user_id) this.data.ce_user_id=options.ce_user_id;
  44 +
41 // msg=decodeURIComponent(msg); 45 // msg=decodeURIComponent(msg);
42 // this.setData({msg:msg}); 46 // this.setData({msg:msg});
43 }, 47 },
@@ -65,6 +69,7 @@ Page({ @@ -65,6 +69,7 @@ Page({
65 //从相册中选择图片 69 //从相册中选择图片
66 back_to:function () { 70 back_to:function () {
67 let url = "/packageD/pages/AI-test-skin/shoot_notice/shoot_notice"; 71 let url = "/packageD/pages/AI-test-skin/shoot_notice/shoot_notice";
  72 + if(this.data.ce_user_id) url+="?ce_user_id="+this.data.ce_user_id;
68 app.goto(url); 73 app.goto(url);
69 }, 74 },
70 75
packageD/pages/AI-test-skin/index/aiskin.js
@@ -19,20 +19,24 @@ Page({ @@ -19,20 +19,24 @@ Page({
19 */ 19 */
20 data: { 20 data: {
21 iurl: setting.imghost, 21 iurl: setting.imghost,
  22 + ce_user_id:0,
22 }, 23 },
23 24
24 /** 25 /**
25 * 生命周期函数--监听页面加载 26 * 生命周期函数--监听页面加载
26 */ 27 */
27 onLoad: function (options) { 28 onLoad: function (options) {
28 - let user_id = options.user_id || getApp().globalData.user_id; 29 + let user_id = options.user_id;
29 if (user_id) { 30 if (user_id) {
30 - getApp().getUserFir(); 31 + this.data.ce_user_id=user_id;
31 } else { 32 } else {
32 - setTimeout(function () {  
33 - let url = "/pages/togoin/togoin";  
34 - app.goto(url);  
35 - }, 1000) 33 + let user_id=getApp().globalData.user_id;
  34 + if(!user_id) {
  35 + setTimeout(function () {
  36 + let url = "/pages/togoin/togoin";
  37 + app.goto(url);
  38 + }, 1000)
  39 + }
36 } 40 }
37 }, 41 },
38 42
@@ -61,14 +65,20 @@ Page({ @@ -61,14 +65,20 @@ Page({
61 goto(e) { 65 goto(e) {
62 66
63 var need=e.currentTarget.dataset.need; 67 var need=e.currentTarget.dataset.need;
  68 +
  69 + let url = e.currentTarget.dataset.url;
  70 + if(this.data.ce_user_id){
  71 + url+="?ce_user_id="+this.data.ce_user_id;
  72 + }
  73 +
64 if(!need){ 74 if(!need){
65 - let url = e.currentTarget.dataset.url; 75 +
66 app.goto(url); 76 app.goto(url);
67 return false; 77 return false;
68 } 78 }
69 79
70 this.check_num(function () { 80 this.check_num(function () {
71 - var user = getApp().globalData.userInfo; 81 + var user = getApp().globalData.userInfo || this.ce_user_id
72 if (!user) { 82 if (!user) {
73 wx.showToast({ 83 wx.showToast({
74 title: "请先授权登陆", 84 title: "请先授权登陆",
@@ -83,7 +93,6 @@ Page({ @@ -83,7 +93,6 @@ Page({
83 return false; 93 return false;
84 } 94 }
85 95
86 - let url = e.currentTarget.dataset.url;  
87 app.goto(url); 96 app.goto(url);
88 }) 97 })
89 98
@@ -120,7 +129,9 @@ Page({ @@ -120,7 +129,9 @@ Page({
120 129
121 130
122 async getHistoryData() { 131 async getHistoryData() {
123 - if (!getApp().globalData.user_id) return false; 132 +
  133 + var user_id=getApp().globalData.user_id || getApp().globalData.ce_user_id;
  134 + if (!user_id) return false;
124 if (this.data.show_his) return false; 135 if (this.data.show_his) return false;
125 136
126 let history = this.data.history; 137 let history = this.data.history;
@@ -129,7 +140,7 @@ Page({ @@ -129,7 +140,7 @@ Page({
129 isShowLoading: true, 140 isShowLoading: true,
130 data: { 141 data: {
131 store_id: setting.stoid, 142 store_id: setting.stoid,
132 - user_id: os.user_id, 143 + user_id: user_id,
133 page: 1, 144 page: 1,
134 pageSize: 1, 145 pageSize: 1,
135 } 146 }
@@ -141,6 +152,10 @@ Page({ @@ -141,6 +152,10 @@ Page({
141 }, 152 },
142 153
143 check_num:function (func) { 154 check_num:function (func) {
  155 +
  156 + var user_id=this.ce_user_id || getApp().globalData.user_id;
  157 + if (!user_id) return false;
  158 +
144 //判断右没有开AI测肤 159 //判断右没有开AI测肤
145 getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ 160 getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{
146 if(rs.data.code!=0 || !rs.data.data){ 161 if(rs.data.code!=0 || !rs.data.data){
@@ -158,7 +173,7 @@ Page({ @@ -158,7 +173,7 @@ Page({
158 }else{ 173 }else{
159 var rdata={ 174 var rdata={
160 store_id:setting.stoid, 175 store_id:setting.stoid,
161 - user_id:getApp().globalData.user_id 176 + user_id:user_id
162 } 177 }
163 this.json_post("/api/weshop/baidubce/face/skinvip",rdata,res=>{ 178 this.json_post("/api/weshop/baidubce/face/skinvip",rdata,res=>{
164 if(res.data.code==0){ 179 if(res.data.code==0){
packageD/pages/AI-test-skin/select_photo/select_photo.js
@@ -13,6 +13,7 @@ Page({ @@ -13,6 +13,7 @@ Page({
13 iurl: setting.imghost, 13 iurl: setting.imghost,
14 gl_skin_img: null, 14 gl_skin_img: null,
15 skin_type: 0, 15 skin_type: 0,
  16 + ce_user_id:0
16 }, 17 },
17 18
18 /** 19 /**
@@ -21,10 +22,14 @@ Page({ @@ -21,10 +22,14 @@ Page({
21 onLoad: function (options) { 22 onLoad: function (options) {
22 var img = getApp().globalData.skin_img_info; 23 var img = getApp().globalData.skin_img_info;
23 this.setData({ gl_skin_img: img }) 24 this.setData({ gl_skin_img: img })
  25 +
  26 + var ce_user_id=options.ce_user_id;
  27 + if(ce_user_id) this.data.ce_user_id=ce_user_id;
24 }, 28 },
25 29
26 //-- 完成选择 -- 30 //-- 完成选择 --
27 ok_select: function () { 31 ok_select: function () {
  32 +
28 const th = this; 33 const th = this;
29 this.check_num(function () { 34 this.check_num(function () {
30 let filePath = th.data.gl_skin_img['path']; 35 let filePath = th.data.gl_skin_img['path'];
@@ -36,6 +41,12 @@ Page({ @@ -36,6 +41,12 @@ Page({
36 getApp().globalData.face_img = e.data.data.img; 41 getApp().globalData.face_img = e.data.data.img;
37 getApp().globalData.face_SourceImg = e.data.data.SourceImg; 42 getApp().globalData.face_SourceImg = e.data.data.SourceImg;
38 let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页 43 let url = "/packageD/pages/AI-test-skin/analyse/analyse"; //跳到分析页
  44 + if(th.data.ce_user_id)
  45 + url+="?ce_user_id="+th.data.ce_user_id;
  46 +
  47 + console.log("select_ph");
  48 + console.log(url);
  49 +
39 app.goto(url); 50 app.goto(url);
40 } else { 51 } else {
41 wx.showToast({ 52 wx.showToast({
@@ -105,6 +116,9 @@ Page({ @@ -105,6 +116,9 @@ Page({
105 size, 116 size,
106 } 117 }
107 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; 118 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo";
  119 + if(th.data.ce_user_id)
  120 + url+="?ce_user_id="+th.data.ce_user_id;
  121 +
108 app.goto(url); 122 app.goto(url);
109 // that.base64(img,"jpg"); 123 // that.base64(img,"jpg");
110 return; 124 return;
@@ -147,6 +161,8 @@ Page({ @@ -147,6 +161,8 @@ Page({
147 size: size1 161 size: size1
148 }; 162 };
149 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; 163 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo";
  164 + if(th.data.ce_user_id)
  165 + url+="?ce_user_id="+th.data.ce_user_id;
150 app.goto(url); 166 app.goto(url);
151 }, 167 },
152 fail: function (res) { 168 fail: function (res) {
@@ -182,6 +198,7 @@ Page({ @@ -182,6 +198,7 @@ Page({
182 }, 198 },
183 199
184 check_num:function (func) { 200 check_num:function (func) {
  201 + var th=this;
185 //判断右没有开AI测肤 202 //判断右没有开AI测肤
186 getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{ 203 getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+setting.stoid,{}).then(rs=>{
187 if(rs.data.code!=0 || !rs.data.data){ 204 if(rs.data.code!=0 || !rs.data.data){
@@ -197,9 +214,11 @@ Page({ @@ -197,9 +214,11 @@ Page({
197 duration: 3000 214 duration: 3000
198 }) 215 })
199 }else{ 216 }else{
  217 +
  218 + var user_id= th.data.ce_user_id || getApp().globalData.user_id;
200 var rdata={ 219 var rdata={
201 store_id:setting.stoid, 220 store_id:setting.stoid,
202 - user_id:getApp().globalData.user_id 221 + user_id:user_id
203 } 222 }
204 this.json_post("/api/weshop/baidubce/face/skinvip",rdata,res=>{ 223 this.json_post("/api/weshop/baidubce/face/skinvip",rdata,res=>{
205 if(res.data.code==0){ 224 if(res.data.code==0){
packageD/pages/AI-test-skin/shoot_notice/shoot_notice.js
@@ -23,13 +23,15 @@ Page({ @@ -23,13 +23,15 @@ Page({
23 skin_type: 0, 23 skin_type: 0,
24 cWidth: 0, 24 cWidth: 0,
25 cHeight: 0, 25 cHeight: 0,
  26 + ce_user_id: 0
26 }, 27 },
27 28
28 /** 29 /**
29 * 生命周期函数--监听页面加载 30 * 生命周期函数--监听页面加载
30 */ 31 */
31 onLoad: function (options) { 32 onLoad: function (options) {
32 - 33 + var ce_user_id=options.ce_user_id;
  34 + if(ce_user_id) this.data.ce_user_id=ce_user_id;
33 }, 35 },
34 36
35 /** 37 /**
@@ -91,6 +93,8 @@ Page({ @@ -91,6 +93,8 @@ Page({
91 console.log(imgArr); 93 console.log(imgArr);
92 getApp().globalData.skin_img_info = imgArr[0]; 94 getApp().globalData.skin_img_info = imgArr[0];
93 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; 95 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo";
  96 + if(th.data.ce_user_id)
  97 + url+="?ce_user_id="+th.data.ce_user_id;
94 app.goto(url); 98 app.goto(url);
95 } 99 }
96 }) 100 })
@@ -158,6 +162,9 @@ Page({ @@ -158,6 +162,9 @@ Page({
158 size, 162 size,
159 } 163 }
160 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; 164 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo";
  165 + if(this.data.ce_user_id){
  166 + url+="?ce_user_id="+this.data.ce_user_id;
  167 + }
161 app.goto(url); 168 app.goto(url);
162 // that.base64(img,"jpg"); 169 // that.base64(img,"jpg");
163 return; 170 return;
@@ -205,6 +212,9 @@ Page({ @@ -205,6 +212,9 @@ Page({
205 size:size1 212 size:size1
206 }; 213 };
207 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo"; 214 let url = "/packageD/pages/AI-test-skin/select_photo/select_photo";
  215 + if(that.data.ce_user_id)
  216 + url+="?ce_user_id="+that.data.ce_user_id;
  217 +
208 app.goto(url); 218 app.goto(url);
209 }, 219 },
210 fail: function (res) { 220 fail: function (res) {
packageD/pages/AI-test-skin/success_result/success_result.wxml
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 </scroll-view> --> 8 </scroll-view> -->
9 <view style="height: 100rpx;"> 9 <view style="height: 100rpx;">
10 <scroll-view enable-flex scroll-into-view="{{tab_id}}" scroll-with-animation scroll-x> 10 <scroll-view enable-flex scroll-into-view="{{tab_id}}" scroll-with-animation scroll-x>
11 - <view class="flex" style="height: 100%;"> 11 + <view class="flex" style="height: 100%; background-color:#fff">
12 <view wx:for="{{tab}}" wx:key="id" id="{{item.id}}" bindtap="clickTab" data-tab_id="{{item.id}}" data-index="{{index}}" class="tab_scroll_item {{currentIndex==index?'active':''}}"> 12 <view wx:for="{{tab}}" wx:key="id" id="{{item.id}}" bindtap="clickTab" data-tab_id="{{item.id}}" data-index="{{index}}" class="tab_scroll_item {{currentIndex==index?'active':''}}">
13 {{item.name}} 13 {{item.name}}
14 </view> 14 </view>