pujiaming il y a 2 ans
Parent
commit
d879d7c60d

+ 0 - 1
package.json

@@ -36,7 +36,6 @@
     "typescript": "^5.0.2",
     "unplugin-vue-components": "^0.25.1",
     "vite": "^4.4.5",
-    "vite-plugin-obfuscator": "^1.0.5",
     "vue-eslint-parser": "^9.3.1",
     "vue-tsc": "^1.8.5"
   }

+ 17 - 10
src/components/layout/header.vue

@@ -40,7 +40,7 @@
         <img :src="getAssetsFile('menu.png')" alt="" @click="show=true"/>
       </div>
       <div class="user">
-        <span v-if="!hasToken" class="el-dropdown-link">
+        <span v-if="!user.isLogin" class="el-dropdown-link">
           <img :src="getAssetsFile('gamer.png')" @click="router.push('/login')" />
         </span>
         <el-dropdown v-else trigger="click" >
@@ -73,8 +73,8 @@
       :key="index"
       :title="item.text"
       @click="toPath(item.url)"/>
-    <van-cell title="账号设置" @click="toSetting"/>
-    <van-cell v-if="hasToken" title="退出登录" @click="logOut"/>
+    <van-cell v-if="user.isLogin" title="账号设置" @click="toSetting"/>
+    <van-cell v-if="user.isLogin" title="退出登录" @click="logOut"/>
   </van-popup>
 </template>
 
@@ -98,8 +98,11 @@ const { search } = useStore()
 const show = ref(false)
 const game_name = ref(local.get('searchText') || '')
 // 绑定el-autocomplete组件
-const hasToken = ref(sessionStorage.getItem('token'))
-
+const oriMenu = reactive([
+  { text: '首页', value: 1, url: '/home' },
+  { text: '分类', value: 2, url: '/cate' },
+  { text: '我的游戏', value: 3, url: '/my_game' }
+])
 const currentIndex = ref(local.get('headerPath') || '') // 取保存的title
 console.log('currentIndex', currentIndex.value)
 
