12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import apiUrl from './common/api.js'
- import numfn from "./common/common"
- App({
- globaldata: {
- corpId: "",
- serverurl: 'https://rismanage3.pacsonline.cn',
- authCode: '',
- apiUrl: apiUrl
- },
- // 封装网络请求
- https(httpstype, url, data, type) {
- dd.showLoading();
- let endurl;
- let headers = {}
- endurl = encodeURI(this.globaldata.serverurl + url);
- headers = {
- "Content-Type": 'application/json;charset=utf-8',
- Authorization: 'Bearer ' + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI1ZDVjOTkwODY1NmZmODAwYTE3ZTExNzUiLCJyYW5kb20iOiJjNjJhNWE2ZDk3OTliMTE1IiwidXNlcm5hbWUiOiLnlJjkuJzkuJwiLCJpYXQiOjE1NjY0NDE4OTR9.LZFdeYmNUCes-xF2HdFIGER4xVddDYn4RvtI3n1kLzs'
- }
- return new Promise((resolve, reject) => {
- dd.httpRequest({
- headers: headers,
- url: endurl,
- method: httpstype,
- data: data,
- dataType: 'json',
- success: (res) => {
- if (res.data.msg && res.data.msg != 'ok') {
- dd.showToast({
- content: res.data.msg,
- duration: 3000
- });
- return
- }
- resolve(res)
- },
- fail: (res) => {
- reject(res)
- },
- complete: (res) => {
- dd.hideLoading()
- }
- })
- })
- },
- onLaunch(options) {
- // 第一次打开
- // debugger
- // options.query == {number:1}
- this.globaldata.corpId = options.query.corpId;
- console.info('App onLaunch');
- },
- onShow(options) {
- // 从后台被 scheme 重新打开
- // options.query == {number:1}
- },
- });
|