about.vue 15 KB

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