微信小程序获取formId

2018-01-02  本文已影响0人  LIsPeri

wxml:
<form bindsubmit='openGroupSubmit' report-submit='true'>
<view class="btn-area">
<button formType="submit">Submit</button>
</view>
</form>

js:
openGroupSubmit: function (e) {
let formId = e.detail.formId;
if ('the formId is a mock one' == formId) {
return;
}
// this.dealFormIds(formId);
var nowDate = new Date();
var month = nowDate.getMonth() + 1;
var date = nowDate.getDate();
if (month < 10) {
month = '0' + month;
}
if (date < 10) {
date = '0' + date;
}
let formIds = app.globalData.formIds;
if (!formIds) formIds = [];
let data = {
formId: nowDate.getFullYear() + '-' + month + '-' + date + '_' + formId,
expire: parseInt(new Date().getTime() / 1000) + 604800
}
formIds.push(data);
app.globalData.formIds = formIds;
console.log(formIds);
let type = e.detail.target.dataset.type;
},

上一篇下一篇

猜你喜欢

热点阅读