jufubao-base 1.0.331 → 1.0.332-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-base",
3
- "version": "1.0.331",
3
+ "version": "1.0.332-beta2",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -51,4 +51,15 @@ module.exports = [
51
51
  },
52
52
  disabled: true,
53
53
  },
54
+ {
55
+ mapFnName: "getExchangeCode",
56
+ title: "兑换码",
57
+ path: "/member/v1/exchange/:exchange_code",
58
+ isRule: true,
59
+ params: {
60
+ exchange_code: ['兑换码', 'String', '必选'],
61
+ },
62
+ isConsole: true,
63
+ disabled: true,
64
+ },
54
65
  ];
@@ -788,9 +788,28 @@ export default {
788
788
  }
789
789
  },
790
790
 
791
-
791
+ doExchangeCode(exchange_code, otherData={}){
792
+ return new Promise((resolve, reject) => {
793
+ this.$xdShowLoading({});
794
+ jfbRootExec("getExchangeCode", {
795
+ vm: this,
796
+ data: {
797
+ exchange_code: exchange_code,
798
+ version: '1.5.1',
799
+ is_return_is_used: "Y",
800
+ ...otherData
801
+ }
802
+ }).then(res => {
803
+ this.$xdHideLoading();
804
+ resolve(res);
805
+ }).catch(e=>{
806
+ this.$xdHideLoading();
807
+ reject(e);
808
+ })
809
+ })
810
+ },
792
811
  handleClick(entry, item){
793
- //如果是小程序,则跳到兑换码开通plus会员页
812
+ //如果是小程序,则跳到兑换码开通plus会员页;仅plus站点
794
813
  if(entry.redirect_type === "WMP"){
795
814
  let redirectData = entry.redirect_data;
796
815
  let site_path = redirectData.site_path;
@@ -803,14 +822,22 @@ export default {
803
822
  }
804
823
  }).then(res => {
805
824
  //从res.card_qrcode中提取参数code_content
806
- let code_content = this.getParams(res.card_qrcode, "code_content")
807
- let sitePath = site_path.replace("${qrcode}", Base64.encodeURI(code_content));
808
- // this.handleH5ToMP(app_id, sitePath, '');
825
+ let code_content = this.getParams(res.card_qrcode, "code_content");
826
+ let exchange_code = Base64.encodeURI(code_content);
827
+ let sitePath = "";
828
+ this.doExchangeCode(exchange_code).then(res => {
829
+ //被使用,跳首页; 未使用,跳兑换页
830
+ if(res.is_used === 'Y'){
831
+ sitePath = "/main/zhrk/zhrk";//跳小程序首页路径
832
+ }else{
833
+ sitePath = site_path.replace("${qrcode}", exchange_code);
834
+ }
835
+ let query = encodeURIComponent(`path=${sitePath}&is_return_is_used=Y`);
836
+ let wxLink = `weixin://dl/business/?appid=${app_id}&path=pages/loading/loading&query=${query}&env_version=release`;
837
+ console.log(wxLink)
838
+ window.location.href = wxLink;
839
+ })
809
840
  //is_return_is_used=Y 表示兑换码页面会用到is_return_is_used参数来判断兑换码已使用跳首页的逻辑。
810
- let query = encodeURIComponent(`path=${sitePath}&is_return_is_used=Y`);
811
- let wxLink = `weixin://dl/business/?appid=${app_id}&path=pages/loading/loading&query=${query}&env_version=release`;
812
- console.log(wxLink)
813
- window.location.href = wxLink;
814
841
  })
815
842
  }
816
843
  return;