1
0

love.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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="$utils.checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFit"></image>
  8. <view class="name">{{ loveConfig.loveInfo.boyNickname }}</view>
  9. </view>
  10. <image class="like" :src="$utils.checkImageUrl(loveConfig.pageImages.heartImageUrl)" mode="scaleToFill"></image>
  11. <view class="girl">
  12. <image class="avatar" :src="$utils.checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFit"></image>
  13. <view class="name">{{ loveConfig.loveInfo.girlNickname }}</view>
  14. </view>
  15. </view>
  16. <image class="wave-image" :src="$utils.checkImageUrl(loveConfig.pageImages.waveImageUrl)" mode="scaleToFill"></image>
  17. </view>
  18. <!-- 恋爱记时 -->
  19. <view class="love-time-wrap">
  20. <view class="title">{{ loveConfig.loveDateTitle }}</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 navList" :key="index">
  41. <view v-if="nav.use" class="list-item" @click="fnToPage(nav.key)">
  42. <view class="left">
  43. <image class="icon" :src="$utils.checkImageUrl(nav.iconImageUrl)" mode="aspectFit"></image>
  44. </view>
  45. <view class="right">
  46. <view class="name">{{ nav.title }}</view>
  47. <view class="desc">{{ nav.desc }}</view>
  48. </view>
  49. </view>
  50. </block>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. loveDayTimer: null,
  59. loveDayCount: {
  60. d: 0,
  61. h: 0,
  62. m: 0,
  63. s: 0
  64. },
  65. navList: []
  66. };
  67. },
  68. computed: {
  69. loveConfig() {
  70. return this.$tm.vx.getters().getConfigs.loveConfig;
  71. },
  72. loveWrapStyle() {
  73. return {
  74. backgroundImage: `url(${this.$utils.checkImageUrl(this.loveConfig.pageImages.bgImageUrl)})`
  75. };
  76. }
  77. },
  78. watch: {
  79. loveConfig: {
  80. deep: true,
  81. immediate: true,
  82. handler(newVal, oldVal) {
  83. if (!newVal) return;
  84. this.initList(newVal)
  85. this.fnInitLoveDayCount();
  86. }
  87. }
  88. },
  89. onLoad() {
  90. this.fnSetPageTitle('恋爱日记');
  91. },
  92. methods: {
  93. initList(configs) {
  94. this.navList = [
  95. {
  96. key: 'journey',
  97. use: configs.ourStory.enabled,
  98. iconImageUrl: configs.ourStory.iconUrl,
  99. title: '关于我们',
  100. desc: '我们一起度过的那些经历'
  101. },
  102. {
  103. key: 'album',
  104. use: configs.lovePhoto.enabled,
  105. iconImageUrl: configs.lovePhoto.iconUrl,
  106. title: '恋爱相册',
  107. desc: '定格了我们的那些小美好'
  108. },
  109. {
  110. key: 'list',
  111. use: configs.loveDaily.enabled,
  112. iconImageUrl: configs.loveDaily.iconUrl,
  113. title: '恋爱清单',
  114. desc: '你我之间的约定我们都在努力实现'
  115. },
  116. ]
  117. },
  118. fnInitLoveDayCount() {
  119. clearTimeout(this.loveDayTimer);
  120. const _countDownFn = () => {
  121. this.loveDayTimer = setTimeout(_countDownFn, 1000);
  122. const formatStartDate = this.loveConfig.loveDate.replace(/-/g, '/');
  123. const start = new Date(formatStartDate),
  124. now = new Date();
  125. const T = now.getTime() - start.getTime();
  126. const i = 24 * 60 * 60 * 1000;
  127. const d = T / i;
  128. const D = Math.floor(d);
  129. const h = (d - D) * 24;
  130. const H = Math.floor(h);
  131. const m = (h - H) * 60;
  132. const M = Math.floor(m);
  133. const s = (m - M) * 60;
  134. const S = Math.floor(s);
  135. this.loveDayCount = {
  136. d: D,
  137. h: H,
  138. m: M,
  139. s: S
  140. };
  141. };
  142. _countDownFn();
  143. },
  144. fnToPage(pageName) {
  145. uni.navigateTo({
  146. url: `/pagesA/love/${pageName}`
  147. });
  148. }
  149. }
  150. };
  151. </script>
  152. <style scoped lang="scss">
  153. .app-page {
  154. width: 100vw;
  155. min-height: 100vh;
  156. background: linear-gradient(
  157. -45deg,
  158. rgba(247, 149, 51, 0.1),
  159. rgba(243, 112, 85, 0.1) 15%,
  160. rgba(239, 78, 123, 0.1) 30%,
  161. rgba(161, 102, 171, 0.1) 44%,
  162. rgba(80, 115, 184, 0.1) 58%,
  163. rgba(16, 152, 173, 0.1) 72%,
  164. rgba(7, 179, 155, 0.1) 86%,
  165. rgba(109, 186, 130, 0.1)
  166. );
  167. }
  168. .lover-wrap {
  169. position: relative;
  170. width: 100vw;
  171. height: 50vh;
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. background-size: cover;
  176. background-repeat: no-repeat;
  177. background-position: 50% 50%;
  178. &::before {
  179. position: absolute;
  180. left: 0;
  181. top: 0;
  182. right: 0;
  183. bottom: 0;
  184. content: '';
  185. background-color: rgba(255, 255, 255, 0.1);
  186. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAKUlEQVQImU3IMREAIAgAwJfNkQCEsH8cijjpMf6vnXlQaIiJFx+omEBfmqIEZLe2jzcAAAAASUVORK5CYII=);
  187. z-index: 0;
  188. backdrop-filter: blur(4rpx);
  189. overflow: hidden;
  190. }
  191. &::after {
  192. content: '';
  193. position: absolute;
  194. left: 0;
  195. bottom: -60rpx;
  196. width: 100vw;
  197. height: 60rpx;
  198. background-image: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
  199. }
  200. .lover-card {
  201. position: absolute;
  202. left: 50%;
  203. top: 58%;
  204. transform: translate(-50%, -50%);
  205. width: 90vw;
  206. display: flex;
  207. align-items: center;
  208. justify-content: space-around;
  209. border-radius: 12rpx;
  210. z-index: 2;
  211. .avatar {
  212. width: 180rpx;
  213. height: 180rpx;
  214. border-radius: 50%;
  215. box-sizing: border-box;
  216. // border: 8rpx solid transparent;
  217. // border: 8rpx solid rgba(255, 255, 255, 0.7) !important;
  218. border: 8rpx solid rgba(255, 255, 255, 1) !important;
  219. }
  220. .name {
  221. font-size: 32rpx;
  222. font-weight: bold;
  223. color: #ffffff;
  224. text-align: center;
  225. letter-spacing: 2rpx;
  226. }
  227. .boy {
  228. color: #3ab8e4;
  229. .avatar {
  230. border-color: rgba(58, 184, 228, 0.7);
  231. }
  232. }
  233. .girl {
  234. color: #f57ab3;
  235. .avatar {
  236. border-color: rgba(245, 122, 179, 0.7);
  237. }
  238. }
  239. .like {
  240. width: 120rpx;
  241. height: 120rpx;
  242. animation: likeani 1s ease-in-out infinite;
  243. }
  244. }
  245. .wave-image {
  246. width: 100%;
  247. height: 120rpx;
  248. position: absolute;
  249. left: 0;
  250. bottom: 0;
  251. mix-blend-mode: screen;
  252. }
  253. }
  254. .love-time-wrap {
  255. margin-top: 80rpx;
  256. width: 100vw;
  257. display: flex;
  258. flex-direction: column;
  259. align-items: center;
  260. justify-content: center;
  261. .title {
  262. font-size: 46rpx;
  263. letter-spacing: 4rpx;
  264. // background-image: linear-gradient(270deg, #ff4500, #ffa500, #ffd700, #90ee90, #00ffff, #1e90ff, #9370db, #ff69b4, #ff4500);
  265. // -webkit-background-clip: text;
  266. // color: #000;
  267. color: #333;
  268. font-size: 42rpx;
  269. font-weight: bold;
  270. // animation: loveTimeTitleAni 80s linear infinite;
  271. }
  272. .content {
  273. margin-top: 24rpx;
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. .text {
  278. font-size: 28rpx;
  279. }
  280. .number {
  281. margin: 0 8rpx;
  282. font-size: 46rpx;
  283. // color: #ff69b4;
  284. color: #f83856;
  285. font-weight: bold;
  286. }
  287. }
  288. }
  289. .list-wrap {
  290. margin-top: 75rpx;
  291. display: flex;
  292. flex-direction: column;
  293. align-items: center;
  294. justify-content: center;
  295. box-sizing: border-box;
  296. padding: 0 36rpx;
  297. .list-item {
  298. width: 100%;
  299. display: flex;
  300. align-items: center;
  301. justify-content: space-around;
  302. box-sizing: border-box;
  303. padding: 28rpx 32rpx;
  304. background-color: #ffffff;
  305. border-radius: 50rpx;
  306. margin-bottom: 32rpx;
  307. box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.03);
  308. &:nth-child(1) {
  309. animation: listItemAni1 3s ease-in-out infinite;
  310. }
  311. &:nth-child(2) {
  312. animation: listItemAni1 3s ease-in-out infinite;
  313. animation-delay: 1.5s;
  314. }
  315. &:nth-child(3) {
  316. animation: listItemAni1 3s ease-in-out infinite;
  317. animation-delay: 2s;
  318. }
  319. .left {
  320. width: 120rpx;
  321. height: 120rpx;
  322. .icon {
  323. width: 100%;
  324. height: 100%;
  325. }
  326. }
  327. .right {
  328. flex-grow: 1;
  329. display: flex;
  330. flex-direction: column;
  331. justify-content: center;
  332. box-sizing: border-box;
  333. padding-left: 40rpx;
  334. .name {
  335. font-size: 32rpx;
  336. font-weight: bold;
  337. color: #333333;
  338. }
  339. .desc {
  340. margin-top: 8px;
  341. font-size: 26rpx;
  342. color: #777777;
  343. }
  344. }
  345. }
  346. }
  347. @keyframes likeani {
  348. 0% {
  349. transform: scale(1);
  350. }
  351. 25% {
  352. transform: scale(1.2);
  353. }
  354. 50% {
  355. transform: scale(1.1);
  356. }
  357. 75% {
  358. transform: scale(1.3);
  359. }
  360. 100% {
  361. transform: scale(1);
  362. }
  363. }
  364. @keyframes loveTimeTitleAni {
  365. to {
  366. background-position: -200rem;
  367. }
  368. }
  369. @keyframes listItemAni1 {
  370. 0% {
  371. transform: translateY(0rpx);
  372. }
  373. 50% {
  374. transform: translateY(-10rpx);
  375. }
  376. 100% {
  377. transform: translateY(0rpx);
  378. }
  379. }
  380. </style>