<template> <view class="container ask-container"> <view class="advice-ipt-cont"> <u-input v-model="advice_content" type="textarea" maxlength="100" :clearable="false" :placeholder="titlePlaceholder" height="300" class="ipt" /> <text class="num-tag">{{ advice_content.length }}/100</text> </view> <view class="btn-cont" @click="submitHandle"> 提交 </view> <freeCharge class="free-charge" :isShowFreeBtn="isShowFree"/> </view> </template> <script> import { activity, Report } from "@/config/api.js"; import freeCharge from '@/components/freeCharge' export default { data() { return { advice_content: "", id: "", type: "", }; }, components: { freeCharge }, computed: { titlePlaceholder() { return this.type == "文章" ? "请描述您的问题,销售会跟进问题,后期在线下为您解答" : "请描述您的问题,分析师会代您向专家提问。"; }, }, methods: { submitHandle() { if (this.type == "文章") { Report.articleAskAdd({ ArticleId: Number(this.id), Content: this.advice_content, }).then((res) => { if (res.Ret === 200) { this.$util.toast("提交成功"); this.advice_content = ""; setTimeout(() => { uni.navigateBack(); }, 500); } }); } else { activity .activityAskAdd({ ActivityId: Number(this.id), Content: this.advice_content, }) .then((res) => { if (res.Ret === 200) { this.$util.toast("提交成功"); this.advice_content = ""; setTimeout(() => { uni.navigateBack(); }, 500); } }); } }, }, onLoad(option) { this.id = option.id; this.type = option.type || ""; uni.setNavigationBarTitle({ title: this.type == "文章" ? "提问" : this.type == "提问" ? "实时提问" : "帮我带问", }); }, }; </script> <style scoped lang="scss"> .ask-container { background-color: #fff; padding: 30rpx 34rpx; .advice-ipt-cont { height: 420rpx; border: 1rpx solid #d0cfd5; border-radius: 8rpx; padding: 30rpx; position: relative; font-size: 28rpx; color: #d0cfd5; .num-tag { position: absolute; bottom: 30rpx; right: 30rpx; } } .btn-cont { margin: 80rpx auto; width: 368rpx; height: 80rpx; font-size: 34rpx; line-height: 80rpx; text-align: center; color: #ffffff; background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%); opacity: 1; border-radius: 4rpx; } } </style>