函数入口 (postmassage)
this.$nextTick(() => {
let _this = this;
window.onmessage = async function(event) {
//iframe调用填报页,接收消息
// console.info(event.data);
let iframe_url = window.location.search;
let theRequest = new Object();
if (iframe_url.indexOf("?") != -1) {
//获取路径中的mode
let str = iframe_url.substr(1);
let strs = str.split("&");
for (let i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
Vue.set(_this.codes, "iframe_code", event.data.code);
异步函数
async checkModifyAuthrizationToken(token) {
let result;
await this.axios.post("/formDetail/checkModifyAuthrizationToken", {
token: token,
assignee:this.$route.query.assignee,
}).then(res => {
let data = res.data;
//校验通过
if (data.result_code == "sys-200") {
this.isAdminModify = true;
this.handleTools();
this.showTools = true;
result = true;
}else{
//this.isAdminModify = false;
this.disabledForm(res.data.error_message);
if(this.isSteps){
this.showTools = true;
}
result = false;
}
});
return result
},
函数调用
let result = await _this.checkModifyAuthrizationToken(_this.$route.query.adminKey);
if(!result){
FormFillInUtils.handlePostMessage({
code: 211, //状态码 已提交
msg: "表单修改令牌已过期或已失效", //状态消息
data: {
form_id: _this.formDetail.form_id,
form_detail_id: _this.$route.query.detailId,
affair_rela_id: _this.$route.query.id
}
})
return
}