notice.mock.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. import { defineMock } from "./base";
  2. export default defineMock([
  3. {
  4. url: "notices/page",
  5. method: ["GET"],
  6. body: {
  7. code: "00000",
  8. data: {
  9. list: [
  10. {
  11. id: 1,
  12. title: "v2.12.0 新增系统日志,访问趋势统计功能。",
  13. publishStatus: 1,
  14. type: 1,
  15. publisherName: "系统管理员",
  16. level: "L",
  17. publishTime: "2024-09-30 17:21",
  18. isRead: null,
  19. targetType: 1,
  20. createTime: "2024-09-28 11:21",
  21. revokeTime: "2024-09-30 17:21",
  22. },
  23. {
  24. id: 2,
  25. title: "v2.13.0 新增菜单搜索。",
  26. publishStatus: 1,
  27. type: 1,
  28. publisherName: "系统管理员",
  29. level: "L",
  30. publishTime: "2024-09-30 17:22",
  31. isRead: null,
  32. targetType: 1,
  33. createTime: "2024-09-28 11:21",
  34. revokeTime: "2024-09-30 17:21",
  35. },
  36. {
  37. id: 3,
  38. title: "\r\nv2.14.0 新增个人中心。",
  39. publishStatus: 1,
  40. type: 1,
  41. publisherName: "系统管理员",
  42. level: "L",
  43. publishTime: "2024-09-30 17:23",
  44. isRead: null,
  45. targetType: 1,
  46. createTime: "2024-09-28 11:21",
  47. revokeTime: "2024-09-30 17:21",
  48. },
  49. {
  50. id: 4,
  51. title: "v2.15.0 登录页面改造。",
  52. publishStatus: 1,
  53. type: 1,
  54. publisherName: "系统管理员",
  55. level: "L",
  56. publishTime: "2024-09-30 17:24",
  57. isRead: null,
  58. targetType: 1,
  59. createTime: "2024-09-28 11:21",
  60. revokeTime: "2024-09-30 17:21",
  61. },
  62. {
  63. id: 5,
  64. title: "v2.16.0 通知公告、字典翻译组件。",
  65. publishStatus: 1,
  66. type: 1,
  67. publisherName: "系统管理员",
  68. level: "L",
  69. publishTime: "2024-09-30 17:25",
  70. isRead: null,
  71. targetType: 1,
  72. createTime: "2024-09-28 11:21",
  73. revokeTime: "2024-09-30 17:21",
  74. },
  75. {
  76. id: 6,
  77. title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。",
  78. publishStatus: 1,
  79. type: 2,
  80. publisherName: "系统管理员",
  81. level: "L",
  82. publishTime: "2024-09-30 17:26",
  83. isRead: null,
  84. targetType: 1,
  85. createTime: "2024-09-28 11:21",
  86. revokeTime: "2024-09-30 17:21",
  87. },
  88. {
  89. id: 7,
  90. title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。",
  91. publishStatus: 1,
  92. type: 3,
  93. publisherName: "系统管理员",
  94. level: "L",
  95. publishTime: "2024-09-30 17:27",
  96. isRead: null,
  97. targetType: 1,
  98. createTime: "2024-09-28 11:21",
  99. revokeTime: "2024-09-30 17:21",
  100. },
  101. {
  102. id: 8,
  103. title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。",
  104. publishStatus: 1,
  105. type: 4,
  106. publisherName: "系统管理员",
  107. level: "L",
  108. publishTime: "2024-09-30 17:28",
  109. isRead: null,
  110. targetType: 1,
  111. createTime: "2024-09-28 11:21",
  112. revokeTime: "2024-09-30 17:21",
  113. },
  114. {
  115. id: 9,
  116. title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。",
  117. publishStatus: 1,
  118. type: 5,
  119. publisherName: "系统管理员",
  120. level: "L",
  121. publishTime: "2024-09-30 17:29",
  122. isRead: null,
  123. targetType: 1,
  124. createTime: "2024-09-28 11:21",
  125. revokeTime: "2024-09-30 17:21",
  126. },
  127. {
  128. id: 10,
  129. title:
  130. "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。",
  131. publishStatus: 1,
  132. type: 1,
  133. publisherName: "系统管理员",
  134. level: "L",
  135. publishTime: "2024-09-30 17:30",
  136. isRead: null,
  137. targetType: 1,
  138. createTime: "2024-09-28 11:21",
  139. revokeTime: "2024-09-30 17:21",
  140. },
  141. ],
  142. total: 10,
  143. },
  144. msg: "一切ok",
  145. },
  146. },
  147. // 新增通知
  148. {
  149. url: "notices",
  150. method: ["POST"],
  151. body({ body }) {
  152. return {
  153. code: "00000",
  154. data: null,
  155. msg: "新增成功",
  156. };
  157. },
  158. },
  159. // 获取通知表单数据
  160. {
  161. url: "notices/:id/form",
  162. method: ["GET"],
  163. body: ({ params }) => {
  164. return {
  165. code: "00000",
  166. data: noticeMap[params.id],
  167. msg: "一切ok",
  168. };
  169. },
  170. },
  171. // 获取通知详情
  172. {
  173. url: "notices/:id/detail",
  174. method: ["GET"],
  175. body: ({ params }) => {
  176. return {
  177. code: "00000",
  178. data: noticeMap[params.id],
  179. msg: "一切ok",
  180. };
  181. },
  182. },
  183. // 修改通知
  184. {
  185. url: "roles/:id",
  186. method: ["PUT"],
  187. body({ body }) {
  188. return {
  189. code: "00000",
  190. data: null,
  191. msg: "修改通知" + body.name + "成功",
  192. };
  193. },
  194. },
  195. // 删除通知
  196. {
  197. url: "roles/:id",
  198. method: ["DELETE"],
  199. body({ params }) {
  200. return {
  201. code: "00000",
  202. data: null,
  203. msg: "删除通知" + params.id + "成功",
  204. };
  205. },
  206. },
  207. // 我的通知分页列表
  208. {
  209. url: "notices/my-page",
  210. method: ["GET"],
  211. body: {
  212. code: "00000",
  213. data: {
  214. list: [
  215. {
  216. id: 10,
  217. title:
  218. "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。",
  219. type: 1,
  220. level: "L",
  221. publisherName: "系统管理员",
  222. publishTime: "2024-09-30 17:30",
  223. isRead: 0,
  224. },
  225. {
  226. id: 9,
  227. title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。",
  228. type: 5,
  229. level: "L",
  230. publisherName: "系统管理员",
  231. publishTime: "2024-09-30 17:29",
  232. isRead: 0,
  233. },
  234. {
  235. id: 8,
  236. title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。",
  237. type: 4,
  238. level: "L",
  239. publisherName: "系统管理员",
  240. publishTime: "2024-09-30 17:28",
  241. isRead: 0,
  242. },
  243. {
  244. id: 7,
  245. title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。",
  246. type: 3,
  247. level: "L",
  248. publisherName: "系统管理员",
  249. publishTime: "2024-09-30 17:27",
  250. isRead: 0,
  251. },
  252. {
  253. id: 6,
  254. title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。",
  255. type: 2,
  256. level: "L",
  257. publisherName: "系统管理员",
  258. publishTime: "2024-09-30 17:26",
  259. isRead: 0,
  260. },
  261. ],
  262. total: 10,
  263. },
  264. msg: "一切ok",
  265. },
  266. },
  267. ]);
  268. // 通知映射表数据
  269. const noticeMap: Record<string, any> = {
  270. 1: {
  271. id: 1,
  272. title: "v2.12.0 新增系统日志,访问趋势统计功能。",
  273. publishStatus: 1,
  274. type: 1,
  275. publisherName: "系统管理员",
  276. level: "L",
  277. levelLabel: null,
  278. publishTime: "2024-09-30 17:21",
  279. isRead: null,
  280. targetType: 1,
  281. createTime: "2024-09-28 11:21",
  282. revokeTime: "2024-09-30 17:21",
  283. },
  284. 2: {
  285. id: 2,
  286. title: "v2.13.0 新增菜单搜索。",
  287. publishStatus: 1,
  288. type: 1,
  289. publisherName: "系统管理员",
  290. level: "L",
  291. levelLabel: null,
  292. publishTime: "2024-09-30 17:22",
  293. isRead: null,
  294. targetType: 1,
  295. createTime: "2024-09-28 11:21",
  296. revokeTime: "2024-09-30 17:21",
  297. },
  298. 3: {
  299. id: 3,
  300. title: "\r\nv2.14.0 新增个人中心。",
  301. publishStatus: 1,
  302. type: 1,
  303. publisherName: "系统管理员",
  304. level: "L",
  305. levelLabel: null,
  306. publishTime: "2024-09-30 17:23",
  307. isRead: null,
  308. targetType: 1,
  309. createTime: "2024-09-28 11:21",
  310. revokeTime: "2024-09-30 17:21",
  311. },
  312. 4: {
  313. id: 4,
  314. title: "v2.15.0 登录页面改造。",
  315. publishStatus: 1,
  316. type: 1,
  317. publisherName: "系统管理员",
  318. level: "L",
  319. levelLabel: null,
  320. publishTime: "2024-09-30 17:24",
  321. isRead: null,
  322. targetType: 1,
  323. createTime: "2024-09-28 11:21",
  324. revokeTime: "2024-09-30 17:21",
  325. },
  326. 5: {
  327. id: 5,
  328. title: "v2.16.0 通知公告、字典翻译组件。",
  329. publishStatus: 1,
  330. type: 1,
  331. publisherName: "系统管理员",
  332. level: "L",
  333. levelLabel: null,
  334. publishTime: "2024-09-30 17:25",
  335. isRead: null,
  336. targetType: 1,
  337. createTime: "2024-09-28 11:21",
  338. revokeTime: "2024-09-30 17:21",
  339. },
  340. 6: {
  341. id: 6,
  342. title: "系统将于本周六凌晨 2 点进行维护,预计维护时间为 2 小时。",
  343. publishStatus: 1,
  344. type: 2,
  345. publisherName: "系统管理员",
  346. level: "L",
  347. levelLabel: null,
  348. publishTime: "2024-09-30 17:26",
  349. isRead: null,
  350. targetType: 1,
  351. createTime: "2024-09-28 11:21",
  352. revokeTime: "2024-09-30 17:21",
  353. },
  354. 7: {
  355. id: 7,
  356. title: "最近发现一些钓鱼邮件,请大家提高警惕,不要点击陌生链接。",
  357. publishStatus: 1,
  358. type: 3,
  359. publisherName: "系统管理员",
  360. level: "L",
  361. levelLabel: null,
  362. publishTime: "2024-09-30 17:27",
  363. isRead: null,
  364. targetType: 1,
  365. createTime: "2024-09-28 11:21",
  366. revokeTime: "2024-09-30 17:21",
  367. },
  368. 8: {
  369. id: 8,
  370. title: "国庆假期从 10 月 1 日至 10 月 7 日放假,共 7 天。",
  371. publishStatus: 1,
  372. type: 4,
  373. publisherName: "系统管理员",
  374. level: "L",
  375. levelLabel: null,
  376. publishTime: "2024-09-30 17:28",
  377. isRead: null,
  378. targetType: 1,
  379. createTime: "2024-09-28 11:21",
  380. revokeTime: "2024-09-30 17:21",
  381. },
  382. 9: {
  383. id: 9,
  384. title: "公司将在 10 月 15 日举办新产品发布会,敬请期待。",
  385. publishStatus: 1,
  386. type: 5,
  387. publisherName: "系统管理员",
  388. level: "L",
  389. levelLabel: null,
  390. publishTime: "2024-09-30 17:29",
  391. isRead: null,
  392. targetType: 1,
  393. createTime: "2024-09-28 11:21",
  394. revokeTime: "2024-09-30 17:21",
  395. },
  396. 10: {
  397. id: 10,
  398. title:
  399. "v2.16.1 版本修复了 WebSocket 重复连接导致的后台线程阻塞问题,优化了通知公告。",
  400. publishStatus: 1,
  401. type: 1,
  402. publisherName: "系统管理员",
  403. level: "L",
  404. levelLabel: null,
  405. publishTime: "2024-09-30 17:30",
  406. isRead: null,
  407. targetType: 1,
  408. createTime: "2024-09-28 11:21",
  409. revokeTime: "2024-09-30 17:21",
  410. },
  411. };