加了上传图片安全检测了,怎么还说违规,屏蔽了页面?
313 浏览2022年09月23日作者:chunxia

我上传图片的地方加了安全检测,为什么说是违规了,麻烦大佬看一下,急等回复谢谢,我现在这个页面,说是违规已经被屏蔽了


我真机调试输出的:


前端代码:

chooseImage: function() {

var _this = this;

var ss = ["camera","album"];

uni.chooseImage({

count: 1,

sourceType: ss,

sizeType:['compressed'],

success: (res) => {

// _this.setData({

// imageSrc: res.tempFilePaths[0],

// });

// _this.loadImage();

// _this.isShow = true;

// console.log('chooseImage', res)

uni.showLoading({

title: '图片检测中...'

})

//上传图片

uni.compressImage({

src: res.tempFilePaths[0],

quality: 80,

success: ress => {

console.log('ress.tempFilePath',ress.tempFilePath)

uni.uploadFile({

// url: app.domain + '/index.php?g=Wap&m=Mwxaapi&a=check_wxa_pic&token=' + app.token + '&appid=' + app.appid+'&session_3rd='+app.session_3rd+'&test=1', //接口地址

url: app.ewmdomain + '/index.php?g=Wap&m=Mwxaapi&a=face_pic_newbak&token=' + app

.token + '&appid=' + app.appid + '&session_3rd=' + app.session_3rd +

'&testa=1', //仅为示例,非真实的接口地址

// filePath: res.tempFilePath,

filePath: ress.tempFilePath,

name: 'file',

formData: {},

success: (fileres) => {

uni.hideLoading();

console.log('检测接口返回的内容', fileres)

var datastr = fileres.data;

var data = JSON.parse(datastr);

// console.log('上传成功返回图片地址',data.img_path)

console.log('上传返回值', fileres)

console.log('上传返回值2', data)

if (data.status == 1001) {//验证通过

_this.setData({

imageSrc: res.tempFilePaths[0],

});

_this.loadImage();

_this.isShow = true;

console.log('chooseImage', res)

//检测图片成功

} else {

uni.hideLoading();

uni.showToast({

title: '抱歉,您的图片可能涉及违法违规内容',

icon: "none"

})

}

}

})

}

})

},

fail: (res) => {

console.log('手动打开相册权限=====', res)

//getSetting 获取用户的当前设置, 判断是否已授权,

uni.getSetting({

success: (res) => {

//用户授权结果,其中 key 为 scope 值,value 为 Boolean 值,表示用户是否允许授权

let authStatus = res.authSetting['scope.album','scope.camera'];

if (!authStatus) {

uni.showModal({

title: '授权失败',

content: '系统需要从您的相册和相机的权限,请在设置界面打开相关权限',

success: (res) => {

//确认按钮框

if (res.confirm) {

//调起客户端小程序设置界面,返回用户设置的操作结果。

uni.openSetting()

}

}

})

}

},

fail: (res) => {

console.log('相册授权zouzhelil====',res);

}

})

}

// fail: function(res) {

// console.log('图片失败:',res)

// // 分享失败

// }

})

},


最后一次编辑于 2022 年 09 月 23 日
1 条评论

相关文章

专题推荐

热门文章

热门问答