generationAsk.vue 2.9 KB

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