|
|
@ -61,7 +61,7 @@ const add = async function () { |
|
|
|
rechargeGold: 1, |
|
|
|
paidGold: "", |
|
|
|
}; |
|
|
|
user.value = {}; |
|
|
|
user.value = {}; |
|
|
|
// addRecharge.value.adminId = adminData.value.adminId; |
|
|
|
// addRecharge.value.area = adminData.value.area; |
|
|
|
// addRecharge.value.rechargeVoucher = ""; |
|
|
@ -194,15 +194,61 @@ const getCurrency = async function () { |
|
|
|
}; |
|
|
|
getCurrency(); |
|
|
|
|
|
|
|
// 这是添加上传图片的接口 |
|
|
|
const imageUrl = ref(""); |
|
|
|
// // 这是添加上传图片的接口 |
|
|
|
// const imageUrl = ref(""); |
|
|
|
|
|
|
|
// 上传图片成功的回调函数 |
|
|
|
// // 上传图片成功的回调函数 |
|
|
|
// const handleAvatarSuccess = (response, uploadFile) => { |
|
|
|
// // imageUrl.value = URL.createObjectURL(uploadFile.raw); |
|
|
|
// // console.log("图片上传成功", response, uploadFile); |
|
|
|
// // addRecharge.value.rechargeVoucher = `http://192.168.8.93:10010/upload/${response.data}`; |
|
|
|
// // console.log("图片名称", addRecharge.value.rechargeVoucher); |
|
|
|
// // 将图片转换为 Base64 编码 |
|
|
|
// const reader = new FileReader(); |
|
|
|
// reader.onloadend = () => { |
|
|
|
// const base64data = reader.result; |
|
|
|
// const data = { |
|
|
|
// rechargeVoucher: base64data, |
|
|
|
// }; |
|
|
|
// // 发送 JSON 对象到服务器 |
|
|
|
// axios |
|
|
|
// .post("http://192.168.8.93:10010/upload", data) |
|
|
|
// .then((res) => { |
|
|
|
// console.log("图片上传成功", res); |
|
|
|
// addRecharge.value.rechargeVoucher = `http://192.168.8.93:10010/upload/${response.data}`; |
|
|
|
// console.log("图片名称", addRecharge.value.rechargeVoucher); |
|
|
|
// }) |
|
|
|
// .catch((error) => { |
|
|
|
// console.error("图片上传失败", error); |
|
|
|
// }); |
|
|
|
// }; |
|
|
|
// reader.readAsDataURL(uploadFile.raw); |
|
|
|
// imageUrl.value = URL.createObjectURL(uploadFile.raw); |
|
|
|
// console.log("图片上传成功", response, uploadFile); |
|
|
|
// }; |
|
|
|
const handleAvatarSuccess = (response, uploadFile) => { |
|
|
|
// 将图片转换为 Base64 编码 |
|
|
|
const reader = new FileReader(); |
|
|
|
reader.onloadend = () => { |
|
|
|
const base64data = reader.result; |
|
|
|
const data = { |
|
|
|
rechargeVoucher: base64data, |
|
|
|
}; |
|
|
|
console.log("图片名称", data); |
|
|
|
// 发送 JSON 对象到服务器 |
|
|
|
API.post("http://192.168.8.93:10010/upload", {}) |
|
|
|
.then((res) => { |
|
|
|
console.log("图片上传成功", res); |
|
|
|
addRecharge.value.rechargeVoucher = `http://192.168.8.93:10010/upload/${response.data}`; |
|
|
|
console.log("图片名称", addRecharge.value.rechargeVoucher); |
|
|
|
}) |
|
|
|
.catch((error) => { |
|
|
|
console.error("图片上传失败", error); |
|
|
|
}); |
|
|
|
}; |
|
|
|
reader.readAsDataURL(uploadFile.raw); |
|
|
|
imageUrl.value = URL.createObjectURL(uploadFile.raw); |
|
|
|
console.log("图片上传成功", response, uploadFile); |
|
|
|
addRecharge.value.rechargeVoucher = `http://192.168.8.93:10010/upload/${response.data}`; |
|
|
|
console.log("图片名称", addRecharge.value.rechargeVoucher); |
|
|
|
}; |
|
|
|
// 上传图片之前的校验函数 |
|
|
|
const beforeAvatarUpload = (rawFile) => { |
|
|
|