admin.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <view class="app-page">
  3. <!-- 博主信息 -->
  4. <view class="blogger bg-white flex flex-center ma-24 mt-30 pa-24 round-3" @click="fnToModifyProfile">
  5. <image class="avatar" :src="$utils.checkAvatarUrl(bloggerInfo.avatar, true)" mode="aspectFill"></image>
  6. <view class="info pl-24">
  7. <view class="name text-weight-b text-grey-darken-5">☔️{{ bloggerInfo.nickname }} 欢迎回来!</view>
  8. <view class="mt-12 text-size-s text-grey-darken-1">{{ bloggerInfo.description || '这个人真懒,没填写描述~' }}</view>
  9. </view>
  10. <view class="modify"><text class="text-grey-darken-1 text-size-m iconfont icon-angle-right"></text></view>
  11. </view>
  12. <!-- 工作台导航 -->
  13. <view class="works bg-white ma-24 mt-36 pt-24 pb-16 flex flex-wrap round-3">
  14. <view class="works-item pt-24 pb-24 flex flex-col flex-center " v-for="(item, index) in workList" :key="index">
  15. <view class="icon flex flex-center round-4" :style="{ backgroundColor: item.bgColor }" @click="fnOnNav(item)">
  16. <text class="haloicon" :class="[item.icon]"></text>
  17. </view>
  18. <view class="mt-12 title text-size-s text-grey-darken-1">{{ item.name }}</view>
  19. </view>
  20. </view>
  21. <tm-bottomnavigation
  22. class="shadow-6"
  23. position="bottom"
  24. :bottom="24"
  25. :safe="false"
  26. :round="3"
  27. :offset-left="12"
  28. border=""
  29. icon-color="blue"
  30. icon-color-grey="blue"
  31. :list="quickBarList"
  32. @change="fnOnNavBar"
  33. ></tm-bottomnavigation>
  34. </view>
  35. </template>
  36. <script>
  37. import tmBottomnavigation from '@/tm-vuetify/components/tm-bottomnavigation/tm-bottomnavigation.vue';
  38. export default {
  39. components: { tmBottomnavigation },
  40. data() {
  41. return {
  42. workList: [
  43. {
  44. icon: 'haloicon-shuxie1',
  45. name: '日记管理',
  46. bgColor: 'rgba(80,167,255,1)',
  47. path: '/pagesB/journal/journal',
  48. todo: false
  49. },
  50. {
  51. icon: 'haloicon-wenzhang1',
  52. name: '文章管理',
  53. bgColor: 'rgba(27,187,179,1)',
  54. path: '/pagesB/articles/articles',
  55. todo: false
  56. },
  57. {
  58. icon: 'haloicon-fenlei2',
  59. name: '分类管理',
  60. bgColor: 'rgba(253,103,132,1)',
  61. path: '/pagesB/category/category',
  62. todo: false
  63. },
  64. {
  65. icon: 'haloicon-biaoqian2',
  66. name: '标签管理',
  67. bgColor: '#6638B5',
  68. path: '/pagesB/tags/tags',
  69. todo: false
  70. },
  71. {
  72. icon: 'haloicon-fujian1',
  73. name: '附件管理',
  74. bgColor: 'rgba(253,103,132,1)',
  75. path: '/pagesB/attachment/attachment',
  76. todo: false
  77. },
  78. {
  79. icon: 'haloicon-links',
  80. name: '友链管理',
  81. bgColor: 'rgba(80,167,255,1)',
  82. path: '/pagesB/links/links',
  83. todo: false
  84. },
  85. {
  86. icon: 'haloicon-tukuguanli',
  87. name: '图库管理',
  88. bgColor: 'rgba(254,178,0,1) ',
  89. path: '/pagesB/photos/photos',
  90. todo: false
  91. },
  92. {
  93. icon: 'haloicon-pinglun1',
  94. name: '评论管理',
  95. bgColor: 'rgba(27,187,179,1)',
  96. path: '/pagesB/comments/comments',
  97. todo: false
  98. },
  99. {
  100. icon: 'haloicon-xitongrizhi',
  101. name: '日志管理',
  102. bgColor: '#6638B5',
  103. path: '/pagesB/logs/logs',
  104. todo: false
  105. },
  106. {
  107. icon: 'haloicon-caidan',
  108. name: '菜单设置',
  109. bgColor: 'rgba(254,178,0,1)',
  110. path: '/pagesB/menus/menus',
  111. todo: true
  112. },
  113. {
  114. icon: 'haloicon-password',
  115. name: '修改密码',
  116. bgColor: 'rgba(27,187,179,1)',
  117. path: '/pagesB/password/password',
  118. todo: false
  119. },
  120. {
  121. icon: 'haloicon-shezhi',
  122. name: '系统设置',
  123. bgColor: '#8698A2',
  124. path: '/pagesB/settings/settings',
  125. todo: true
  126. }
  127. ],
  128. quickBarList: [
  129. { key: 'logout', iconSize: 36, icon: 'icon-poweroff', fontSize: 26, value: '退出登录' },
  130. {
  131. key: 'article-edit',
  132. iconSize: 36,
  133. icon: 'icon-plus',
  134. fontSize: 26,
  135. value: '写文章',
  136. custom: true,
  137. customColor: 'blue',
  138. customFontColor: 'white'
  139. },
  140. { key: 'back-home', iconSize: 36, icon: 'icon-home', fontSize: 26, value: '返回首页' }
  141. ]
  142. };
  143. },
  144. computed: {
  145. bloggerInfo() {
  146. return this.$tm.vx.getters().getBlogger;
  147. }
  148. },
  149. created() {
  150. // this.fnGetData();
  151. this.fnSetPageTitle('欢迎登录工作台');
  152. },
  153. onPullDownRefresh() {
  154. uni.stopPullDownRefresh();
  155. },
  156. methods: {
  157. fnGetData() {
  158. this.$httpApi.admin
  159. .getLinkList()
  160. .then(res => {
  161. console.log('getLinkList,success:', res);
  162. })
  163. .catch(err => {
  164. console.log('getLinkList,error:', err);
  165. });
  166. },
  167. fnToModifyProfile() {
  168. this.$Router.push({
  169. path: '/pagesB/profile/profile'
  170. });
  171. },
  172. fnOnNav(item) {
  173. if (item.todo) return uni.$tm.toast('功能开发中...');
  174. this.$Router.push({
  175. path: item.path
  176. });
  177. },
  178. fnOnNavBar(e) {
  179. if (e.item.key == 'logout') {
  180. uni.$eShowModal({
  181. title: '提示',
  182. content: '是否要退出当前后台管理登录?',
  183. showCancel: true,
  184. cancelText: '否',
  185. cancelColor: '#999999',
  186. confirmText: '是',
  187. confirmColor: '#03a9f4'
  188. })
  189. .then(res => {
  190. uni.showLoading({
  191. title: '正在退出登录...'
  192. });
  193. uni.$tm.vx.actions('user/adminLogout');
  194. setTimeout(() => {
  195. uni.hideLoading();
  196. uni.switchTab({
  197. url: '/pages/tabbar/about/about'
  198. });
  199. }, 1000);
  200. })
  201. .catch(err => {});
  202. } else if (e.item.key == 'article-edit') {
  203. uni.$tm.toast(e.item.value);
  204. this.$Router.push({
  205. path: '/pagesB/articles/article-edit'
  206. });
  207. } else if (e.item.key == 'back-home') {
  208. uni.$eShowModal({
  209. title: '提示',
  210. content: '是否返回首页?',
  211. showCancel: true,
  212. cancelText: '否',
  213. cancelColor: '#999999',
  214. confirmText: '是',
  215. confirmColor: '#03a9f4'
  216. })
  217. .then(res => {
  218. uni.switchTab({
  219. url: '/pages/tabbar/home/home'
  220. });
  221. })
  222. .catch(err => {});
  223. }
  224. }
  225. }
  226. };
  227. </script>
  228. <style scoped lang="scss">
  229. .app-page {
  230. width: 100vw;
  231. ::v-deep {
  232. .tm-bottomnavigation {
  233. box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.05);
  234. }
  235. }
  236. }
  237. .blogger {
  238. box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05);
  239. .avatar {
  240. width: 80rpx;
  241. height: 80rpx;
  242. border-radius: 50%;
  243. border: 6rpx solid #ffffff;
  244. box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.07);
  245. }
  246. .info {
  247. width: 0;
  248. flex-grow: 1;
  249. .name {
  250. font-size: 30rpx;
  251. }
  252. }
  253. .modify {
  254. width: 40rpx;
  255. }
  256. }
  257. .works {
  258. box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.05);
  259. &-item {
  260. width: 25%;
  261. box-sizing: border-box;
  262. .icon {
  263. width: 100rpx;
  264. height: 100rpx;
  265. box-shadow: 0rpx 4rpx 24rpx rgba(0, 0, 0, 0.1);
  266. .haloicon {
  267. color: #ffffff;
  268. font-size: 66rpx;
  269. }
  270. }
  271. .title {
  272. color: #55647a;
  273. }
  274. }
  275. }
  276. </style>