var f = document.getElementById("file").files[0];
var reads = new FileReader();
reads.readAsDataURL(f);
reads.onload = function(e) {
that.form3[indexs].ef_head = this.result;
var params = new FormData();
params.append("file", that.dataURLtoBlob(that.form3[indexs].ef_head));
that
.$ajax({
method: "post",
url: that.actionUrl,
data: params,
async: true,
cache: false,
contentType: false,
processData: false,
dataType: "json"
})
.then(function(response) {
if (response.data.code == 200) {
// debugger
that.form3[indexs].ef_head = response.data.url;
that.$store.commit("setFamilyData", that.form3);
} else if (response.data.code == "401") {
that.$message({
message: response.data.message,
type: "warning"
});
// that.$router.push("/login");
} else {
that.$message.error({
message: response.data.message
});
}
that.loading = false;
})
.catch(function(error) {
that.$message.error(error);
that.loading = false;
});
that.$forceUpdate();