about.vue 20 KB

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