1.2.21 • Published 4 years ago

jdb_vue_proxy v1.2.21

Weekly downloads
3
License
-
Repository
-
Last release
4 years ago

鉴权&收银台使用文档

一、鉴权

install

 npm i jdb_vue_proxy -S

引入&使用

 main.js 全局引入

import {requestProxy} from 'jdb_vue_proxy'
Vue.prototype.requestProxy = requestProxy;

使用

eg:

this.requestProxy({
      'env':'development',
      'url':'url',
      'data': {
        a: '123213',
        b: '1212',
        c: '123213',
        d: '12'
      }
    }).then( (res)=>{
      console.log(res)
    },
    (err) => {
      console.log(err)
    })

参数:

  • options:
    • env: 环境 development /test/ huidu / production
    • url: url(接口地址)
    • data: 业务参数
  • 成功回调
1、res.error.returnCode === 0
2、res.error.returnCode !== 0
// 前两种情况   接口返回res原样返回
3、res.error.returnCode === 451
// 代表需要鉴权,sdk会代理鉴权项,
// 如果用户手动关闭,或者是鉴权项不支持,会原样返回451
{
   error:{
       returnCode: 451,
       returnUserMessage: '...'
   }
}
  • 失败回调
- 接口错误
      {
        errorType: 1,
        errorMessage: "网络错误"
      }

二、收银台

引入&使用

main.js 全局引入

import {payCashier} from 'jdb_vue_proxy'
Vue.prototype.payCashier = payCashier;

使用

this.payCashier({
        env: 'development',
        data: {
          orderID:123213,
          businessType: 1,
          ext:{}
        }
      }).then(
        res => {
          console.log(res)
        },
        err =>{
          console.log(err)
        }
      )

参数:

  • options:
 - env: (必传)环境  //development /test/ huidu / production
 - data: {
     orderID: (必传)订单号,
     businessType: (必传)风控type,
     ext:{} (必传)// 额外参数,预下单接口返回
 }
  • 成功回调
{
   orderID: "123213",  //订单ID
   forgetPassword: false, // 是否点击过忘记密码
   status: 0 //0:取消支付 1:成功 2:失败 3:处理中
   statusText: //  取消支付/支付成功/支付失败 3:处理中
}
  • 失败回调
err:{} //接口失败的error信息

三、端外登录&注册 插件使用文档

安装

 npm i jdb_vue_proxy -S

引入&使用

main.js 全局引入

import {loginRegister} from 'jdb_vue_proxy'
Vue.prototype.loginRegister = loginRegister;

使用

eg:
  const imgCodeCompStyle = `
    #img_code_namespace .message_img_code_component {
        padding: 35px 1vw 0;
    }
  `;
  const imgCodeCompTxt = {
    title: "", // 选传,默认显示“用借贷宝账号登录”
    telPlaceholder: "请输入您的手机号码", // 选传
    codePlaceholder: "请输入验证码", // 选传,
    imgDialogTitle: "请输入图形验证码", // 选传,
    codeBtnText: "发送", // 选传,
    imgDialogPlaceholder: "请输入验证码", // 选传,
    imgDialogBtnText: ["取消", "确定"], // 选传,
    submitBtnText: '登录/注册', // 选传,
    showCloseBtn: true, // 是否展示关闭按钮,默认展示 // 选传,
    closeBtnPosition: 'right', // 默认不传就为左边 // 选传,
  };
  const imgCodeCompConf = {
    container: null, // 选传,挂载的容器
    outerCommonData: null, // 必传,端外公参
    env: "production", // 必传
    scrollY: 0, // 键盘收起时需要滚动的距离
    textConfig: imgCodeCompTxt, // 选传,
    styleConfig: imgCodeCompStyle // 选传,
  };

  imgCodeCompConf.container = document.getElementById('component_box');
  imgCodeCompConf.env = process.env.NODE_ENV;
  imgCodeCompConf.outerCommonData = {
    userId: 123456
  };

  this.loginRegister(imgCodeCompConf).then((res) => {
    console.log(res);
  }, (err) => {
    console.log(err);
  });

参数:

  - options:
  - env: "production", // optional: development /test/ huidu / production
  - container: 挂载节点 // required
  - outerCommonData: null // 端外公参(必传)
  - textConfig: object, // optional
  - styleConfig: `` // optional

回调值 value

  • 1-成功
  • 2-失败
  • 其他-异常

四、端外实名认证 插件使用文档

安装

 npm i jdb_vue_proxy -S

引入&使用

main.js 全局引入

import {realName} from 'jdb_vue_proxy'
Vue.prototype.realName = realName;

使用

eg:
  this.realName({
    title: '', // 选传,标题
    subTitle: '', // 选传,子标题
    showCloseBtn: true, // 选传,默认true
    env: "development", // 必传
    scrollY: 0, // 选传。收起键盘滚动的位置
    params: {
      memberID: "727736831383365290",
    }, // 选传,业务参数
    outerCommonData: {
      userId: 9988
    } // 必传,端外公参
  }).then((res) => {
    <!-- 1 || 2 -->
    console.log(res);
  }, (err) => {
    <!-- 3 -->
    console.log(err);
  });

参数:

  - options:
  - title: '', // 选传,标题
  - subTitle: '', // 选传,子标题
  - showCloseBtn: true, // 选传,默认true
  - env: "development", // 必传
  - scrollY: 0, // 选传。收起键盘滚动的位置
  - params: {}, // 选传,业务参数
  - outerCommonData: {} // 必传,端外公参

回调值 value

  • 1-成功
  • 2-失败
  • 3-异常