NavBar.vue 8.9 KB

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