requests.ts 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. export const getClassmates = () =>
  54. httpGetMock<any[]>([
  55. {
  56. avatar: 'https://via.placeholder.com/35x35',
  57. nickname: '苏小萌',
  58. level: '0',
  59. },
  60. {
  61. avatar: 'https://via.placeholder.com/35x35',
  62. nickname: '苏小萌',
  63. level: '0',
  64. },
  65. {
  66. avatar: 'https://via.placeholder.com/35x35',
  67. },
  68. ])
  69. export const getClassmate = () =>
  70. httpGetMock<any>({
  71. title: '2023同学荟|清华空间环境艺术设计研修班 阔步向未来',
  72. author: {
  73. avatar: 'https://via.placeholder.com/35x35',
  74. nickname: '苏小萌',
  75. level: '0',
  76. },
  77. viewNum: 125,
  78. createdAt: dayjs('2024-07-15').toDate(),
  79. content: '<div>111111</div>',
  80. })
  81. export const getStudyTours = () =>
  82. httpGetMock<any[]>([
  83. {
  84. title: '东京艺术大学设计游学',
  85. createdAt: dayjs('2024-07-15').toDate(),
  86. startedAt: dayjs('2024-07-15').toDate(),
  87. endedAt: dayjs('2024-08-15').toDate(),
  88. amount: 16000,
  89. },
  90. ])
  91. export const getMaterialDealers = () =>
  92. httpGetMock<any[]>([
  93. {
  94. name: 'IMOLA瓷砖',
  95. icon: 'https://via.placeholder.com/78x78',
  96. brandType: '进口品牌',
  97. type: '瓷砖',
  98. views: 1000,
  99. createdAt: dayjs('2024-07-15').toDate(),
  100. },
  101. {
  102. name: 'IMOLA瓷砖',
  103. icon: 'https://via.placeholder.com/78x78',
  104. brandType: '进口品牌',
  105. type: '瓷砖',
  106. views: 1000,
  107. createdAt: dayjs('2024-07-15').toDate(),
  108. },
  109. ])
  110. export const weixinMiniAppLogin = (phoneCode: string, loginCode: string, state: string) =>
  111. httpPost<any>('/app-api/member/auth/weixin-mini-app-login', {
  112. phoneCode,
  113. loginCode,
  114. state,
  115. })
  116. export const getMemberUserInfo = () => httpGet<any>('/app-api/member/user/get')
  117. export const getByDictType = (type: string | 'member_channel_source') =>
  118. httpGet<
  119. {
  120. label: string
  121. value: string
  122. dictType: string
  123. status: number
  124. }[]
  125. >('/app-api/system/dict-data/type', { type })
  126. export const createUserAuthInfo = (
  127. data: Partial<{
  128. id: number
  129. userId: number
  130. designerName: string
  131. gender: number
  132. mobile: string
  133. channelSource: number
  134. referrer: string
  135. employer: string
  136. spatialExpertiseType: number
  137. attachment: string
  138. auditStatus: number
  139. remark: string
  140. }>,
  141. ) => httpPost<any>('/app-api/member/user-auth-info/create', data)
  142. export const getCircles = (query) =>
  143. httpGet<{
  144. list: {
  145. id: number
  146. headUrl?: string
  147. stylistId?: number
  148. stylistName?: string
  149. marketing?: string
  150. circleDesc?: string
  151. tagName?: string
  152. detailsType?: string
  153. detailsUrl?: string
  154. detailsDesc?: string
  155. circleType?: string
  156. spaceType?: string
  157. designStyle?: string
  158. spaceAddr?: string
  159. customerDemand?: string
  160. createTime: number
  161. bannerUrls: string[]
  162. shareCount?: number
  163. upvoteCount?: number
  164. ownUpvote: boolean
  165. reviewCount: number
  166. }[]
  167. }>('/app-api/member/circle/page', query)
  168. export const createCircle = (data: Partial<Circle>) =>
  169. httpPost<any>('/app-api/member/circle/create', data)
  170. export const getCircle = (id: string) =>
  171. httpGet<Partial<CircleRes>>('/app-api/member/circle/get', { id })
  172. export const createCircleUpvote = (data: { circleId: number; userId: number; userName: string }) =>
  173. httpPost('/app-api/member/circle-upvote/create', data)
  174. export const cancelCircleUpvote = (query: { id: string }) =>
  175. httpGet('/app-apimember/circle-upvote/delete', query)
  176. export const createCircleReview = (
  177. data: Partial<{
  178. circleId: string
  179. userId: string | number
  180. userName: string
  181. reviewContent: string
  182. replayReviewId: string
  183. }>,
  184. ) => httpPost<any>('/app-api/member/circle-review/create', data)
  185. export const getCircleReviews = (query: { circleId: string }) =>
  186. httpGet<{
  187. list: Partial<{
  188. id: number
  189. circleId: number
  190. userId: number
  191. userName: string
  192. reviewContent: string
  193. upvoteCount: any
  194. replayReviewId: any
  195. reviewTime: number
  196. createTime: number
  197. replayToUserName: any
  198. replayToUserId: any
  199. replayFirstId: any
  200. upvote: boolean
  201. ownDel: boolean
  202. }>[]
  203. }>('/app-api/member/circle-review/getCircleReviewByCircleId', query)
  204. export const createCircleReviewUpvote = (data: {
  205. circleId: number
  206. userId: number
  207. userName: string
  208. reviewId: number
  209. }) => httpPost('/app-api/member/circle-review-upvote/create', data)
  210. export const cancelCircleReviewUpvote = (query: {
  211. circleId: string
  212. userId: string
  213. reviewId: string
  214. }) => httpGet('/app-api/member/circle-review-upvote/cancel', query)
  215. export const getCircleReviewUpvotes = (query: { circleId: string; reviewId?: string }) =>
  216. httpGet('/app-api/member/circle-review-upvote/page', query)
  217. export const getReviewReplay = (query: { id: string }) =>
  218. httpGet('/app-api/member/circle-review/getReviewReplay', query)
  219. export const getTasks = (query) =>
  220. httpGet<{
  221. list: {
  222. id: number
  223. taskKey: string
  224. taskValue: string
  225. createTime: string
  226. sort: number
  227. status: number
  228. }[]
  229. }>('/app-api/basicsetting/set-task-center/page', query)
  230. export const login = (data: {
  231. mobile: string
  232. password: string
  233. socialType: number
  234. socialCode: string
  235. socialState: string
  236. socialCodeValid: boolean
  237. }) => httpPost('/app-api/member/auth/login', data)
  238. export const refreshToken = (refreshToken: string) =>
  239. httpPost<any>('/app-api/member/auth/refresh-token', {}, { refreshToken })
  240. /**
  241. * 商家端-扫码验券
  242. */
  243. export const scanCodeCheckPaper = (data: { orderNo: string }) =>
  244. httpPost('/app-api/member/vendorApp/scanCodeCheckPaper', data)
  245. export const httpGetMock = <T>(data: T) =>
  246. new Promise<IResData<T>>((resolve) => resolve({ code: 1, msg: '', data } as IResData<T>))
  247. export interface Circle {
  248. headUrl: string
  249. stylistId: string | number
  250. stylistName: string
  251. marketing: string
  252. circleDesc: string
  253. tagName: string
  254. detailsType: string
  255. detailsUrl: string
  256. detailsDesc: string
  257. circleType: string
  258. spaceType: string
  259. designStyle: string
  260. spaceAddr: string
  261. customerDemand: string
  262. bannerUrls: string[]
  263. }
  264. export interface CircleRes {
  265. id: number
  266. headUrl?: string
  267. stylistId?: number
  268. stylistName?: string
  269. marketing?: string
  270. circleDesc?: string
  271. tagName?: string
  272. detailsType?: string
  273. detailsUrl?: string
  274. detailsDesc?: string
  275. circleType?: string
  276. spaceType?: string
  277. designStyle?: string
  278. spaceAddr?: string
  279. customerDemand?: string
  280. createTime: number
  281. bannerUrls: string[]
  282. shareCount?: number
  283. upvoteCount?: number
  284. ownUpvote: boolean
  285. reviewCount: number
  286. }