generationAsk.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. </view>
  9. </template>
  10. <script>
  11. import { activity, Report } from "@/config/api.js";
  12. export default {
  13. data() {
  14. return {
  15. advice_content: "",
  16. id: "",
  17. type: "",
  18. };
  19. },
  20. computed: {
  21. titlePlaceholder() {
  22. return this.type == "文章" ? "请描述您的问题,销售会跟进问题,后期在线下为您解答" : "请描述您的问题,分析师会代您向专家提问。";
  23. },
  24. },
  25. methods: {
  26. submitHandle() {
  27. if (this.type == "文章") {
  28. Report.articleAskAdd({
  29. ArticleId: Number(this.id),
  30. Content: this.advice_content,
  31. }).then((res) => {
  32. if (res.Ret === 200) {
  33. this.$util.toast("提交成功");
  34. this.advice_content = "";
  35. setTimeout(() => {
  36. uni.navigateBack();
  37. }, 500);
  38. }
  39. });
  40. } else {
  41. activity
  42. .activityAskAdd({
  43. ActivityId: Number(this.id),
  44. Content: this.advice_content,
  45. })
  46. .then((res) => {
  47. if (res.Ret === 200) {
  48. this.$util.toast("提交成功");
  49. this.advice_content = "";
  50. setTimeout(() => {
  51. uni.navigateBack();
  52. }, 500);
  53. }
  54. });
  55. }
  56. },
  57. },
  58. onLoad(option) {
  59. this.id = option.id;
  60. this.type = option.type || "";
  61. uni.setNavigationBarTitle({
  62. title: this.type == "文章" ? "提问" : this.type == "提问" ? "实时提问" : "帮我带问",
  63. });
  64. },
  65. };
  66. </script>
  67. <style scoped lang="scss">
  68. .ask-container {
  69. background-color: #fff;
  70. padding: 30rpx 34rpx;
  71. .advice-ipt-cont {
  72. height: 420rpx;
  73. border: 1rpx solid #d0cfd5;
  74. border-radius: 8rpx;
  75. padding: 30rpx;
  76. position: relative;
  77. font-size: 28rpx;
  78. color: #d0cfd5;
  79. .num-tag {
  80. position: absolute;
  81. bottom: 30rpx;
  82. right: 30rpx;
  83. }
  84. }
  85. .btn-cont {
  86. margin: 80rpx auto;
  87. width: 368rpx;
  88. height: 80rpx;
  89. font-size: 34rpx;
  90. line-height: 80rpx;
  91. text-align: center;
  92. color: #ffffff;
  93. background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
  94. opacity: 1;
  95. border-radius: 4rpx;
  96. }
  97. }
  98. </style>