FeedBack.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <div class="feed-back">
  3. <BtnClose
  4. @click="emit('close')"
  5. />
  6. <div class="paper-wrap">
  7. <article class="paper">
  8. <h1>用户反馈</h1>
  9. <h2>User feedback</h2>
  10. <div class="row">
  11. <div class="key">
  12. 您的称呼
  13. </div>
  14. <input
  15. v-model="name"
  16. aotufocus
  17. type="text"
  18. placeholder="请输入内容,20字以内"
  19. maxlength="20"
  20. >
  21. </div>
  22. <div class="row">
  23. <div class="key">
  24. 联系方式
  25. </div>
  26. <input
  27. v-model="contact"
  28. type="text"
  29. placeholder="请输入内容,20字以内"
  30. maxlength="20"
  31. >
  32. </div>
  33. <div class="row">
  34. <div class="key">
  35. 反馈内容
  36. </div>
  37. <textarea
  38. v-model="feedback"
  39. placeholder="请输入省市区街道,50字以内"
  40. maxlength="50"
  41. />
  42. </div>
  43. <div class="splitter" />
  44. <div class="row">
  45. <div class="key veri-code-key">
  46. 验证码
  47. </div>
  48. <input
  49. v-model="veriCode"
  50. class="veri-code-input"
  51. type="text"
  52. maxlength="20"
  53. placeholder="请输入内容"
  54. >
  55. <button
  56. class="get-veri-code"
  57. @click="onClickVerifiCode"
  58. >
  59. <img
  60. v-if="isShowVerifiCode"
  61. class=""
  62. :src="`${$env.VUE_APP_DEPLOY_ORIGIN}/api/show/getRandCode`"
  63. alt=""
  64. draggable="false"
  65. >
  66. </button>
  67. </div>
  68. <div class="btn-group">
  69. <button
  70. class="cancel"
  71. @click="emit('close')"
  72. >
  73. 取消
  74. </button>
  75. <button
  76. class="confirm"
  77. :disabled="!canSubmit"
  78. @click="onSubmit"
  79. >
  80. 提交
  81. </button>
  82. </div>
  83. </article>
  84. <div class="deco" />
  85. </div>
  86. </div>
  87. </template>
  88. <script setup>
  89. import { ref, computed, watch, onMounted, nextTick, inject } from "vue"
  90. import { useRoute, useRouter } from "vue-router"
  91. import { useStore } from "vuex"
  92. import BtnClose from "./BtnClose.vue"
  93. import { ElMessage } from 'element-plus'
  94. import { submitFeedback } from '@/api.js'
  95. const route = useRoute()
  96. const router = useRouter()
  97. const store = useStore()
  98. const $env = inject('$env')
  99. const emit = defineEmits(['close'])
  100. const isShowVerifiCode = ref(true)
  101. const onClickVerifiCode = utils.throttle(() => {
  102. isShowVerifiCode.value = false
  103. nextTick(() => {
  104. isShowVerifiCode.value = true
  105. })
  106. }, 333)
  107. const name = ref('')
  108. const contact = ref('')
  109. const feedback = ref('')
  110. const veriCode = ref('')
  111. const canSubmit = computed(() => {
  112. return name.value && contact.value && feedback.value && veriCode.value
  113. })
  114. function onSubmit() {
  115. submitFeedback(name.value, contact.value, feedback.value, veriCode.value).then(() => {
  116. ElMessage({
  117. message: '您的反馈已发送',
  118. type: 'success',
  119. })
  120. emit('close')
  121. }).catch(() => {
  122. ElMessage.error('网络异常,请稍后再试')
  123. })
  124. }
  125. </script>
  126. <style lang="less" scoped>
  127. .feed-back{
  128. position: fixed;
  129. left: 0;
  130. top: 0;
  131. width: 100%;
  132. height: 100%;
  133. background: rgba(0,0,0,0.6);
  134. backdrop-filter: blur(10px);
  135. z-index: 10;
  136. overflow: auto;
  137. >div.paper-wrap{
  138. position: absolute;
  139. left: 50%;
  140. top: 60px;
  141. transform: translate(-50%, 0);
  142. width: 925px;
  143. height: 810px;
  144. z-index: 0;
  145. >article.paper{
  146. position: absolute;
  147. left: 0;
  148. top: 0;
  149. width: 100%;
  150. height: 100%;
  151. background: linear-gradient( 180deg, rgba(200,200,200, 1) 0%, rgba(100,100,100, 1) 100%);
  152. z-index: 1;
  153. display: flex;
  154. flex-direction: column;
  155. align-items: center;
  156. padding-top: 73px;
  157. padding-bottom: 64px;
  158. >h1{
  159. position: absolute;
  160. top: -37px;
  161. left: 36px;
  162. font-family: Source Han Serif CN, Source Han Serif CN;
  163. font-weight: bold;
  164. font-size: 32px;
  165. color: #FFFFFF;
  166. line-height: 38px;
  167. }
  168. >h2{
  169. position: absolute;
  170. top: 6px;
  171. left: 68px;
  172. font-family: Source Han Sans CN, Source Han Sans CN;
  173. font-weight: 400;
  174. font-size: 14px;
  175. color: #b0b0b0;
  176. line-height: 16px;
  177. }
  178. >.row{
  179. display: flex;
  180. align-items: center;
  181. margin-bottom: 37px;
  182. >.key{
  183. font-family: Source Han Serif CN, Source Han Serif CN;
  184. font-weight: bold;
  185. font-size: 24px;
  186. color: #424A4A;
  187. line-height: 28px;
  188. letter-spacing: 7px;
  189. margin-right: 34px;
  190. }
  191. >.key.veri-code-key{
  192. font-family: Source Han Serif CN, Source Han Serif CN;
  193. font-weight: bold;
  194. font-size: 24px;
  195. color: #FFFFFF;
  196. line-height: 1px;
  197. letter-spacing: 24px;
  198. margin-right: 15px;
  199. }
  200. >input, >textarea{
  201. width: 506px;
  202. background: rgba(213,221,215,0.5);
  203. box-shadow: 0px 1px 3px 0px rgba(255,255,255,0.25);
  204. border-radius: 3px 3px 3px 3px;
  205. border: 1px solid;
  206. border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.15)) 1 1;
  207. font-family: Source Han Sans CN, Source Han Sans CN;
  208. font-weight: 400;
  209. font-size: 16px;
  210. color: #000000;
  211. line-height: 19px;
  212. padding-left: 20px;
  213. padding-right: 2px;
  214. &::placeholder{
  215. opacity: 0.3;
  216. }
  217. }
  218. >input {
  219. height: 51px;
  220. }
  221. >textarea{
  222. width: 506px;
  223. height: 238px;
  224. resize: none;
  225. padding-top: 13px;
  226. padding-bottom: 13px;
  227. }
  228. >input.veri-code-input{
  229. width: 338px;
  230. margin-right: 15px;
  231. }
  232. >button.get-veri-code{
  233. width: 155px;
  234. height: 51px;
  235. border-radius: 3px;
  236. background-color: #fff;
  237. >img{
  238. height: 100%;
  239. width: 100%;
  240. object-fit: contain;
  241. }
  242. }
  243. }
  244. >.splitter{
  245. width: 830px;
  246. border: 1px solid #B5C2B9;
  247. opacity: 0.6;
  248. margin-bottom: 40px;
  249. }
  250. >.btn-group{
  251. >button.cancel{
  252. width: 194px;
  253. height: 94px;
  254. padding-bottom: 9px;
  255. font-family: Source Han Sans CN, Source Han Sans CN;
  256. font-weight: 400;
  257. font-size: 20px;
  258. color: #FFFFFF;
  259. line-height: 23px;
  260. background-image: url(@/assets/images/button-cancel-bg.png);
  261. background-size: cover;
  262. background-repeat: no-repeat;
  263. background-position: center center;
  264. }
  265. >button.confirm{
  266. width: 194px;
  267. height: 94px;
  268. padding-bottom: 9px;
  269. font-family: Source Han Sans CN, Source Han Sans CN;
  270. font-weight: 400;
  271. font-size: 20px;
  272. color: #9C6D42;
  273. line-height: 23px;
  274. background-image: url(@/assets/images/button-confirm-bg.png);
  275. background-size: cover;
  276. background-repeat: no-repeat;
  277. background-position: center center;
  278. &[disabled]{
  279. background-image: url(@/assets/images/button-cancel-bg.png);
  280. cursor: not-allowed;
  281. color: #fff;
  282. }
  283. }
  284. }
  285. }
  286. >.deco{
  287. position: absolute;
  288. z-index: 0;
  289. width: 100%;
  290. height: 100%;
  291. left: -14px;
  292. top: 14px;
  293. border: 1px solid rgba(255, 255, 255, 0.5);
  294. }
  295. }
  296. }
  297. </style>