requests.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import { http, httpGet, httpPost } from '@/utils/http'
  2. import { Schedule } from '../models/schedule'
  3. import { Moment } from '../models/moment'
  4. import dayjs from 'dayjs'
  5. export const getUserInfo = () =>
  6. httpGetMock<any>({
  7. avatar: 'https://via.placeholder.com/21x21',
  8. nickname: '苏小萌',
  9. })
  10. export const getSchedule = () =>
  11. httpGetMock<Schedule>({
  12. name: '东京艺术设计研习营',
  13. cover: 'https://via.placeholder.com/375x297',
  14. items: [
  15. {
  16. title: '早稻田大学课程',
  17. time: '9:00',
  18. content:
  19. '是位于日本东京都新宿区的一所著名的私立大学。它由早稻田大学的创始人大隈重信于1882年创立,是日本超级国际化大学计划(Top Global University Project)选定的大学之一,也是日本顶尖的高等教育机构之一。',
  20. momentExample: 'https://via.placeholder.com/285x157',
  21. monentHint: '*说明:打卡地XX,收集上课素材',
  22. },
  23. {
  24. title: '早稻田大学博物馆参观',
  25. time: '11:00',
  26. content:
  27. '早稻田大学拥有多座博物馆,‌其中最著名的是早稻田大学历史馆。‌早稻田大学历史馆收藏、‌展示着著名校友在运动方面的杰出表现和成就,‌馆内的解说牌以日语和英语标示,‌展现了传统样式风格的建筑。',
  28. momentExample: 'https://via.placeholder.com/285x157',
  29. monentHint: '*说明:打卡地XX,收集上课素材',
  30. },
  31. ],
  32. })
  33. export const getMoment = () =>
  34. httpGetMock<Moment>({
  35. author: {
  36. avatar: 'https://via.placeholder.com/35x35',
  37. nickname: '苏小萌',
  38. level: '0',
  39. },
  40. content: '用心做好设计,为客户创造美好家居环境',
  41. images: [
  42. 'https://via.placeholder.com/165x220',
  43. 'https://via.placeholder.com/220x220',
  44. 'https://via.placeholder.com/165x220',
  45. ],
  46. tags: ['意大利游学设计班'],
  47. shares: 0,
  48. comments: 0,
  49. likes: 0,
  50. createdAt: dayjs('2024-07-15').toDate(),
  51. commentList: [
  52. {
  53. id: 1,
  54. author: {
  55. avatar: 'https://via.placeholder.com/28x28',
  56. nickname: '李一鸣设计师',
  57. level: '',
  58. },
  59. content: '哇~你真的好厉害,棒棒棒',
  60. createdAt: dayjs('2024-07-15').toDate(),
  61. childrens: [
  62. {
  63. id: 3,
  64. parentId: 1,
  65. author: {
  66. avatar: 'https://via.placeholder.com/28x28',
  67. nickname: '李一鸣设计师',
  68. level: '',
  69. },
  70. content: '这个是去参加了意大利游学活动',
  71. createdAt: undefined,
  72. },
  73. ],
  74. },
  75. {
  76. id: 2,
  77. author: {
  78. avatar: 'https://via.placeholder.com/28x28',
  79. nickname: '王莉莎',
  80. level: '',
  81. },
  82. content: '这个活动怎么参加呢?',
  83. createdAt: undefined,
  84. },
  85. ],
  86. })
  87. export const getClassmates = () =>
  88. httpGetMock<any[]>([
  89. {
  90. avatar: 'https://via.placeholder.com/35x35',
  91. nickname: '苏小萌',
  92. level: '0',
  93. },
  94. {
  95. avatar: 'https://via.placeholder.com/35x35',
  96. nickname: '苏小萌',
  97. level: '0',
  98. },
  99. {
  100. avatar: 'https://via.placeholder.com/35x35',
  101. },
  102. ])
  103. export const getClassmate = () =>
  104. httpGetMock<any>({
  105. title: '2023同学荟|清华空间环境艺术设计研修班 阔步向未来',
  106. author: {
  107. avatar: 'https://via.placeholder.com/35x35',
  108. nickname: '苏小萌',
  109. level: '0',
  110. },
  111. viewNum: 125,
  112. createdAt: dayjs('2024-07-15').toDate(),
  113. content: '<div>111111</div>',
  114. })
  115. export const getStudyTours = () =>
  116. httpGetMock<any[]>([
  117. {
  118. title: '东京艺术大学设计游学',
  119. createdAt: dayjs('2024-07-15').toDate(),
  120. startedAt: dayjs('2024-07-15').toDate(),
  121. endedAt: dayjs('2024-08-15').toDate(),
  122. amount: 16000,
  123. },
  124. ])
  125. export const getMaterialDealers = () =>
  126. httpGetMock<any[]>([
  127. {
  128. name: 'IMOLA瓷砖',
  129. icon: 'https://via.placeholder.com/78x78',
  130. brandType: '进口品牌',
  131. type: '瓷砖',
  132. views: 1000,
  133. createdAt: dayjs('2024-07-15').toDate(),
  134. },
  135. {
  136. name: 'IMOLA瓷砖',
  137. icon: 'https://via.placeholder.com/78x78',
  138. brandType: '进口品牌',
  139. type: '瓷砖',
  140. views: 1000,
  141. createdAt: dayjs('2024-07-15').toDate(),
  142. },
  143. ])
  144. export const weixinMiniAppLogin = (phoneCode: string, loginCode: string, state: string) =>
  145. httpPost<any>('/app-api/member/auth/weixin-mini-app-login', {
  146. phoneCode,
  147. loginCode,
  148. state,
  149. })
  150. export const getMemberUserInfo = () => httpGet<any>('/app-api/member/user/get')
  151. export const httpGetMock = <T>(data: T) =>
  152. new Promise<IResData<T>>((resolve) => resolve({ code: 1, msg: '', data } as IResData<T>))