love.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="app-page bg-white">
  3. <!-- 情侣信息 -->
  4. <view class="lover-wrap" :style="[loveWrapStyle]">
  5. <view class="lover-card">
  6. <view class="boy">
  7. <image class="avatar" :src="loveConfig.boy.avatar" mode="aspectFit"></image>
  8. <view class="name">{{ loveConfig.boy.name }}</view>
  9. </view>
  10. <image class="like" :src="loveConfig.loveImageUrl" mode="scaleToFill"></image>
  11. <view class="girl">
  12. <image class="avatar" :src="loveConfig.girl.avatar" mode="aspectFit"></image>
  13. <view class="name">{{ loveConfig.girl.name }}</view>
  14. </view>
  15. </view>
  16. <image class="wave-image" :src="loveConfig.waveImageUrl" mode="scaleToFill"></image>
  17. </view>
  18. <!-- 恋爱记时 -->
  19. <view class="love-time-wrap">
  20. <view class="title">{{ loveConfig.timeTitle }}</view>
  21. <view class="content">
  22. <text class="text">
  23. <text class="number">{{ loveDayCount.d }}</text>
  24. </text>
  25. <text class="text">
  26. <text class="number">{{ loveDayCount.h }}</text>
  27. 小时
  28. </text>
  29. <text class="text">
  30. <text class="number">{{ loveDayCount.m }}</text>
  31. 分钟
  32. </text>
  33. <text class="text">
  34. <text class="number">{{ loveDayCount.s }}</text>
  35. </text>
  36. </view>
  37. </view>
  38. <!-- 功能导航 -->
  39. <view class="list-wrap">
  40. <block v-for="(nav, index) in loveConfig.nav" :key="index">
  41. <view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)">
  42. <view class="left"><image class="icon" :src="nav.iconImageUrl" mode="aspectFit"></image></view>
  43. <view class="right">
  44. <view class="name">{{ nav.title }}</view>
  45. <view class="desc">{{ nav.desc }}</view>
  46. </view>
  47. </view>
  48. </block>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import LoveConfig from '@/config/love.config.js';
  54. export default {
  55. data() {
  56. return {
  57. loveConfig: LoveConfig,
  58. loveDayTimer: null,
  59. loveDayCount: {
  60. d: 0,
  61. h: 0,
  62. m: 0,
  63. s: 0
  64. }
  65. };
  66. },
  67. computed: {
  68. loveWrapStyle() {
  69. return {
  70. backgroundImage: `url(${this.loveConfig.bgImageUrl})`
  71. };
  72. }
  73. },
  74. onLoad() {
  75. this.fnSetPageTitle('恋爱日记');
  76. this.fnInitLoveDayCount();
  77. },
  78. methods: {
  79. fnInitLoveDayCount() {
  80. clearTimeout(this.loveDayTimer);
  81. const _countDownFn = () => {
  82. this.loveDayTimer = setTimeout(_countDownFn, 1000);
  83. const formatStartDate = this.loveConfig.loveStartDate.replace(/-/g, '/');
  84. const start = new Date(formatStartDate),
  85. now = new Date();
  86. const T = now.getTime() - start.getTime();
  87. const i = 24 * 60 * 60 * 1000;
  88. const d = T / i;
  89. const D = Math.floor(d);
  90. const h = (d - D) * 24;
  91. const H = Math.floor(h);
  92. const m = (h - H) * 60;
  93. const M = Math.floor(m);
  94. const s = (m - M) * 60;
  95. const S = Math.floor(s);
  96. this.loveDayCount = {
  97. d: D,
  98. h: H,
  99. m: M,
  100. s: S
  101. };
  102. };
  103. _countDownFn();
  104. },
  105. fnToPage(pageName) {
  106. uni.navigateTo({
  107. url: `/pagesA/love/${pageName}`
  108. });
  109. }
  110. }
  111. };
  112. </script>
  113. <style scoped lang="scss">
  114. .app-page {
  115. width: 100vw;
  116. min-height: 100vh;
  117. background: linear-gradient(
  118. -45deg,
  119. rgba(247, 149, 51, 0.1),
  120. rgba(243, 112, 85, 0.1) 15%,
  121. rgba(239, 78, 123, 0.1) 30%,
  122. rgba(161, 102, 171, 0.1) 44%,
  123. rgba(80, 115, 184, 0.1) 58%,
  124. rgba(16, 152, 173, 0.1) 72%,
  125. rgba(7, 179, 155, 0.1) 86%,
  126. rgba(109, 186, 130, 0.1)
  127. );
  128. }
  129. .lover-wrap {
  130. position: relative;
  131. width: 100vw;
  132. height: 50vh;
  133. display: flex;
  134. align-items: center;
  135. justify-content: center;
  136. background-size: cover;
  137. background-repeat: no-repeat;
  138. background-position: 50% 50%;
  139. &::before {
  140. position: absolute;
  141. left: 0;
  142. top: 0;
  143. right: 0;
  144. bottom: 0;
  145. content: '';
  146. background-color: rgba(255, 255, 255, 0.1);
  147. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAKUlEQVQImU3IMREAIAgAwJfNkQCEsH8cijjpMf6vnXlQaIiJFx+omEBfmqIEZLe2jzcAAAAASUVORK5CYII=);
  148. z-index: 0;
  149. backdrop-filter: blur(4rpx);
  150. overflow: hidden;
  151. }
  152. &::after {
  153. content: '';
  154. position: absolute;
  155. left: 0;
  156. bottom: -60rpx;
  157. width: 100vw;
  158. height: 60rpx;
  159. background-image: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
  160. }
  161. .lover-card {
  162. position: absolute;
  163. left: 50%;
  164. top: 58%;
  165. transform: translate(-50%, -50%);
  166. width: 90vw;
  167. display: flex;
  168. align-items: center;
  169. justify-content: space-around;
  170. border-radius: 12rpx;
  171. z-index: 2;
  172. .avatar {
  173. width: 180rpx;
  174. height: 180rpx;
  175. border-radius: 50%;
  176. box-sizing: border-box;
  177. // border: 8rpx solid transparent;
  178. // border: 8rpx solid rgba(255, 255, 255, 0.7) !important;
  179. border: 8rpx solid rgba(255, 255, 255, 1) !important;
  180. }
  181. .name {
  182. font-size: 32rpx;
  183. font-weight: bold;
  184. color: #ffffff;
  185. text-align: center;
  186. letter-spacing: 2rpx;
  187. }
  188. .boy {
  189. color: #3ab8e4;
  190. .avatar {
  191. border-color: rgba(58, 184, 228, 0.7);
  192. }
  193. }
  194. .girl {
  195. color: #f57ab3;
  196. .avatar {
  197. border-color: rgba(245, 122, 179, 0.7);
  198. }
  199. }
  200. .like {
  201. width: 120rpx;
  202. height: 120rpx;
  203. animation: likeani 1s ease-in-out infinite;
  204. }
  205. }
  206. .wave-image {
  207. width: 100%;
  208. height: 120rpx;
  209. position: absolute;
  210. left: 0;
  211. bottom: 0;
  212. mix-blend-mode: screen;
  213. }
  214. }
  215. .love-time-wrap {
  216. margin-top: 80rpx;
  217. width: 100vw;
  218. display: flex;
  219. flex-direction: column;
  220. align-items: center;
  221. justify-content: center;
  222. .title {
  223. font-size: 46rpx;
  224. letter-spacing: 4rpx;
  225. // background-image: linear-gradient(270deg, #ff4500, #ffa500, #ffd700, #90ee90, #00ffff, #1e90ff, #9370db, #ff69b4, #ff4500);
  226. // -webkit-background-clip: text;
  227. // color: #000;
  228. color: #333;
  229. font-size: 42rpx;
  230. font-weight: bold;
  231. // animation: loveTimeTitleAni 80s linear infinite;
  232. }
  233. .content {
  234. margin-top: 24rpx;
  235. display: flex;
  236. align-items: center;
  237. justify-content: center;
  238. .text {
  239. font-size: 28rpx;
  240. }
  241. .number {
  242. margin: 0 8rpx;
  243. font-size: 46rpx;
  244. // color: #ff69b4;
  245. color: #f83856;
  246. font-weight: bold;
  247. }
  248. }
  249. }
  250. .list-wrap {
  251. margin-top: 75rpx;
  252. display: flex;
  253. flex-direction: column;
  254. align-items: center;
  255. justify-content: center;
  256. box-sizing: border-box;
  257. padding: 0 36rpx;
  258. .list-item {
  259. width: 100%;
  260. display: flex;
  261. align-items: center;
  262. justify-content: space-around;
  263. box-sizing: border-box;
  264. padding: 28rpx 32rpx;
  265. background-color: #ffffff;
  266. border-radius: 50rpx;
  267. margin-bottom: 32rpx;
  268. box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
  269. &:nth-child(1) {
  270. animation: listItemAni1 3s ease-in-out infinite;
  271. }
  272. &:nth-child(2) {
  273. animation: listItemAni1 3s ease-in-out infinite;
  274. animation-delay: 1.5s;
  275. }
  276. &:nth-child(3) {
  277. animation: listItemAni1 3s ease-in-out infinite;
  278. animation-delay: 2s;
  279. }
  280. .left {
  281. width: 120rpx;
  282. height: 120rpx;
  283. .icon {
  284. width: 100%;
  285. height: 100%;
  286. }
  287. }
  288. .right {
  289. flex-grow: 1;
  290. display: flex;
  291. flex-direction: column;
  292. justify-content: center;
  293. box-sizing: border-box;
  294. padding-left: 40rpx;
  295. .name {
  296. font-size: 32rpx;
  297. font-weight: bold;
  298. color: #333333;
  299. }
  300. .desc {
  301. margin-top: 8px;
  302. font-size: 26rpx;
  303. color: #777777;
  304. }
  305. }
  306. }
  307. }
  308. @keyframes likeani {
  309. 0% {
  310. transform: scale(1);
  311. }
  312. 25% {
  313. transform: scale(1.2);
  314. }
  315. 50% {
  316. transform: scale(1.1);
  317. }
  318. 75% {
  319. transform: scale(1.3);
  320. }
  321. 100% {
  322. transform: scale(1);
  323. }
  324. }
  325. @keyframes loveTimeTitleAni {
  326. to {
  327. background-position: -200rem;
  328. }
  329. }
  330. @keyframes listItemAni1 {
  331. 0% {
  332. transform: translateY(0rpx);
  333. }
  334. 50% {
  335. transform: translateY(-10rpx);
  336. }
  337. 100% {
  338. transform: translateY(0rpx);
  339. }
  340. }
  341. </style>