Commit ab5f61ae12c4c607ec180e00aa734cac4b725e51

Authored by yvan.ni
1 parent 2f4a0160

1.分享的地址优化生成

2.接口的替换
packageA/pages/prom_list/prom_list.js
@@ -641,9 +641,9 @@ Page({ @@ -641,9 +641,9 @@ Page({
641 } 641 }
642 if(getApp().globalData.user_id){ 642 if(getApp().globalData.user_id){
643 if(pagePath.indexOf("?")>0){ 643 if(pagePath.indexOf("?")>0){
644 - pagePath+="&first_leader="+getApp().globalData.user_id; 644 + pagePath+="&goods_id="+this.data.gid+" &first_leader="+getApp().globalData.user_id;
645 }else{ 645 }else{
646 - pagePath+="?first_leader="+getApp().globalData.user_id; 646 + pagePath+="?goods_id="+this.data.gid+"&first_leader="+getApp().globalData.user_id;
647 } 647 }
648 } 648 }
649 649
pages/cart/cart2/cart2.js
@@ -1431,7 +1431,7 @@ Page({ @@ -1431,7 +1431,7 @@ Page({
1431 goods.guide_id=gg.guide_id; 1431 goods.guide_id=gg.guide_id;
1432 goods.guide_type=gg.guide_type; 1432 goods.guide_type=gg.guide_type;
1433 //调用接口判断是不是会员 1433 //调用接口判断是不是会员
1434 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{ 1434 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getid/"+oo.stoid+"/"+gg.guide_id,{}).then(res=>{
1435 if(res.data.code==0){ 1435 if(res.data.code==0){
1436 goods.guide_name=res.data.data.salesman; 1436 goods.guide_name=res.data.data.salesman;
1437 goods.guide_sn=res.data.data.salesman_no; 1437 goods.guide_sn=res.data.data.salesman_no;
@@ -1631,7 +1631,7 @@ Page({ @@ -1631,7 +1631,7 @@ Page({
1631 goods.guide_id=g_item.guide_id; 1631 goods.guide_id=g_item.guide_id;
1632 goods.guide_type=g_item.guide_type; 1632 goods.guide_type=g_item.guide_type;
1633 //调用接口判断是不是会员 1633 //调用接口判断是不是会员
1634 - await getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+g_item.guide_id,{}).then(res=>{ 1634 + await getApp().request.promiseGet("/api/weshop/shoppingGuide/getid/"+oo.stoid+"/"+g_item.guide_id,{}).then(res=>{
1635 if(res.data.code==0){ 1635 if(res.data.code==0){
1636 goods.guide_name=res.data.data.salesman; 1636 goods.guide_name=res.data.data.salesman;
1637 goods.guide_sn=res.data.data.salesman_no; 1637 goods.guide_sn=res.data.data.salesman_no;
pages/goods/goodsList/goodsList.js
@@ -21,10 +21,13 @@ Page({ @@ -21,10 +21,13 @@ Page({
21 is_new:0, 21 is_new:0,
22 is_hot:0, 22 is_hot:0,
23 prom_goods_list:null, 23 prom_goods_list:null,
  24 + rq_data:null,
24 }, 25 },
25 26
26 onLoad: function(t) { 27 onLoad: function(t) {
27 28
  29 + this.data.rq_data=t;
  30 +
28 //接受有没有导购的参数 31 //接受有没有导购的参数
29 var first_leader=t.first_leader; 32 var first_leader=t.first_leader;
30 if(first_leader){ 33 if(first_leader){
@@ -212,14 +215,20 @@ Page({ @@ -212,14 +215,20 @@ Page({
212 if (pagePath.indexOf('/') != 0) { 215 if (pagePath.indexOf('/') != 0) {
213 pagePath = '/' + pagePath; 216 pagePath = '/' + pagePath;
214 } 217 }
215 - if(getApp().globalData.user_id){  
216 218
  219 + if(this.data.rq_data && JSON.stringify(this.data.rq_data) != "{}") {
  220 + var parm = ut.ob_to_parm(this.data.rq_data);
  221 + pagePath += "?" + parm;
  222 + }
  223 +
  224 + if(getApp().globalData.user_id){
217 if(pagePath.indexOf("?")>0){ 225 if(pagePath.indexOf("?")>0){
218 pagePath+="&first_leader="+getApp().globalData.user_id; 226 pagePath+="&first_leader="+getApp().globalData.user_id;
219 }else{ 227 }else{
220 pagePath+="?first_leader="+getApp().globalData.user_id; 228 pagePath+="?first_leader="+getApp().globalData.user_id;
221 } 229 }
222 } 230 }
  231 + console.log("11-11"+pagePath);
223 return { 232 return {
224 title: "商品列表", 233 title: "商品列表",
225 path:pagePath, 234 path:pagePath,
pages/goods/search/search.js
@@ -21,8 +21,11 @@ Page({ @@ -21,8 +21,11 @@ Page({
21 21
22 tabname: "goods_id", //排序的字段 22 tabname: "goods_id", //排序的字段
23 adname: "desc", //升降的字段 23 adname: "desc", //升降的字段
  24 + rq_data:null,
24 }, 25 },
25 onLoad: function(t) { 26 onLoad: function(t) {
  27 + this.data.rq_data=t;
  28 +
26 //接受有没有导购的参数 29 //接受有没有导购的参数
27 var first_leader=t.first_leader; 30 var first_leader=t.first_leader;
28 if(first_leader){ 31 if(first_leader){
@@ -184,6 +187,7 @@ Page({ @@ -184,6 +187,7 @@ Page({
184 //-----点击搜索按钮---- 187 //-----点击搜索按钮----
185 search: function(t) { 188 search: function(t) {
186 if ("string" != typeof t || "" == t) return a.showWarning("请输入搜索关键词"); 189 if ("string" != typeof t || "" == t) return a.showWarning("请输入搜索关键词");
  190 + this.data.key_str=t;
187 this.resetData(), this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t)); 191 this.resetData(), this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t));
188 }, 192 },
189 193
@@ -194,6 +198,11 @@ Page({ @@ -194,6 +198,11 @@ Page({
194 if (pagePath.indexOf('/') != 0) { 198 if (pagePath.indexOf('/') != 0) {
195 pagePath = '/' + pagePath; 199 pagePath = '/' + pagePath;
196 } 200 }
  201 +
  202 + if(this.data.key_str) {
  203 + pagePath += "?s_key=" + this.data.key_str;
  204 + }
  205 +
197 if(getApp().globalData.user_id){ 206 if(getApp().globalData.user_id){
198 207
199 if(pagePath.indexOf("?")>0){ 208 if(pagePath.indexOf("?")>0){
@@ -202,6 +211,8 @@ Page({ @@ -202,6 +211,8 @@ Page({
202 pagePath+="?first_leader="+getApp().globalData.user_id; 211 pagePath+="?first_leader="+getApp().globalData.user_id;
203 } 212 }
204 } 213 }
  214 +
  215 + console.log("11-11"+pagePath);
205 return { 216 return {
206 title: "商品搜索", 217 title: "商品搜索",
207 path:pagePath, 218 path:pagePath,
pages/team/team_success/team_success.js
@@ -677,10 +677,11 @@ Page({ @@ -677,10 +677,11 @@ Page({
677 677
678 //------ 分享配置 -------- 678 //------ 分享配置 --------
679 onShareAppMessage: function (e) { 679 onShareAppMessage: function (e) {
680 - var scene=th.data.teamgroup.id; 680 + var th=this;
  681 + var scene=this.data.teamgroup.id;
681 var url="/pages/team/team_show/team_show?tg_id="+scene; 682 var url="/pages/team/team_show/team_show?tg_id="+scene;
682 //--分享图片-- 683 //--分享图片--
683 - img=th.data.iurl+th.data.teamlist.share_imgurl; 684 + var img=th.data.iurl+th.data.teamlist.share_imgurl;
684 //--把会员分享出去-- 685 //--把会员分享出去--
685 if(getApp().globalData.user_id){ 686 if(getApp().globalData.user_id){
686 if(url.indexOf("?")>0) 687 if(url.indexOf("?")>0)
@@ -688,6 +689,7 @@ Page({ @@ -688,6 +689,7 @@ Page({
688 else 689 else
689 url+="?first_leader="+getApp().globalData.user_id; 690 url+="?first_leader="+getApp().globalData.user_id;
690 } 691 }
  692 + console.log(url);
691 693
692 return { 694 return {
693 path:url, 695 path:url,
utils/util.js
@@ -401,6 +401,15 @@ function base64_encode (str) { // 编码,配合encodeURIComponent使用 @@ -401,6 +401,15 @@ function base64_encode (str) { // 编码,配合encodeURIComponent使用
401 return strin 401 return strin
402 } 402 }
403 403
  404 +function ob_to_parm(ob){
  405 + var parm="";
  406 + for( var key in ob){
  407 + parm+="&"+key+"="+ob[key];
  408 + }
  409 + parm = parm.substr(1);
  410 + return parm;
  411 +}
  412 +
404 module.exports = { 413 module.exports = {
405 formatTime: function(e, r) { 414 formatTime: function(e, r) {
406 var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { 415 var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) {
@@ -505,5 +514,6 @@ module.exports = { @@ -505,5 +514,6 @@ module.exports = {
505 draw_circle:draw_circle,//绘制圆, 514 draw_circle:draw_circle,//绘制圆,
506 mergeArray:mergeArray, //数组合并 515 mergeArray:mergeArray, //数组合并
507 isContained:isContained, //是否包含 516 isContained:isContained, //是否包含
508 - base64_encode:base64_encode //64位加密 517 + base64_encode:base64_encode, //64位加密
  518 + ob_to_parm:ob_to_parm //对象变成参数
509 }; 519 };