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.

158 lines
3.0 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 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="#000" :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. evaluateList : []
  40. }
  41. },
  42. props : {
  43. show : {
  44. type : Boolean,
  45. default : true
  46. },
  47. oid : {
  48. }
  49. },
  50. created(){
  51. this.getEvaluateList()
  52. },
  53. methods: {
  54. //关闭选择评论弹框
  55. closeReviewProp(){
  56. let data = {}
  57. this.evaluateList.forEach(n => {
  58. if(n.optionValue == this.checkedOption){
  59. data = n
  60. }
  61. })
  62. this.request('evaluate', {}, {
  63. evaluateId : data.id,
  64. id : this.oid,
  65. num : data.num
  66. }).then(res => {
  67. if(res.code == 200){
  68. this.$emit('close', this.checkedOption)
  69. this.checkedOption = ''
  70. }
  71. })
  72. },
  73. getEvaluateList(){
  74. this.request('getEvaluateList').then(res => {
  75. if(res.code == 200){
  76. this.evaluateList = res.result
  77. }
  78. })
  79. },
  80. async asyncLoading() { //加载效果
  81. return new Promise((resolve, reject) => {
  82. uni.showLoading({
  83. title: this.$t('page.review.loading')
  84. });
  85. setTimeout(() => {
  86. uni.hideLoading();
  87. resolve()
  88. }, 500)
  89. })
  90. },
  91. },
  92. watch : {
  93. checkedOption : function(newVal){
  94. if(this.checkedOption){
  95. play()
  96. this.asyncLoading().then(res => {
  97. this.closeReviewProp()
  98. })
  99. }
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .review {
  106. display: flex;
  107. align-items: center;
  108. justify-content: center;
  109. position: fixed;
  110. top: 0;
  111. left: 0;
  112. width: 750rpx;
  113. height: 100vh;
  114. margin: 0rpx auto;
  115. z-index: 99999;
  116. background-color: #00000099;
  117. .review-main {
  118. background: $uni-bg-color;
  119. width: 600rpx;
  120. color: $uni-bg-color-app;
  121. border-radius: 10rpx;
  122. padding: 15rpx;
  123. border: 1px solid #ccc;
  124. .review-title {
  125. font-size: 34rpx;
  126. padding: 15rpx 0rpx;
  127. text-align: center;
  128. }
  129. .options {
  130. margin-top: 20rpx;
  131. .option {
  132. margin-bottom: 15rpx;
  133. .option-top {
  134. display: flex;
  135. justify-content: space-between;
  136. }
  137. .option-content{
  138. color: #747474;
  139. }
  140. }
  141. }
  142. }
  143. }
  144. </style>