addHealthButler.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_user = require("../api/user.js");
  4. require("../common/request.js");
  5. const _sfc_main = {
  6. data() {
  7. return {
  8. baseUrl: common_vendor.index.getStorageSync("requestPath"),
  9. userId: null,
  10. imgurl: ""
  11. };
  12. },
  13. onLoad(options) {
  14. this.userId = options.userId;
  15. console.log(options.userId);
  16. this.getQRCode();
  17. },
  18. methods: {
  19. getQRCode() {
  20. api_user.getAppContactWay(this.userId).then((res) => {
  21. if (res.code == 200) {
  22. this.imgurl = res.data || "";
  23. } else {
  24. common_vendor.index.showToast({
  25. title: res.msg,
  26. icon: ""
  27. });
  28. }
  29. });
  30. },
  31. downImg() {
  32. common_vendor.index.showLoading({
  33. title: "\u56FE\u7247\u4FDD\u5B58\u4E2D..."
  34. });
  35. common_vendor.index.downloadFile({
  36. url: this.imgurl,
  37. fail: function(res) {
  38. common_vendor.index.showModal({
  39. title: "\u63D0\u793A",
  40. content: "\u4FDD\u5B58\u5931\u8D25"
  41. });
  42. common_vendor.index.hideLoading();
  43. },
  44. success: function(res) {
  45. var tempFilePath = res.tempFilePath;
  46. common_vendor.index.saveImageToPhotosAlbum({
  47. filePath: tempFilePath,
  48. success: () => {
  49. common_vendor.index.showToast({
  50. title: "\u4FDD\u5B58\u6210\u529F",
  51. duration: 2e3
  52. });
  53. },
  54. fail: () => {
  55. console.log("\u56FE\u7247\u5931\u8D25");
  56. common_vendor.index.showToast({
  57. title: "\u56FE\u7247\u5931\u8D25",
  58. duration: 2e3,
  59. icon: "error"
  60. });
  61. common_vendor.index.hideLoading();
  62. },
  63. complete: function() {
  64. common_vendor.index.hideLoading();
  65. }
  66. });
  67. }
  68. });
  69. }
  70. }
  71. };
  72. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  73. return {
  74. a: $data.imgurl
  75. };
  76. }
  77. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_user/addHealthButler.vue"]]);
  78. wx.createPage(MiniProgramPage);