Level.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <van-overlay ref="overLay" :show="show" @click="close" z-index="99">
  3. <div class="box" ref="box">
  4. <van-image width="260" height="220" :src="levelInfo.bg" fit="contain" />
  5. <div class="box-top">
  6. <div class="box-title" :style="{ color: levelInfo.color, borderColor: levelInfo.color }">
  7. 恭喜您 获得新勋章
  8. </div>
  9. <div class="icon">
  10. <van-image :src="levelInfo.icon" width="114" height="114" />
  11. <span class="text2" :style="{ color: levelInfo.color }">{{ levelInfo.level }}</span>
  12. </div>
  13. <div class="text3" :style="{ color: levelInfo.color, backgroundColor: levelInfo.color + '23' }">
  14. {{ levelInfo.realm }}
  15. </div>
  16. <div class="text1" :style="{ color: levelInfo.color }">{{ levelInfo.title }}</div>
  17. </div>
  18. <div class="box-content">
  19. <div class="text1">
  20. 您已升级至<span :style="{ color: levelInfo.color }">V{{ levelInfo.level }}</span
  21. >,感谢您对RAEX宇宙的信任。愿RAEX宇宙的荣光普照河山!!
  22. </div>
  23. <div class="btn">
  24. <van-button :color="levelInfo.color" block round>领取</van-button>
  25. </div>
  26. </div>
  27. </div>
  28. </van-overlay>
  29. <div v-if="isLogin && !show && levelInfo.icon" ref="medal" class="medal-info" @click="$router.push('/mineLevel')">
  30. <div class="medal-icon">
  31. <van-image :src="levelInfo.icon" width="28" height="28" />
  32. <div class="text1" :style="{ color: levelInfo.color1 || levelInfo.color }">{{ levelInfo.level }}</div>
  33. </div>
  34. <div class="medal-text">
  35. <div
  36. class="text1"
  37. :style="{
  38. color: levelInfo.color1 || levelInfo.color,
  39. backgroundColor: (levelInfo.color1 || levelInfo.color) + '33'
  40. }"
  41. >
  42. {{ levelInfo.title }}
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import level from '../../mixins/level';
  49. export default {
  50. data() {
  51. return {
  52. show: false
  53. };
  54. },
  55. mixins: [level],
  56. mounted() {
  57. // this.$nextTick(() => {
  58. // document.getElementById('app').appendChild(this.$refs.overLay);
  59. // });
  60. },
  61. methods: {
  62. changeLevel(level) {
  63. if (level >= 10) {
  64. this.show = true;
  65. }
  66. this.$http.post('/user/update', {
  67. ...this.$store.state.userInfo,
  68. level: level
  69. });
  70. },
  71. close() {
  72. this.addClass('box', 'zoomOutUp', false, 200).then(() => {
  73. this.show = false;
  74. this.$nextTick(() => {
  75. this.$refs.medal.className += ' flipInX';
  76. });
  77. });
  78. }
  79. }
  80. };
  81. </script>
  82. <style lang="less" scoped>
  83. .box {
  84. background-color: @bg;
  85. border-radius: 16px;
  86. overflow: hidden;
  87. top: 50%;
  88. left: 50%;
  89. width: 260px;
  90. height: 338px;
  91. position: absolute;
  92. margin-top: -169px;
  93. margin-left: -130px;
  94. .box-content {
  95. padding: 16px 23px 20px;
  96. .text1 {
  97. font-size: 12px;
  98. line-height: 17px;
  99. text-align: center;
  100. span {
  101. font-weight: bold;
  102. }
  103. }
  104. }
  105. .btn {
  106. padding: 16px 40px 0;
  107. }
  108. }
  109. .box-top {
  110. position: absolute;
  111. width: 260px;
  112. height: 220px;
  113. top: 0;
  114. left: 0;
  115. .flex-col();
  116. align-items: center;
  117. justify-content: center;
  118. .text3 {
  119. border-radius: 2px;
  120. padding: 0 9px;
  121. margin-top: 6px;
  122. font-size: 12px;
  123. line-height: 20px;
  124. }
  125. .text1 {
  126. font-size: 12px;
  127. line-height: 17px;
  128. margin-top: 2px;
  129. }
  130. }
  131. .box-title {
  132. font-size: 14px;
  133. font-weight: bold;
  134. line-height: 24px;
  135. vertical-align: middle;
  136. &::after,
  137. &::before {
  138. display: inline-block;
  139. width: 30px;
  140. content: '';
  141. border-top: 1px solid;
  142. vertical-align: middle;
  143. margin: 10px;
  144. }
  145. }
  146. .icon {
  147. position: relative;
  148. margin-top: 9px;
  149. .text2 {
  150. font-size: 34px;
  151. font-weight: bold;
  152. font-family: AlibabaPuHuiTi-Bold, AlibabaPuHuiTi;
  153. line-height: 34px;
  154. position: absolute;
  155. left: 52px;
  156. top: 38px;
  157. }
  158. }
  159. .medal-info {
  160. .flex();
  161. .medal-icon {
  162. flex-shrink: 0;
  163. position: relative;
  164. z-index: 1;
  165. transform: translateY(2px);
  166. .van-image {
  167. display: block;
  168. }
  169. .text1 {
  170. position: absolute;
  171. left: 10px;
  172. top: 8px;
  173. font-size: 12px;
  174. transform: scale(0.8);
  175. line-height: 12px;
  176. font-weight: bold;
  177. text-align: center;
  178. display: block;
  179. min-width: 14px;
  180. // min-height: 12px;
  181. font-weight: bold;
  182. letter-spacing: -1px;
  183. }
  184. }
  185. .medal-text {
  186. .flex-col();
  187. align-items: center;
  188. justify-content: center;
  189. transform: scale(0.8) translateX(-18px);
  190. z-index: 0;
  191. .text1 {
  192. font-size: 12px;
  193. border-radius: 2px;
  194. line-height: 16px;
  195. padding: 0 4px 0 6px;
  196. border-radius: 2px;
  197. text-align: center;
  198. position: relative;
  199. display: block;
  200. overflow: hidden;
  201. &::after {
  202. content: '';
  203. position: absolute;
  204. top: 0;
  205. left: 0;
  206. right: 0;
  207. bottom: 0;
  208. z-index: -1;
  209. background-color: #fff;
  210. }
  211. }
  212. }
  213. }
  214. .van-overlay {
  215. top: -103px;
  216. width: 100vw;
  217. height: 100vh;
  218. left: -16px;
  219. width: 100vw;
  220. height: 100vh;
  221. }
  222. </style>