about.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. <template>
  2. <view class="app-page pb-24">
  3. <!-- 博主信息 -->
  4. <view class="blogger-info" :style="[calcProfileStyle]">
  5. <image class="avatar" :src="$utils.checkAvatarUrl(bloggerInfo.avatar)" mode="aspectFill"></image>
  6. <view class="profile">
  7. <view class="author mt-24 text-size-g text-weight-b">{{ bloggerInfo.nickname }}</view>
  8. <view class="desc mt-24 text-size-m">
  9. {{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
  10. </view>
  11. </view>
  12. <image v-if="calcWaveUrl" :src="calcWaveUrl" mode="scaleToFill" class="gif-wave"></image>
  13. </view>
  14. <!-- 统计信息 -->
  15. <view class="statistics-wrap bg-white">
  16. <tm-more iconColor="light-blue" :open.sync="statisticsShowMore" :maxHeight="62" label=" " open-label=" ">
  17. <template>
  18. <view class="statistics flex pt-24 pb-24" :class="{ 'has-solid': statisticsShowMore }">
  19. <view class="item flex-1 text-align-center">
  20. <view class="number text-size-xl text-bg-gradient-orange-accent">
  21. <tm-flop :startVal="0" :decimals="0" :endVal="statistics.post"
  22. :duration="3000"></tm-flop>
  23. </view>
  24. <view class="mt-6 text-align-center text-size-s text-grey-darken-1">内容数量</view>
  25. </view>
  26. <view class="item flex-1 text-align-center">
  27. <view class="number text-size-xl text-bg-gradient-green-accent">
  28. <tm-flop :startVal="0" :decimals="0" :endVal="statistics.visit"
  29. :duration="3000"></tm-flop>
  30. </view>
  31. <view class="mt-6 text-size-s text-grey-darken-1">访客数量</view>
  32. </view>
  33. <view class="item flex-1 text-align-center">
  34. <view class="number text-size-xl text-bg-gradient-blue-accent">
  35. <tm-flop :startVal="0" :decimals="0" :endVal="statistics.category"
  36. :duration="3000"></tm-flop>
  37. </view>
  38. <view class="mt-6 text-align-center text-size-s text-grey-darken-1">分类总数</view>
  39. </view>
  40. </view>
  41. <view class="statistics solid-top has-solid flex pt-24 pb-24">
  42. <view class="item flex-1 text-align-center">
  43. <view class="number text-size-xl text-bg-gradient-orange-accent">
  44. <tm-flop :startVal="0" :decimals="0" :endVal="statistics.comment"
  45. :duration="3000"></tm-flop>
  46. </view>
  47. <view class="mt-6 text-align-center text-size-s text-grey-darken-1">评论数量</view>
  48. </view>
  49. <view class="item flex-1 text-align-center">
  50. <view class="number text-size-xl text-bg-gradient-blue-accent">
  51. <tm-flop :startVal="0" :decimals="0" :endVal="statistics.upvote"
  52. :duration="3000"></tm-flop>
  53. </view>
  54. <view class="mt-6 text-size-s text-grey-darken-1">点赞数量</view>
  55. </view>
  56. </view>
  57. </template>
  58. </tm-more>
  59. </view>
  60. <!-- 功能导航 -->
  61. <view class="nav-wrap ma-24 round-3">
  62. <tm-grouplist :shadow="0" :round="3" :margin="[0, 0]">
  63. <block v-for="(nav, index) in navList" :key="index">
  64. <tm-listitem v-if="nav.show" :title="nav.title" :left-icon="nav.leftIcon" show-left-icon
  65. :left-icon-color="nav.leftIconColor" :value="nav.rightText" @click="fnOnNav(nav)">
  66. <template slot="rightValue">
  67. <button class="right-value-btn" v-if="nav.openType" :open-type="nav.openType">
  68. {{ nav.rightText }}
  69. </button>
  70. <text v-else>{{ nav.rightText }}</text>
  71. </template>
  72. </tm-listitem>
  73. </block>
  74. </tm-grouplist>
  75. </view>
  76. <!-- 版权 -->
  77. <view v-if="copyrightConfig.enabled" class="copyright mt-40 text-size-xs text-align-center">
  78. <view class="">{{ copyrightConfig.content }}</view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import {
  84. checkHasAdminLogin
  85. } from '@/utils/auth.js';
  86. import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
  87. import {
  88. CheckWxUpdate
  89. } from '@/utils/update.js';
  90. import tmGrouplist from '@/tm-vuetify/components/tm-grouplist/tm-grouplist.vue';
  91. import tmListitem from '@/tm-vuetify/components/tm-listitem/tm-listitem.vue';
  92. import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
  93. import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
  94. import tmMore from '@/tm-vuetify/components/tm-more/tm-more.vue';
  95. import tmFlop from '@/tm-vuetify/components/tm-flop/tm-flop.vue';
  96. import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
  97. import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
  98. import wave from '@/components/wave/wave.vue';
  99. export default {
  100. components: {
  101. tmGrouplist,
  102. tmListitem,
  103. tmTranslate,
  104. tmPoup,
  105. tmMore,
  106. tmFlop,
  107. tmButton,
  108. tmIcons,
  109. wave
  110. },
  111. data() {
  112. return {
  113. statisticsShowMore: false,
  114. // 统计信息
  115. statistics: {
  116. post: 0, // 文章数量
  117. comment: 0, // 评论数量
  118. category: 0, // 分类数量
  119. visit: 0, // 访客数量
  120. upvote: 0 // 点赞数量
  121. },
  122. // 导航信息
  123. navList: [],
  124. miniProfileCard: {
  125. show: false
  126. }
  127. };
  128. },
  129. computed: {
  130. haloConfigs() {
  131. return this.$tm.vx.getters().getConfigs
  132. },
  133. pageConfig() {
  134. return this.haloConfigs.pageConfig.aboutConfig;
  135. },
  136. postDetailConfig() {
  137. return this.haloConfigs.basicConfig.postDetailConfig;
  138. },
  139. bloggerInfo() {
  140. return this.haloConfigs.authorConfig.blogger;
  141. },
  142. calcProfileStyle() {
  143. const _imgUrlOr = this.pageConfig.bgImageUrl;
  144. return {
  145. backgroundImage: `url(${this.$utils.checkImageUrl(_imgUrlOr)})`
  146. }
  147. },
  148. calcWaveUrl() {
  149. return this.$utils.checkImageUrl(this.pageConfig.waveImageUrl);
  150. },
  151. copyrightConfig() {
  152. return this.haloConfigs.basicConfig.copyrightConfig;
  153. }
  154. },
  155. watch: {
  156. haloConfigs: {
  157. handler(val) {
  158. if (!val) return;
  159. this.fnGetNavList();
  160. },
  161. deep: true,
  162. immediate: true,
  163. }
  164. },
  165. created() {
  166. this.fnGetData();
  167. },
  168. onPullDownRefresh() {
  169. this.fnGetData();
  170. },
  171. methods: {
  172. fnGetNavList() {
  173. const systemInfo = uni.getSystemInfoSync();
  174. let _isWx = false;
  175. // #ifdef MP-WEIXIN
  176. _isWx = true;
  177. // #endif
  178. this.navList = [{
  179. key: 'archives',
  180. title: '文章归档',
  181. leftIcon: 'halocoloricon-classify',
  182. leftIconColor: 'red',
  183. rightText: '已归档的文章',
  184. path: '/pagesA/archives/archives',
  185. isAdmin: false,
  186. type: 'page',
  187. show: true
  188. }, {
  189. key: 'love',
  190. title: '恋爱日记',
  191. leftIcon: 'halocoloricon-attent',
  192. leftIconColor: 'red',
  193. rightText: '甜蜜恋人的专属',
  194. path: '/pagesA/love/love',
  195. isAdmin: false,
  196. type: 'page',
  197. show: this.haloConfigs.loveConfig.loveEnabled
  198. }, {
  199. key: 'disclaimers',
  200. title: '友情链接',
  201. leftIcon: 'icon-lianjie',
  202. leftIconColor: 'blue',
  203. rightText: '看看朋友们吧',
  204. path: '/pagesA/friend-links/friend-links',
  205. isAdmin: false,
  206. type: 'page',
  207. show: true
  208. },
  209. {
  210. key: 'disclaimers',
  211. title: '免责声明',
  212. leftIcon: 'icon-map',
  213. leftIconColor: 'red',
  214. rightText: '博客内容免责声明',
  215. path: '/pagesA/disclaimers/disclaimers',
  216. isAdmin: false,
  217. type: 'page',
  218. show: this.haloConfigs.basicConfig.disclaimers.enabled
  219. },
  220. {
  221. key: 'contact-blogger',
  222. title: '联系博主',
  223. leftIcon: 'icon-paper-plane',
  224. leftIconColor: 'orange',
  225. rightText: '博主常用联系方式',
  226. path: '/pagesA/contact/contact',
  227. isAdmin: false,
  228. type: 'page',
  229. show: this.haloConfigs.authorConfig.social.enabled
  230. },
  231. {
  232. key: 'session',
  233. title: '在线客服',
  234. leftIcon: 'icon-headset-fill',
  235. leftIconColor: 'cyan',
  236. rightText: '在线客服为您答疑',
  237. path: null,
  238. isAdmin: false,
  239. type: 'page',
  240. openType: 'contact',
  241. show: _isWx
  242. },
  243. {
  244. key: 'feedback',
  245. title: '意见反馈',
  246. leftIcon: 'icon-comment-dots',
  247. leftIconColor: 'light-blue',
  248. rightText: '提交系统使用反馈',
  249. path: null,
  250. isAdmin: false,
  251. type: 'page',
  252. openType: 'feedback',
  253. show: _isWx
  254. },
  255. {
  256. key: 'about',
  257. title: '关于项目',
  258. leftIcon: 'icon-exclamation-circle',
  259. leftIconColor: 'blue',
  260. rightText: '小莫唐尼开源项目',
  261. path: '/pagesA/about/about',
  262. isAdmin: false,
  263. type: 'page',
  264. show: this.haloConfigs.basicConfig.showAboutSystem
  265. },
  266. // {
  267. // key: 'cache',
  268. // title: '清除缓存',
  269. // leftIcon: 'icon-delete',
  270. // leftIconColor: 'gray',
  271. // rightText: uni.getStorageInfoSync().currentSize + 'KB',
  272. // path: 'clear',
  273. // isAdmin: false,
  274. // type: 'poup',
  275. // show: true
  276. // },
  277. // {
  278. // key: 'update',
  279. // title: '版本更新',
  280. // leftIcon: 'icon-clouddownload',
  281. // leftIconColor: 'pink',
  282. // rightText: `当前版本 v${systemInfo.appVersion}`,
  283. // path: 'update',
  284. // isAdmin: false,
  285. // type: 'poup',
  286. // show: true
  287. // },
  288. // {
  289. // key: 'setting',
  290. // title: '应用设置',
  291. // leftIcon: 'icon-cog',
  292. // leftIconColor: 'indigo',
  293. // rightText: `进入系统常用设置`,
  294. // path: '/pagesA/setting/setting',
  295. // isAdmin: false,
  296. // type: 'page',
  297. // show: false
  298. // },
  299. // {
  300. // key: 'admin',
  301. // title: '后台管理',
  302. // leftIcon: 'icon-lock',
  303. // leftIconColor: 'gray',
  304. // rightText: '博客后台系统入口',
  305. // path: '/pagesB/admin/admin',
  306. // isAdmin: true,
  307. // type: 'page',
  308. // show: false
  309. // }
  310. ];
  311. },
  312. fnGetData() {
  313. this.$httpApi.v2
  314. .getBlogStatistics()
  315. .then(res => {
  316. this.statistics = res;
  317. })
  318. .catch(err => {
  319. this.$tm.toast('数据加载失败,请重试!');
  320. })
  321. .finally(() => {
  322. uni.stopPullDownRefresh();
  323. });
  324. },
  325. fnOnNav(data) {
  326. const {
  327. type,
  328. path,
  329. isAdmin,
  330. openType
  331. } = data;
  332. if (openType) {
  333. // #ifndef MP-WEIXIN
  334. return uni.$tm.toast('仅支持微信小程序打开!');
  335. // #endif
  336. // #ifdef MP-WEIXIN
  337. return;
  338. // #endif
  339. }
  340. if (!path) return;
  341. // 拦截后台管理页面(插件拦截不友好,无法阻断)
  342. if (isAdmin && !checkHasAdminLogin()) {
  343. uni.$eShowModal({
  344. title: '提示',
  345. content: '未登录超管账号或登录状态已过期,是否立即登录?',
  346. showCancel: true,
  347. cancelText: '否',
  348. cancelColor: '#999999',
  349. confirmText: '是',
  350. confirmColor: '#03a9f4'
  351. })
  352. .then(res => {
  353. uni.navigateTo({
  354. url: '/pagesB/login/login'
  355. });
  356. })
  357. .catch(err => {});
  358. return;
  359. }
  360. if (type == 'poup') {
  361. switch (path) {
  362. case 'clear':
  363. uni.$eShowModal({
  364. title: '提示',
  365. content: '清除后可能退出您当前的登录或已授权状态,是否确定清除缓存吗?',
  366. showCancel: true,
  367. cancelText: '否',
  368. cancelColor: '#999999',
  369. confirmText: '是',
  370. confirmColor: '#03a9f4'
  371. })
  372. .then(res => {
  373. uni.clearStorageSync();
  374. this.navList.find(x => x.key == 'cache').rightText =
  375. uni.getStorageInfoSync().currentSize + 'KB';
  376. })
  377. .catch(err => {});
  378. break;
  379. case 'update':
  380. // #ifdef APP-PLUS
  381. CheckAppUpdate();
  382. // #endif
  383. // #ifdef MP-WEIXIN
  384. CheckWxUpdate(true);
  385. // #endif
  386. // #ifndef APP-PLUS|| MP-WEIXIN
  387. uni.showToast({
  388. icon: 'none',
  389. title: '版本无需更新!'
  390. });
  391. // #endif
  392. break;
  393. }
  394. } else if (type == 'page') {
  395. uni.navigateTo({
  396. url: path
  397. })
  398. }
  399. },
  400. // 快捷导航页面跳转
  401. fnToNavPage(item) {
  402. // 判断是内置页面还是网页
  403. if (this.$utils.checkIsUrl(item.path)) {
  404. uni.navigateTo({
  405. url: '/pagesC/website/website?data=' +
  406. JSON.stringify({
  407. title: item.text || this.$haloConfig.title,
  408. url: item.path
  409. })
  410. });
  411. return;
  412. }
  413. switch (item.type) {
  414. case 'tabbar':
  415. uni.switchTab({
  416. url: item.path
  417. });
  418. break;
  419. case 'page':
  420. uni.navigateTo({
  421. url: item.path
  422. });
  423. break;
  424. }
  425. },
  426. fnOnToAdTest(path) {
  427. uni.navigateTo({
  428. url: path
  429. });
  430. }
  431. }
  432. };
  433. </script>
  434. <style scoped lang="scss">
  435. .app-page {
  436. width: 100vw;
  437. min-height: 100vh;
  438. }
  439. .blogger-info {
  440. position: relative;
  441. width: 100%;
  442. height: 600rpx;
  443. background-size: cover;
  444. background-repeat: no-repeat;
  445. &:before {
  446. content: '';
  447. width: 100%;
  448. height: 100%;
  449. position: absolute;
  450. background-color: rgba(0, 0, 0, 0.3);
  451. background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAKUlEQVQImU3IMREAIAgAwJfNkQCEsH8cijjpMf6vnXlQaIiJFx+omEBfmqIEZLe2jzcAAAAASUVORK5CYII=);
  452. z-index: 0;
  453. }
  454. .avatar {
  455. position: absolute;
  456. top: 200rpx;
  457. left: 50%;
  458. transform: translateX(-50%);
  459. width: 130rpx;
  460. height: 130rpx;
  461. border-radius: 50%;
  462. border: 6rpx solid #ffffff;
  463. }
  464. .profile {
  465. width: 100%;
  466. position: absolute;
  467. top: 340rpx;
  468. left: 0;
  469. z-index: 6;
  470. color: #fff;
  471. text-align: center;
  472. }
  473. .gif-wave {
  474. position: absolute;
  475. width: 100%;
  476. bottom: 0;
  477. left: 0;
  478. z-index: 99;
  479. mix-blend-mode: screen;
  480. height: 100rpx;
  481. }
  482. }
  483. .profile-card {
  484. position: relative;
  485. background-color: #fff;
  486. overflow: hidden;
  487. &_label {
  488. width: 120rpx;
  489. position: absolute;
  490. top: 8rpx;
  491. left: -36rpx;
  492. transform: rotateZ(-45deg);
  493. text-align: center;
  494. color: #ffffff;
  495. }
  496. .left {
  497. width: 260rpx;
  498. .avatar {
  499. width: 130rpx;
  500. height: 130rpx;
  501. border-radius: 50%;
  502. }
  503. }
  504. .right {
  505. width: 0;
  506. flex-grow: 1;
  507. .photos {
  508. &-img {
  509. width: 130rpx;
  510. height: 130rpx;
  511. }
  512. }
  513. .photos-img+.photos-img {
  514. margin-left: 12rpx;
  515. }
  516. }
  517. }
  518. .statistics-wrap {
  519. box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
  520. border-radius: 0rpx 0rpx 24rpx 24rpx;
  521. overflow: hidden;
  522. .statistics {
  523. &.has-solid {
  524. .item+.item {
  525. border-left: 2rpx solid #fafafa;
  526. }
  527. }
  528. &.solid-top {
  529. position: relative;
  530. &:before {
  531. content: '';
  532. position: absolute;
  533. top: 0;
  534. left: 36rpx;
  535. right: 36rpx;
  536. height: 2rpx;
  537. background-color: #fafafa;
  538. }
  539. }
  540. }
  541. }
  542. .quick-nav {
  543. background-color: #fff;
  544. box-sizing: border-box;
  545. box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
  546. .name {
  547. color: var(--main-text-color);
  548. }
  549. .icon {
  550. border-radius: 50%;
  551. font-size: 80rpx;
  552. }
  553. }
  554. .nav-wrap {
  555. box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
  556. background-color: #fff;
  557. }
  558. .copyright {
  559. color: #c0c4c7;
  560. }
  561. .right-value-btn {
  562. background-color: transparent;
  563. border: none;
  564. padding: 0;
  565. margin: 0;
  566. font-size: 24rpx;
  567. color: #c0c4c7;
  568. border-radius: 0;
  569. line-height: initial;
  570. &::after {
  571. border: none;
  572. border-radius: 0;
  573. transform: initial;
  574. }
  575. }
  576. </style>