api.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. import { axios } from "@/configue/http";
  2. // 获取内容列表
  3. export function getList(type, data, cb) {
  4. let params = {
  5. ...data,
  6. startTime: data.date ? data.date[0] + " 00:00:00" : "",
  7. endTime: data.date ? data.date[1] + " 23:59:59" : "",
  8. };
  9. axios({
  10. method: "post",
  11. data: params,
  12. url: `cms/${type}/list`,
  13. }).then((res) => {
  14. cb(res);
  15. });
  16. }
  17. // 获取系统设置列表
  18. export function getSysList(type, data, cb) {
  19. let tmp = {}
  20. if (data.date) {
  21. tmp = {
  22. startTime: data.date ? data.date[0] + " 00:00:00" : "",
  23. endTime: data.date ? data.date[1] + " 23:59:59" : "",
  24. }
  25. }
  26. let params = {
  27. ...data,
  28. ...tmp
  29. };
  30. axios({
  31. method: "post",
  32. data: params,
  33. url: `sys/${type}/list`,
  34. }).then((res) => {
  35. cb(res);
  36. });
  37. }
  38. // 获取用户设置的权限列表
  39. export function getRoleList(cb) {
  40. axios({
  41. method: "get",
  42. url: `sys/user/getRole`,
  43. }).then((res) => {
  44. cb(res);
  45. });
  46. }
  47. // 保存
  48. export function saveSys(type, data, cb) {
  49. let params = {
  50. ...data,
  51. };
  52. axios({
  53. method: "post",
  54. data: params,
  55. url: `sys/${type}/save`,
  56. }).then((res) => {
  57. cb(res);
  58. });
  59. }
  60. // 保存
  61. export function save(type, data, cb) {
  62. let params = {
  63. ...data,
  64. };
  65. axios({
  66. method: "post",
  67. data: params,
  68. url: `cms/${type}/save`,
  69. }).then((res) => {
  70. cb(res);
  71. });
  72. }
  73. //删除
  74. export function del(type, data, cb) {
  75. axios({
  76. method: "get",
  77. url: `cms/${type}/remove/${data.id}`,
  78. }).then((res) => {
  79. cb(res);
  80. });
  81. }
  82. //获取cms详情
  83. export function getDetail(type, data, cb) {
  84. axios({
  85. method: "get",
  86. url: `cms/${type}/detail/${data.id}`,
  87. }).then((res) => {
  88. cb(res);
  89. });
  90. }
  91. //获取sys详情
  92. export function getSysDetail(type, data, cb) {
  93. axios({
  94. method: "get",
  95. url: `sys/${type}/detail/${data.id}`,
  96. }).then((res) => {
  97. cb(res);
  98. });
  99. }
  100. //设置图片封面
  101. export function setCover(data, cb) {
  102. axios({
  103. method: "get",
  104. url: `cms/goods/setIndex/${data.fileId}`,
  105. }).then((res) => {
  106. cb(res);
  107. });
  108. }
  109. //删除图库图片
  110. export function delImg(data, cb) {
  111. axios({
  112. method: "get",
  113. url: `cms/goods/remove/file/${data.fileId}`,
  114. }).then((res) => {
  115. cb(res);
  116. });
  117. }
  118. //更新图库图片
  119. export function refreshImg(data, cb) {
  120. axios({
  121. method: "get",
  122. url: `cms/goods/afresh/uploadImg/${data.fileId}/${data.code}`,
  123. }).then((res) => {
  124. cb(res);
  125. });
  126. }
  127. //提审
  128. export function apply(type,data, cb) {
  129. axios({
  130. method: "get",
  131. url: `cms/${type}/apply/${data.id}`,
  132. }).then((res) => {
  133. cb(res);
  134. });
  135. }
  136. // 审核
  137. export function audit(type, data, cb) {
  138. let params = {
  139. ...data
  140. };
  141. axios({
  142. method: "post",
  143. data: params,
  144. url: `cms/${type}/audit`,
  145. }).then((res) => {
  146. cb(res);
  147. });
  148. }
  149. //审核详情
  150. export function applyDetail(type,data, cb) {
  151. axios({
  152. method: "get",
  153. url: `cms/${type}/auditDetail/${data.id}`,
  154. }).then((res) => {
  155. cb(res);
  156. });
  157. }
  158. // 是否显示
  159. export function handleDisplay(type, data, cb) {
  160. axios({
  161. method: "get",
  162. url: `cms/${type}/display/${data.id}/${data.display}`,
  163. }).then((res) => {
  164. cb(res);
  165. });
  166. }
  167. // 是否启用
  168. export function handleDisable(type, data, cb) {
  169. axios({
  170. method: "get",
  171. url: `sys/${type}/editStatus/${data.id}/${data.isEnabled}`,
  172. }).then((res) => {
  173. cb(res);
  174. });
  175. }
  176. // 新建修改问题
  177. export function saveQuestion(data, cb) {
  178. axios({
  179. method: "post",
  180. data: {
  181. answer:data
  182. },
  183. url: `cms/questionGroup/questionAnswer/save`,
  184. }).then((res) => {
  185. cb(res);
  186. });
  187. }
  188. // 修改问题
  189. export function updateQuestion( data, cb) {
  190. let params = {
  191. ...data
  192. };
  193. axios({
  194. method: "post",
  195. data: params,
  196. url: `cms/questionGroup/questionAnswer/update`,
  197. }).then((res) => {
  198. cb(res);
  199. });
  200. }
  201. //删除问题
  202. export function delQuestion(data, cb) {
  203. axios({
  204. method: "get",
  205. url: `cms/questionGroup/remove/${data.id}`,
  206. }).then((res) => {
  207. cb(res);
  208. });
  209. }
  210. //删除场景
  211. export function delscene(data, cb) {
  212. axios({
  213. method: "get",
  214. url: `cms/scene/removes/${data.id}`,
  215. }).then((res) => {
  216. cb(res);
  217. });
  218. }
  219. //删除(sys)
  220. export function delSys(type, data, cb) {
  221. axios({
  222. method: "get",
  223. url: `sys/${type}/removes/${data.id}`,
  224. }).then((res) => {
  225. cb(res);
  226. });
  227. }
  228. //删除(sys)
  229. export function delSysSingle(type, data, cb) {
  230. axios({
  231. method: "get",
  232. url: `sys/${type}/remove/${data.id}`,
  233. }).then((res) => {
  234. cb(res);
  235. });
  236. }
  237. //修改密码
  238. export function updatePwd(data, cb) {
  239. axios({
  240. method: "post",
  241. data,
  242. url: `sys/user/updatePwd`,
  243. }).then((res) => {
  244. cb(res);
  245. });
  246. }
  247. //重置密码
  248. export function resetPass(data, cb) {
  249. axios({
  250. method: "get",
  251. url: `sys/user/resetPass/${data.id}`,
  252. }).then((res) => {
  253. cb(res);
  254. });
  255. }