api.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. import { axios } from "./http";
  2. // 获取列表
  3. export function getList(type,data, cb) {
  4. let params = {
  5. ...data
  6. };
  7. axios({
  8. method: "post",
  9. data: params,
  10. url: `api/web/${type}/list`,
  11. }).then((res) => {
  12. cb(res);
  13. });
  14. }
  15. // 获取详情
  16. export function getDetail(type,data, cb) {
  17. let params = {
  18. ...data
  19. };
  20. axios({
  21. method: "post",
  22. data: params,
  23. url: `api/web/${type}/list`,
  24. }).then((res) => {
  25. cb(res);
  26. });
  27. }
  28. // 访问量
  29. export function getVisit(cb) {
  30. axios({
  31. method: "get",
  32. url: `api/web/webVisit`,
  33. }).then((res) => {
  34. cb(res);
  35. });
  36. }
  37. // 登录
  38. export function login(data, cb) {
  39. let params = {
  40. ...data
  41. };
  42. axios({
  43. method: "post",
  44. data: params,
  45. url: `admin/login`,
  46. }).then((res) => {
  47. cb(res);
  48. });
  49. }
  50. // 登出
  51. export function logout(cb) {
  52. axios({
  53. method: "get",
  54. url: `admin/logout`,
  55. }).then((res) => {
  56. cb(res);
  57. });
  58. }
  59. // 用户详情
  60. export function getUserInfo(data,cb) {
  61. axios({
  62. method: "get",
  63. url: `cms/web/manage/user/detail/${data.id}`,
  64. }).then((res) => {
  65. cb(res);
  66. });
  67. }
  68. //获取留言树
  69. export function getMsg(data, cb) {
  70. let params = {
  71. ...data
  72. };
  73. axios({
  74. method: "post",
  75. data: params,
  76. url: `api/web/comment/listTree`,
  77. }).then((res) => {
  78. cb(res);
  79. });
  80. }
  81. //提交留言接口
  82. export function saveMsg(type,data, cb) {
  83. let params = {
  84. ...data
  85. };
  86. axios({
  87. method: "post",
  88. data: params,
  89. url: `cms/web/manage/${type}/save`,
  90. }).then((res) => {
  91. cb(res);
  92. });
  93. }
  94. //提交弹幕接口
  95. export function saveBarrage(data, cb) {
  96. let params = {
  97. ...data
  98. };
  99. axios({
  100. method: "post",
  101. data: params,
  102. url: `cms/web/manage/barrageSave`,
  103. }).then((res) => {
  104. cb(res);
  105. });
  106. }
  107. //获取详情
  108. export function getDetailById(type,data, cb) {
  109. axios({
  110. method: "get",
  111. url: `api/web/${type}/detail/${data.id}`,
  112. }).then((res) => {
  113. cb(res);
  114. });
  115. }
  116. //拜祭
  117. export function mournVisit(data, cb=()=>{}) {
  118. axios({
  119. method: "get",
  120. url: `api/web/martyr/visit/${data.id}`,
  121. }).then((res) => {
  122. cb(res);
  123. });
  124. }
  125. //获取悼念列表
  126. export function getMournList(data, cb) {
  127. axios({
  128. method: "get",
  129. url: `api/web/mourn/comment/${data.id}`,
  130. }).then((res) => {
  131. cb(res);
  132. });
  133. }
  134. //获取题组列表
  135. export function getQuestionGroupList(data, cb) {
  136. let params = {
  137. ...data
  138. };
  139. axios({
  140. method: "post",
  141. data:params,
  142. url: `cms/web/manage/questionGroup/list`,
  143. }).then((res) => {
  144. cb(res);
  145. });
  146. }
  147. //获取题目详情
  148. export function getQuestionGroupDetail(data, cb) {
  149. axios({
  150. method: "get",
  151. url: `cms/web/manage/questionGroup/detail/${data.id}`,
  152. }).then((res) => {
  153. cb(res);
  154. });
  155. }
  156. //提交留言接口
  157. export function submitAnswers(data, cb) {
  158. let params = {
  159. ...data
  160. };
  161. axios({
  162. method: "post",
  163. data: params,
  164. url: `cms/web/manage/questionUser/submit`,
  165. }).then((res) => {
  166. cb(res);
  167. });
  168. }
  169. //获取排名列表
  170. export function getRanking(data, cb) {
  171. axios({
  172. method: "get",
  173. url: `cms/web/manage/questionUser/ranking/${data.id}`,
  174. }).then((res) => {
  175. cb(res);
  176. });
  177. }
  178. //检测是否登录
  179. export function checkLogin(cb) {
  180. axios({
  181. method: "get",
  182. url: `admin/checkLogin`,
  183. }).then((res) => {
  184. cb(res);
  185. });
  186. }
  187. //检测是否可修改密码
  188. export function checkCanEditPsd(data,cb) {
  189. axios({
  190. method: "post",
  191. data,
  192. url: `api/web/retrieve/password`,
  193. }).then((res) => {
  194. cb(res);
  195. });
  196. }
  197. //找回密码
  198. export function updatePwd(data,cb) {
  199. axios({
  200. method: "post",
  201. data,
  202. url: `api/web/updatePwd`,
  203. }).then((res) => {
  204. cb(res);
  205. });
  206. }
  207. //修改密码
  208. export function updateSysPwd(data,cb) {
  209. axios({
  210. method: "post",
  211. data,
  212. url: `sys/user/updatePwd`,
  213. }).then((res) => {
  214. cb(res);
  215. });
  216. }
  217. //获取点赞
  218. export function getStar(cb) {
  219. axios({
  220. method: "get",
  221. url: `api/web/scene/getStar`,
  222. }).then((res) => {
  223. cb(res);
  224. });
  225. }
  226. //点赞
  227. export function dianzan(cb) {
  228. axios({
  229. method: "get",
  230. url: `api/web/scene/star`,
  231. }).then((res) => {
  232. cb(res);
  233. });
  234. }
  235. //获取知识详情
  236. export function getNewsDetail(data, cb=()=>{}) {
  237. axios({
  238. method: "get",
  239. url: `api/web/news/detail/${data.id}`,
  240. }).then((res) => {
  241. cb(res);
  242. });
  243. }
  244. // 获取精品典藏tab列表和学习园地
  245. export const getTabList = (type) => {
  246. return axios({
  247. method: 'post',
  248. url: `api/web/goods/module/list/${type}`,
  249. })
  250. }
  251. // 保存网站访问量 数字史馆 精品典藏 ……
  252. export const setVisit = (type) => {
  253. return axios({
  254. method: 'get',
  255. url: `api/web/visit/${type}`,
  256. })
  257. }
  258. // 精品典藏的
  259. // 点赞
  260. export const goodsLikeApi = (data) => {
  261. return axios({
  262. method: 'post',
  263. url: 'cms/web/manage/goods/like',
  264. data
  265. })
  266. }
  267. // 取消点赞
  268. export const goodsLikeDelApi = (goodsId) => {
  269. return axios({
  270. method: 'get',
  271. url: `cms/web/manage/goods/like/del/${goodsId}`,
  272. })
  273. }
  274. // 投票
  275. export const goodsVoteApi = (data) => {
  276. return axios({
  277. method: 'post',
  278. url: 'cms/web/manage/goods/vote',
  279. data
  280. })
  281. }
  282. // 取消投票
  283. export const goodsVoteDelApi = (goodsId) => {
  284. return axios({
  285. method: 'get',
  286. url: `cms/web/manage/goods/vote/del/${goodsId}`,
  287. })
  288. }
  289. // 检查留言---------
  290. export const webMesCheck = () => {
  291. return axios({
  292. method: 'get',
  293. url: '/cms/web/manage/check/message',
  294. })
  295. }