You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

189 lines
3.9 KiB

8 months ago
  1. <template>
  2. <view v-if="show" class="review">
  3. <view class="review-main">
  4. <!-- 标题 -->
  5. <view class="review-title">{{ $t('page.review.title') }}</view>
  6. <!-- 选项列表 -->
  7. <view class="options">
  8. <u-radio-group v-model="checkedOption" placement="column">
  9. <view v-for="(item,index) in evaluateList" class="option">
  10. <view class="option-top">
  11. <view class="option-top-left">
  12. <u-radio :customStyle="{marginBottom: '8px'}"
  13. activeColor="#aec438" :label="item.optionValue"
  14. :name="item.optionValue" />
  15. </view>
  16. <view class="option-top-right">
  17. <u-rate :count="5"
  18. active-color="#EEBF72"
  19. v-model="item.num"></u-rate>
  20. </view>
  21. </view>
  22. <view class="option-content"> {{ item[type[$i18n.locale]] }}</view>
  23. </view>
  24. </u-radio-group>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import { play } from '@/utils/clickSound.js'
  31. export default {
  32. data() {
  33. return {
  34. checkedOption: '',
  35. type : {
  36. en : 'answerEnglish',
  37. es : "answerSpanish"
  38. },
  39. // "A" : "This app has been with me since lstarted hiah school and continued unti!had my child, You deserve to have it.",
  40. // "B" : "Very easy to use,l have recommendedt to my familly and friends.",
  41. // "C" : "This APp is very suitable for beginnerso choose.",
  42. // "D" : "This APP interface is very good.",
  43. // "E" : "Not bad, but not good either, barelyworth usina."
  44. // optionList: [{
  45. // letter: 'A.',
  46. // mark: 5,
  47. // content: this.$t('page.review.A')
  48. // },
  49. // {
  50. // letter: 'B.',
  51. // mark: 4,
  52. // content: this.$t('page.review.B')
  53. // },
  54. // {
  55. // letter: 'C.',
  56. // mark: 3,
  57. // content: this.$t('page.review.C')
  58. // },
  59. // {
  60. // letter: 'D.',
  61. // mark: 2,
  62. // content: this.$t('page.review.D')
  63. // },
  64. // {
  65. // letter: 'E.',
  66. // mark: 1,
  67. // content: this.$t('page.review.E')
  68. // }
  69. // ],
  70. evaluateList : []
  71. }
  72. },
  73. props : {
  74. show : {
  75. type : Boolean,
  76. default : true
  77. },
  78. oid : {
  79. }
  80. },
  81. created(){
  82. this.getEvaluateList()
  83. },
  84. methods: {
  85. //关闭选择评论弹框
  86. closeReviewProp(){
  87. let data = {}
  88. this.evaluateList.forEach(n => {
  89. if(n.optionValue == this.checkedOption){
  90. data = n
  91. }
  92. })
  93. this.request('evaluate', {}, {
  94. evaluateId : data.id,
  95. id : this.oid,
  96. num : data.num
  97. }).then(res => {
  98. if(res.code == 200){
  99. this.$emit('close', this.checkedOption)
  100. this.checkedOption = ''
  101. }
  102. })
  103. },
  104. getEvaluateList(){
  105. this.request('getEvaluateList').then(res => {
  106. if(res.code == 200){
  107. this.evaluateList = res.result
  108. }
  109. })
  110. },
  111. async asyncLoading() { //加载效果
  112. return new Promise((resolve, reject) => {
  113. uni.showLoading({
  114. title: this.$t('page.review.loading')
  115. });
  116. setTimeout(() => {
  117. uni.hideLoading();
  118. resolve()
  119. }, 500)
  120. })
  121. },
  122. },
  123. watch : {
  124. checkedOption : function(newVal){
  125. if(this.checkedOption){
  126. play()
  127. this.asyncLoading().then(res => {
  128. this.closeReviewProp()
  129. })
  130. }
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .review {
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. position: fixed;
  141. top: 0;
  142. left: 0;
  143. width: 750rpx;
  144. height: 100vh;
  145. margin: 0rpx auto;
  146. z-index: 99999;
  147. background-color: #00000099;
  148. .review-main {
  149. background: black;
  150. width: 600rpx;
  151. color: white;
  152. border-radius: 10rpx;
  153. padding: 15rpx;
  154. border: 1px solid #ccc;
  155. .review-title {
  156. font-size: 34rpx;
  157. padding: 15rpx 0rpx;
  158. text-align: center;
  159. }
  160. .options {
  161. margin-top: 20rpx;
  162. .option {
  163. margin-bottom: 15rpx;
  164. .option-top {
  165. display: flex;
  166. justify-content: space-between;
  167. }
  168. .option-content{
  169. color: #747474;
  170. }
  171. }
  172. }
  173. }
  174. }
  175. </style>