diff --git a/index.html b/index.html index 4d3145f..c0890f5 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@ type: 'tpl', inline: false, className: 'w-full', - tpl: '
' + tpl: '
${ls:openId}
' }, // footer: '
底部区域
', // asideBefore: '
菜单前面区域
', diff --git a/responseHanler.md b/responseHanler.md new file mode 100644 index 0000000..ec02887 --- /dev/null +++ b/responseHanler.md @@ -0,0 +1,21 @@ +```js + + +// 调用接口前判断是否已登录 +var openId = localStorage.getItem("openId"); +if (openId != null && openId != 'null' && openId != '' && openId !== undefined) { + alert("已登录,你的ID是:" + openId); + window.location.href = 'index.html'; + return api; +} + + +// 轮询登录校验返回 +if (payload.data != 'NO_LOGIN' && payload.status == '0') { + localStorage.setItem("openId", payload.data.openId); + alert("扫码已登录成功,你的ID是:" + payload.data.openId); + window.location.href = 'index.html'; +} +return payload; + +``` \ No newline at end of file