import { axios } from "@/configue/http"; // 获取内容列表 export function getList(type, data, cb) { let params = { ...data, startTime: data.date ? data.date[0] + " 00:00:00" : "", endTime: data.date ? data.date[1] + " 23:59:59" : "", }; axios({ method: "post", data: params, url: `cms/${type}/list`, }).then((res) => { cb(res); }); } // 获取系统设置列表 export function getSysList(type, data, cb) { let tmp = {} if (data.date) { tmp = { startTime: data.date ? data.date[0] + " 00:00:00" : "", endTime: data.date ? data.date[1] + " 23:59:59" : "", } } let params = { ...data, ...tmp }; axios({ method: "post", data: params, url: `sys/${type}/list`, }).then((res) => { cb(res); }); } // 获取用户设置的权限列表 export function getRoleList(cb) { axios({ method: "get", url: `sys/user/getRole`, }).then((res) => { cb(res); }); } // 保存 export function saveSys(type, data, cb) { let params = { ...data, }; axios({ method: "post", data: params, url: `sys/${type}/save`, }).then((res) => { cb(res); }); } // 保存 export function save(type, data, cb) { let params = { ...data, }; axios({ method: "post", data: params, url: `cms/${type}/save`, }).then((res) => { cb(res); }); } //删除 export function del(type, data, cb) { axios({ method: "get", url: `cms/${type}/remove/${data.id}`, }).then((res) => { cb(res); }); } //获取cms详情 export function getDetail(type, data, cb) { axios({ method: "get", url: `cms/${type}/detail/${data.id}`, }).then((res) => { cb(res); }); } //获取sys详情 export function getSysDetail(type, data, cb) { axios({ method: "get", url: `sys/${type}/detail/${data.id}`, }).then((res) => { cb(res); }); } //设置图片封面 export function setCover(data, cb) { axios({ method: "get", url: `cms/goods/setIndex/${data.fileId}`, }).then((res) => { cb(res); }); } //删除图库图片 export function delImg(data, cb) { axios({ method: "get", url: `cms/goods/remove/file/${data.fileId}`, }).then((res) => { cb(res); }); } //更新图库图片 export function refreshImg(data, cb) { axios({ method: "get", url: `cms/goods/afresh/uploadImg/${data.fileId}/${data.code}`, }).then((res) => { cb(res); }); } //提审 export function apply(type,data, cb) { axios({ method: "get", url: `cms/${type}/apply/${data.id}`, }).then((res) => { cb(res); }); } // 审核 export function audit(type, data, cb) { let params = { ...data }; axios({ method: "post", data: params, url: `cms/${type}/audit`, }).then((res) => { cb(res); }); } //审核详情 export function applyDetail(type,data, cb) { axios({ method: "get", url: `cms/${type}/auditDetail/${data.id}`, }).then((res) => { cb(res); }); } // 是否显示 export function handleDisplay(type, data, cb) { axios({ method: "get", url: `cms/${type}/display/${data.id}/${data.display}`, }).then((res) => { cb(res); }); } // 是否启用 export function handleDisable(type, data, cb) { axios({ method: "get", url: `sys/${type}/editStatus/${data.id}/${data.isEnabled}`, }).then((res) => { cb(res); }); } // 新建修改问题 export function saveQuestion(data, cb) { axios({ method: "post", data: { answer:data }, url: `cms/questionGroup/questionAnswer/save`, }).then((res) => { cb(res); }); } // 修改问题 export function updateQuestion( data, cb) { let params = { ...data }; axios({ method: "post", data: params, url: `cms/questionGroup/questionAnswer/update`, }).then((res) => { cb(res); }); } //删除问题 export function delQuestion(data, cb) { axios({ method: "get", url: `cms/questionGroup/remove/${data.id}`, }).then((res) => { cb(res); }); } //删除场景 export function delscene(data, cb) { axios({ method: "get", url: `cms/scene/removes/${data.id}`, }).then((res) => { cb(res); }); } //删除(sys) export function delSys(type, data, cb) { axios({ method: "get", url: `sys/${type}/removes/${data.id}`, }).then((res) => { cb(res); }); } //删除(sys) export function delSysSingle(type, data, cb) { axios({ method: "get", url: `sys/${type}/remove/${data.id}`, }).then((res) => { cb(res); }); } //修改密码 export function updatePwd(data, cb) { axios({ method: "post", data, url: `sys/user/updatePwd`, }).then((res) => { cb(res); }); } //重置密码 export function resetPass(data, cb) { axios({ method: "get", url: `sys/user/resetPass/${data.id}`, }).then((res) => { cb(res); }); }