NavBar.vue 9.3 KB

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