C # share detailed code,
The examples in this article share the code shared by C # For your reference. The details are as follows:
Share code
Obtain the signature:
mui.ajax('/apijson/wxsign', {type: 'get',data: {url: location.href,},success: function (data) {//alert(JSON.stringify(data));wx.config({
Debug: false, // enable the debugging mode. The returned values of all called APIs are displayed on the alert client. To view the input parameters, open them on the pc, the parameter information is output through log and printed only on the pc end.
AppId: data. appid, // required. timestamp is the unique identifier of the public number. timestamp, // required. The signature timestamp nonceStr: data. nonceStr, // required. The random string signature: data. signature, // required, signature jsApiList: ['onmenusharetimeline ', 'onmenushareappmessage', 'startrecord', 'stoprecord ', 'alipay', 'playvoice', 'pausevoice ', 'stopvoice', 'onvoiceplayend', 'uploadvoice ', 'downloadvoice', 'chooseimag', 'previewimage', 'uploadimage', 'downloadimage'] // required, list of JS interfaces to be used });}})
Share code:
Wx. ready (function () {var url = window. location. href; // call APIwx here. onMenuShareAppMessage ({title: "Yu Yuandan-send your parents and those most grateful to you! ", // Share the title" desc: "Long-term use of Party and army leaders, such as zhipindeng Xiaoping, Yang Shangkun, and Ye Jianying, out of the red wall! ", // Share description link: url, // share link imgUrl:" https://m.981china.com/images/yuyuandanlogo.png ", // share icon type:'', // dataUrl :'', // if the type is music or video, a data link is provided. The default value is success: function () {// callback function executed after the user confirms the sharing}. cancel: function () {// callback function executed after the user cancels the sharing}); wx. onMenuShareTimeline ({title: "Yu Yuandan-send your parents and those most grateful! ", // Share the title" desc: "Long-term use of Party and army leaders, such as zhipindeng Xiaoping, Yang Shangkun, and Ye Jianying, out of the red wall! ", // Share description link: url, // share link imgUrl:" https://m.981china.com/images/yuyuandanlogo.png ", // share icon type:'', // dataUrl :'', // if the type is music or video, a data link is provided. The default value is success: function () {// callback function executed after the user confirms the sharing}. cancel: function () {// callback function executed after the user cancels the sharing }});});
Json output by wxsign
{"appid": "wx888888888888","jsapi_ticket": "bxLdikRXVbTPdHSM05e5u2WtcuareekEvI9AoiSB9hYDykHA-zgWRJIeoZkZivtjOGcI87SVk1r8888888888","timestamp": 150358888,"nonceStr": "ESbJrsnzGHi8888","signature": "fec1a26592ef07d52ff066183f50536888888888f5"