app.js
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const fetchApi = require('./http/fetch-api.js');
const api = require('./http/api');
const config = require('./config');
const router = require('./router/index');
const storage = require('./utils/stroage');
const util = require('./utils/util');
const func = require('./utils/func');
// console.log('api.login:', api.login)
// console.log('fetchApi:',fetchApi)
// console.log('fetchApi.get:',fetchApi.fetch)
App({
get: fetchApi.fetchMethod,
post: (params) => {
params.method = 'post';
return fetchApi.fetchMethod(params);
},
delete: (params) => {
params.method = 'DELETE';
return fetchApi.fetchMethod(params);
},
uploadFile: fetchApi.uploadFile, // 单文件上传
uploadFileMultiple: fetchApi.uploadFileMultiple, // 多文件上传,
api: api,
config: config,
router: router,
storage: storage,
util: util,
func: func,
tapData: util.getBindtapData,
globalData: {
userInfo: null,
profile: null,
wxcode: storage.getItem("wxcode"),
ui: {
colorUI: "#409EFF",
colorDanger: "#EE0A24"
},
invitationCode: "",
statusBarHeight: 0,
},
onLaunch(options) {
// 第一次打开
// options.query == {number:1}
console.info('App onLaunch');
},
onShow(options) {
// 从后台被 scheme 重新打开
// options.query == {number:1}
},
/**
* 封装toast
* @returns
*/
toast(title, opt = {
icon: 'none'
}) {
let data = opt;
data.title = title
my.showToast({
content: title
})
return;
},
});