share.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. "use strict";
  2. const common_vendor = require("./vendor.js");
  3. const config = require("../config.js");
  4. const share = {
  5. data() {
  6. return {
  7. share: {}
  8. };
  9. },
  10. onShareAppMessage(res) {
  11. common_vendor.index.showShareMenu({
  12. withShareTicket: true
  13. });
  14. common_vendor.wx$1.updateShareMenu({
  15. isPrivateMessage: true,
  16. withShareTicket: true,
  17. success(res2) {
  18. console.log("updateShareMenu: ", res2);
  19. },
  20. fail() {
  21. }
  22. });
  23. return {
  24. title: config.config.share.title,
  25. path: config.config.share.path,
  26. imageUrl: config.config.share.imageUrl,
  27. success(res2) {
  28. common_vendor.index.showToast({
  29. title: "分享成功"
  30. });
  31. },
  32. fail(res2) {
  33. common_vendor.index.showToast({
  34. title: "分享失败",
  35. icon: "none"
  36. });
  37. }
  38. };
  39. },
  40. onShareTimeline(res) {
  41. return {
  42. title: config.config.share.title,
  43. path: config.config.share.path,
  44. imageUrl: config.config.share.imageUrl,
  45. success(res2) {
  46. common_vendor.index.showToast({
  47. title: "分享成功"
  48. });
  49. },
  50. fail(res2) {
  51. common_vendor.index.showToast({
  52. title: "分享失败",
  53. icon: "none"
  54. });
  55. }
  56. };
  57. }
  58. };
  59. exports.share = share;