generationAsk.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="container ask-container">
  3. <view class="container-box">
  4. <view class="advice-ipt-cont">
  5. <u-input v-model="advice_content" type="textarea" maxlength="100" :clearable="false" placeholder="可以留下您对该内容的看法或者疑问" height="300" class="ipt" />
  6. <text class="num-tag">{{ advice_content.length }}/100</text>
  7. </view>
  8. <view class="btn-cont" @click="submitHandle"> 提交 </view>
  9. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  10. </view>
  11. <Loading />
  12. </view>
  13. </template>
  14. <script>
  15. import { activity, Report, Home } from "@/config/api.js";
  16. import freeCharge from "@/components/freeCharge";
  17. export default {
  18. data() {
  19. return {
  20. advice_content: "",
  21. id: "",
  22. type: "",
  23. roadshowTitle: "", // 微路演标题
  24. roadshow: null, // 判断微路演的类型
  25. };
  26. },
  27. components: {
  28. freeCharge,
  29. },
  30. methods: {
  31. async submitHandle() {
  32. if (!this.advice_content)
  33. return uni.showToast({
  34. title: "内容不能为空",
  35. icon: "none",
  36. duration: 2000,
  37. });
  38. const res =
  39. this.roadshow && this.type == "文章"
  40. ? await Home.microRoadshowAdd({
  41. SourceId: Number(this.id),
  42. Content: this.advice_content,
  43. SourceType: Number(this.roadshow),
  44. Title: this.roadshowTitle,
  45. PageRouter: this.$store.state.pageRouterReport,
  46. })
  47. : this.type == "文章"
  48. ? await Report.articleAskAdd({
  49. ArticleId: Number(this.id),
  50. Content: this.advice_content,
  51. PageRouter: this.$store.state.pageRouterReport,
  52. })
  53. : await activity.activityAskAdd({
  54. ActivityId: Number(this.id),
  55. Content: this.advice_content,
  56. PageRouter: this.$store.state.pageRouterReport,
  57. });
  58. if (res.Ret === 200) {
  59. this.$util.toast("提交成功");
  60. this.advice_content = "";
  61. setTimeout(() => {
  62. uni.navigateBack();
  63. }, 500);
  64. }
  65. },
  66. },
  67. onLoad(option) {
  68. this.id = option.id;
  69. this.type = option.type || "";
  70. this.roadshow = option.roadshow || null;
  71. this.roadshowTitle = option.roadshowTitle || "";
  72. uni.setNavigationBarTitle({
  73. title: this.type == "文章" ? "留言" : this.type == "提问" ? "实时提问" : "帮我带问",
  74. });
  75. },
  76. };
  77. </script>
  78. <style scoped lang="scss">
  79. .ask-container {
  80. background-color: $uni-color-new;
  81. padding: 30rpx 34rpx;
  82. .container-box {
  83. background-color: #fff;
  84. padding: 25rpx;
  85. border-radius: 8rpx;
  86. }
  87. .advice-ipt-cont {
  88. height: 420rpx;
  89. border: 1rpx solid #d0cfd5;
  90. border-radius: 8rpx;
  91. padding: 30rpx;
  92. position: relative;
  93. font-size: 28rpx;
  94. color: #d0cfd5;
  95. .num-tag {
  96. position: absolute;
  97. bottom: 30rpx;
  98. right: 30rpx;
  99. }
  100. }
  101. .btn-cont {
  102. margin: 80rpx auto;
  103. width: 500rpx;
  104. height: 60rpx;
  105. font-size: 24rpx;
  106. line-height: 60rpx;
  107. text-align: center;
  108. color: #ffffff;
  109. background: $uni-color-new;
  110. border-radius: 4rpx;
  111. }
  112. }
  113. </style>