templateMsg.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view v-if="textData.ButtonText" class="container container-templateMsg">
  3. <view>
  4. {{ textData.Content }}
  5. </view>
  6. <view class="ButtonText" @click="routerHandler">
  7. {{ textData.ButtonText }}
  8. </view>
  9. <Loading />
  10. </view>
  11. </template>
  12. <script>
  13. import { MsgTemplate } from "@/config/api.js";
  14. export default {
  15. data() {
  16. return {
  17. textData: {},
  18. };
  19. },
  20. methods: {
  21. // 获取数据
  22. async getData(options) {
  23. const res = await MsgTemplate.microRoadshowDetail({
  24. SourceId: options.SourceId,
  25. SourceType: options.SourceType,
  26. });
  27. if (res.Ret === 200) {
  28. this.textData = res.Data;
  29. this.textData.ButtonText = options.SourceType == 1 ? "查看报告详情" : options.SourceType == 2 ? "查看活动详情" : "查看音视频详情";
  30. }
  31. },
  32. // 跳转页面
  33. routerHandler() {
  34. if (this.textData.RedirectType == 1) {
  35. uni.navigateTo({ url: "/pageMy/reportDetail/reportDetail?id=" + this.textData.SourceId });
  36. } else if (this.textData.RedirectType == 2) {
  37. uni.navigateTo({ url: "/activityPages/activityDetail/activityDetail?id=" + this.textData.SourceId });
  38. } else {
  39. uni.navigateTo({ url: "/reportPages/IndustryReport/IndustryReport?id=" + this.textData.SourceId });
  40. }
  41. },
  42. },
  43. onLoad(options) {
  44. wx.setNavigationBarTitle({
  45. title: options.SourceType == 2 ? "问题详情" : "留言详情",
  46. });
  47. this.getData(options);
  48. },
  49. };
  50. </script>
  51. <style scoped lang="scss">
  52. .container-templateMsg {
  53. padding: 50rpx;
  54. font-size: 34rpx;
  55. line-height: 48rpx;
  56. color: #333;
  57. .ButtonText {
  58. display: flex;
  59. align-items: center;
  60. justify-content: center;
  61. width: 304rpx;
  62. height: 78rpx;
  63. margin: 360rpx auto 0;
  64. background: #376cbb;
  65. border-radius: 4rpx;
  66. color: #fff;
  67. font-size: 32rpx;
  68. }
  69. }
  70. </style>