generationAsk.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. submitHandle() {
  32. if (this.type == "文章") {
  33. Report.articleAskAdd({
  34. ArticleId: Number(this.id),
  35. Content: this.advice_content,
  36. }).then((res) => {
  37. if (res.Ret === 200) {
  38. this.$util.toast("提交成功");
  39. this.advice_content = "";
  40. setTimeout(() => {
  41. uni.navigateBack();
  42. }, 500);
  43. }
  44. });
  45. } else {
  46. activity
  47. .activityAskAdd({
  48. ActivityId: Number(this.id),
  49. Content: this.advice_content,
  50. })
  51. .then((res) => {
  52. if (res.Ret === 200) {
  53. this.$util.toast("提交成功");
  54. this.advice_content = "";
  55. setTimeout(() => {
  56. uni.navigateBack();
  57. }, 500);
  58. }
  59. });
  60. }
  61. },
  62. },
  63. onLoad(option) {
  64. this.id = option.id;
  65. this.type = option.type || "";
  66. uni.setNavigationBarTitle({
  67. title: this.type == "文章" ? "提问" : this.type == "提问" ? "实时提问" : "帮我带问",
  68. });
  69. },
  70. };
  71. </script>
  72. <style scoped lang="scss">
  73. .ask-container {
  74. background-color: #fff;
  75. padding: 30rpx 34rpx;
  76. .advice-ipt-cont {
  77. height: 420rpx;
  78. border: 1rpx solid #d0cfd5;
  79. border-radius: 8rpx;
  80. padding: 30rpx;
  81. position: relative;
  82. font-size: 28rpx;
  83. color: #d0cfd5;
  84. .num-tag {
  85. position: absolute;
  86. bottom: 30rpx;
  87. right: 30rpx;
  88. }
  89. }
  90. .btn-cont {
  91. margin: 80rpx auto;
  92. width: 368rpx;
  93. height: 80rpx;
  94. font-size: 34rpx;
  95. line-height: 80rpx;
  96. text-align: center;
  97. color: #ffffff;
  98. background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
  99. opacity: 1;
  100. border-radius: 4rpx;
  101. }
  102. }
  103. </style>