@ -0,0 +1,4 @@ |
|||
const config = { |
|||
api_url: '', // 服务器地址
|
|||
} |
|||
export { config } |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 328 B |
After Width: | Height: | Size: 294 B |
After Width: | Height: | Size: 667 B |
After Width: | Height: | Size: 853 B |
After Width: | Height: | Size: 716 B |
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 569 B |
After Width: | Height: | Size: 465 B |
After Width: | Height: | Size: 421 B |
After Width: | Height: | Size: 352 B |
After Width: | Height: | Size: 764 B |
After Width: | Height: | Size: 580 B |
After Width: | Height: | Size: 580 B |
After Width: | Height: | Size: 459 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 594 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 657 B |
After Width: | Height: | Size: 487 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 634 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 680 B |
@ -0,0 +1,15 @@ |
|||
import {HTTP} from '../utils/http.js' |
|||
|
|||
class HomeModel extends HTTP { |
|||
constructor () { |
|||
super() |
|||
} |
|||
// 首页列表
|
|||
getHomeList (success) { |
|||
let params = { |
|||
url: '', |
|||
sucess: sucess |
|||
} |
|||
this.request(params) |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
import {config} from '../config.js' |
|||
|
|||
class HTTP { |
|||
constructor () { |
|||
this.baseUrl = config.api_url |
|||
} |
|||
request = (params) => { |
|||
let url = this.baseUrl + params.url |
|||
if (!params.method) { |
|||
params.method = 'GET' |
|||
} |
|||
wx.request({ |
|||
url: url, |
|||
data: params.data, |
|||
header: { |
|||
'conent-type': 'application/json', |
|||
}, |
|||
method: params.method, |
|||
dataType: 'json', |
|||
responseType: 'json', |
|||
success: function(res) { |
|||
console.log(res) |
|||
let code = res.statusCode.toString() |
|||
let startCode = code.charAt(0) |
|||
if (startCode == '2') { |
|||
params.success && params.success(res.data) |
|||
} else { |
|||
params.error && params.error(res) |
|||
} |
|||
}, |
|||
fail: function(res) { |
|||
params.fail && params.fail(res) |
|||
}, |
|||
}) |
|||
} |
|||
} |
|||
export {HTTP} |