chooseDialog.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <!--
  2. * @FileDescription: 选中弹窗
  3. * @Author: 黄琪勇
  4. * @Date:2024-03-22 15:21:44
  5. -->
  6. <template>
  7. <div class="chooseDialog">
  8. <div class="close" @click="close"></div>
  9. <div class="chooseCon" v-loading="loading">
  10. <img class="imgMid" src="@/img/cloudTextbooks/shu.png" />
  11. <div class="chooseBox" v-for="(listDetails, index) in listDetailData" :key="index">
  12. <div
  13. class="operate"
  14. v-show="(index === 0 && pageNum !== 0) || (index === 1 && listData.length > pageNum + 1)"
  15. @click="handlePage(index === 0 ? 'prev' : 'next')"
  16. >
  17. <img :src="require(`@/img/cloudTextbooks/${index === 0 ? 'left' : 'right'}.png`)" />
  18. </div>
  19. <div class="chooseList">
  20. <div class="listItem" v-for="item in listDetails" :key="item.id">
  21. <div class="img">
  22. <template v-if="item.lockFlag">
  23. <img src="@/img/cloudTextbooks/jy.png" />
  24. </template>
  25. <template v-else>
  26. <img src="@/img/cloudTextbooks/bf.png" />
  27. <!-- <img src="@/img/cloudTextbooks/xm.png" /> -->
  28. </template>
  29. </div>
  30. <div class="nameCon">
  31. <div class="name">{{ item.name }}</div>
  32. <div class="text" v-if="item.useNum ?? false">已使用{{ item.useNum }}次</div>
  33. </div>
  34. <div class="play" :class="{ disabled: item.lockFlag }" @click="item.lockFlag === true || handlePaly(item.id)">查看</div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script setup lang="ts">
  42. import { useDataDetailList } from "./useData"
  43. const { handleGetDetailList, loading, listDetailData, listData, pageNum, handlePage } = useDataDetailList()
  44. import router from "@/router"
  45. const props = defineProps<{
  46. modalData: {
  47. id: string
  48. }
  49. }>()
  50. const emits = defineEmits<{
  51. (e: "onClose"): void
  52. }>()
  53. handleGetDetailList(props.modalData.id)
  54. function close() {
  55. emits("onClose")
  56. }
  57. function handlePaly(id: string) {
  58. const url = router.resolve({
  59. name: "coursewarePlay",
  60. params: { id }
  61. }).href
  62. window.open(url, "_blank")
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .chooseDialog {
  67. width: 100%;
  68. height: 100%;
  69. padding: 40px;
  70. .close {
  71. position: absolute;
  72. top: -14px;
  73. right: -16px;
  74. width: 42px;
  75. height: 44px;
  76. cursor: pointer;
  77. background: url("@/img/useDialogConfirm/close.png") no-repeat;
  78. &:hover {
  79. background: url("@/img/useDialogConfirm/closeHover.png") no-repeat;
  80. background-size: cover;
  81. }
  82. }
  83. .chooseCon {
  84. width: 100%;
  85. height: 100%;
  86. display: flex;
  87. position: relative;
  88. .imgMid {
  89. position: absolute;
  90. left: 50%;
  91. top: 50%;
  92. transform: translate(-50%, -50%);
  93. z-index: 1;
  94. }
  95. .chooseBox {
  96. width: 50%;
  97. height: 100%;
  98. background: #f6d7c1;
  99. box-shadow: 0px 2px 3px 0px #a05400;
  100. border-radius: 17px;
  101. padding: 5px;
  102. position: relative;
  103. &:nth-child(2) {
  104. .operate {
  105. left: -30px;
  106. border-radius: 6px 0px 0px 6px;
  107. }
  108. &:hover .operate {
  109. opacity: 1;
  110. }
  111. }
  112. &:nth-child(3) {
  113. margin-left: 10px;
  114. .operate {
  115. right: -30px;
  116. border-radius: 0px 6px 6px 0px;
  117. }
  118. &:hover .operate {
  119. opacity: 1;
  120. }
  121. }
  122. .operate {
  123. width: 30px;
  124. height: 68px;
  125. background: #fffefb;
  126. position: absolute;
  127. top: 50%;
  128. transform: translate(0, -50%);
  129. cursor: pointer;
  130. display: flex;
  131. align-items: center;
  132. justify-content: center;
  133. transition: opacity 0.28s;
  134. opacity: 0;
  135. &:hover {
  136. background-color: #edeff0;
  137. }
  138. }
  139. .chooseList {
  140. width: 100%;
  141. height: 100%;
  142. background: #fdf7f0;
  143. border-radius: 17px;
  144. padding: 0 40px 0 30px;
  145. overflow: hidden;
  146. .listItem {
  147. margin-top: 12px;
  148. padding: 10px 0;
  149. display: flex;
  150. justify-content: space-between;
  151. align-items: center;
  152. border-bottom: 1px solid #eaeaea;
  153. &:first-child {
  154. margin-top: 32px;
  155. }
  156. &:last-child {
  157. border-bottom: none;
  158. }
  159. .img {
  160. flex-shrink: 0;
  161. width: 35px;
  162. height: 40%;
  163. position: relative;
  164. & > img:nth-child(1) {
  165. width: 100%;
  166. }
  167. & > img:nth-child(2) {
  168. position: absolute;
  169. left: 0;
  170. top: 0;
  171. z-index: 1;
  172. }
  173. }
  174. .nameCon {
  175. margin-left: 7px;
  176. flex-grow: 1;
  177. .name {
  178. font-weight: 600;
  179. font-size: 16px;
  180. color: #333333;
  181. line-height: 22px;
  182. }
  183. .text {
  184. font-weight: 400;
  185. font-size: 12px;
  186. color: #777777;
  187. line-height: 17px;
  188. }
  189. }
  190. .play {
  191. flex-shrink: 0;
  192. width: 64px;
  193. height: 24px;
  194. background: linear-gradient(180deg, #ffab71 0%, #ff6e45 100%);
  195. border-radius: 12px;
  196. line-height: 24px;
  197. text-align: center;
  198. font-weight: 500;
  199. font-size: 12px;
  200. color: #ffffff;
  201. letter-spacing: 1px;
  202. cursor: pointer;
  203. &:hover {
  204. opacity: $opacity-hover;
  205. }
  206. &.disabled {
  207. background: linear-gradient(180deg, #d3d3d3 0%, #b5b5b5 100%);
  208. cursor: not-allowed;
  209. &:hover {
  210. opacity: 1;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. }
  217. }
  218. }
  219. </style>
  220. <style lang="scss">
  221. .modalFrame.chooseDialog {
  222. --modalFrameTitHeight: 0px;
  223. .modalFrameTitle {
  224. display: none !important;
  225. }
  226. .modalFrameBox {
  227. background: url("@/img/cloudTextbooks/bg.png") no-repeat;
  228. background-size: cover;
  229. box-shadow: none;
  230. }
  231. }
  232. </style>