generationAsk.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 } 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. };
  21. },
  22. components: {
  23. freeCharge,
  24. },
  25. computed: {
  26. titlePlaceholder() {
  27. return this.type == "文章" ? "可以留下您对报告内容的看法或者疑问" : "请描述您的问题,分析师会代您向专家提问。";
  28. },
  29. },
  30. methods: {
  31. async submitHandle() {
  32. const res =
  33. this.type == "文章"
  34. ? await Report.articleAskAdd({
  35. ArticleId: Number(this.id),
  36. Content: this.advice_content,
  37. })
  38. : activity.activityAskAdd({
  39. ActivityId: Number(this.id),
  40. Content: this.advice_content,
  41. });
  42. if (res.Ret === 200) {
  43. this.$util.toast("提交成功");
  44. this.advice_content = "";
  45. setTimeout(() => {
  46. uni.navigateBack();
  47. }, 500);
  48. }
  49. },
  50. },
  51. onLoad(option) {
  52. this.id = option.id;
  53. this.type = option.type || "";
  54. uni.setNavigationBarTitle({
  55. title: this.type == "文章" ? "留言" : this.type == "提问" ? "实时提问" : "帮我带问",
  56. });
  57. },
  58. };
  59. </script>
  60. <style scoped lang="scss">
  61. .ask-container {
  62. background-color: #fff;
  63. padding: 30rpx 34rpx;
  64. .advice-ipt-cont {
  65. height: 420rpx;
  66. border: 1rpx solid #d0cfd5;
  67. border-radius: 8rpx;
  68. padding: 30rpx;
  69. position: relative;
  70. font-size: 28rpx;
  71. color: #d0cfd5;
  72. .num-tag {
  73. position: absolute;
  74. bottom: 30rpx;
  75. right: 30rpx;
  76. }
  77. }
  78. .btn-cont {
  79. margin: 80rpx auto;
  80. width: 368rpx;
  81. height: 80rpx;
  82. font-size: 34rpx;
  83. line-height: 80rpx;
  84. text-align: center;
  85. color: #ffffff;
  86. background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
  87. opacity: 1;
  88. border-radius: 4rpx;
  89. }
  90. }
  91. </style>