Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
swx_weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-10-28 18:08:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0355a1c86dc6547fafcb8258db93dcda7840679d
0355a1c8
1 parent
32077bd8
检测图片格式
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
28 deletions
src/pages/activityDetail/index.vue
src/pages/apxUserInfo/index.vue
src/pages/activityDetail/index.vue
View file @
0355a1c
<!--
* @Date: 2022-09-26 14:36:57
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-28 1
7:56:57
* @LastEditTime: 2022-10-28 1
8:02:43
* @FilePath: /swx/src/pages/activityDetail/index.vue
* @Description: 活动详情页
-->
...
...
@@ -206,6 +206,7 @@ const start = async () => {
const qrcode = await qrCodeActivityAPI({ i: getCurrentPageParam().id });
if (qrcode.code) {
qrcode_url = qrcode.data.qrcode_url;
// 图片格式不对可能导致渲染失败
base = {
width: 1024,
height: 1334,
...
...
src/pages/apxUserInfo/index.vue
View file @
0355a1c
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-28 1
6:30:35
* @LastEditTime: 2022-10-28 1
8:07:32
* @FilePath: /swx/src/pages/apxUserInfo/index.vue
* @Description: 补充资料
-->
...
...
@@ -54,32 +54,42 @@ const afterRead = (event) => {
mask: true
});
const { file } = event.detail;
// 获取上传URL
wx.uploadFile({
url: BASE_URL + '/admin/?m=srv&a=upload',
filePath: file.url,
name: 'file',
header: {
'content-type': 'multipart/form-data',
},
success: function (res) {
let upload_data = JSON.parse(res.data);
wx.hideLoading({
success: () => {
if (res.statusCode === 200) {
has_image.value = true;
uploader_image.value = upload_data.data.src;
} else {
wx.showToast({
icon: 'error',
title: '服务器错误,稍后重试!',
mask: true
})
}
},
});
}
});
const fileName = file.url;
const ext = fileName.substring(fileName.lastIndexOf('.') + 1);
if(ext == "gif" || ext == "GIF" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "JPG" || ext == "png" || ext == "PNG"){
// 获取上传URL
wx.uploadFile({
url: BASE_URL + '/admin/?m=srv&a=upload',
filePath: file.url,
name: 'file',
header: {
'content-type': 'multipart/form-data',
},
success: function (res) {
let upload_data = JSON.parse(res.data);
wx.hideLoading({
success: () => {
if (res.statusCode === 200) {
has_image.value = true;
uploader_image.value = upload_data.data.src;
} else {
wx.showToast({
icon: 'error',
title: '服务器错误,稍后重试!',
mask: true
})
}
},
});
}
});
} else {
wx.showToast({
icon: 'error',
title: '请检查图片格式!',
mask: true
})
}
}
const removeUploadImage = () => {
has_image.value = false;
...
...
Please
register
or
login
to post a comment