jt-popup3.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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: 35rem;"></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: true,
  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. },
  81. methods: {
  82. closebasicLayer() {
  83. console.log("animationClass", this.animationClass)
  84. let style = document.styleSheets[0];
  85. if (this.animationClass === "slide-right") {
  86. style.insertRule(
  87. "@keyframes move-right {0% {opacity: 1;transform: translateX(-100%)}100% {opacity: 1;transform: translateX(0%)}}",
  88. 10);
  89. style.insertRule(
  90. "@keyframes slide-right {0% {opacity: 1;transform: translateX(100%)}100% {opacity: 1;transform: translateX(0%)}}",
  91. 11);
  92. let popup = this.$refs.popup
  93. popup.style.right = '-400rem'
  94. popup.style.animation = 'move-right 0.4s linear';
  95. setTimeout(res => {
  96. popup.style.animation = 'slide-right 0.4s linear'
  97. this.isshow = false
  98. }, 400)
  99. } else if (this.animationClass === "fadein-left") {
  100. style.insertRule(
  101. "@keyframes move-rightL {0% {opacity: 1;transform: translateX(0%)}100% {opacity: 1;transform: translateX(-100%)}}",
  102. 8);
  103. style.insertRule(
  104. "@keyframes slide-right {0% {opacity: 1;transform: translateX(100%)}100% {opacity: 1;transform: translateX(0%)}}",
  105. 9);
  106. style.insertRule(
  107. "@keyframes slide-left {0% {opacity: 1;transform: translateX(-100%)}100% {opacity: 1;transform: translateX(0%)}}",
  108. 10);
  109. let popup = this.$refs.popup
  110. // popup.style.left = '-400rem'
  111. popup.style.animation = 'move-rightL 0.4s linear';
  112. setTimeout(res => {
  113. popup.style.animation = 'slide-left 0.4s linear'
  114. this.isshow = false
  115. }, 400)
  116. }
  117. if (this.isEmit) {
  118. this.$emit('closeJTPopup');
  119. }
  120. }
  121. },
  122. mounted() {
  123. console.log('store', this.showfooter)
  124. }
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. @charset "UTF-8";
  129. @font-face {
  130. font-family: "TTTGB-Medium";
  131. src: url("@/assets/fonts/fonts/TTTGB-Medium.ttf") format("truetype"),
  132. url("@/assets/fonts/fonts/TTTGB-Medium.eot") format("embedded-opentype"),
  133. url("@/assets/fonts/fonts/TTTGB-Medium.svg") format("svg");
  134. font-weight: normal;
  135. font-style: normal;
  136. }
  137. .popup-main {
  138. position: absolute;
  139. right: 10rem;
  140. top: 90rem;
  141. // height: 490rem;
  142. height: calc((100% - 115rem) / 3);
  143. width: 350rem;
  144. // padding: 10rem;
  145. z-index: 11;
  146. font-size: 16rem;
  147. color: white;
  148. user-select: none;
  149. animation-name: slide-left;
  150. animation-duration: .8s;
  151. // background-color: rgba(5, 45, 115, 0.7) !important;
  152. //头部背景图
  153. .header {
  154. height: 35rem;
  155. // width: calc(100% + 20rem);
  156. background: url('@/assets/images/tcheader.png') no-repeat;
  157. background-size: 100% 100%;
  158. margin: -10rem;
  159. margin-bottom: 0rem;
  160. line-height: 35rem;
  161. display: flex;
  162. text-align: left;
  163. i:hover {
  164. cursor: pointer;
  165. }
  166. span {
  167. font-family: "TTTGB-Medium", sans-serif !important;
  168. font-size: 16rem;
  169. // flex: 15;
  170. }
  171. i:hover {
  172. cursor: pointer;
  173. }
  174. i {
  175. z-index: 101;
  176. flex: 1;
  177. margin: 0rem 8rem;
  178. font-size: 20rem !important;
  179. text-align: center;
  180. }
  181. }
  182. // .iconfont{
  183. // font-size: 16rem;
  184. // }
  185. //滚动条-鼠标悬浮显示
  186. // .middle {
  187. // height: calc(100% - 71rem);
  188. // width: 100%;
  189. // overflow-y: hidden;
  190. // padding: 15rem 0 0 0;
  191. // }
  192. // .middle:hover{
  193. // overflow-y:auto;
  194. // }
  195. //滚动条一直显示
  196. .middle {
  197. height: calc(100% - 81rem);
  198. width: 100%;
  199. overflow-y: auto;
  200. padding: 15rem 0 0 0;
  201. }
  202. .footers {
  203. position: absolute;
  204. left: 0;
  205. bottom: 0;
  206. height: 30rem;
  207. width: 100%;
  208. line-height: 30rem;
  209. background: url('@/assets/images/footerss.webp') no-repeat center;
  210. opacity: 0.7;
  211. }
  212. /* 四个边角样式 */
  213. .borderstyle {
  214. position: relative;
  215. width: 100%;
  216. // height: 490rem;
  217. height: calc(100vh - 200rem);
  218. padding: 10rem;
  219. border: 1rem solid #008aff70 !important;
  220. background-color: rgba(5, 45, 115, 0.7) !important;
  221. box-shadow: 0 4rem 15rem 1rem #02213bb3;
  222. .angle-border {
  223. position: absolute;
  224. width: 12rem;
  225. height: 12rem;
  226. }
  227. .angle-border-blue {
  228. position: absolute;
  229. width: 70rem;
  230. height: 30rem;
  231. }
  232. .left-top-border {
  233. top: -2rem;
  234. left: -2rem;
  235. border-left: 2rem solid #008affdd;
  236. border-top: 2rem solid #008affdd;
  237. }
  238. .right-top-border {
  239. top: -2rem;
  240. right: -2rem;
  241. border-right: 2rem solid #008affdd;
  242. border-top: 2rem solid #008affdd;
  243. }
  244. .left-bottom-border {
  245. bottom: -2rem;
  246. left: -2rem;
  247. border-bottom: 2rem solid #FFFFFF;
  248. border-left: 2rem solid #FFFFFF;
  249. }
  250. .right-bottom-border {
  251. bottom: -2rem;
  252. right: -2rem;
  253. border-right: 2rem solid #FFFFFF;
  254. border-bottom: 2rem solid #FFFFFF;
  255. }
  256. }
  257. }
  258. .long {
  259. background: url('@/assets/images/longheader.png') no-repeat !important;
  260. background-size: 100% 100% !important;
  261. }
  262. // .fadein-right {
  263. // animation-name: slide-right;
  264. // animation-duration: .8s;
  265. // }
  266. @keyframes slide-left {
  267. 0% {
  268. opacity: 0;
  269. transform: translateX(-100%)
  270. }
  271. 100% {
  272. opacity: 1;
  273. transform: translateX(0)
  274. }
  275. }
  276. @keyframes slide-bottom {
  277. 0% {
  278. opacity: 0;
  279. transform: translateY(-100%)
  280. }
  281. 100% {
  282. opacity: 1;
  283. transform: translateY(0)
  284. }
  285. }
  286. @keyframes move-right {
  287. 0% {
  288. opacity: 0;
  289. transform: translateX(50%)
  290. }
  291. 100% {
  292. opacity: 1;
  293. transform: translateX(100%)
  294. }
  295. }
  296. .fadein-left {
  297. animation-name: slide-left;
  298. animation-duration: .8s;
  299. left: 40rem;
  300. }
  301. @keyframes slide-left {
  302. from {
  303. opacity: 0;
  304. transform: translate3d(-100%, 0, 0);
  305. }
  306. to {
  307. opacity: 1;
  308. transform: none;
  309. }
  310. }
  311. </style>