Coder Social home page Coder Social logo

helpmiss's Introduction

MissHelp

帮走失

常用

` 使用app.WxService 调用原生方法支持promise

app.WxService.navigateTo("/pages/apply/index?type=bus&roleType=1");


app.WxService.scanCode({
      onlyFromCamera: false,
    }).then(res => {
      console.log(res.result);
      const query = res.result;
      const querylist = decodeURIComponent(query).split('/');
      const cabinet_id = (query && query.length > 0) ? querylist[querylist.length - 1] : 44;
      return app.HttpService.getCabinetcodeByid({
        cabinet_id,
      })
    }).then(data => {
        const cabinet_code = data.data.cabinet_code;
        app.globalData.cabinet_code = cabinet_code;
        this.aferScanCode(cabinet_code);
    }).catch((e) => {
      console.log(e);
      app.WxService.redirectTo("/pages/operator/usercenter/index");
})

` 使用 app.HttpService 发送请求 进行了一些封装

app.HttpService.getorderlist(params).then(data => {
  console.log(data);
  var result = data.data.map((item) => {
    item['addtime_format'] = moment(item['addtime'] * 1000).format('YYYY-MM-DD HH:mm:ss');
    item['order_no_format'] = '...' + item['order_no'].slice(item['order_no'].length - 12, item['order_no'].length);
    item['goods_list'].map((it) => {
      it.price = it.good_price;
      return it;
    })
    return item;
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.