studio.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div>
  3. <v-navigation-drawer
  4. v-model="drawer"
  5. app
  6. clipped
  7. >
  8. <router-link :to="`/user/${this.$store.state.user.userInfo.userId}`">
  9. <v-row justify="center" align="center">
  10. <v-col cols="12" style="text-align: center">
  11. <v-avatar size="62">
  12. <v-img :src="this.$store.state.user.userInfo.avatarUrl" />
  13. </v-avatar>
  14. </v-col>
  15. </v-row>
  16. <v-row justify="center" align="center">
  17. <v-col cols="12" style="text-align: center">
  18. {{ this.$store.state.user.userInfo.username }}
  19. </v-col>
  20. </v-row>
  21. </router-link>
  22. <router-link v-for="item in items" :key="item.text" :to="item.link">
  23. <v-list-item
  24. link
  25. >
  26. <v-list-item-action>
  27. <v-icon>{{ item.icon }}</v-icon>
  28. </v-list-item-action>
  29. <v-list-item-content>
  30. <v-list-item-title>
  31. {{ item.text }}
  32. </v-list-item-title>
  33. </v-list-item-content>
  34. </v-list-item>
  35. </router-link>
  36. <v-divider />
  37. <!-- TODO 具有特定角色才能查看 -->
  38. <div v-if="CheckPower.checkPower(this.$store.state.user.userInfo) === 'admin'">
  39. <!--<div v-if="CheckPower.checkPower(this.$store.state.user.userInfo) == 'user'">-->
  40. <router-link v-for="item in adminList" :key="item.text" :to="item.link">
  41. <v-list-item
  42. link
  43. >
  44. <v-list-item-action>
  45. <v-icon>{{ item.icon }}</v-icon>
  46. </v-list-item-action>
  47. <v-list-item-content>
  48. <v-list-item-title>
  49. {{ item.text }}
  50. </v-list-item-title>
  51. </v-list-item-content>
  52. </v-list-item>
  53. </router-link>
  54. </div>
  55. </v-navigation-drawer>
  56. <v-app-bar
  57. :clipped-left="$vuetify.breakpoint.lgAndUp"
  58. app
  59. color="blue"
  60. dark
  61. >
  62. <v-app-bar-nav-icon @click.stop="drawer = !drawer" />
  63. <v-toolbar-title
  64. style="width: 300px"
  65. class="ml-0 pl-4"
  66. >
  67. <span style="cursor:pointer" @click="goToHome()">{{ this.$store.state.webInfo.name }}</span>
  68. </v-toolbar-title>
  69. <!-- <v-text-field
  70. flat
  71. solo-inverted
  72. hide-details
  73. prepend-inner-icon="mdi-magnify"
  74. label="搜索"
  75. class="hidden-sm-and-down"
  76. />-->
  77. <v-spacer />
  78. <v-tooltip bottom>
  79. <template v-slot:activator="{ on, attrs }">
  80. <v-btn
  81. icon
  82. v-bind="attrs"
  83. v-on="on"
  84. @click="goToPublish"
  85. >
  86. <v-icon>mdi-video-plus</v-icon>
  87. </v-btn>
  88. </template>
  89. <span>发布</span>
  90. </v-tooltip>
  91. <v-tooltip bottom>
  92. <template v-slot:activator="{ on, attrs }">
  93. <v-btn
  94. icon
  95. v-bind="attrs"
  96. v-on="on"
  97. >
  98. <v-icon>mdi-bell</v-icon>
  99. </v-btn>
  100. </template>
  101. <span>通知</span>
  102. </v-tooltip>
  103. <!-- 登陆后 -->
  104. <Head v-if="this.$store.state.user.userInfo" />
  105. <!-- 未登录 -->
  106. <v-btn
  107. v-if="this.$store.state.user.userInfo == null"
  108. outlined
  109. @click="goToLoginPage"
  110. >
  111. <v-icon left dark>mdi-account</v-icon> 登录
  112. </v-btn>
  113. </v-app-bar>
  114. <v-main>
  115. <router-view />
  116. </v-main>
  117. </div>
  118. </template>
  119. <script>
  120. import Head from '@/layout/components/head.vue'
  121. import CheckPower from '@/utils/check-power.vue'
  122. export default {
  123. components: {
  124. Head
  125. },
  126. data: () => ({
  127. CheckPower,
  128. drawer: true,
  129. items: [
  130. { icon: 'mdi-filmstrip-box-multiple', text: '稿件列表', link: '/studio/post' },
  131. { icon: 'mdi-upload', text: '投稿', link: '/studio/upload' },
  132. { icon: 'mdi-database', text: '数据统计', link: '/studio/statistics' }
  133. /* { icon: 'mdi-account-multiple', text: '粉丝管理', link: '/studio/fans' },
  134. { icon: 'mdi-cash-usd', text: '付费会员', link: '/vip' },
  135. { icon: 'mdi-wrench', text: '自定义频道', link: '/user/setting' }*/
  136. ],
  137. adminList: [
  138. { icon: 'mdi-playlist-edit', text: '分类管理', link: '/studio/admin/category' },
  139. { icon: 'mdi-application', text: '邀请码', link: '/studio/admin/invitation' },
  140. { icon: 'mdi-video', text: '待审核', link: '/studio/admin/examine' },
  141. { icon: 'mdi-filmstrip-box-multiple', text: '投稿列表', link: '/studio/admin/article/list' },
  142. { icon: 'mdi-file', text: '文件列表', link: '/studio/admin/file/list' },
  143. { icon: 'mdi-account-multiple', text: '用户列表', link: '/studio/admin/userlist' },
  144. { icon: 'mdi-square-edit-outline', text: '网页设置', link: '/studio/admin/websetting' }
  145. ]
  146. }),
  147. mounted() {
  148. },
  149. created() {
  150. this.$vuetify.theme.dark = this.$store.state.darkThemOpen
  151. },
  152. methods: {
  153. goToLoginPage() {
  154. this.$router.push('/login')
  155. },
  156. goToPublish() {
  157. if (this.$route.path === '/studio/upload') {
  158. return
  159. }
  160. this.$router.push('/studio/upload')
  161. },
  162. goToUserHome() {
  163. this.$router.push('/user/' + this.$store.state.user.userInfo.userId)
  164. },
  165. goToHome() {
  166. if (this.$route.path === '/') {
  167. return
  168. }
  169. this.$router.push('/')
  170. }
  171. }
  172. }
  173. </script>
  174. <style scoped>
  175. a {
  176. text-decoration: none;
  177. }
  178. </style>