|
@@ -222,3 +222,29 @@ export function validateNickName (name) {
|
|
|
return res.data
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+export function uploadFile(fileData) {
|
|
|
+ console.log(fileData)
|
|
|
+ const file = new window.File(
|
|
|
+ [fileData],
|
|
|
+ 'temp-img',
|
|
|
+ { type: 'image/jpeg', }
|
|
|
+ )
|
|
|
+ console.log('file', file)
|
|
|
+
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append("type", 'img')
|
|
|
+ formData.append("file", file)
|
|
|
+
|
|
|
+ return axios({
|
|
|
+ method: 'post',
|
|
|
+ url: `${process.env.VUE_APP_DEPLOY_ORIGIN}/api/cms/game/upload`,
|
|
|
+ headers: {
|
|
|
+ token: store.state.token,
|
|
|
+ 'Content-Type': 'multipart/form-data',
|
|
|
+ },
|
|
|
+ data: formData
|
|
|
+ }).then((res) => {
|
|
|
+ return res.data
|
|
|
+ })
|
|
|
+}
|