generationAsk.vue 2.3 KB

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