In order to be compatible withand migrate to the DingTalk, we provide the following compatibility method to achieve the smallest changes of the H5 application so as to migrate to DingTalk.
Migration Method
After loading the DingTalk JSAPI,you can continue to use DingTalk’s JSAPI interface name and parametersby loading the adaptation script.
<script src="https://g.alicdn.com/gdt/jsapi/1.9.4/index.js"></script>
<script src="https://g.alicdn.com/gdt/jsapi-adapter-dingtalk-pc/1.2.10/index.js"></script>
Code example:
dd.ready(() => {
dd.runtime.permission.requestAuthCode({
corpId: '',
onSuccess(res) { console.log(res.code); }
});
});
Note
1.The authentication method of DingTalk is different from its implementation. If authentication is required, please refer to the authentication document of DingTalk.
2.The JSAPI called in the page initialization needs to be placed in “dd.ready”, otherwise the call may fail.
3.The DingTalk no longer provides the “dd.error” method for capturing “dd.cconfig” errors that can be directly captured in “catch” with “dd.authConfig” in DingTalk.
dd.authConfig({ ... }).catch(e => console.error(e));
Compatibility table
DingTalk interface | Dingtalk interface Related government affairs |
Compatibility level |
Differences of input parameter | Function differences |
---|---|---|---|---|
biz.chat.chooseConversationByCorpId | dd.pickChat | Partially compatible | Not support isAllowCreateGroup,filterNotOwnerGroup etc |
|
biz.contact.departmentsPicker | dd.chooseDepartments | Partially compatible | Not support title/limitTips/pickedDepartments/disabledDepartments/requiredDepartments/appId/permissionType/startWithDepartmentId etc |
|
biz.contact.complexPicker | dd.chooseContactWithComplexPicker | Partially compatible | Not support permissionType/appId |
|
biz.telephone.showCallMenu | dd.callPhone | Partially compatible | Only support phoneNumber,Not support code/showDingCall | |
biz.util.open | dd.openPage | Partially compatible | Support opening page of personal information | |
biz.microApp.openApp | dd.openApp | Partially compatible | Only support appId | |
biz.util.share | dd.shareToMessage | Partially compatible | Not support “type” with 1 by default | Support IM sharing and three ports |
biz.map.view | dd.showOnMap | Partially compatible | Not support Navigation button | |
biz.map.search | dd.searchOnMap | Partially compatible | Not support search box | |
biz.navigation.setRight | dd.setOptionMenu | Partially compatible | Not support show/controls | After calling setOptionMenu,call its menu |
biz.navigation.setLeft | dd.setNavLeftText | Partially compatible | Not support “control” parameter | |
dd.config | dd.authConfig | Not compatible | ||
dd_nav_bgcolor | dd_nav_bgcolor | Not compatible | Supported format: “RRGGBB” | |
biz.navigation.setMenu | dd.setOptionMenu | Not compatible | See the interface documentation for details |