| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620 |
- <template>
- <view class="app-page pb-24">
- <!-- 博主信息 -->
- <view class="blogger-info" :style="[calcProfileStyle]">
- <image class="avatar" :src="$utils.checkAvatarUrl(bloggerInfo.avatar)" mode="aspectFill"></image>
- <view class="profile">
- <view class="author mt-24 text-size-g text-weight-b">{{ bloggerInfo.nickname }}</view>
- <view class="desc mt-24 text-size-m">
- {{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
- </view>
- </view>
- <image v-if="calcWaveUrl" :src="calcWaveUrl" mode="scaleToFill" class="gif-wave"></image>
- </view>
- <!-- 统计信息 -->
- <view class="statistics-wrap bg-white">
- <tm-more iconColor="light-blue" :open.sync="statisticsShowMore" :maxHeight="62" label=" " open-label=" ">
- <template>
- <view class="statistics flex pt-24 pb-24" :class="{ 'has-solid': statisticsShowMore }">
- <view class="item flex-1 text-align-center">
- <view class="number text-size-xl text-bg-gradient-orange-accent">
- <tm-flop :startVal="0" :decimals="0" :endVal="statistics.post"
- :duration="3000"></tm-flop>
- </view>
- <view class="mt-6 text-align-center text-size-s text-grey-darken-1">内容数量</view>
- </view>
- <view class="item flex-1 text-align-center">
- <view class="number text-size-xl text-bg-gradient-green-accent">
- <tm-flop :startVal="0" :decimals="0" :endVal="statistics.visit"
- :duration="3000"></tm-flop>
- </view>
- <view class="mt-6 text-size-s text-grey-darken-1">访客数量</view>
- </view>
- <view class="item flex-1 text-align-center">
- <view class="number text-size-xl text-bg-gradient-blue-accent">
- <tm-flop :startVal="0" :decimals="0" :endVal="statistics.category"
- :duration="3000"></tm-flop>
- </view>
- <view class="mt-6 text-align-center text-size-s text-grey-darken-1">分类总数</view>
- </view>
- </view>
- <view class="statistics solid-top has-solid flex pt-24 pb-24">
- <view class="item flex-1 text-align-center">
- <view class="number text-size-xl text-bg-gradient-orange-accent">
- <tm-flop :startVal="0" :decimals="0" :endVal="statistics.comment"
- :duration="3000"></tm-flop>
- </view>
- <view class="mt-6 text-align-center text-size-s text-grey-darken-1">评论数量</view>
- </view>
- <view class="item flex-1 text-align-center">
- <view class="number text-size-xl text-bg-gradient-blue-accent">
- <tm-flop :startVal="0" :decimals="0" :endVal="statistics.upvote"
- :duration="3000"></tm-flop>
- </view>
- <view class="mt-6 text-size-s text-grey-darken-1">点赞数量</view>
- </view>
- </view>
- </template>
- </tm-more>
- </view>
- <!-- 功能导航 -->
- <view class="nav-wrap ma-24 round-3">
- <tm-grouplist :shadow="0" :round="3" :margin="[0, 0]">
- <block v-for="(nav, index) in navList" :key="index">
- <tm-listitem v-if="nav.show" :title="nav.title" :left-icon="nav.leftIcon" show-left-icon
- :left-icon-color="nav.leftIconColor" :value="nav.rightText" @click="fnOnNav(nav)">
- <template slot="rightValue">
- <button class="right-value-btn" v-if="nav.openType" :open-type="nav.openType">
- {{ nav.rightText }}
- </button>
- <text v-else>{{ nav.rightText }}</text>
- </template>
- </tm-listitem>
- </block>
- </tm-grouplist>
- </view>
- <!-- 版权 -->
- <view v-if="copyrightConfig.enabled" class="copyright mt-40 text-size-xs text-align-center">
- <view class="">{{ copyrightConfig.content }}</view>
- </view>
- </view>
- </template>
- <script>
- import {
- checkHasAdminLogin
- } from '@/utils/auth.js';
- import CheckAppUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
- import {
- CheckWxUpdate
- } from '@/utils/update.js';
- import {
- NeedPluginIds,
- NeedPlugins,
- checkNeedPluginAvailable
- } from "@/utils/plugin.js"
- import tmGrouplist from '@/tm-vuetify/components/tm-grouplist/tm-grouplist.vue';
- import tmListitem from '@/tm-vuetify/components/tm-listitem/tm-listitem.vue';
- import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
- import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
- import tmMore from '@/tm-vuetify/components/tm-more/tm-more.vue';
- import tmFlop from '@/tm-vuetify/components/tm-flop/tm-flop.vue';
- import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
- import tmIcons from '@/tm-vuetify/components/tm-icons/tm-icons.vue';
- import wave from '@/components/wave/wave.vue';
- export default {
- components: {
- tmGrouplist,
- tmListitem,
- tmTranslate,
- tmPoup,
- tmMore,
- tmFlop,
- tmButton,
- tmIcons,
- wave
- },
- data() {
- return {
- statisticsShowMore: false,
- // 统计信息
- statistics: {
- post: 0, // 文章数量
- comment: 0, // 评论数量
- category: 0, // 分类数量
- visit: 0, // 访客数量
- upvote: 0 // 点赞数量
- },
- // 导航信息
- navList: [],
- miniProfileCard: {
- show: false
- }
- };
- },
- computed: {
- haloConfigs() {
- return this.$tm.vx.getters().getConfigs
- },
- pageConfig() {
- return this.haloConfigs.pageConfig.aboutConfig;
- },
- postDetailConfig() {
- return this.haloConfigs.basicConfig.postDetailConfig;
- },
- bloggerInfo() {
- return this.haloConfigs.authorConfig.blogger;
- },
- calcProfileStyle() {
- const _imgUrlOr = this.pageConfig.bgImageUrl;
- return {
- backgroundImage: `url(${this.$utils.checkImageUrl(_imgUrlOr)})`
- }
- },
- calcWaveUrl() {
- return this.$utils.checkImageUrl(this.pageConfig.waveImageUrl);
- },
- copyrightConfig() {
- return this.haloConfigs.basicConfig.copyrightConfig;
- },
- calcAuditModeEnabled() {
- return this.haloConfigs.auditConfig.auditModeEnabled
- },
- },
- watch: {
- haloConfigs: {
- handler(val) {
- if (!val) return;
- this.fnGetNavList();
- },
- deep: true,
- immediate: true,
- }
- },
- created() {
- this.fnGetData();
- },
- onPullDownRefresh() {
- this.fnGetData();
- },
- methods: {
- async fnGetNavList() {
- const systemInfo = uni.getSystemInfoSync();
- let _isWx = false;
- // #ifdef MP-WEIXIN
- _isWx = true;
- // #endif
- this.navList = [{
- key: 'data-visual',
- title: '数据看板',
- leftIcon: 'icon-chart-bar',
- leftIconColor: 'light-blue',
- rightText: '站点数据可视化',
- path: '/pagesA/data-visual/data-visual',
- isAdmin: false,
- type: 'page',
- show: await checkNeedPluginAvailable(NeedPluginIds.PluginDataStatistics)
- },{
- key: 'archives',
- title: this.calcAuditModeEnabled ? '内容归档' : '文章归档',
- leftIcon: 'halocoloricon-classify',
- leftIconColor: 'red',
- rightText: this.calcAuditModeEnabled ? '全部已归档内容' : '全部已归档文章',
- path: '/pagesA/archives/archives',
- isAdmin: false,
- type: 'page',
- show: true
- }, {
- key: 'love',
- title: '恋爱日记',
- leftIcon: 'halocoloricon-attent',
- leftIconColor: 'red',
- rightText: '博主的恋爱日记',
- path: '/pagesA/love/love',
- isAdmin: false,
- type: 'page',
- show: this.haloConfigs.loveConfig.loveEnabled
- }, {
- key: 'vote',
- title: '投票中心',
- leftIcon: 'icon-box',
- leftIconColor: 'red',
- rightText: '查看和进行投票',
- path: '/pagesA/votes/votes',
- isAdmin: false,
- type: 'page',
- show: !this.calcAuditModeEnabled
- }, {
- key: 'disclaimers',
- title: '友情链接',
- leftIcon: 'icon-lianjie',
- leftIconColor: 'blue',
- rightText: '看看博主朋友们吧',
- path: '/pagesA/friend-links/friend-links',
- isAdmin: false,
- type: 'page',
- show: true
- },
- {
- key: 'disclaimers',
- title: '免责声明',
- leftIcon: 'icon-map',
- leftIconColor: 'red',
- rightText: '博客内容免责声明',
- path: '/pagesA/disclaimers/disclaimers',
- isAdmin: false,
- type: 'page',
- show: this.haloConfigs.basicConfig.disclaimers.enabled
- },
- {
- key: 'contact-blogger',
- title: '联系博主',
- leftIcon: 'icon-paper-plane',
- leftIconColor: 'orange',
- rightText: '博主常用联系方式',
- path: '/pagesA/contact/contact',
- isAdmin: false,
- type: 'page',
- show: this.haloConfigs.authorConfig.social.enabled
- },
- {
- key: 'session',
- title: '在线客服',
- leftIcon: 'icon-headset-fill',
- leftIconColor: 'cyan',
- rightText: '在线客服为您答疑',
- path: null,
- isAdmin: false,
- type: 'page',
- openType: 'contact',
- show: _isWx
- },
- {
- key: 'feedback',
- title: '意见反馈',
- leftIcon: 'icon-comment-dots',
- leftIconColor: 'light-blue',
- rightText: '提交系统使用反馈',
- path: null,
- isAdmin: false,
- type: 'page',
- openType: 'feedback',
- show: _isWx
- },
- {
- key: 'about',
- title: '关于项目',
- leftIcon: 'icon-exclamation-circle',
- leftIconColor: 'blue',
- rightText: '小莫唐尼开源项目',
- path: '/pagesA/about/about',
- isAdmin: false,
- type: 'page',
- show: this.haloConfigs.basicConfig.showAboutSystem
- },
- // {
- // key: 'cache',
- // title: '清除缓存',
- // leftIcon: 'icon-delete',
- // leftIconColor: 'gray',
- // rightText: uni.getStorageInfoSync().currentSize + 'KB',
- // path: 'clear',
- // isAdmin: false,
- // type: 'poup',
- // show: true
- // },
- // {
- // key: 'update',
- // title: '版本更新',
- // leftIcon: 'icon-clouddownload',
- // leftIconColor: 'pink',
- // rightText: `当前版本 v${systemInfo.appVersion}`,
- // path: 'update',
- // isAdmin: false,
- // type: 'poup',
- // show: true
- // },
- ];
- },
- fnGetData() {
- this.$httpApi.v2
- .getBlogStatistics()
- .then(res => {
- this.statistics = res;
- })
- .catch(err => {
- this.$tm.toast('数据加载失败,请重试!');
- })
- .finally(() => {
- uni.stopPullDownRefresh();
- });
- },
- fnOnNav(data) {
- const {
- type,
- path,
- isAdmin,
- openType
- } = data;
- if (openType) {
- // #ifndef MP-WEIXIN
- return uni.$tm.toast('仅支持微信小程序打开!');
- // #endif
- // #ifdef MP-WEIXIN
- return;
- // #endif
- }
- if (!path) return;
- // 拦截后台管理页面(插件拦截不友好,无法阻断)
- if (isAdmin && !checkHasAdminLogin()) {
- uni.$eShowModal({
- title: '提示',
- content: '未登录超管账号或登录状态已过期,是否立即登录?',
- showCancel: true,
- cancelText: '否',
- cancelColor: '#999999',
- confirmText: '是',
- confirmColor: '#03a9f4'
- })
- .then(res => {
- uni.navigateTo({
- url: '/pagesB/login/login'
- });
- })
- .catch(err => {});
- return;
- }
- if (type == 'poup') {
- switch (path) {
- case 'clear':
- uni.$eShowModal({
- title: '提示',
- content: '清除后可能退出您当前的登录或已授权状态,是否确定清除缓存吗?',
- showCancel: true,
- cancelText: '否',
- cancelColor: '#999999',
- confirmText: '是',
- confirmColor: '#03a9f4'
- })
- .then(res => {
- uni.clearStorageSync();
- this.navList.find(x => x.key == 'cache').rightText =
- uni.getStorageInfoSync().currentSize + 'KB';
- })
- .catch(err => {});
- break;
- case 'update':
- // #ifdef APP-PLUS
- CheckAppUpdate();
- // #endif
- // #ifdef MP-WEIXIN
- CheckWxUpdate(true);
- // #endif
- // #ifndef APP-PLUS|| MP-WEIXIN
- uni.showToast({
- icon: 'none',
- title: '版本无需更新!'
- });
- // #endif
- break;
- }
- } else if (type == 'page') {
- uni.navigateTo({
- url: path
- })
- }
- },
- // 快捷导航页面跳转
- fnToNavPage(item) {
- // 判断是内置页面还是网页
- if (this.$utils.checkIsUrl(item.path)) {
- uni.navigateTo({
- url: '/pagesC/website/website?data=' +
- JSON.stringify({
- title: item.text || this.$haloConfig.title,
- url: encodeURIComponent(item.path)
- })
- });
- return;
- }
- switch (item.type) {
- case 'tabbar':
- uni.switchTab({
- url: item.path
- });
- break;
- case 'page':
- uni.navigateTo({
- url: item.path
- });
- break;
- }
- },
- fnOnToAdTest(path) {
- uni.navigateTo({
- url: path
- });
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .app-page {
- width: 100vw;
- min-height: 100vh;
- }
- .blogger-info {
- position: relative;
- width: 100%;
- height: 600rpx;
- background-size: cover;
- background-repeat: no-repeat;
- &:before {
- content: '';
- width: 100%;
- height: 100%;
- position: absolute;
- background-color: rgba(0, 0, 0, 0.3);
- background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAKUlEQVQImU3IMREAIAgAwJfNkQCEsH8cijjpMf6vnXlQaIiJFx+omEBfmqIEZLe2jzcAAAAASUVORK5CYII=);
- z-index: 0;
- }
- .avatar {
- position: absolute;
- top: 200rpx;
- left: 50%;
- transform: translateX(-50%);
- width: 130rpx;
- height: 130rpx;
- border-radius: 50%;
- border: 6rpx solid #ffffff;
- }
- .profile {
- width: 100%;
- position: absolute;
- top: 340rpx;
- left: 0;
- z-index: 6;
- color: #fff;
- text-align: center;
- }
- .gif-wave {
- position: absolute;
- width: 100%;
- bottom: 0;
- left: 0;
- z-index: 99;
- mix-blend-mode: screen;
- height: 100rpx;
- }
- }
- .profile-card {
- position: relative;
- background-color: #fff;
- overflow: hidden;
- &_label {
- width: 120rpx;
- position: absolute;
- top: 8rpx;
- left: -36rpx;
- transform: rotateZ(-45deg);
- text-align: center;
- color: #ffffff;
- }
- .left {
- width: 260rpx;
- .avatar {
- width: 130rpx;
- height: 130rpx;
- border-radius: 50%;
- }
- }
- .right {
- width: 0;
- flex-grow: 1;
- .photos {
- &-img {
- width: 130rpx;
- height: 130rpx;
- }
- }
- .photos-img+.photos-img {
- margin-left: 12rpx;
- }
- }
- }
- .statistics-wrap {
- box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
- border-radius: 0rpx 0rpx 24rpx 24rpx;
- overflow: hidden;
- .statistics {
- &.has-solid {
- .item+.item {
- border-left: 2rpx solid #fafafa;
- }
- }
- &.solid-top {
- position: relative;
- &:before {
- content: '';
- position: absolute;
- top: 0;
- left: 36rpx;
- right: 36rpx;
- height: 2rpx;
- background-color: #fafafa;
- }
- }
- }
- }
- .quick-nav {
- background-color: #fff;
- box-sizing: border-box;
- box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
- .name {
- color: var(--main-text-color);
- }
- .icon {
- border-radius: 50%;
- font-size: 80rpx;
- }
- }
- .nav-wrap {
- box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.03);
- background-color: #fff;
- }
- .copyright {
- color: #c0c4c7;
- }
- .right-value-btn {
- background-color: transparent;
- border: none;
- padding: 0;
- margin: 0;
- font-size: 24rpx;
- color: #c0c4c7;
- border-radius: 0;
- line-height: initial;
- &::after {
- border: none;
- border-radius: 0;
- transform: initial;
- }
- }
- </style>
|