putQuestions.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="qaBox">
  3. <global-loading />
  4. <view class="qaTopInfo">
  5. <view class="qaTopInfoBox">
  6. <image :src="qudata.images"></image>
  7. <view class="qaInfoText">
  8. <h3>{{ qudata.productName }}</h3>
  9. <span>共{{ qudata.questionNumber }}个问题</span>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="questionCent">
  14. <view class="uni-textarea">
  15. <textarea v-model="questionText" maxlength="200" placeholder="请说出你的问题..." auto-height />
  16. </view>
  17. <!-- <view class="anonymous"> -->
  18. <!-- <view class="flex-row-plus flex-items" @click="changeCheck"> -->
  19. <!-- <image mode="aspectFill" v-if="anonymous == true" src="../../static/images/origin/selectActive.png" class="cart-select-img"></image> -->
  20. <!-- <image mode="aspectFill" v-else src="../../static/images/origin/selectEmpty.png" class="cart-select-img"></image> -->
  21. <!-- <label>匿名提问</label> -->
  22. <!-- </view> -->
  23. <!-- </view> -->
  24. </view>
  25. <view class="putQuestionsBox" @click="addProblem">
  26. <span class="putQuestionsBtn">发布</span>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. const NET = require('../../utils/request')
  32. const API = require('../../config/api')
  33. export default {
  34. name: 'QADetail',
  35. data() {
  36. return {
  37. anonymous: false,
  38. qudata: {},
  39. questionText: '',
  40. ifAnonymous: 0
  41. }
  42. },
  43. onLoad(params) {
  44. this.qudata = this.$getJumpParam(params)
  45. },
  46. methods: {
  47. seeAllFn() {
  48. uni.navigateTo({
  49. url: 'qADetail'
  50. })
  51. },
  52. changeCheck() {
  53. this.anonymous = !this.anonymous
  54. },
  55. addProblem() {
  56. if (this.questionText === '') {
  57. uni.showToast({
  58. title: '内容不能为空!',
  59. icon: 'none'
  60. })
  61. return false
  62. }
  63. // uni.showLoading({
  64. // title: '提交中...',
  65. // mask: true
  66. // });
  67. if (this.anonymous == true) {
  68. this.ifAnonymous = 1
  69. } else {
  70. this.ifAnonymous = 0
  71. }
  72. NET.request(API.addProblem, {
  73. productId: this.qudata.productId,
  74. problem: this.questionText,
  75. ifAnonymous: this.ifAnonymous
  76. }, 'POST').then((res) => {
  77. uni.hideLoading()
  78. uni.showToast({
  79. title: '提问成功',
  80. icon: 'success'
  81. })
  82. uni.navigateTo({
  83. url: '../../pages_category_page2/userModule/questionList'
  84. })
  85. })
  86. .catch((res) => {
  87. uni.showToast({
  88. title: '失败',
  89. icon: 'none'
  90. })
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .qaBox {
  98. padding: 0 30upx;
  99. .cart-select-img {
  100. width: 50upx;
  101. height: 50upx;
  102. margin: 30upx;
  103. box-sizing: border-box;
  104. }
  105. .qaTopInfo {
  106. margin-top: 20upx;
  107. margin-bottom: 30upx;
  108. .qaTopInfoBox {
  109. display: flex;
  110. align-items: center;
  111. padding: 15upx 20upx;
  112. margin-bottom: 55upx;
  113. image {
  114. width: 120upx;
  115. height: 120upx;
  116. margin-right: 20upx;
  117. border: 2rpx solid #E4E5E6;
  118. }
  119. .qaInfoText {
  120. h3 {
  121. font-size: 30upx;
  122. font-weight: 500;
  123. color: #333333;
  124. }
  125. span {
  126. font-size: 24upx;
  127. color: #CCCCCC;
  128. margin-top: 20rpx;
  129. }
  130. }
  131. }
  132. .qaTitBox {
  133. padding-bottom: 30upx;
  134. border-bottom: 1upx solid #EEEEEE;
  135. .qaTit {
  136. display: flex;
  137. align-items: center;
  138. margin-bottom: 35upx;
  139. i {
  140. width: 38upx;
  141. height: 38upx;
  142. background: linear-gradient(0deg, #C5AA7B 0%, #F79D4D 100%);
  143. border-radius: 4upx;
  144. font-style: normal;
  145. text-align: center;
  146. color: #FFFFFF;
  147. font-size: 28upx;
  148. margin-right: 30upx;
  149. }
  150. h3 {
  151. font-size: 28upx;
  152. font-family: PingFang SC;
  153. font-weight: 500;
  154. color: #333333;
  155. }
  156. }
  157. .qaTitTime {
  158. display: flex;
  159. align-items: center;
  160. img {
  161. width: 44upx;
  162. height: 44upx;
  163. margin-right: 20upx;
  164. }
  165. .qaName {
  166. font-size: 28upx;
  167. color: #666666;
  168. margin-right: 35upx;
  169. }
  170. .qaTimeInfo {
  171. color: #999999;
  172. font-size: 22upx;
  173. }
  174. }
  175. }
  176. }
  177. .questionCent {
  178. width: 100%;
  179. textarea {
  180. padding: 30upx;
  181. box-sizing: border-box;
  182. min-height: 300upx;
  183. background: #FFFFFF;
  184. border: 2upx solid #EEEEEE;
  185. width: 100%;
  186. color: #666666;
  187. }
  188. .textarea-placeholder {
  189. font-size: 26upx;
  190. color: #999999;
  191. }
  192. .anonymous {
  193. label {
  194. font-size: 26upx;
  195. color: #333333;
  196. }
  197. }
  198. }
  199. .putQuestionsBox {
  200. position: fixed;
  201. bottom: 0;
  202. left: 0;
  203. width: 100%;
  204. background: #FFFFFF;
  205. .putQuestionsBtn {
  206. width: 90%;
  207. height: 100upx;
  208. line-height: 100upx;
  209. text-align: center;
  210. background: #333333;
  211. display: block;
  212. margin: 0 auto 70upx auto;
  213. color: #FFEBC4;
  214. font-size: 28rpx;
  215. }
  216. }
  217. }
  218. </style>