抖音c端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.6 KiB

  1. // pages/index/sw/index.js
  2. const imgurl = require("../../utils/imgurl");
  3. const app = getApp()
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. list: {
  10. value: [],
  11. type: Array
  12. }
  13. },
  14. /**
  15. * 组件的初始数据
  16. */
  17. data: {
  18. bannerUrl: imgurl.banner.url,
  19. currentIndex: 0,
  20. mouldType: 0,
  21. },
  22. /**
  23. * 组件的方法列表
  24. */
  25. methods: {
  26. gotobannerdetail: function (e) {
  27. console.log(e, 'e');
  28. console.log(this.data.list)
  29. if (e.currentTarget.dataset.data.type == 3) {
  30. // 小程序路径
  31. let indexOf = (e.currentTarget.dataset.data.pagePath).indexOf("=");
  32. console.log(indexOf, "123")
  33. let id = (e.currentTarget.dataset.data.pagePath).substr(indexOf);
  34. console.log(id.split("="), 123);
  35. let type = (e.currentTarget.dataset.data.pagePath).substr(indexOf + 1, 2) // 2020/7/22 变量获取pagePath中的type
  36. console.log(indexOf, id, type);
  37. console.log(e.currentTarget.dataset.data.pagePath)
  38. if (type == 'cd' || type == 'sd') {
  39. tt.navigateTo({
  40. url: `/${e.currentTarget.dataset.data.pagePath}`,
  41. })
  42. } else if (type == "wj") {
  43. tt.navigateTo({
  44. url: `/pages/questionnaire/questionnaire?id=` + id.split("=")[2],
  45. })
  46. } else if (type == 'ra') {
  47. tt.navigateTo({
  48. url: `/pages/radetail/index?id=` + id.split("=")[2],
  49. })
  50. }
  51. } else if (e.currentTarget.dataset.data.type == 2) {
  52. console.log('freeBannerDetail');
  53. // 自由图文
  54. tt.navigateTo({
  55. url: `/pages/freeBannerDetail/freeBannerDetail?id=${e.currentTarget.dataset.id}`
  56. });
  57. } else if (e.currentTarget.dataset.data.type == 4) {
  58. tt.navigateToMiniProgram({
  59. appId: e.currentTarget.dataset.data.goAppid,
  60. // path: 'page/index/index?id=123',
  61. // extraData: {
  62. // foo: 'bar'
  63. // },
  64. // envVersion: 'develop',
  65. success(res) {
  66. // 打开成功
  67. }
  68. })
  69. } else {
  70. // 固定格式
  71. tt.navigateTo({
  72. url: `/pages/bannerdetail/bannerdetail?id=${e.currentTarget.dataset.id}&mallTenantId=${e.currentTarget.dataset.data.tenantId}`
  73. });
  74. }
  75. },
  76. handleChange: function (e) {
  77. this.setData({
  78. currentIndex: e.detail.current
  79. })
  80. },
  81. },
  82. attached: function () {
  83. // 在组件实例进入页面节点树时执行
  84. if (app.globalData.mouldType) {
  85. this.setData({
  86. mouldType: app.globalData.mouldType
  87. })
  88. }
  89. },
  90. });