123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import http from '../utils/http'
- const getProject = (that, success = null, error = null) => {
- http({
- url: 'projects/detail',
- data: {
- id: that.data.id
- },
- success: function(res) {
- if(res.code == 0) {
- that.setData({
- project: res.data
- })
- }
- typeof success === "function" && success(res.data)
- },
- error: error
- })
- }
- const getByName = (that, url, name, data={}, success=null, error=null) => {
- http({
- url: url,
- data: data,
- success: function(res) {
- if(res.code == 0) {
- that.setData({
- [name]: res.data
- })
- }
- typeof success === "function" && success(res.data)
- },
- error: error
- })
- }
- const api = {
- getProject,
- getByName
- }
- export default api
|