@@ -110,8 +113,9 @@ if (route.query.account) {
 
 // 顶部导航栏
 onMounted(() => {
-  const token = sessionStorage.getItem('token')
+  const token = sessionStorage.getItem('token') || ''
   if (token) {
+    user.isLogin = true
     user.getUserProfile()
   }
 })
@@ -119,11 +123,14 @@ onMounted(() => {
 // 退出登录
 const logOut = () => {
   // console.log(22);
+  show.value = false
+  user.menuPath = oriMenu
   sessionStorage.removeItem('token')
-  hasToken.value = ''
+  user.isLogin = false
   router.push({ path: '/login' })
 }
 const toSetting = () => {
+  show.value = false
   router.push('/settings')
 }
 interface LinkItem {
@@ -173,7 +180,7 @@ const searchChange = async(str: string, cb: (arg: any) => void) => {
 
 const handleSelect = (item: LinkItem) => {
   if (item) {
-    if (route.path !== 'search') {
+    if (route.path !== '/search') {
       router.push({ path: '/search' })
     }
     search.onSearch()
@@ -183,7 +190,7 @@ const handleSelect = (item: LinkItem) => {
 
 // 手动回车跳转搜索页
 const handleKeyEnter = () => {
-  if (route.path !== 'search') {
+  if (route.path !== '/search') {
     router.push({ path: '/search' })
   }
   search.onSearch()
@@ -204,8 +211,8 @@ const platform = computed(() => {
   }
 })
 const toPath = (url: any) => {
-  router.push({ path: url })
   show.value = false
+  router.push({ path: url })
 }
 </script>
 

+ 122 - 2
src/global.scss

@@ -198,13 +198,133 @@
 @media screen and (max-width:350px) {
     #header{
         height: 60px;
-        box-sizing: border-box;
-        overflow: hidden;
+        background-color: #eaedfc;
         .wrap{
+            padding:0 10px;
             width: 100%;
+            .left-part{
+                font-size: 22px;
+            }
+            .menu{
+                display: none;
+            }
+            .search-wrap{
+                // width: 170px!important;
+                // :deep(.el-input__wrapper){
+                //     border-radius: 20px;
+                // }
+                display: none;
+            }
+            .mini-menu{
+                display: block!important;
+                padding-right: 15px;
+            }
+            .user{
+                display: none;
+            }
+            
         }
     }
     .header-hidden{
         height: 60px!important;
     }
+    #main{
+        .main-wrap{
+            width: 100%;
+            margin: 0;
+            padding: 0;
+            display: block;
+            .left-list, .right-action{
+                display: none;
+            }
+            .mob-page{
+                display: block!important;
+            }
+            .cate-list{
+                .cate-tag, .divide{
+                    display: none;
+                }
+                .drop-tag{
+                    display: block!important;
+                }
+                .hot-item{
+                    height: 120px;
+                    .game-logo{
+                        display: none;
+                    }
+                    flex-direction: row-reverse;
+                    justify-content: flex-end;
+                    --van-button-small-padding:15px;
+                    .game-poster{
+                        width: 133px;
+                        height: 75px;
+                        border-radius: var(--logo-radius);
+                        margin-right: 5px;
+                    }
+                    margin-bottom: 0;
+                    .down-btn{
+                        display: block!important;
+                    }
+                    .detail{
+                        width: 150px;
+                        
+                    }
+                    .game_tag{
+                        margin-right: 2px;
+                        font-size: 10px;
+                    }
+                }
+            }
+            .bg{
+                display: none;
+            }
+            .mob-login{
+                display: flex!important;
+            }
+            .rest-list{
+                display: none;
+            }
+            .mob-list{
+                display: block!important;
+                min-height: calc(100vh - 60px)
+            }
+            .settings{
+                display: none;
+            }
+            .mob-setting{
+                display: block!important;
+            }
+            .mine{
+                .pcbt, .game-poster{
+                    display: none;
+                }
+                .right{
+                    display: flex!important;
+                }
+            }
+            .search_cont{
+                .search_key{
+                    display: block!important;
+                }
+                .pcbt, .game-poster{
+                    display: none;
+                }
+                .right{
+                    display: flex!important;
+                }
+                .hot-item{
+                    height: 96px;
+                    width: 100%;
+                    box-sizing: border-box;
+                    .game-logo{
+                        margin-right: 10px;
+                    }
+                    .detail{
+                        width: 170px;
+                    }
+                }
+            }
+            
+        }
+    }
 }

+ 2 - 1
src/store/user.ts

@@ -18,7 +18,8 @@ export const user = defineStore('user', {
         { text: '首页', value: 1, url: '/home' },
         { text: '分类', value: 2, url: '/cate' },
         { text: '我的游戏', value: 3, url: '/my_game' }
-      ]
+      ],
+      isLogin: false
     }
   },
   getters: {

+ 1 - 1
src/views/category.vue

@@ -285,7 +285,7 @@ const posterErrorFun = (event:any) => {
       // top: 50%;
       width: 5rem;
       height: 7rem;
-      background-color: rgba($color: #e6a23c, $alpha: .5);
+      background-color: rgba($color: #99ccff, $alpha: .5);
       // transform: translateY(-50%);
       display: flex;
       align-items: center;

+ 2 - 1
src/views/home.vue

@@ -392,7 +392,8 @@ const downGame = (url: string, disabled:boolean) => {
       .my-swipe{
         height: 140px;
         overflow: hidden;
-        border-radius: 5%;
+        border-radius: 5px;
+        width: 100%;
         .swiper-item{
           position: relative;
           .game-card{

+ 4 - 0
src/views/login.vue

@@ -239,6 +239,7 @@ const submitForm = async(formEl: FormInstance | undefined) => {
             sessionStorage.setItem('token', res.data.data.token)
             sessionStorage.setItem('account', loginForm.account)
             localStorage.setItem('from', '1')
+            user.isLogin = true
             await user.getUserProfile()
             // 跳转我的游戏页面
             setTimeout(() => {
@@ -264,6 +265,7 @@ const submitForm = async(formEl: FormInstance | undefined) => {
             sessionStorage.setItem('token', res.data.data.token)
             sessionStorage.setItem('account', loginForm.account)
             localStorage.setItem('from', '2')
+            user.isLogin = true
             await user.getUserProfile()
             setTimeout(() => {
               router.push({ path: '/my_game', query: { account: loginForm.account }})
@@ -302,6 +304,7 @@ const submitFormM = async() => {
         sessionStorage.setItem('token', res.data.data.token)
         sessionStorage.setItem('account', loginForm.account)
         localStorage.setItem('from', '1')
+        user.isLogin = true
         await user.getUserProfile()
         // 跳转我的游戏页面
         setTimeout(() => {
@@ -328,6 +331,7 @@ const submitFormM = async() => {
         localStorage.setItem('token', res.data.data.token)
         localStorage.setItem('account', loginForm.account)
         localStorage.setItem('from', '2')
+        user.isLogin = true
         await user.getUserProfile()
         setTimeout(() => {
           router.push({ path: '/my_game', query: { account: loginForm.account }})

+ 5 - 5
src/views/mine.vue

@@ -17,15 +17,15 @@
           <el-button type="info" @click="showGifts(item)" class="pcbt">查看礼包</el-button>
         </div>
         <div class="right">
-          <van-button size="small" round color="#ed8c0f" @click="showGifts2(item)">查看礼包</van-button>
-          <van-button size="small" :disabled="item.download_url === '' ? true : false"  round color="#ed8c0f" @click="downGame(item.download_url)">下载</van-button>
+          <van-button size="small" type="primary" round color="#909399" @click="showGifts2(item)">查看礼包</van-button>
+          <van-button size="small" type="primary" :disabled="item.download_url === '' ? true : false"  round color="#909399" @click="downGame(item.download_url)">下载</van-button>
         </div>
         <img :src="prefix + item.screenshot" class="game-poster" :onerror="posterErrorFun" alt=""/>
       </li>
     </ul>
     <div v-if="!token" :style="{ height: viewWidth + 'px' }" class="df fdc aic jcc">
       <el-empty description="您还未登录!登录后可查询数据!">
-        <el-button style="color:#fff" color="#ed8c0f" @click="goLogin">去登录 &gt;&gt;</el-button>
+        <el-button style="color:#fff" color="#909399" @click="goLogin">去登录 &gt;&gt;</el-button>
       </el-empty>
     </div>
     <div class="more-action">
@@ -45,7 +45,7 @@
           </el-form>
         </el-collapse-item>
         <div style="width: 20%;">
-          <el-button :disabled="item.user_get_at !== ''" color="#ed8c0f" style="color: #fff;" @click="receiveGift(item.id)">领取礼包</el-button>
+          <el-button :disabled="item.user_get_at !== ''" color="#909399" style="color: #fff;" @click="receiveGift(item.id)">领取礼包</el-button>
         </div>
       </div>
 
@@ -57,7 +57,7 @@
     <van-collapse v-if="giftData.length" v-model="activeNames">
       <van-collapse-item v-for="(item, index) in giftData" :key="index" :title="item.gift_name" :name="item.id">
         <template #value>
-          <van-button size="small" :disabled="item.user_get_at !== ''" round color="#ed8c0f" @click="receiveGift(item.id)">领取礼包</van-button>
+          <van-button size="small" :disabled="item.user_get_at !== ''" round color="#909399" @click="receiveGift(item.id)">领取礼包</van-button>
         </template>
         <van-cell-group>
           <van-cell value-class="value-length" center size="large" title="礼包内容:" :value="item.gift_content">

+ 10 - 10
src/views/settings.vue

@@ -21,7 +21,7 @@
               <el-input type="password" v-model="ruleForm.new_password2" placeholder="请再次输入新密码" @input="blurValidate(ruleFormRef)" />
             </el-form-item>
             <el-form-item>
-              <el-button type="primary" color="#ed8c0f" style="color: #fff;" size="large" @click="submitForm(ruleFormRef)">
+              <el-button type="primary" color="#909399" style="color: #fff;" size="large" @click="submitForm(ruleFormRef)">
                 提交
               </el-button>
             </el-form-item>
@@ -42,7 +42,7 @@
               <el-input type="text" :disabled="!!user.profile.user_name" v-model="ruleForm2.account" placeholder="请输入用户名" />
             </el-form-item>
             <el-form-item v-if="!user.profile.user_name">
-              <el-button type="primary" color="#ed8c0f" style="color: #fff;" size="large" @click="submitForm2(ruleFormRef2)">
+              <el-button type="primary" color="#909399" style="color: #fff;" size="large" @click="submitForm2(ruleFormRef2)">
                 提交
               </el-button>
             </el-form-item>
@@ -71,10 +71,10 @@
               </el-input>
             </el-form-item>
             <el-form-item >
-              <el-button v-if="!!user.profile.mobile" type="primary" color="#ed8c0f" style="color: #fff;" size="large" @click="submitForm3(ruleFormRef3)">
+              <el-button v-if="!!user.profile.mobile" type="info"  style="color: #fff;" size="large" @click="submitForm3(ruleFormRef3)">
                 解绑
               </el-button>
-              <el-button v-else type="primary" color="#ed8c0f" style="color: #fff;" size="large" @click="submitForm4(ruleFormRef3)">
+              <el-button v-else type="info"  style="color: #fff;" size="large" @click="submitForm4(ruleFormRef3)">
                 绑定
               </el-button>
             </el-form-item>
@@ -133,7 +133,7 @@
           :rules="[{ required: true, message: '请再次填写新密码' },{ validator: checkAgeMob}]"
         />
         <div style="margin: 16px;display: flex;flex-direction: row-reverse;">
-          <van-button style="width: 100%;padding: 10px;" round block type="primary" color="#ed8c0f" native-type="submit">
+          <van-button style="width: 100%;padding: 10px;" round block type="primary" color="#909399" native-type="submit">
             提交
           </van-button>
         </div>
@@ -151,7 +151,7 @@
           :rules="[{ required: true, message: '请填写用户名',trigger: 'onBlur' },{ pattern: pattern, message: '请输入以字母为开头,长度为6-20位的用户名'}]"
         />
         <div v-if="!user.profile.user_name" style="margin: 16px;display: flex;flex-direction: row-reverse;">
-          <van-button round block style="width: 100%;padding: 10px;" type="primary" color="#ed8c0f" native-type="submit">
+          <van-button round block style="width: 100%;padding: 10px;" type="primary" color="#909399" native-type="submit">
             提交
           </van-button>
         </div>
@@ -176,15 +176,15 @@
           placeholder="请输入验证码"
           :rules="[{ required: true, message: '请填写验证码' }]">
           <template #button>
-            <van-button v-if="!!user.profile.mobile" color="#ed8c0f" size="small" type="primary" style="min-width: 20vw;" :disabled="!can_send" @click="getCaptcha">{{ smsMessage }}</van-button>
-            <van-button v-else size="small" color="#ed8c0f" type="primary" style="min-width: 20vw;" :disabled="!can_send" @click="getCaptcha2">{{ smsMessage }}</van-button>
+            <van-button v-if="!!user.profile.mobile" color="#909399" size="small" type="primary" style="min-width: 20vw;" :disabled="!can_send" @click="getCaptcha">{{ smsMessage }}</van-button>
+            <van-button v-else size="small" color="#909399" type="primary" style="min-width: 20vw;" :disabled="!can_send" @click="getCaptcha2">{{ smsMessage }}</van-button>
           </template>
         </van-field>
         <div style="margin: 16px;">
-          <van-button v-if="!!user.profile.mobile" style="width: 100%;padding: 10px;" round block type="primary" color="#ed8c0f" @click="onSubmit3">
+          <van-button v-if="!!user.profile.mobile" style="width: 100%;padding: 10px;" round block type="primary" color="#909399" @click="onSubmit3">
             解绑
           </van-button>
-          <van-button v-else round block type="primary" style="width: 100%;padding: 10px;" color="#ed8c0f" @click="onSubmit4">
+          <van-button v-else round block type="primary" style="width: 100%;padding: 10px;" color="#909399" @click="onSubmit4">
             绑定
           </van-button>
         </div>

+ 0 - 56
vite.config.ts

@@ -6,7 +6,6 @@ import postcsspxtoviewport from 'postcss-px-to-viewport-8-plugin'
 import autoprefixer from 'autoprefixer'
 import Components from 'unplugin-vue-components/vite'
 import { VantResolver } from 'unplugin-vue-components/resolvers'
-import { viteObfuscateFile } from 'vite-plugin-obfuscator'
 
 function pathResolve(dir) {
   // eslint-disable-next-line no-undef
@@ -41,61 +40,6 @@ export default defineConfig({
         'esnext.global-this',
         'esnext.string.match-all'
       ]
-    }),
-    viteObfuscateFile({
-      compact: true,
-      controlFlowFlattening: false,
-      controlFlowFlatteningThreshold: 0.75,
-      deadCodeInjection: false,
-      deadCodeInjectionThreshold: 0.4,
-      debugProtection: false,
-      debugProtectionInterval: 0,
-      disableConsoleOutput: false,
-      domainLock: [],
-      domainLockRedirectUrl: 'about:blank',
-      forceTransformStrings: [],
-      identifierNamesCache: null,
-      identifierNamesGenerator: 'hexadecimal',
-      identifiersDictionary: [],
-      identifiersPrefix: '',
-      ignoreImports: false,
-      inputFileName: '',
-      log: false,
-      numbersToExpressions: false,
-      optionsPreset: 'default',
-      renameGlobals: false,
-      renameProperties: false,
-      renamePropertiesMode: 'safe',
-      reservedNames: [],
-      reservedStrings: [],
-      seed: 0,
-      selfDefending: false,
-      simplify: true,
-      sourceMap: false,
-      sourceMapBaseUrl: '',
-      sourceMapFileName: '',
-      sourceMapMode: 'separate',
-      sourceMapSourcesMode: 'sources-content',
-      splitStrings: false,
-      splitStringsChunkLength: 10,
-      stringArray: true,
-      stringArrayCallsTransform: true,
-      stringArrayCallsTransformThreshold: 0.5,
-      stringArrayEncoding: [],
-      stringArrayIndexesType: [
-        'hexadecimal-number'
-      ],
-      stringArrayIndexShift: true,
-      stringArrayRotate: true,
-      stringArrayShuffle: true,
-      stringArrayWrappersCount: 1,
-      stringArrayWrappersChainedCalls: true,
-      stringArrayWrappersParametersMaxCount: 2,
-      stringArrayWrappersType: 'variable',
-      stringArrayThreshold: 0.75,
-      target: 'browser',
-      transformObjectKeys: false,
-      unicodeEscapeSequence: false
     })
 
   ],