msg.js 783 B

12345678910111213141516171819202122232425262728293031
  1. import Api from "../../model/api";
  2. import {formatTime, getEventParam} from "../../utils/utils";
  3. const app = getApp();
  4. app.Base({
  5. data: {
  6. },
  7. onLoad(options){
  8. this.noInit = true;
  9. console.log("数据",this.noInit)
  10. },
  11. async bindLogin(e){
  12. const isLogin = getEventParam(e,"isLogin")
  13. if (isLogin) {
  14. await this.resetData(this);
  15. }
  16. },
  17. async requestData() {
  18. const res = await Api.getMsgList({
  19. pageNum: this.pageNum,
  20. pageSize: this.pageSize
  21. });
  22. res.data.rows = res.data.rows.map(item => {
  23. return {
  24. content: item.sendContent || '',
  25. time: formatTime(item.createTime),
  26. }
  27. });
  28. return res;
  29. },
  30. });