import request from '@/api/request' import { get_base_url } from '@/api/request.js' const app_url = '/traapp' /** * 查询吉祥物列表 * 出参: mascotId 吉祥物ID String mascotName 吉祥物名称 String mascotNameEn 吉祥物英文名称 String mascotDesc 吉祥物简介 String mascotNo 吉祥物编号 String imgAddr 吉祥物图片 String imgThumbAddr 吉祥物缩略图 String showOrder 显示顺序 int */ export const queryValidTraMascotInfo = (data) => { return request({ url: app_url + '/traMascotInfo/queryValidTraMascotInfo', method: 'post', toastErrors: true, data }); }; /** * 设置吉祥物 * 入参: mascotId 必输项:true 类型:String */ export const setTraMascotInfo = (data) => { return request({ url: app_url + '/traMascotInfo/setTraMascotInfo', method: 'post', toastErrors: true, data }); }; // 查询当前已经选择的吉祥物 /** * 查询当前已经选择的吉祥物 * 出参: mascotId 吉祥物ID String mascotName 吉祥物名称 String mascotNameEn 吉祥物英文名称 String mascotDesc 吉祥物简介 String mascotNo 吉祥物编号 String imgAddr 吉祥物图片 String imgThumbAddr 吉祥物缩略图 String showOrder 显示顺序 int */ export const queryCurrentValidMascotInfo = (data) => { return request({ url: app_url + '/traMascotInfo/queryCurrentValidMascotInfo', method: 'post', toastErrors: true, data }).then(({ body }) => { if (body.imgAddr) { // setTimeout(() => { // const base_url = get_base_url() // const url = base_url + body.imgAddr // const img = new Image(); // 创建Image对象 // img.onload = () => { // console.log(`图片缓存成功: ${url}`); // }; // // 图片加载失败 // img.onerror = () => { // console.error(`图片缓存失败: ${url}`); // }; // img.src = url; // 开始加载图片(设置src触发请求,浏览器会自动缓存) // }) } return body }) };