JS端很简单,就一个按钮点击上传图片
$(function () {
init(0, 0, 0, 0, 0, 1);
var userInfoData = window.eval(localStorage.getItem("userInfo"));
$("#newImg").prop("src", userInfoData[0].user_img_tid);
$("#upload").on("tap", function () {
var ua = navigator.userAgent.toLowerCase();
if (/android/i.test(ua)) {
//Android
JavaScriptInterface.modifyPhoto();
}
else if (/ipad|iphone|mac/i.test(ua)) {
//IOS
var url = "testapp:" + "alert";
document.location = url;
}
});
});
function setNewImg(data) {
$("#newImg").prop("src", data);
var userInfoData = window.eval(localStorage.getItem("userInfo"));
//客户端上传头像之后记得更新JS端头像
updateUser(userInfoData, data);
}