Przeglądaj źródła

Merge branch 'master' into develop_wzl

# Conflicts:
#	pages/converter.vue
#	pages/pricing.vue
wzl 2 lat temu
rodzic
commit
8ea43dbf10

+ 0 - 1
assets/main.scss

@@ -5,7 +5,6 @@ html {
 }
 
 body {
-  min-width: 1200px;
 	-webkit-font-smoothing: antialiased;
 	-moz-osx-font-smoothing: grayscale;
 }

+ 6 - 6
components/BuyTicket.vue

@@ -3,7 +3,7 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-11-01 14:10:22
- * @LastEditTime: 2022-11-08 16:57:28
+ * @LastEditTime: 2022-11-16 09:44:53
 -->
 <template>
   <div>
@@ -35,9 +35,9 @@
           </div>
         </div>
         <div v-else>
-          <no-ssr>
+          <client-only>
             <vue-qr :size="176" :text="qrcode"></vue-qr>
-          </no-ssr>
+          </client-only>
           <p class="text-[#666] text-18px leading-20px">扫一扫 即可支付</p>
         </div>
       </div>
@@ -92,7 +92,7 @@ export default {
       return item.productCode.split('.')[1]
     },
     getVipList() {
-      this.$axios.post('pricing/getPricingList',{client: 'web',language: 'zh'}).then((res)=> {
+      this.$axios.post('pricing/list',{client: 'web',language: 'zh'}).then((res)=> {
         if(res.code === 200) {
           this.list = res.result.pricingList.filter(item => item.mode !== 1)  // 加云的不展示
           this.choosedTicket = this.list[this.list.length - 1]
@@ -154,14 +154,14 @@ export default {
       this.$axios.post('subscription/create',params).then((res) => {
         if(res.code === 200) {
           location.href = res.result.order.pagePayUrl
+          this.$store.commit('OPEN_LOGIN',false)
         }
       }) 
     },
     getUserInfo() {
       this.$axios.get('members/getMemberInfo').then((res)=> {
         if(res.code === 200) {
-          this.$store.commit('setUser',res.result)
-          localStorage.setItem('userInfo',JSON.stringify(res.result))
+          this.$store.commit('setUser',res.result.memberInfo)
           this.$router.push('/members/me/expenses')
         }
       })

+ 5 - 5
components/BuyVip.vue

@@ -3,7 +3,7 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-31 20:41:42
- * @LastEditTime: 2022-11-08 17:01:57
+ * @LastEditTime: 2022-11-15 19:24:18
 -->
 <template>
   <div>
@@ -37,9 +37,9 @@
           </div>
         </div>
         <div v-else>
-          <no-ssr>
+          <client-only>
             <vue-qr :size="176" :text="qrcode"></vue-qr>
-          </no-ssr>
+          </client-only>
           <p class="text-[#666] text-18px leading-20px">扫一扫 即可支付</p>
         </div>
       </div>
@@ -145,8 +145,7 @@ export default {
     getUserInfo() {
       this.$axios.get('members/getMemberInfo').then((res)=> {
         if(res.code === 200) {
-          this.$store.commit('setUser',res.result)
-          localStorage.setItem('userInfo',JSON.stringify(res.result))
+          this.$store.commit('setUser',res.result.memberInfo)
           this.$router.push('/members/me/expenses')
         }
       })
@@ -161,6 +160,7 @@ export default {
       this.$axios.post('subscription/create',params).then((res) => {
         if(res.code === 200) {
           location.href = res.result.order.pagePayUrl
+          this.$store.commit('OPEN_LOGIN',false)
         }
       }) 
     }

+ 18 - 18
components/LoginBar.vue

@@ -2,6 +2,7 @@
 <script>
 import qs from 'qs'
 import { mapActions } from 'vuex'
+import { setToken } from '~/utils/cookie';
 
 export default {
   data() {
@@ -38,7 +39,7 @@ export default {
   },
   computed: {
     loginBtnDisabled() {
-      return !(this.form.username && this.form.password)
+      return !(this.form.username && this.form.password && this.form.password.length >= 6)
     },
     forgetDisabled() {
       return !(this.forgetForm.account && this.forgetForm.code)
@@ -53,21 +54,21 @@ export default {
   methods: {
     ...mapActions(['login']),
     handlerLogin() {
-      if(this.checked) {
-        localStorage.setItem('username',this.form.username)
-        localStorage.setItem('password',this.form.password)
-      }else {
-        localStorage.removeItem('username',this.form.username)
-        localStorage.removeItem('password',this.form.password)
-        this.form.username = ''
-        this.form.password = ''
-      }
       this.logging = true
       this.$axios.post('login',qs.stringify(this.form)).then((res)=> {
         if(res.code === 200) {
             this.$store.dispatch('login',res.result).then((token)=> {
             this.$axios.setToken(token, 'Bearer')
             localStorage.setItem('token',token)
+            if(this.checked) {
+              localStorage.setItem('username',this.form.username)
+              localStorage.setItem('password',this.form.password)
+            }else {
+              localStorage.removeItem('username',this.form.username)
+              localStorage.removeItem('password',this.form.password)
+              this.form.username = ''
+              this.form.password = ''
+            }
             this.handlerClose()
             this.getUserInfo()
           })
@@ -78,9 +79,10 @@ export default {
     getUserInfo()  {
       this.$axios.get('members/getMemberInfo').then((res)=> {
         if(res.code === 200) {
-          this.$store.commit('setUser',res.result)
-          localStorage.setItem('userInfo',JSON.stringify(res.result))
+          this.$store.commit('setUser',res.result.memberInfo)
+          setToken('vuex',JSON.stringify(res.result.memberInfo))
           this.logging = false
+          this.$emit('loginSucess')
         }
       })
     },
@@ -95,18 +97,16 @@ export default {
         action: '1', // 找回密码
         receiver: this.forgetForm.account
       }
-      if(this.regPhone.test(this.form.username)) params.type = '1'
-      if(this.regEmail.test(this.form.username)) params.type = '0'
+      if(this.regPhone.test(this.forgetForm.account)) params.type = '1'
+      if(this.regEmail.test(this.forgetForm.account)) params.type = '0'
       this.$axios.get('auth/getVerifyCode', {params}).then((res)=> {
         if(res.code === 200) {
           this.sending = true
           let interval = setInterval(() => {
             this.clock--
             if(this.clock === 0) {
-              this.$once('hook:beforeDestroy',()=> {
-                clearInterval(interval)
-                interval = null
-              })
+              clearInterval(interval)
+              interval = null
               this.clock = 60
               this.sending = false
             }

+ 4 - 6
components/RegisterBar.vue

@@ -62,10 +62,8 @@ export default {
           let interval = setInterval(() => {
             this.clock--
             if(this.clock === 0) {
-              this.$once('hook:beforeDestroy',()=> {
-                clearInterval(interval)
-                interval = null
-              })
+              clearInterval(interval)
+              interval = null
               this.clock = 60
               this.sending = false
             }
@@ -85,8 +83,8 @@ export default {
     getUserInfo()  {
       this.$axios.get('members/getMemberInfo').then((res)=> {
         if(res.code === 200) {
-          this.$store.commit('setUser',res.result)
-          localStorage.setItem('userInfo',JSON.stringify(res.result))
+          this.$store.commit('setUser',res.result.memberInfo)
+          this.$emit('loginSucess')
         }
       })
     },

+ 6 - 7
components/UserManage.vue

@@ -30,7 +30,7 @@
         <br/>
         <input  v-model="form.newPassword"  class="login_input_password new" type="password" placeholder="新密码(6-16个字符,区分大小写)">
         <br/>
-        <input  v-model="form.newPassword_confirm"  class="login_input_password confirm" type="password" placeholder="确认新密码">
+        <input  v-model="form.newPasswordConfirm"  class="login_input_password confirm" type="password" placeholder="确认新密码">
         <br/>
         <div class="error-mess error-mess-signup" >
           <span id="error-message error-tip">{{errMsg}}</span>
@@ -47,11 +47,11 @@ export default {
   data() {
     return {
       changePsd: false,
-      username: this.$store.state.userInfo?.memberInfo?.name,
+      username: this.$store.state.userInfo?.name,
       form: {
         password:'',
         newPassword: '',
-        newPassword_confirm:''
+        newPasswordConfirm:''
       },
       errMsg:''
     }
@@ -60,7 +60,7 @@ export default {
   methods: {
     // 点击注册前置校验
     vailidate() {
-      if(this.form.newPassword !== this.form.newPassword_confirm) {
+      if(this.form.newPassword !== this.form.newPasswordConfirm) {
         this.errMsg = '密码不一致'
       }else if(this.form.newPassword.length < 6) {
         this.errMsg = '密码位数不能少于6位'
@@ -91,8 +91,7 @@ export default {
     getUserInfo()  {
       this.$axios.get('members/getMemberInfo').then((res)=> {
         if(res.code === 200) {
-          this.$store.commit('setUser',res.result)
-          localStorage.setItem('userInfo',JSON.stringify(res.result))
+          this.$store.commit('setUser',res.result.memberInfo)
         }
       })
     },
@@ -100,7 +99,7 @@ export default {
       this.changePsd = false
       this.form.password = ''
       this.form.newPassword = ''
-      this.form.newPassword_confirm = ''
+      this.form.newPasswordConfirm = ''
     }
   }
 }

+ 22 - 17
layouts/components/NavBar.vue

@@ -3,7 +3,7 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-17 15:19:11
- * @LastEditTime: 2022-11-11 17:47:39
+ * @LastEditTime: 2022-11-16 17:06:45
 -->
 <template>
   <div class="h-80px flex relative z-3 justify-between px-[10%] border-b-1 border-b-[#f0f0f0] border-b-solid">
@@ -22,6 +22,8 @@
       <div v-if="!!token">
         <client-only>
           <el-popover
+            ref="popover"
+            v-model="popover"
             placement="bottom"
             trigger="hover"
             :close-delay="800"
@@ -30,28 +32,28 @@
               <div class="px-24px pt-24px min-w-300px">
                 <div class="flex pb-22px cursor-pointer" style="border-bottom: 1px solid #f0f0f0;">
                   <a href="/members/me/expenses">
-                    <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" >
+                    <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" >
                     <img v-else class="w-64px rounded-1/2"  src="http://user-file.17pdf.com/avatars/2018/01/02/f183029426a996325853fa244e7df661-jpg.jpg" >
                   </a>
                   <div class="pl-20px">
-                    <p class="mt-15px mb-10px text-[#333]">{{userInfo?.memberInfo?.name}}</p>
-                    <p class="text-[#999]">{{userInfo?.memberInfo?.email || userInfo?.memberInfo?.phone}}</p>
+                    <p class="mt-15px mb-10px text-[#333]">{{userInfo?.name}}</p>
+                    <p class="text-[#999]">{{userInfo?.email || userInfo?.phone}}</p>
                   </div>
                 </div>
                 <div class="flex py-14px mt-20px justify-between">
                   <div>
-                    <p v-if="userInfo?.memberInfo.subscriberType === 1" class="text-18px text-[#333] leading-24px">17会员</p>
+                    <p v-if="userInfo?.subscriberType === 1" class="text-18px text-[#333] leading-24px">17会员</p>
                     <p v-else class="text-18px text-[#333] leading-24px">免费用户</p>
-                    <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>
+                    <p v-if="userInfo?.subscriberType === 1" class="text-12px text-[#999] leading-17px">剩余<span class="text-bg-$btn-color-primary">{{userInfo?.day}}</span>天到期</p>
                     <p v-else class="text-12px text-[#999] leading-17px">订阅会员免费格式转换</p>
                   </div>
                   <button class="btn-renew" @click="$router.push('/pricing')">
-                    {{userInfo?.memberInfo.subscriberType === 1 ? '续费' : '订阅会员'}}
+                    {{userInfo?.subscriberType === 1 ? '续费' : '订阅会员'}}
                   </button>
                 </div>
                 <div class="flex py-14px my-8px justify-between" style="border-bottom: 1px solid #f0f0f0;">
                   <div>
-                    <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>
+                    <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>
                     <p class="text-12px text-[#999] leading-17px">转换券</p>
                   </div>
                   <button class="btn-recharge" @click="handlerOpenLogin('ticket')">充值</button>
@@ -64,7 +66,7 @@
                 </div>
               </div>
             </div>
-            <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')" />
+            <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')" />
           </el-popover>
         </client-only>
       </div>
@@ -84,8 +86,8 @@
         :custom-class="interface === 'manage' ? 'manage-dialog': 'login-dialog'"
         @close="handlerCloseDialog"
       >
-        <login v-show="interface === 'login'" ref="loginRef"  @register="showChange" @close="handlerCloseDialog"></login>
-        <register v-show="interface === 'register'" ref="registerRef" @login="showChange" @close="handlerCloseDialog"></register>
+        <login v-show="interface === 'login'" ref="loginRef"  @register="showChange" @close="handlerCloseDialog" @loginSucess="handleLoginSucess"></login>
+        <register v-show="interface === 'register'" ref="registerRef" @login="showChange" @close="handlerCloseDialog" @loginSucess="handleLoginSucess"></register>
         <UserManage v-show="interface === 'manage'" ref="manageRef" @close="handlerCloseDialog"></UserManage>
         <BuyVip v-if="interface === 'vip'" ref="vipRef" @close="handlerCloseDialog"></BuyVip>
         <BuyTicket v-if="interface === 'ticket'" ref="ticketRef" @close="handlerCloseDialog"></BuyTicket>
@@ -114,6 +116,7 @@ export default {
   data() {
     return {
       dialogVisiable: false,
+      popover: false,
     }
   },
   computed: {
@@ -139,13 +142,15 @@ export default {
       }
     }
   },
-  mounted() {
-    if(localStorage.getItem('userInfo')) {
-      this.$store.commit('setUser',JSON.parse(localStorage.getItem('userInfo')))
-      this.$store.commit('SET_TOKEN',localStorage.getItem('token'))
-    }
-  },
   methods: {
+    handleLoginSucess() {
+      this.$nextTick(()=> {
+        this.popover = true
+      })
+      setTimeout(() => {
+        this.popover = false
+      }, 2000);
+    },
     handlerOpenLogin(type) {
       this.dialogVisiable = true
       this.$store.commit('SET_INTERFACE', type)

+ 4 - 4
layouts/components/navbar2.vue

@@ -3,7 +3,7 @@
  * @Author: 李阳滨
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-31 11:32:24
- * @LastEditTime: 2022-11-03 15:33:53
+ * @LastEditTime: 2022-11-17 09:05:34
 -->
 <template>
   <div>
@@ -94,7 +94,7 @@
                 >注册</a
               >
             </li>
-            <img v-else class="w-36px h-36px rounded-full <tiny:mt-8px mr-0 md-0 cursor-pointer text-[0px] tiny:ml-35px lg:ml-135px xl:ml-190px" :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')" />
+            <img v-else class="w-36px h-36px rounded-full <tiny:mt-8px mr-0 md-0 cursor-pointer text-[0px] tiny:ml-35px lg:ml-135px xl:ml-190px" :src="userInfo?.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')" />
           </ul>
         </div>
       </nav>
@@ -104,7 +104,7 @@
       class="top-menu-overlay fixed top-60px left-0 w-full h-full z-100 bg-[#00000033]"
     ></div>
 
-    <no-ssr>
+    <client-only>
       <el-dialog 
         :visible="dialogVisiable"
         :close-on-click-modal="false"
@@ -118,7 +118,7 @@
         <login v-show="interface === 'login'" ref="loginRef"  @register="showChange" @close="handlerCloseDialog"></login>
         <register v-show="interface === 'register'" ref="registerRef" @login="showChange" @close="handlerCloseDialog"></register>
       </el-dialog>
-    </no-ssr>
+    </client-only>
   </div>
 </template>
 

+ 1 - 1
layouts/custom.vue

@@ -3,7 +3,7 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-21 10:04:45
- * @LastEditTime: 2022-10-24 13:54:46
+ * @LastEditTime: 2022-11-15 10:10:52
 -->
 <template>
   <div>

+ 2 - 2
layouts/default.vue

@@ -3,10 +3,10 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-17 15:11:18
- * @LastEditTime: 2022-11-11 19:18:17
+ * @LastEditTime: 2022-11-15 10:03:54
 -->
 <template>
-  <div class="font-primary">
+  <div class="font-primary min-w-1200px">
     <Navbar></Navbar>
     <Nuxt></Nuxt>
     <FooterBar></FooterBar>

+ 8 - 8
layouts/userCenter.vue

@@ -3,7 +3,7 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-11-01 20:18:40
- * @LastEditTime: 2022-11-11 19:18:14
+ * @LastEditTime: 2022-11-16 10:16:06
 -->
 <template>
   <div class="font-primary min-w-1200px">
@@ -13,27 +13,27 @@
         <div class="person">
           <div>
             <a href="/members/me/expenses" class="members">
-              <img v-if="userInfo?.memberInfo.subscriberType === 1" src="http://user-file.17pdf.com/avatars/2020/11/16/0577b907be980556bdafa23fb0be0732-jpg.jpg" >
+              <img v-if="userInfo?.subscriberType === 1" src="http://user-file.17pdf.com/avatars/2020/11/16/0577b907be980556bdafa23fb0be0732-jpg.jpg" >
               <img v-else src="http://user-file.17pdf.com/avatars/2018/01/02/f183029426a996325853fa244e7df661-jpg.jpg" >
             </a>
             <br>
-            <p class="username">{{userInfo?.memberInfo?.name}}</p>
-            <p class="user-showname block mt-16px">{{userInfo?.memberInfo?.email || userInfo?.memberInfo?.phone}}</p>
+            <p class="username">{{userInfo?.name}}</p>
+            <p class="user-showname block mt-16px">{{userInfo?.email || userInfo?.phone}}</p>
           </div>
           <div class="flex py-14px mt-20px justify-between text-left">
             <div>
-              <p v-if="userInfo?.memberInfo.subscriberType === 1" class="user-vip text-18px mb-6px text-[#333] font-500 leading-24px">17会员</p>
+              <p v-if="userInfo?.subscriberType === 1" class="user-vip text-18px mb-6px text-[#333] font-500 leading-24px">17会员</p>
               <p v-else class="text-18px text-[#333] font-500 leading-24px mb-6px">免费用户</p>
-              <p v-if="userInfo?.memberInfo.subscriberType === 1" class="text-12px text-[#999] pl-28px mb-6px leading-17px">剩余<span class="text-bg-$btn-color-primary">{{userInfo?.memberInfo?.day}}</span>天到期</p>
+              <p v-if="userInfo?.subscriberType === 1" class="text-12px text-[#999] pl-28px mb-6px leading-17px">剩余<span class="text-bg-$btn-color-primary">{{userInfo?.day}}</span>天到期</p>
               <p v-else class="text-12px text-[#999] leading-17px">订阅会员免费格式转换</p>
             </div>
             <button class="btn-renew" @click="handlerBuy('vip')">
-              {{userInfo?.memberInfo.subscriberType === 1 ? '续费' : '订阅会员'}}
+              {{userInfo?.subscriberType === 1 ? '续费' : '订阅会员'}}
             </button>
           </div>
           <div class="flex py-14px my-8px justify-between text-left">
             <div class="user-ticket">
-              <p class="text-18px text-[#333] leading-24px mb-6px"><span class="font-500 text-bg-$btn-color-primary text-18px leading-24px tracking-1px">{{userInfo?.memberInfo?.points}}</span><span class="text-bg-$btn-color-primary text-14px leading-18px">张</span><span class="text-14px text-[rgba(0,0,0,0.8)] leading-18px">/{{userInfo?.memberInfo?.totalPoints}}张</span></p>
+              <p class="text-18px text-[#333] leading-24px mb-6px"><span class="font-500 text-bg-$btn-color-primary text-18px leading-24px tracking-1px">{{userInfo?.points}}</span><span class="text-bg-$btn-color-primary text-14px leading-18px">张</span><span class="text-14px text-[rgba(0,0,0,0.8)] leading-18px">/{{userInfo?.totalPoints}}张</span></p>
               <p class="text-12px text-[#999] leading-17px">转换券</p>
             </div>
             <button class="btn-recharge" @click="handlerBuy('ticket')">充值</button>

+ 2 - 2
middleware/auth.js

@@ -3,10 +3,10 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-11-07 17:12:06
- * @LastEditTime: 2022-11-07 17:16:40
+ * @LastEditTime: 2022-11-14 11:48:15
  */
 export default function ({redirect, store}) {
-  if (store.state.token === '' ) {
+  if (store?.state?.token === '' ) {
     return redirect('/');
   }
 }

+ 4 - 5
middleware/user.js

@@ -3,14 +3,13 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-11-08 09:15:06
- * @LastEditTime: 2022-11-08 09:42:08
+ * @LastEditTime: 2022-11-16 13:58:30
  */
 export default function({store, app: {$axios}}) {
-  if(store.state.token !== '') {
-    $axios.get('members/getMemberInfo').then((res)=> {
+  if(store?.state?.token !== '') {
+    return $axios.get('members/getMemberInfo').then((res)=> {
       if(res.code === 200) {
-        store.commit('setUser',res.result)
-        localStorage.setItem('userInfo',JSON.stringify(res.result))
+        store.commit('setUser',res.result.memberInfo)
       }
     })
   }

+ 12 - 10
nuxt.config.js

@@ -3,12 +3,12 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-17 11:06:52
- * @LastEditTime: 2022-11-10 15:18:13
+ * @LastEditTime: 2022-11-16 16:42:17
  */
 export default {
   // Global page headers: https://go.nuxtjs.dev/config-head
   head: {
-    title: '17PDF',
+    title: '',
     htmlAttrs: {
       lang: 'en',
     },
@@ -20,18 +20,20 @@ export default {
     ],
     link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
   },
-  
+  env: {
+    BASE_URL: process.env.BASE_URL,
+    NODE_ENV: process.env.NODE_ENV
+  },
   // Global CSS: https://go.nuxtjs.dev/config-css
   css: [
     '@/assets/main.scss',
     {src:'element-ui/lib/theme-chalk/index.css'},
   ],
-
   // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
   plugins: [
     '~/plugins/axios',
     {src: '~plugins/element-ui', ssr: false},
-    {src: '@/plugins/localStorage', ssr: false},
+    {src: '@/plugins/localStorage', ssr: true},
     {src: '@/plugins/vueqr', ssr: false},
   ],
 
@@ -54,12 +56,12 @@ export default {
   ],
   axios: {
     timeout: 3000,
-    prefix: '/17pdf-backend-core/',
-    proxy: process.env.NODE_ENV !== 'production'
-  },
-  proxy: {
-    '/17pdf-backend-core': { target: 'http://81.68.234.235:8999',}
+    baseURL: process.env.BASE_URL,
+    // prefix: '/17pdf-backend-core',
   },
+  // proxy: {
+  //   '/17pdf-backend-core': { target: 'http://81.68.234.235:8999',}
+  // },
 
   // Build Configuration: https://go.nuxtjs.dev/config-build
   build: {

+ 4 - 3
package.json

@@ -3,9 +3,9 @@
   "version": "1.0.0",
   "private": true,
   "scripts": {
-    "dev": "nuxt",
-    "build": "nuxt build",
-    "start": "nuxt start",
+    "dev": "cross-env BASE_URL=http://81.68.234.235:8999/17pdf-backend-core NODE_ENV=development nuxt",
+    "build": "cross-env BASE_URL=http://139.196.160.101:8082/17pdf-backend-core NODE_ENV=production nuxt build",
+    "start": "cross-env BASE_URL=http://139.196.160.101:8082/17pdf-backend-core NODE_ENV=production nuxt start",
     "generate": "nuxt generate",
     "lint:js": "eslint --ext \".js,.ts,.vue\" --ignore-path .gitignore .",
     "lint:prettier": "prettier --check .",
@@ -35,6 +35,7 @@
     "@nuxtjs/eslint-config-typescript": "^11.0.0",
     "@nuxtjs/eslint-module": "^3.1.0",
     "@nuxtjs/proxy": "^2.1.0",
+    "cross-env": "^7.0.3",
     "eslint": "^8.24.0",
     "eslint-config-prettier": "^8.5.0",
     "eslint-plugin-nuxt": "^4.0.0",

+ 50 - 33
pages/converter.vue

@@ -4,9 +4,9 @@
       <img src="http://cn-file.17pdf.com/website/common/ic_notice.svg" class="align-middle">
       <div class="text-container">
         <span class="text">
-          转档后的文件支持在云端保留24小时,<span v-if="userInfo?.memberInfo.subscriberType === 1">会员尊享5G容量,</span>请在24小时内下载文件至本地永久保存
+          转档后的文件支持在云端保留24小时,<span v-if="userInfo?.subscriberType === 1">会员尊享5G容量,</span>请在24小时内下载文件至本地永久保存
         </span>
-        <span v-if="userInfo?.memberInfo.subscriberType === 1" class="vip tip">
+        <span v-if="userInfo?.subscriberType === 1" class="vip tip">
           <img src="http://cn-file.17pdf.com/website/common/ic_info.svg" alt="">
           <div class="tip-text">
             若已有文件大小超出5G,将按转档时间计算(从最近一次转档往过去推算),即保留最近的5G容量文件,超出部分文件将不再保留
@@ -17,7 +17,8 @@
     <h1 class="text-48px text-opacity-100 font-500 text-[#3333] mt-48px mb-10px text-center">文件转换器</h1>
     <h2 class="text-20px text-center text-[#666] mt-20px font-normal">PDF文件格式转换器,一键转档,支持批量转换,精准快速。</h2>
     <div class="text-center mb-80px">
-      <a class="mt-20px text-[#4D4D4D] text-16px font-600 inline-flex items-center leading-22px hover:text-$btn-color-primary hover:underline"
+      <a
+class="mt-20px text-[#4D4D4D] text-16px font-600 inline-flex items-center leading-22px hover:text-$btn-color-primary hover:underline"
         href="https://www.compdf.com/pdf-conversion-sdk?utm_source=anroidapp&utm_medium=17pdfweb&utm_campaign=pdfsdk" target="_blank">由 ComPDFKit Conversion SDK 提供技术支持
         <svg class="ml-8px" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
           <path d="M6 12.9567L10.714 8.24261L6 3.52856" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
@@ -35,7 +36,7 @@
               <a class="text-[#ff4f4f] no-underline leading-normal" @click="handlerBuy('ticket')">充值</a>
             </span>
             <div class="need-volume float-right right-48px text-16px text-[#666] leading-48px mr-20px">
-              所需券:<span class="text-[#0dd299] text-16px" :class="{'text-red-500': requiredCoupon > userInfo !== null ? userInfo.memberInfo.points : 0 }">{{ requiredCoupon }}券</span> / 剩余券:<span class="text-[#0dd299] text-16px">{{ userInfo?.memberInfo.points > 0 ? userInfo.memberInfo.points : 0 }}券</span>
+              所需券:<span class="text-[#0dd299] text-16px" :class="{'text-red-500': requiredCoupon > userInfo?.points}">{{ requiredCoupon }}券</span> / 剩余券:<span class="text-[#0dd299] text-16px">{{ userInfo?.points }}券</span>
             </div>
           </div>
           <div class="transfer-panel">
@@ -50,7 +51,7 @@
                         点击从电脑上传文件或把文件拖到这里
                         <p class="text-14px">(支持PDF to Word、PPT、Excel、TXT、JPG/PNG无限次数转换)</p>
                       </div>
-                      <table class="table table-hover w-[100%] max-w-[100%]" id="table-fileinput">
+                      <table id="table-fileinput" class="table table-hover w-[100%] max-w-[100%]">
                         <thead v-show="fileList.length > 0">
                           <tr class="h-40px bg-[#eee]">
                             <th class="!w-[5.5%]"></th>
@@ -63,15 +64,15 @@
                           </tr>
                         </thead>
                         <tbody v-show="fileList.length > 0" class="file-preview-thumbnails cursor-default">
-                          <tr v-for="(item, index) in fileList" :key="index" class="file-preview-frame explorer-frame  kv-preview-thumb w-100px h-38px hover:bg-[#f5f5f5]" id="preview-1668340925733-0" data-fileindex="0" data-template="pdf" title="test.pdf">
+                          <tr v-for="(item, index) in fileList" id="preview-1668340925733-0" :key="index" class="file-preview-frame explorer-frame  kv-preview-thumb w-100px h-38px hover:bg-[#f5f5f5]" data-fileindex="0" data-template="pdf" title="test.pdf">
                             <td class="file-details-cell">{{ index+1 }}</td>
                             <td class="file-details-cell !text-left">
                               <div class="explorer-caption max-w-260px truncate block text-[#777]" title="test.pdf">{{ item.name }}</div>
                             </td>
                             <td class="file-details-cell text-[#999]">{{ getfilesize(item.size) }}</td>
-                            <td class="file-details-cell points">{{ userInfo?.memberInfo.subscriberType === 1 ? 0 : item.price }}</td>
+                            <td class="file-details-cell points">{{ userInfo.subscriberType === 1 ? 0 : item.price }}</td>
                             <td class="file-details-cell select w-106px">
-                              <select v-if="item.status !== 6" class="transfer-select appearance-none" v-model="item.output" @change="changeOutput(item, index)">
+                              <select v-if="item.status !== 6" v-model="item.output" class="transfer-select appearance-none" @change="changeOutput(item, index)">
                                 <option value="png">PNG</option>
                                 <option value="xlsx">XLSX</option>
                                 <option value="pptx">PPTX</option>
@@ -106,10 +107,11 @@
                     <div class="input-group-btn relative text-0px whitespace-nowrap !flex">
                       <div tabindex="500" class="btn btn-file" :class="{'btn-file-left' : fileList.length > 0}">
                         <div class="add-file" :class="{'add-file-left':(fileList.length > 0)}">{{ fileList.length > 0 ? '添加文件' : '' }}</div>
-                        <input name="file" id="fileinput-explorer" ref="file" @change="addFile($event)" accept=".pdf" title="上传文件" type="file" multiple=""
-                        class="absolute top-0 right-0 p-0 m-0 min-w-[100%] h-[100%] w-90px text-right opacity-0 bg-none bg-repeat bg-scroll block outline-none border-0 cursor-pointer"/>
+                        <input
+id="fileinput-explorer" ref="file" name="file" accept=".pdf" title="上传文件" type="file" multiple="" class="absolute top-0 right-0 p-0 m-0 min-w-[100%] h-[100%] w-90px text-right opacity-0 bg-none bg-repeat bg-scroll block outline-none border-0 cursor-pointer"
+                        @change="addFile($event)"/>
                       </div>
-                      <div v-if="fileList.length > 0" @click="deleteAllFile" class="inline-block ml-30px bg-white border border-[#ff4f4f] boder-solid text-16px py-7px px-18px rounded-4px mt-4px cursor-pointer text-[#ff4f4f] leading-normal hover:bg-[#ff4f4f] hover:text-white">清空</div>
+                      <div v-if="fileList.length > 0" class="inline-block ml-30px bg-white border border-[#ff4f4f] boder-solid text-16px py-7px px-18px rounded-4px mt-4px cursor-pointer text-[#ff4f4f] leading-normal hover:bg-[#ff4f4f] hover:text-white" @click="deleteAllFile">清空</div>
                     </div>
                   </div>
                 </div>
@@ -118,7 +120,7 @@
 
             <div class="transfer-btn mt-30px h-64px text-center">
               <div class="cursor-not-allowed inline-block">
-                <span @click="createFileMission" :class="{'disabledBtn' : !checkbox || !changeFileFlag }" class="btn transfer-start-btn bg-[#ff524f] text-20px py-0 px-150px rounded-4px h-60px w-386px text-white hover:bg-[#f34545]">
+                <span :class="{'disabledBtn' : !checkbox || !changeFileFlag }" class="btn transfer-start-btn bg-[#ff524f] text-20px py-0 px-150px rounded-4px h-60px w-386px text-white hover:bg-[#f34545]" @click="createFileMission">
                   <a class="text-white leading-60px">{{ !changeFileFlag ? '转换中...' : '开始转换' }}</a>
                   <span v-if="!changeFileFlag" class="loading"></span>
                 </span>
@@ -138,7 +140,7 @@
           <div class="modal-dialog verifi-dialog w-480px h-426px my-50px" role="document">
             <div class="modal-content relative bg-white rounded-6px border border-solid border-[rgba(0,0,0,0.2)] outline-0 bg-clip-padding ring-[rgba(0,0,0/50%)] ring-offseet-3px ring-9px md:ring-offset-5 md:ring-15px">
               <div class="">
-                <button type="button" id="verifi-close" class="close pompt_close py-5px px-10px outline-none" data-dismiss="modal" aria-label="Close">
+                <button id="verifi-close" type="button" class="close pompt_close py-5px px-10px outline-none" data-dismiss="modal" aria-label="Close">
                   <span aria-hidden="true">×</span>
                 </button>
               </div>
@@ -158,7 +160,7 @@
       <div class="file_num w-[100%] h-120px text-center text-white leading-120px text-30px mb-76px">
         17PDF Reader,当前已转换了<span class="text-32px"> 1,859,726 </span> 个文件
       </div>
-      <div class="pdf_converter clear w-[80%] my-0 mx-auto" id="more_type">
+      <div id="more_type" class="pdf_converter clear w-[80%] my-0 mx-auto">
         <div class="package_type">
           <h3 class="text-24px text-[#333] font-normal mx-0 mt-0 mb-49px h-30px leading-30px">会员专享格式</h3>
           <ul class="flex justify-center w-[100%] min-w-340px p-0 mt-0 mb-10">
@@ -297,7 +299,22 @@ export default {
       changeSucesssFileList: []
     }
   },
-  middleware: 'user',
+  // middleware: 'user',
+  head() {
+    return {
+      title: 'PDF转换器免费在线转档',
+      meta: [
+        {
+        hid: 'description',
+        content: '17PDF Reader免费提供在线PDF格式转换文件转档服务,支持PDF转word,PDF转doc,PDF转PPT,PDF转png,PDF转html,PDF转epub,PDF转xls,psd转ai等。轻松拖曳,一键转档,批量转换,支持多种常用格式相互转档。先进的转换引擎,极速转换,精准度高达99.99%。',
+        },
+        {
+          name: 'keywords',
+          content: '格式转换,文件转档,pdf convert,converter, word to pdf'
+        }
+      ]
+    }
+  },
   computed: {
     ...mapState([
       'userInfo'
@@ -327,9 +344,9 @@ export default {
       // 阻止发生默认行为
       event.preventDefault();
       const array = event.target.files
-      let defaultPrice = await this.getFilePrice('pdf', 'docx')
+      const defaultPrice = await this.getFilePrice('pdf', 'docx')
       for (let i = 0; i < array.length; i++) {
-        let fileObj = {
+        const fileObj = {
           name: array[i].name,
           size: array[i].size,
           price: defaultPrice,
@@ -355,14 +372,14 @@ export default {
     },
     // 改变要转换的格式
     async changeOutput (item, index) {
-      let price = await this.getFilePrice(item.input, item.output)
+      const price = await this.getFilePrice(item.input, item.output)
       this.$set(this.fileList[index], 'price', price)
       this.$set(this.fileList[index], 'output', item.output)
     },
     // 计算文件大小函数(保留两位小数),Size为字节大小
     getfilesize (size) {
       if (!size) return ""
-      var num = 1024.00 //byte
+      const num = 1024.00 // byte
       if (size < num) {
         return size + "B"
       }
@@ -403,23 +420,23 @@ export default {
     // 转档第一步,根据文件列表创建任务和插入文件信息
     createFileMission () {
       // if (this.fileList.length === 0) return
-      // let points = this.userInfo.memberInfo.points
-      // if (this.requiredCoupon > points) {
-      //   alert('券数不足,请充值')
-      //   return
-      // }
-      let filterFileList = this.fileList.filter(function(item){
+      const points = this.userInfo.points
+      if (this.requiredCoupon > points) {
+        alert('券数不足,请充值')
+        return
+      }
+      const filterFileList = this.fileList.filter(function(item){
         return item.status !== 6
       })
       console.log(filterFileList)
       let fileArr = []
       for (let i = 0; i < filterFileList.length; i++) {
-        let file = {}
-        file['sourceType'] = 0
-        file['size'] = filterFileList[i].size
-        file['input'] = 'pdf'
-        file['output'] = filterFileList[i].output
-        file['filename'] = filterFileList[i].name
+        const file = {}
+        file.sourceType = 0
+        file.size = filterFileList[i].size
+        file.input = 'pdf'
+        file.output = filterFileList[i].output
+        file.filename = filterFileList[i].name
         fileArr[i] = file;
       }
       fileArr = JSON.stringify(fileArr)
@@ -437,7 +454,7 @@ export default {
       }
       this.$axios('/mission/create', config).then((res) => {
         if(res.code === 200) {
-          let missionFiles = res.result.missionFilePoJos
+          const missionFiles = res.result.missionFilePoJos
           console.log(missionFiles)
           for (let i = 0; i < missionFiles.length; i++) {
             this.changeFileStatus(missionFiles[i].fileName, 2)
@@ -545,7 +562,7 @@ export default {
       this.$axios.post('/mission/queryFileStatus', formData, config).then((res) => {
         console.log('获取文件状态')
         if(res.code === 200) {
-          let getFileList = res.result[0].missionFilePoJos
+          const getFileList = res.result[0].missionFilePoJos
           console.log(getFileList)
           let changeSucesssNum = 0
           for (let i = 0; i < getFileList.length; i++) {

+ 22 - 5
pages/index.vue

@@ -1,11 +1,28 @@
 <script>
 export default {
-  middleware: 'user',
+  // middleware: 'user',
   data() {
     return {
       indexActive: 1
     }
   },
+  head() {
+    return {
+      title: '17PDF Reader 一起阅读 - 移动端PDF阅读器 + 免费在线PDF转档',
+      meta: [
+        {
+          name: 'keywords',
+          hid: 'keywords',
+          content: 'PDFReader,pdfreader,17PDF Reader,pdf软件,PDF阅读器,文件扫描'
+        },
+        {
+          hid: 'description',
+          name: 'description',
+          content: '17PDF Reader是行走的PDF阅读器和文件扫描仪,并提供免费的PDF文件格式转换工具,支持pdf转word,pdf转doc,pdf转ppt,pdf转图片等。17PDF Reader被用户誉为“亚洲的Adobe”,拥有自主产权的PDF核心技术,为商务精英、教育族群及企业提供全方位的PDF文件解决方案。'
+        }
+      ]
+    }
+  },
   methods: {
     // elementui走马灯组件bug:item只有两个时变换的方向有问题
     // fix:多增加一份item,自定义轮播点
@@ -25,7 +42,7 @@ export default {
 </script>
 <template>
   <div class="page-home">
-    <no-ssr>
+    <client-only>
       <el-carousel ref="carousel" indicator-position="none" loop  height="100vh" @change="handlerCarouselChange">
         <el-carousel-item>
           <div class="home-banner banner ">
@@ -72,7 +89,7 @@ export default {
           </div>
         </el-carousel-item>
       </el-carousel>
-    </no-ssr>
+    </client-only>
     <!-- 自定义轮播点 -->
     <ul class="indicators">
       <li v-for="index in 2" :key="index" :class="index === indexActive?'is-active':''" class="indicator">
@@ -169,7 +186,7 @@ export default {
     </div>
     <div class="home_user_say">
       <h3>5年口碑 · 品质之选</h3>
-      <no-ssr>
+      <client-only>
         <el-carousel class="user_say_carousel">
           <el-carousel-item class="item">
             <ul class="clear">
@@ -248,7 +265,7 @@ export default {
             </ul>
           </el-carousel-item>
         </el-carousel>
-      </no-ssr>
+      </client-only>
     </div>
     <div class="free_signup">
       <p>开启17PDF Reader高效办公学习旅程</p>

+ 3 - 3
pages/members/me/expenses.vue

@@ -3,7 +3,7 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-11-01 19:27:42
- * @LastEditTime: 2022-11-08 09:44:09
+ * @LastEditTime: 2022-11-17 09:06:01
 -->
 <template>
   <div>
@@ -11,9 +11,9 @@
       <img src="http://cn-file.17pdf.com/website/common/ic_notice.svg" class="align-middle">
       <div class="text-container">
         <span class="text">
-          转档后的文件支持在云端保留24小时,<span v-if="userInfo?.memberInfo.subscriberType === 1">会员尊享5G容量,</span>请在24小时内下载文件至本地永久保存
+          转档后的文件支持在云端保留24小时,<span v-if="userInfo?.subscriberType === 1">会员尊享5G容量,</span>请在24小时内下载文件至本地永久保存
         </span>
-        <span v-if="userInfo?.memberInfo.subscriberType === 1" class="vip tip">
+        <span v-if="userInfo?.subscriberType === 1" class="vip tip">
           <img src="http://cn-file.17pdf.com/website/common/ic_info.svg" alt="">
           <div class="tip-text">
             若已有文件大小超出5G,将按转档时间计算(从最近一次转档往过去推算),即保留最近的5G容量文件,超出部分文件将不再保留

+ 1 - 1
pages/members/me/points.vue

@@ -3,7 +3,7 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-11-02 10:18:11
- * @LastEditTime: 2022-11-08 09:44:32
+ * @LastEditTime: 2022-11-16 17:50:37
 -->
 <template>
   <div>

+ 16 - 1
pages/pdf-reader/download.vue

@@ -3,7 +3,7 @@
  * @Author: 李阳滨
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-31 10:30:00
- * @LastEditTime: 2022-11-03 18:01:40
+ * @LastEditTime: 2022-11-14 11:43:26
 -->
 <template>
   <div class="pdf-reader-wrapper">
@@ -492,6 +492,21 @@
 <script>
 export default {
   layout: 'downnav',
+  head() {
+    return {
+      title: 'PDF Reader - PDF阅读, 编辑, 转换软件, 移动端PDF文件解决方案',
+      meta: [
+        {
+          name: 'keywords',
+          content: 'pdf阅读器,pdf浏览器,pdf转换器,pdf编辑,文件转换'
+        },
+        {
+        hid: 'description',
+        content: 'PDF Reader是一款综合型PDF阅读器和编辑器,方便您在安卓手机和平板上浏览、注释、转换、编辑、水印、OCR、加密、扫描和分享PDF文件。立即下载安装,提升您的学习与办公效率!'
+       },
+      ]
+    }
+  },
   methods: {
     moveDownload() {
       const scrollPart = document.querySelector("#download-wrapper"); 

Plik diff jest za duży
+ 321 - 225
pages/pricing.vue


+ 2 - 0
pages/sdk.vue

@@ -223,10 +223,12 @@ export default {
       meta: [
         {
           name: 'keywords',
+          hid: 'keywords',
           content: 'PDF SDK,PDF library, pdf开发包,pdf kit'
         },
         {
         hid: 'description',
+        name: 'description',
         content: '17PDF Reader提供跨平台整合PDF阅读器核心功能到你的App中, 文件阅读、文件注释、文件扫描、数字签名、水印、OCR、文本编辑、表单填写、文件合并、文件分割等各种功能集成,让你的工具更强大!'
        },
       ]

+ 5 - 2
plugins/axios.js

@@ -3,9 +3,11 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-19 13:58:11
- * @LastEditTime: 2022-11-03 15:36:24
+ * @LastEditTime: 2022-11-16 10:25:06
  */
 import { Message } from 'element-ui';
+import { removeToken } from '~/utils/cookie';
+
 
 export default function({store, app:{ $axios }, redirect} ) {
   $axios.onRequest(config => {
@@ -19,8 +21,9 @@ export default function({store, app:{ $axios }, redirect} ) {
       Message.error('登录过期,请重新登录')
       store.commit('OPEN_LOGIN',false)
       store.commit('DEL_TOKEN','')
+      store.commit('setUser', {})
+      removeToken('Token')
       localStorage.removeItem('token')
-      localStorage.removeItem('userInfo')
       return Promise.resolve(false)
     }
     if (code !== 200) {

+ 19 - 4
plugins/localStorage.js

@@ -3,12 +3,27 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-26 09:30:22
- * @LastEditTime: 2022-10-26 09:30:32
+ * @LastEditTime: 2022-11-16 15:44:52
  */
 import createPersistedState from 'vuex-persistedstate'
+import * as Cookies from 'js-cookie'
+import { cookieParse } from '~/utils/cookie'
 
-export default ({ store }) => {
+
+export default ({store, req}) => {
     createPersistedState({
-        storage: sessionStorage
-    })(store)
+        storage: {
+            getItem: (key) => {
+                if (process.server) {
+                    const parsedCookies = cookieParse(req.headers.cookie)
+                    return parsedCookies[key];
+                } else {
+                    return Cookies.get(key);
+                }
+            },
+            setItem: (key, value) => Cookies.set(key, value, { expires: 15, secure: false }),
+            removeItem: key => Cookies.remove(key)
+        }
+    })(store);
+
 }

+ 0 - 1
static/usermanual.html

@@ -1117,7 +1117,6 @@
     var nl = (navigator.language || navigator.browserLanguage).toLowerCase();
     var cnContainer = document.getElementsByClassName('chinese')[0];
     var enContainer = document.getElementsByClassName('english')[0];
-    console.log(window.location.search)
     if (nl.indexOf('zh-cn') >= 0 && (window.location.search !== '?lang=en')) {
       cnContainer.style.display = 'block';
       enContainer.style.display = 'none';

+ 16 - 8
store/index.js

@@ -3,14 +3,12 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-25 17:19:19
- * @LastEditTime: 2022-11-02 16:03:41
+ * @LastEditTime: 2022-11-16 13:51:41
  */
+import { setToken, cookieParse } from '~/utils/cookie'
+
 export const state = () => ({
-  userInfo: {
-    memberInfo: {},
-    pricingList: [],
-    setPricingList: [],
-  },
+  userInfo: {},
   token: '',
   globalLoginVisiable: false,
   globalInterfaceType: false
@@ -38,15 +36,25 @@ export const mutations = {
 export const actions = {
 
   nuxtServerInit ({commit, state}, {req}) {
-      if (req && req.headers && req.headers.token) {
-        commit('SET_TOKEN', req.headers.token)
+    let token = null
+    let userInfo = null
+    if (req && req.headers && req.headers.cookie) {
+      const parsed = cookieParse(req.headers.cookie)
+      try {
+        token = parsed?.Token || ''
+        userInfo = JSON.parse(decodeURIComponent(parsed.vuex)).userInfo
+      } catch (err) {
       }
+      commit('SET_TOKEN', token)
+      commit('setUser', userInfo)
+    }
   },
 
   login ({ commit }, params) {
     return new Promise((resolve, reject) => {
       this.$axios.get(`auth/getToken?code=${params}`).then(res => {
         const token = res.result.accessToken
+        setToken('Token', token)
         localStorage.setItem('token',token)
         commit('SET_TOKEN', token)
         resolve(token)

+ 2 - 2
utils/cookie.js

@@ -3,9 +3,9 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-11-11 11:27:09
- * @LastEditTime: 2022-11-11 13:43:02
+ * @LastEditTime: 2022-11-11 11:43:25
  */
-const Cookies = process.client ? require('js-cookie') : undefined
+const Cookies = require('js-cookie')
 
 export function getToken (TokenKey) {
   return Cookies ? Cookies.get(TokenKey) : ''

+ 5 - 2
windi.config.js

@@ -3,7 +3,7 @@
  * @Author: 欧阳承珺
  * @LastEditors: 欧阳承珺
  * @Date: 2022-10-19 17:25:48
- * @LastEditTime: 2022-11-03 13:41:21
+ * @LastEditTime: 2022-11-15 09:56:22
  */
 import { defineConfig } from 'windicss/helpers'
 
@@ -15,7 +15,10 @@ export default defineConfig({
       'xl': '1280px',
       'lg': '1120px',
       'tiny': '960px',
-      'sm': '768px'
+      'sm': '768px',
+      'sm750':'750px',
+      'sm550':'550px',
+      'sm480':'480px',
     },
     extend: {
       fontFamily: {