notice.mock.ts 11 KB

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