jt-popup.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <script setup>
  2. import {
  3. Store
  4. } from '@/store/index';
  5. store = Store();
  6. </script>
  7. <template>
  8. <!-- 弹出框组件 -->
  9. <div :class="['popup-main',animationClass]" v-show="isshow" :isEmit="isEmit" id="popup"
  10. :style="{height:height,width:width,top:top,right:right,minWidth:minWidth}" ref="popup">
  11. <div class="borderstyle" :style="{height:height}">
  12. <!-- <div class="angle-border-blue left-top-border"></div> -->
  13. <!-- <div class="angle-border-blue right-top-border"></div> -->
  14. <div class="angle-border left-bottom-border"></div>
  15. <div class="angle-border right-bottom-border"></div>
  16. <div :class="longheader?'header long':'header'">
  17. <div style="width: 20rem;"></div>
  18. <span>{{title}}</span>
  19. <i :class="store.userport == 'PC'?'iconfont icon-youjiantou':'iconfont icon-youjiantou'"
  20. @click="closebasicLayer" style="font-size: 16rem;" />
  21. </div>
  22. <div class="middle">
  23. <slot></slot>
  24. </div>
  25. <div v-if="showfooter" class="footers"></div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. let store = undefined;
  31. export default {
  32. data() {
  33. return {
  34. isshow: false,
  35. title: '',
  36. }
  37. },
  38. // props: ['height', 'title', 'width', 'isEmit', 'animationClass'],
  39. props: {
  40. height: { //高度单位rem
  41. type: String,
  42. default: ''
  43. },
  44. title: { //标题
  45. type: String,
  46. default: ""
  47. },
  48. right: { //初始化位置,右侧距离
  49. type: String,
  50. default: ""
  51. },
  52. top: { //初始化位置,顶部距离
  53. type: String,
  54. default: ""
  55. },
  56. width: { //的宽度
  57. type: String,
  58. default: ""
  59. },
  60. isEmit: { //是否有回调函数,用于清除功能
  61. type: Boolean,
  62. default: false
  63. },
  64. animationClass: { //组件弹出方向,slide-right右,slide-left左,slide-bottom下
  65. type: String,
  66. default: 'slide-right'
  67. },
  68. showfooter: { //底部动态文字是否展示
  69. type: Boolean,
  70. default: true
  71. },
  72. minWidth: { //最小宽度
  73. type: String,
  74. default: ""
  75. },
  76. longheader: { //是否是长背景图
  77. type: String,
  78. default: 0
  79. },
  80. top:{//距离顶端
  81. type:String,
  82. default:""
  83. }
  84. },
  85. methods: {
  86. closebasicLayer() {
  87. console.log("animationClass", this.animationClass)
  88. let style = document.styleSheets[0];
  89. if (this.animationClass === "slide-right") {
  90. style.insertRule(
  91. "@keyframes move-right {0% {opacity: 1;transform: translateX(-100%)}100% {opacity: 1;transform: translateX(0%)}}",
  92. 10);
  93. style.insertRule(
  94. "@keyframes slide-right {0% {opacity: 1;transform: translateX(100%)}100% {opacity: 1;transform: translateX(0%)}}",
  95. 11);
  96. let popup = this.$refs.popup
  97. popup.style.right = '-400rem'
  98. popup.style.animation = 'move-right 0.4s linear';
  99. setTimeout(res => {
  100. popup.style.animation = 'slide-right 0.4s linear'
  101. this.isshow = false
  102. }, 400)
  103. } else if (this.animationClass === "fadein-left") {
  104. style.insertRule(
  105. "@keyframes move-rightL {0% {opacity: 1;transform: translateX(0%)}100% {opacity: 1;transform: translateX(-100%)}}",
  106. 8);
  107. style.insertRule(
  108. "@keyframes slide-right {0% {opacity: 1;transform: translateX(100%)}100% {opacity: 1;transform: translateX(0%)}}",
  109. 9);
  110. style.insertRule(
  111. "@keyframes slide-left {0% {opacity: 1;transform: translateX(-100%)}100% {opacity: 1;transform: translateX(0%)}}",
  112. 10);
  113. let popup = this.$refs.popup
  114. // popup.style.left = '-400rem'
  115. popup.style.animation = 'move-rightL 0.4s linear';
  116. setTimeout(res => {
  117. popup.style.animation = 'slide-left 0.4s linear'
  118. this.isshow = false
  119. }, 400)
  120. }
  121. if (this.isEmit) {
  122. this.$emit('closeJTPopup');
  123. }
  124. }
  125. },
  126. mounted() {
  127. console.log('store', this.showfooter)
  128. }
  129. }
  130. </script>
  131. <style scoped lang="scss">
  132. @charset "UTF-8";
  133. @font-face {
  134. font-family: "TTTGB-Medium";
  135. src: url("@/assets/fonts/fonts/TTTGB-Medium.ttf") format("truetype"),
  136. url("@/assets/fonts/fonts/TTTGB-Medium.eot") format("embedded-opentype"),
  137. url("@/assets/fonts/fonts/TTTGB-Medium.svg") format("svg");
  138. font-weight: normal;
  139. font-style: normal;
  140. }
  141. .popup-main {
  142. position: absolute;
  143. right: 26rem;
  144. top: 125rem;
  145. // height: 490rem;
  146. height: calc(100% - 200rem);
  147. width: 350rem;
  148. // padding: 10rem;
  149. // z-index: 1000;
  150. font-size: 16rem;
  151. color: white;
  152. user-select: none;
  153. animation-name: slide-right;
  154. animation-duration: .8s;
  155. //头部背景图
  156. .header {
  157. height: 51rem;
  158. width: calc(100% + 20rem);
  159. background: url('@/assets/images/PopupHeader.png') no-repeat;
  160. background-size: 100% 100%;
  161. margin: -10rem;
  162. margin-bottom: 0rem;
  163. line-height: 51rem;
  164. display: flex;
  165. text-align: left;
  166. i:hover {
  167. cursor: pointer;
  168. }
  169. span {
  170. font-family: "TTTGB-Medium", sans-serif !important;
  171. font-size: 20rem;
  172. flex: 15;
  173. }
  174. i:hover {
  175. cursor: pointer;
  176. }
  177. i {
  178. z-index: 101;
  179. flex: 1;
  180. margin: 0rem 8rem;
  181. font-size: 20rem !important;
  182. text-align: center;
  183. }
  184. }
  185. // .iconfont{
  186. // font-size: 16rem;
  187. // }
  188. //滚动条-鼠标悬浮显示
  189. // .middle {
  190. // height: calc(100% - 71rem);
  191. // width: 100%;
  192. // overflow-y: hidden;
  193. // padding: 15rem 0 0 0;
  194. // }
  195. // .middle:hover{
  196. // overflow-y:auto;
  197. // }
  198. //滚动条一直显示
  199. .middle {
  200. height: calc(100% - 81rem);
  201. width: 100%;
  202. overflow-y: auto;
  203. padding: 15rem 0 0 0;
  204. }
  205. .footers {
  206. position: absolute;
  207. left: 0;
  208. bottom: 0;
  209. height: 30rem;
  210. width: 100%;
  211. line-height: 30rem;
  212. background: url('@/assets/images/footerss.webp') no-repeat center;
  213. opacity: 0.7;
  214. }
  215. /* 四个边角样式 */
  216. .borderstyle {
  217. position: relative;
  218. width: 100%;
  219. // height: 490rem;
  220. height: calc(100vh - 200rem);
  221. padding: 10rem;
  222. border: 1rem solid #008aff70 !important;
  223. background-color: rgba(5, 45, 115, 0.7) !important;
  224. box-shadow: 0 4rem 15rem 1rem #02213bb3;
  225. .angle-border {
  226. position: absolute;
  227. width: 12rem;
  228. height: 12rem;
  229. }
  230. .angle-border-blue {
  231. position: absolute;
  232. width: 70rem;
  233. height: 30rem;
  234. }
  235. .left-top-border {
  236. top: -2rem;
  237. left: -2rem;
  238. border-left: 2rem solid #008affdd;
  239. border-top: 2rem solid #008affdd;
  240. }
  241. .right-top-border {
  242. top: -2rem;
  243. right: -2rem;
  244. border-right: 2rem solid #008affdd;
  245. border-top: 2rem solid #008affdd;
  246. }
  247. .left-bottom-border {
  248. bottom: -2rem;
  249. left: -2rem;
  250. border-bottom: 2rem solid #FFFFFF;
  251. border-left: 2rem solid #FFFFFF;
  252. }
  253. .right-bottom-border {
  254. bottom: -2rem;
  255. right: -2rem;
  256. border-right: 2rem solid #FFFFFF;
  257. border-bottom: 2rem solid #FFFFFF;
  258. }
  259. }
  260. }
  261. .long {
  262. background: url('@/assets/images/longheader.png') no-repeat !important;
  263. background-size: 100% 100% !important;
  264. }
  265. // .fadein-right {
  266. // animation-name: slide-right;
  267. // animation-duration: .8s;
  268. // }
  269. @keyframes slide-right {
  270. 0% {
  271. opacity: 0;
  272. transform: translateX(100%)
  273. }
  274. 100% {
  275. opacity: 1;
  276. transform: translateX(0)
  277. }
  278. }
  279. @keyframes slide-bottom {
  280. 0% {
  281. opacity: 0;
  282. transform: translateY(-100%)
  283. }
  284. 100% {
  285. opacity: 1;
  286. transform: translateY(0)
  287. }
  288. }
  289. @keyframes move-right {
  290. 0% {
  291. opacity: 0;
  292. transform: translateX(50%)
  293. }
  294. 100% {
  295. opacity: 1;
  296. transform: translateX(100%)
  297. }
  298. }
  299. .fadein-left {
  300. animation-name: slide-left;
  301. animation-duration: .8s;
  302. left: 40rem;
  303. }
  304. @keyframes slide-left {
  305. from {
  306. opacity: 0;
  307. transform: translate3d(-100%, 0, 0);
  308. }
  309. to {
  310. opacity: 1;
  311. transform: none;
  312. }
  313. }
  314. </style>