main-navbar.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <nav class="site-navbar">
  3. <div class="site-navbar clearfix">
  4. <ul class="TT-nav">
  5. <li>
  6. <router-link :to="{name: 'home'}">首页</router-link>
  7. </li>
  8. <li>
  9. <el-dropdown class="TT-login" :show-timeout="0" placement="bottom" style="cursor: pointer;">
  10. <span class="el-dropdown-link">淘宝工具</span>
  11. <el-dropdown-menu slot="dropdown">
  12. <el-dropdown-item>
  13. <router-link :to="{name: 'toolsAnalyze'}">竞品透析</router-link>
  14. </el-dropdown-item>
  15. <el-dropdown-item>
  16. <router-link :to="{name: 'toolsCredit'}">旺旺透视</router-link>
  17. </el-dropdown-item>
  18. <el-dropdown-item>
  19. <router-link :to="{name: 'toolsOnline'}">指数转换</router-link>
  20. </el-dropdown-item>
  21. <el-dropdown-item>
  22. <router-link :to="{name: 'toolsPricetrend'}">价格走势</router-link>
  23. </el-dropdown-item>
  24. <el-dropdown-item>
  25. <router-link :to="{name: 'toolsOrdersearch'}">淘客订单查询</router-link>
  26. </el-dropdown-item>
  27. <el-dropdown-item>
  28. <router-link :to="{name: 'toolsStarkeysearch'}">淘宝下拉框选词</router-link>
  29. </el-dropdown-item>
  30. <el-dropdown-item>
  31. <router-link :to="{name: 'toolsShopinfo'}">店铺信息查询</router-link>
  32. </el-dropdown-item>
  33. <el-dropdown-item>
  34. <router-link :to="{name: 'toolsFeedback'}">商品评论查询</router-link>
  35. </el-dropdown-item>
  36. <el-dropdown-item>
  37. <router-link :to="{name: 'toolsProductinfo'}">商品信息查询</router-link>
  38. </el-dropdown-item>
  39. <el-dropdown-item>
  40. <router-link :to="{name: 'toolsProductaskinfo'}">商品问大家</router-link>
  41. </el-dropdown-item>
  42. </el-dropdown-menu>
  43. </el-dropdown>
  44. </li>
  45. </ul>
  46. <template v-if="token">
  47. <el-dropdown class="TT-login" :show-timeout="0" placement="bottom" style="cursor: pointer;">
  48. <span class="el-dropdown-link">个人中心</span>
  49. <el-dropdown-menu slot="dropdown">
  50. <el-dropdown-item>
  51. <router-link :to="{name: 'minePaycheck'}">充值</router-link>
  52. </el-dropdown-item>
  53. <el-dropdown-item>
  54. <router-link :to="{name: 'mineWallet'}">我的钱包</router-link>
  55. </el-dropdown-item>
  56. <el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
  57. <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
  58. </el-dropdown-menu>
  59. </el-dropdown>
  60. </template>
  61. <template v-else>
  62. <router-link :to="{name: 'login'}" replace>登录</router-link>
  63. <router-link :to="{name: 'register'}" replace>/注册</router-link>
  64. </template>
  65. </div>
  66. <!-- 弹窗, 修改密码 -->
  67. <update-password v-if="updatePassowrdVisible" ref="updatePassowrd"/>
  68. </nav>
  69. </template>
  70. <script>
  71. import UpdatePassword from './main-navbar-update-password'
  72. import { clearLoginInfo } from '@/utils'
  73. import Vue from 'vue'
  74. export default {
  75. components: {
  76. UpdatePassword
  77. },
  78. data () {
  79. return {
  80. updatePassowrdVisible: false
  81. }
  82. },
  83. computed: {
  84. token () {
  85. return this.$store.state.user.token || Vue.cookie.get('token')
  86. }
  87. },
  88. methods: {
  89. // 修改密码
  90. updatePasswordHandle () {
  91. this.updatePassowrdVisible = true
  92. this.$nextTick(() => {
  93. this.$refs.updatePassowrd.init()
  94. })
  95. },
  96. // 退出
  97. logoutHandle () {
  98. this.$confirm(`确定进行[退出]操作?`, '提示', {
  99. confirmButtonText: '确定',
  100. cancelButtonText: '取消',
  101. type: 'warning'
  102. }).then(() => {
  103. this.$http({
  104. url: this.$http.adornUrl('/user/loginout'),
  105. method: 'post',
  106. data: this.$http.adornData()
  107. }).then(({ data }) => {
  108. if (data.status) {
  109. clearLoginInfo()
  110. this.$router.push({ name: 'login' })
  111. }
  112. })
  113. }).catch(() => {})
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. .site-navbar {
  120. display: flex;
  121. justify-content: space-between;
  122. align-items: center;
  123. padding: 0 10%;
  124. background: #fff;
  125. .TT-nav {
  126. flex: 1;
  127. display: flex;
  128. align-items: center;
  129. list-style: none;
  130. li {
  131. display: flex;
  132. justify-content: center;
  133. width: 12.5%;
  134. padding: 0 20px;
  135. }
  136. }
  137. }
  138. a {
  139. display: block;
  140. font-size: 16px;
  141. color: #666;
  142. text-decoration: none;
  143. }
  144. </style>