requests.ts 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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 getByDictType = (type: string | 'member_channel_source') =>
  152. httpGet<
  153. {
  154. label: string
  155. value: string
  156. dictType: string
  157. status: number
  158. }[]
  159. >('/app-api/system/dict-data/type', { type })
  160. export const createUserAuthInfo = (
  161. data: Partial<{
  162. id: number
  163. userId: number
  164. designerName: string
  165. gender: number
  166. mobile: string
  167. channelSource: number
  168. referrer: string
  169. employer: string
  170. spatialExpertiseType: number
  171. attachment: string
  172. auditStatus: number
  173. remark: string
  174. }>,
  175. ) => httpPost<any>('/app-api/member/user-auth-info/create', data)
  176. export const getCircles = (query) =>
  177. httpGet<{
  178. list: {
  179. id: number
  180. headUrl?: string
  181. stylistId?: number
  182. stylistName?: string
  183. marketing?: string
  184. circleDesc?: string
  185. tagName?: string
  186. detailsType?: string
  187. detailsUrl?: string
  188. detailsDesc?: string
  189. circleType?: string
  190. spaceType?: string
  191. designStyle?: string
  192. spaceAddr?: string
  193. customerDemand?: string
  194. createTime: number
  195. bannerUrls: string[]
  196. shareCount?: number
  197. upvoteCount?: number
  198. ownUpvote: boolean
  199. reviewCount: number
  200. }[]
  201. }>('/app-api/member/circle/page', query)
  202. export const createCircle = (
  203. data: Partial<{
  204. headUrl: string
  205. stylistId: string
  206. stylistName: string
  207. marketing: string
  208. circleDesc: string
  209. tagName: string
  210. detailsType: string
  211. detailsUrl: string
  212. detailsDesc: string
  213. circleType: string
  214. spaceType: string
  215. designStyle: string
  216. spaceAddr: string
  217. customerDemand: string
  218. bannerUrls: string[]
  219. }>,
  220. ) => httpPost<any>('/app-api/member/circle/create', data)
  221. export const refreshToken = (refreshToken: string) =>
  222. httpPost<any>('/app-api/member/auth/refresh-token', {}, { refreshToken })
  223. export const httpGetMock = <T>(data: T) =>
  224. new Promise<IResData<T>>((resolve) => resolve({ code: 1, msg: '', data } as IResData<T>))