annualreport.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. ImagePath: app.globalData.uploadImageUrl,
  7. },
  8. onLoad: function (options) {
  9. var that = this;
  10. that.setData({
  11. Containnerheight: main.getWindowHeight(),
  12. });
  13. wx.showLoading({
  14. title: '请稍候',
  15. });
  16. var userid=app.globalData.userInfo.UserID;
  17. main.getData("GetAnnualReport?UserID=" + userid, function (data) {
  18. wx.hideLoading();
  19. if (data){
  20. that.setData({
  21. Data:data,
  22. });
  23. }
  24. });
  25. var imageQRCode = app.globalData.serverUrl;
  26. imageQRCode += common.Encrypt("BuildWXServiceQRCode?QRCodeType=0&UserID=" + app.globalData.userInfo.UserID + "&SourceID=" + app.globalData.ProgramID);
  27. console.log(imageQRCode);
  28. var downloadTask = wx.downloadFile({
  29. url: imageQRCode,
  30. success(res) {
  31. if (res.statusCode === 200) {
  32. that.setData({
  33. QRCode:res.tempFilePath,
  34. });
  35. }
  36. },
  37. fail: function (err) {
  38. console.log("err:"+err);
  39. }
  40. });
  41. downloadTask.onProgressUpdate((res) => {
  42. console.log('下载进度', res.progress)
  43. console.log('已经下载的数据长度', res.totalBytesWritten)
  44. console.log('预期需要下载的数据总长度', res.totalBytesExpectedToWrite)
  45. })
  46. },
  47. goto: function (e) {
  48. var url = e.currentTarget.dataset.url;
  49. wx.navigateTo({
  50. url: url,
  51. });
  52. },
  53. onShareAppMessage: function () {
  54. return {
  55. title: app.globalData.ShareTitle,
  56. path: app.globalData.SharePath + '?LessonID=all&UserID=' + app.globalData.userInfo.UserID,
  57. imageUrl: app.globalData.ShareImage,
  58. }
  59. },
  60. })