Commit 09bba83054574ab93582d5a3e646bb4db9d18cfa

Authored by yvan.ni
1 parent 2df8ec7f

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

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