user.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import Mock from 'mockjs';
  2. import { doCustomTimes } from '@/libs/util';
  3. const Random = Mock.Random;
  4. export const getMessageInit = () => {
  5. let unreadList = [];
  6. doCustomTimes(3, () => {
  7. unreadList.push(
  8. Mock.mock({
  9. title: Random.cword(10, 15),
  10. create_time: '@date',
  11. msg_id: Random.increment(100),
  12. }),
  13. );
  14. });
  15. let readedList = [];
  16. doCustomTimes(4, () => {
  17. readedList.push(
  18. Mock.mock({
  19. title: Random.cword(10, 15),
  20. create_time: '@date',
  21. msg_id: Random.increment(100),
  22. }),
  23. );
  24. });
  25. let trashList = [];
  26. doCustomTimes(2, () => {
  27. trashList.push(
  28. Mock.mock({
  29. title: Random.cword(10, 15),
  30. create_time: '@date',
  31. msg_id: Random.increment(100),
  32. }),
  33. );
  34. });
  35. return {
  36. unread: unreadList,
  37. readed: readedList,
  38. trash: trashList,
  39. };
  40. };
  41. export const getContentByMsgId = () => {
  42. return `<divcourier new',="" monospace;font-weight:="" normal;font-size:="" 12px;line-height:="" 18px;white-space:="" pre;"=""><div>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size: medium;">这是消息内容,这个内容是使用<span style="color: rgb(255, 255, 255); background-color: rgb(28, 72, 127);">富文本编辑器</span>编辑的,所以你可以看到一些<span style="text-decoration-line: underline; font-style: italic; color: rgb(194, 79, 74);">格式</span></span></div><ol><li>你可以查看Mock返回的数据格式,和api请求的接口,来确定你的后端接口的开发</li><li>使用你的真实接口后,前端页面基本不需要修改即可满足基本需求</li><li>快来试试吧</li></ol><p>${Random.csentence(
  43. 100,
  44. 200,
  45. )}</p></divcourier>`;
  46. };
  47. export const hasRead = () => {
  48. return true;
  49. };
  50. export const removeReaded = () => {
  51. return true;
  52. };
  53. export const restoreTrash = () => {
  54. return true;
  55. };
  56. export const messageCount = () => {
  57. return 3;
  58. };