1024programmer HTML5 HTML5 Embed DingTalk Tutorial

HTML5 Embed DingTalk Tutorial


Or npm is also available

Recommended tutorial: “HTML”

2, the api that comes with DingTalk requires authentication, so you must authenticate before using it

Obtain the authentication of the DingTalk interface

dd.config({
               agentId:agentid, // required, micro-app ID
               corpId: corpId, //required, enterprise ID
               timeStamp:timeStamp, // Required, the timestamp of the generated signature
               nonceStr: nonceStr, // Required, generate a random string for the signature
               signature:signature, // required, signature
               type:0,
               jsApiList : [ 'runtime.info', 'biz.contact.choose', 'biz.contact.chooseMobileContacts',
                 'device.notification.confirm', 'device.notification.alert',
                 'device.notification.prompt', 'biz.ding.post', 'biz.util.previewImage',
                 'biz.util.openLink', 'device.geolocation.start', 'device.geolocation.get', 'biz.util.uploadImageFromCamera'  ;, 'biz.util.uploadImage' ,
                 'device.audio.startRecord', 'device.audio.stopRecord', 'device.audio.play', 'device.audio.pause'  ;, 'device.audio.download', 'device.audio.translateVoice', 'device.audio.onPlayEnd'
                 ] // Mandatory, the jsapi list to be used, note: do not include dd.
             });

3, after authentication, DingTalk API can be used in the project, but when calling DingTalk API, it must be executed in dd.ready, otherwise an error will be reported

 dd.ready(()=>{
       // get location
               dd.device.geolocation.get({
       targetAccuracy : Number,
       coordinate : Number,
       withReGeocode : Boolean,
       useCache:true, //The default is true, if you need to get the location frequently, please set false
        onSuccess : (result) => {
         alert('succe: ' + JSON.stringify(result))
                   
        },
       onFail : (err) => {
        alert('fail: ' + JSON.stringify(err))
        }
       })
  })

PS: If you use the API of DingTalk globally, you can call it in the app.vue page or in main.js

Related tutorial: “CSS Tutorial”

The above is the detailed content of the HTML5 embedded DingTalk tutorial, please pay attention to other related articles on 1024programmer.com for more!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/html5-embed-dingtalk-tutorial-2/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索