Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pibigstar/wx-todo
微信小程序todo,前端
https://github.com/pibigstar/wx-todo
chart movable-area todo weui wx wxcharts
Last synced: 2 months ago
JSON representation
微信小程序todo,前端
- Host: GitHub
- URL: https://github.com/pibigstar/wx-todo
- Owner: pibigstar
- License: other
- Created: 2018-12-21T09:48:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-06T12:29:46.000Z (over 5 years ago)
- Last Synced: 2024-10-23T20:11:48.392Z (3 months ago)
- Topics: chart, movable-area, todo, weui, wx, wxcharts
- Language: JavaScript
- Size: 626 KB
- Stars: 10
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 任务发布系统微信小程序端
## 项目截图
![个人页面](https://github.com/pibigstar/wx-todo/blob/master/screenshot/me.png)
![todo列表](https://github.com/pibigstar/wx-todo/blob/master/screenshot/todo.png)
![左滑修改](https://github.com/pibigstar/wx-todo/blob/master/screenshot/todo2.png)
![任务总览](https://github.com/pibigstar/wx-todo/blob/master/screenshot/task.png)## API接口封装
### 抽取request请求
抽取出来请求之后你可以在内部加一些逻辑判断,比如是否登录,或者收集formId之类的。
```javascript
const apiRequest = (url, method, data) => {
var promise = new Promise(function (resolve, reject) {
wx.request({
url: domain + url,
data: data,
method: method,
header: {"todo-token": token},
success: function (res) {
console.log(res);
if (res.statusCode === 200) {
resolve(res.data);
} else {
reject({ errormsg: '服务器内部错误,请稍后重试', code: res.statusCode });
}
},
fail: function (res) {
// 调用接口失败
reject({ errormsg: '网络错误,请稍后重试', code: 0 });
}
})
});
return promise;
};```
### 使用```javascript
// 引入util
const util = require("../../utils/util.js")// 获取用户信息
getUserInfo: function(){
util.apiRequest("user/info", "get").then(data => {
if (data.Code == 200) {
console.log(data.Data)
}
})
},
```## 相关项目
- [任务发布系统后端-go语言编写](https://github.com/pibigstar/go-todo)
- [任务发布系统小程序端](https://github.com/pibigstar/wx-todo)
- [任务发布系统后端-react编写](https://github.com/pibigstar/admin-todo)