jt-popup2.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  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: fixed;
  139. pointer-events: auto;
  140. left: 10rem;
  141. top: 95rem;
  142. margin-top: 15rem;
  143. height: calc((100% - 165rem) / 3);
  144. width: 350rem;
  145. // padding: 10rem;
  146. z-index: 11;
  147. font-size: 16rem;
  148. color: white;
  149. user-select: none;
  150. animation-name: slide-left;
  151. animation-duration: .8s;
  152. // background-color: rgba(5, 45, 115, 0.7) !important;
  153. //头部背景图
  154. .header {
  155. height: 35rem;
  156. // width: 350rem;
  157. background: url('@/assets/images/tcheader.png') no-repeat;
  158. background-size: 100% 100%;
  159. margin: -10rem;
  160. margin-bottom: 0rem;
  161. line-height: 35rem;
  162. display: flex;
  163. text-align: left;
  164. i:hover {
  165. cursor: pointer;
  166. }
  167. span {
  168. font-family: "TTTGB-Medium", sans-serif !important;
  169. font-size: 16rem;
  170. // flex: 15;
  171. }
  172. i:hover {
  173. cursor: pointer;
  174. }
  175. i {
  176. z-index: 101;
  177. flex: 1;
  178. margin: 0rem 8rem;
  179. font-size: 20rem !important;
  180. text-align: center;
  181. }
  182. }
  183. // .iconfont{
  184. // font-size: 16rem;
  185. // }
  186. //滚动条-鼠标悬浮显示
  187. // .middle {
  188. // height: calc(100% - 71rem);
  189. // width: 100%;
  190. // overflow-y: hidden;
  191. // padding: 15rem 0 0 0;
  192. // }
  193. // .middle:hover{
  194. // overflow-y:auto;
  195. // }
  196. //滚动条一直显示
  197. .middle {
  198. height: calc(100% - 35rem);
  199. width: 100%;
  200. overflow-y: scroll;
  201. padding: 0 0 0 0;
  202. }
  203. .middle::-webkit-scrollbar {
  204. width: 0px;
  205. background-color: rgba(0,0,0,0);
  206. // 滚动条整体样式
  207. // 高宽分别对应横竖滚动条的尺寸
  208. }
  209. .middle::-webkit-scrollbar-thumb {
  210. // 滚动条里面小方块
  211. }
  212. .middle::-webkit-scrollbar-track {
  213. // 滚动条底层颜色
  214. }
  215. .footers {
  216. position: absolute;
  217. left: 0;
  218. bottom: 0;
  219. height: 30rem;
  220. width: 100%;
  221. line-height: 30rem;
  222. background: url('@/assets/images/footerss.webp') no-repeat center;
  223. opacity: 0.7;
  224. }
  225. /* 四个边角样式 */
  226. .borderstyle {
  227. position: relative;
  228. width: 100%;
  229. // height: 490rem;
  230. height: calc(100vh - 200rem);
  231. padding: 10rem;
  232. border: 1rem solid #008aff70 !important;
  233. background-color: rgba(5, 45, 115, 0.7) !important;
  234. box-shadow: 0 4rem 15rem 1rem #02213bb3;
  235. .angle-border {
  236. position: absolute;
  237. width: 12rem;
  238. height: 12rem;
  239. }
  240. .angle-border-blue {
  241. position: absolute;
  242. width: 70rem;
  243. height: 30rem;
  244. }
  245. .left-top-border {
  246. top: -2rem;
  247. left: -2rem;
  248. border-left: 2rem solid #008affdd;
  249. border-top: 2rem solid #008affdd;
  250. }
  251. .right-top-border {
  252. top: -2rem;
  253. right: -2rem;
  254. border-right: 2rem solid #008affdd;
  255. border-top: 2rem solid #008affdd;
  256. }
  257. .left-bottom-border {
  258. bottom: -2rem;
  259. left: -2rem;
  260. border-bottom: 2rem solid #FFFFFF;
  261. border-left: 2rem solid #FFFFFF;
  262. }
  263. .right-bottom-border {
  264. bottom: -2rem;
  265. right: -2rem;
  266. border-right: 2rem solid #FFFFFF;
  267. border-bottom: 2rem solid #FFFFFF;
  268. }
  269. }
  270. }
  271. .long {
  272. background: url('@/assets/images/longheader.png') no-repeat !important;
  273. background-size: 100% 100% !important;
  274. }
  275. // .fadein-right {
  276. // animation-name: slide-right;
  277. // animation-duration: .8s;
  278. // }
  279. @keyframes slide-left {
  280. 0% {
  281. opacity: 0;
  282. transform: translateX(-100%)
  283. }
  284. 100% {
  285. opacity: 1;
  286. transform: translateX(0)
  287. }
  288. }
  289. @keyframes slide-bottom {
  290. 0% {
  291. opacity: 0;
  292. transform: translateY(-100%)
  293. }
  294. 100% {
  295. opacity: 1;
  296. transform: translateY(0)
  297. }
  298. }
  299. @keyframes move-right {
  300. 0% {
  301. opacity: 0;
  302. transform: translateX(50%)
  303. }
  304. 100% {
  305. opacity: 1;
  306. transform: translateX(100%)
  307. }
  308. }
  309. .fadein-left {
  310. animation-name: slide-left;
  311. animation-duration: .8s;
  312. left: 40rem;
  313. }
  314. @keyframes slide-left {
  315. from {
  316. opacity: 0;
  317. transform: translate3d(-100%, 0, 0);
  318. }
  319. to {
  320. opacity: 1;
  321. transform: none;
  322. }
  323. }
  324. </style>