有两个页面,一个是my,一个是detail
通过调试日志时间戳看:
dd.config 到完成 dd.requestAuthCode完成耗时都将近1秒和超过1秒。尤其是:requestAuthCode 耗时较长。
请教,应用在多页实现过程中,这种问题怎么处理?
Util.log("Before dd config", location.href.substring(location.href.lastIndexOf('/')+1));
dd.config({
agentId: _config.agentId,
corpId: _config.corpId,
timeStamp: _config.timeStamp,
nonceStr: _config.nonceStr,
signature: _config.signature,
jsApiList: [
'runtime.info',
'device.notification.prompt',
'biz.chat.pickConversation',
'device.notification.confirm',
'device.notification.alert',
'device.notification.prompt',
'biz.chat.open',
'biz.util.open',
'biz.user.get',
'biz.contact.choose',
'biz.telephone.call',
'biz.ding.post',
'device.geolocation.get',
'biz.navigation.setLeft',
'biz.navigation.close',
'ui.pullToRefresh.disable',
]
});
Util.log("End dd config", location.href.substring(location.href.lastIndexOf('/')+1));
Util.log("Before dd ready", location.href.substring(location.href.lastIndexOf('/')+1));
dd.ready(function () {
// alert("dd ready");
dd.runtime.info({
onSuccess: function (info) {
Util.log("dd ready runtime success", location.href.substring(location.href.lastIndexOf('/')+1));
},
onFail: function (err) {
Util.log("dd ready runtime failed", location.href.substring(location.href.lastIndexOf('/')+1));
}
});
setTimeout(dd.runtime.permission.requestAuthCode({
corpId: _config.corpId,
onSuccess: function (info) {
logger.i('authcode: ' + info.code);
Util.log("dd ready requestAuthCode success", location.href.substring(location.href.lastIndexOf('/')+1));
dd.ui.pullToRefresh.disable();
$.ajax({
url: '/authUser',
type: "GET",
data: {"access_token": _config.token, "code": info.code},
dataType: 'json',
timeout: 9000,
success: function (data, status, xhr) {
Util.log("dd ready ajax success", location.href.substring(location.href.lastIndexOf('/')+1));
},
error: function (xhr, errorType, error) {
Util.log("dd ready ajax failed", location.href.substring(location.href.lastIndexOf('/')+1));
}
});
},
onFail: function (err) {
Util.log("dd ready requestAuthCode failed", location.href.substring(location.href.lastIndexOf('/')+1));
}
}), 10000);
});[/code]
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。