NavBar.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <!--
  2. * @Description:
  3. * @Author: 欧阳承珺
  4. * @LastEditors: 欧阳承珺
  5. * @Date: 2022-10-17 15:19:11
  6. * @LastEditTime: 2022-11-02 16:32:44
  7. -->
  8. <template>
  9. <div class="h-80px flex relative z-3 justify-between px-[10%] border-b-1 border-b-[#f0f0f0] border-b-solid">
  10. <div class="flex items-center ml-16px">
  11. <a href="/" title="17PDF Reader阅读器支持文件扫描和文件格式转换">
  12. <img src="http://cn-file.17pdf.com/website/index/logo_pdf_top.png"></img>
  13. </a>
  14. </div>
  15. <div class="flex justify-between">
  16. <div class="text-[#666] flex">
  17. <NuxtLink to="/converter" active-class="menu-active" class="inline-block mx-0 mt-28px md-35px hover:text-[#E93636] hover:opacity-70">格式转换</NuxtLink>
  18. <NuxtLink to="/pricing" active-class="menu-active" class="inline-block mt-28px mr-0 md-0 ml-35px hover:text-[#E93636] hover:opacity-70">订阅服务</NuxtLink>
  19. <NuxtLink to="/sdk" active-class="menu-active" class="inline-block mt-28px mr-0 md-0 ml-35px hover:text-[#E93636] hover:opacity-70">SDK介绍</NuxtLink>
  20. <NuxtLink to="/pdf-reader/download" active-class="menu-active" class="inline-block mt-28px mr-100px md-0 ml-35px hover:text-[#E93636] hover:opacity-70">下载</NuxtLink>
  21. </div>
  22. <div v-if="!!token">
  23. <no-ssr>
  24. <el-popover
  25. placement="bottom"
  26. trigger="hover"
  27. :close-delay="800"
  28. >
  29. <div>
  30. <div class="px-24px pt-24px min-w-300px">
  31. <div class="flex pb-22px cursor-pointer" style="border-bottom: 1px solid #f0f0f0;">
  32. <a href="/members/me/expenses">
  33. <img v-if="userInfo?.memberInfo.subscriberType === 1" class="w-64px rounded-1/2" src="http://user-file.17pdf.com/avatars/2020/11/16/0577b907be980556bdafa23fb0be0732-jpg.jpg" >
  34. <img v-else class="w-64px rounded-1/2" src="http://user-file.17pdf.com/avatars/2018/01/02/f183029426a996325853fa244e7df661-jpg.jpg" >
  35. </a>
  36. <div class="pl-20px">
  37. <p class="mt-15px mb-10px text-[#333]">{{userInfo?.memberInfo?.name}}</p>
  38. <p class="text-[#999]">{{userInfo?.memberInfo?.email || userInfo?.memberInfo?.phone}}</p>
  39. </div>
  40. </div>
  41. <div class="flex py-14px mt-20px justify-between">
  42. <div>
  43. <p v-if="userInfo?.memberInfo.subscriberType === 1" class="text-18px text-[#333] leading-24px">17会员</p>
  44. <p v-else class="text-18px text-[#333] leading-24px">免费用户</p>
  45. <p v-if="userInfo?.memberInfo.subscriberType === 1" class="text-12px text-[#999] leading-17px">剩余<span class="text-bg-$btn-color-primary">{{userInfo?.memberInfo?.day}}</span>天到期</p>
  46. <p v-else class="text-12px text-[#999] leading-17px">订阅会员免费格式转换</p>
  47. </div>
  48. <button class="btn-renew" @click="$router.push('/pricing')">
  49. {{userInfo?.memberInfo.subscriberType === 1 ? '续费' : '订阅会员'}}
  50. </button>
  51. </div>
  52. <div class="flex py-14px my-8px justify-between" style="border-bottom: 1px solid #f0f0f0;">
  53. <div>
  54. <p class="text-18px text-[#333] leading-24px"><span class="text-500 text-bg-$btn-color-primary text-22px leading-18px tracking-1px">{{userInfo?.memberInfo?.points}}</span><span class="text-14px text-[rgba(0,0,0,0.8)] leading-18px">/{{userInfo?.memberInfo?.totalPoints}}</span></p>
  55. <p class="text-12px text-[#999] leading-17px">转换券</p>
  56. </div>
  57. <button class="btn-recharge" @click="handlerOpenLogin('ticket')">充值</button>
  58. </div>
  59. <div class="w-full h-64px leading-64px text-[#666] cursor-pointer hover:text-bg-$btn-color-primary" style="border-bottom: 1px solid #f0f0f0;" @click="handlerOpenLogin('manage')">
  60. 账号管理
  61. </div>
  62. <div class="w-full h-64px leading-64px text-[#666] cursor-pointer hover:text-bg-$btn-color-primary" @click="handlerLogout">
  63. 退出
  64. </div>
  65. </div>
  66. </div>
  67. <img v-if="!!token" slot="reference" class="w-36px h-36px rounded-full mt-23px mr-0 md-0 ml-90px cursor-pointer" :src="userInfo?.memberInfo.subscriberType === 1 ? 'https://user-file.17pdf.com/avatars/2020/11/16/0577b907be980556bdafa23fb0be0732-jpg.jpg' : 'http://user-file.17pdf.com/avatars/2018/01/02/f183029426a996325853fa244e7df661-jpg.jpg'" @click="$router.push('/members/me/expenses')" />
  68. </el-popover>
  69. </no-ssr>
  70. </div>
  71. <div v-if="!token" class="flex items-center">
  72. <button class="border-1 rounded-4px ml-9px text-$btn-color-primary border-$btn-color-primary border-solid w-70px h-42px leading-22px cursor-pointer hover:opacity-70" @click="handlerOpenLogin('login')">登录</button>
  73. <button class="bg-$btn-color-primary rounded-4px ml-25px text-[#fff] w-70px h-42px leading-22px cursor-pointer hover:bg-[#f34545]" @click="handlerOpenLogin('register')">注册</button>
  74. </div>
  75. </div>
  76. <no-ssr>
  77. <el-dialog
  78. :visible="visiable"
  79. :close-on-click-modal="false"
  80. :close-on-press-escape="false"
  81. :width="dialogWidth"
  82. append-to-body
  83. center
  84. :custom-class="interface === 'manage' ? 'manage-dialog': 'login-dialog'"
  85. @close="handlerCloseDialog"
  86. >
  87. <login v-show="interface === 'login'" ref="loginRef" @register="showChange" @close="handlerCloseDialog"></login>
  88. <register v-show="interface === 'register'" ref="registerRef" @login="showChange" @close="handlerCloseDialog"></register>
  89. <UserManage v-show="interface === 'manage'" ref="manageRef" @close="handlerCloseDialog"></UserManage>
  90. <BuyVip v-if="interface === 'vip'" ref="vipRef" @close="handlerCloseDialog"></BuyVip>
  91. <BuyTicket v-if="interface === 'ticket'" ref="ticketRef" @close="handlerCloseDialog"></BuyTicket>
  92. </el-dialog>
  93. </no-ssr>
  94. </div>
  95. </template>
  96. <script>
  97. import { mapState } from 'vuex'
  98. import login from '~/components/LoginBar.vue'
  99. import register from '~/components/RegisterBar.vue'
  100. import userManage from '~/components/UserManage.vue'
  101. import BuyVip from '~/components/BuyVip.vue'
  102. import BuyTicket from '~/components/BuyTicket.vue'
  103. export default {
  104. components: {
  105. login,
  106. register,
  107. userManage,
  108. BuyVip,
  109. BuyTicket
  110. },
  111. data() {
  112. return {
  113. dialogVisiable: false,
  114. }
  115. },
  116. computed: {
  117. ...mapState([
  118. 'token',
  119. 'userInfo',
  120. 'globalLoginVisiable',
  121. 'globalInterfaceType'
  122. ]),
  123. visiable() {
  124. return this.dialogVisiable || this.globalLoginVisiable
  125. },
  126. interface() {
  127. return this.globalInterfaceType || 'login'
  128. },
  129. dialogWidth() {
  130. if(this.interface === 'vip') {
  131. return '512px'
  132. }else if(this.interface === 'ticket') {
  133. return '558px'
  134. }else {
  135. return '480px'
  136. }
  137. }
  138. },
  139. mounted() {
  140. if(localStorage.getItem('userInfo')) {
  141. this.$store.commit('setUser',JSON.parse(localStorage.getItem('userInfo')))
  142. this.$store.commit('SET_TOKEN',localStorage.getItem('token'))
  143. }
  144. },
  145. methods: {
  146. handlerOpenLogin(type) {
  147. this.dialogVisiable = true
  148. this.$store.commit('SET_INTERFACE', type)
  149. },
  150. handlerCloseDialog() {
  151. this.dialogVisiable = false
  152. this.$store.commit('OPEN_LOGIN',false)
  153. this.$refs[`${this.interface}Ref`].resetInterfaceStatus()
  154. },
  155. // 切换弹窗界面
  156. showChange(type) {
  157. this.$store.commit('SET_INTERFACE', type)
  158. },
  159. handlerLogout() {
  160. localStorage.removeItem('token')
  161. localStorage.removeItem('userInfo')
  162. this.$store.commit('DEL_TOKEN', '')
  163. this.$router.push('/')
  164. },
  165. }
  166. }
  167. </script>
  168. <style lang="scss">
  169. .menu-active {
  170. color: #E93636;
  171. opacity: 0.7;
  172. }
  173. .login-dialog {
  174. position: relative;
  175. border-radius: 6px;
  176. box-shadow: 0 5px 15px rgb(0 0 0 / 50%)
  177. }
  178. .manage-dialog {
  179. position: relative;
  180. border-radius: 6px;
  181. box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
  182. .el-dialog__body {
  183. padding: unset !important;
  184. }
  185. }
  186. .btn-renew {
  187. font-size: 14px;
  188. color: white;
  189. height: 36px;
  190. width: 82px;
  191. background: linear-gradient(128deg, #cca166, #edd3b0);
  192. box-shadow: 0px 2px 6px 0px rgb(219 184 137 / 57%);
  193. border-radius: 4px;
  194. font-weight: 500;
  195. }
  196. .btn-recharge {
  197. width: 82px;
  198. height: 36px;
  199. background-color: #FF4F4F;
  200. box-shadow: 0px 2px 6px rgb(255 79 79 / 20%);
  201. border: none;
  202. border-radius: 4px;
  203. color: #fff;
  204. font-size: 14px;
  205. outline: none;
  206. }
  207. </style>