Skip to content

Commit

Permalink
Add ads space
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangao authored and zhangao committed Aug 25, 2023
1 parent 930211f commit 51adfa5
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 33 deletions.
Binary file removed public/images/WechatIMG89.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/aliapi/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default class ServerHttp {
)
}

static configUrl = b64decode('aHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS9yZXBvcy9nYW96aGFuZ21pbi9zdGF0aWNSZXNvdXJjZS9jb250ZW50cy9pbWFnZXMvc2hhcmVfY29uZmlnLmpzb24=')
static configUrl = b64decode('aHR0cHM6Ly9naXRlZS5jb20vemhhbm5hby9yZXNvdXJjZS9yYXcvbWFzdGVyL2ltYWdlcy9zaGFyZV9jb25maWcuanNvbg==')
static updateUrl = b64decode('aHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS9yZXBvcy9nYW96aGFuZ21pbi9hbGl5dW5wYW4vcmVsZWFzZXMvbGF0ZXN0')

static async CheckConfigUpgrade(): Promise<void> {
Expand Down
57 changes: 47 additions & 10 deletions src/pan/PanRight.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<!-- eslint-disable no-irregular-whitespace -->
<script setup lang='ts'>
import { IAliGetFileModel } from '../aliapi/alimodels'
import { KeyboardState, MouseState,
import {
KeyboardState, MouseState,
useAppStore,
useFootStore,
useKeyboardStore,
useMouseStore,
usePanFileStore,
useSettingStore
useSettingStore, useUserStore
} from '../store'
import useWinStore from '../store/winstore'
import {
Expand Down Expand Up @@ -48,6 +49,11 @@ import { menuOpenFile } from '../utils/openfile'
import { throttle } from '../utils/debounce'
import { TestButton } from '../utils/mosehelper'
import usePanTreeStore from './pantreestore'
import { shell } from 'electron'
import axios, { AxiosResponse } from 'axios'
import ServerHttp from '../aliapi/server'
import AliHttp from '../aliapi/alihttp'
import UserDAL from '../user/userdal'
const viewlist = ref()
const inputsearch = ref()
Expand All @@ -58,6 +64,10 @@ const winStore = useWinStore()
const panfileStore = usePanFileStore()
let dirID = ''
let adsImage = ''
let adsUrl = ''
let vip = ref(false)
panfileStore.$subscribe((_m: any, state: PanFileState) => {
if (state.DirID != dirID) {
dirID = state.DirID
Expand Down Expand Up @@ -240,6 +250,26 @@ const onGridResize = throttle(() => {
}, 100)
onMounted(() => {
axios
.get(ServerHttp.configUrl, {
withCredentials: false,
responseType: 'json',
timeout: 3000
})
.then(async (response: AxiosResponse) => {
const config = response.data
if (config.adsUrl && config.addUrl != '') {
adsUrl = config.adsUrl
adsImage = config.adsImgUrl
}
}).catch((error: any) => {
console.log(error)
})
setTimeout(() => {
AliHttp.isVip(useUserStore().GetUserToken.phone).then((res: any) => {
vip.value = res
})
}, 5000)
resizeObserver.observe(document.getElementById('panfilelist')!)
})
Expand Down Expand Up @@ -461,10 +491,17 @@ const onPanDragEnd = (ev: any) => {
showDragUpload.value = false
}
}
const openExternalLink = (targetUrl: string) => {
shell.openExternal(targetUrl);
}
</script>

<template>
<div style='height: 7px'></div>
<div >
<a v-if='!vip && adsUrl != ""' id='imageLink' @click="openExternalLink(adsUrl)">
<img :src=adsImage alt="" width='1125' height='100' style='margin-bottom: 10px'>
</a>
</div>
<div class='toppanbtns' style='height: 26px'>
<DirTopPath />
<div style='flex-grow: 1'></div>
Expand Down Expand Up @@ -647,7 +684,7 @@ const onPanDragEnd = (ev: any) => {
id='panfilelist'
:class="'toppanlist' + (showDragUpload ? ' pandraging' : '') + (dragingRowItem ? ' draging' : '') + (rangIsSelecting ? ' ranging' : '')"
tabindex='-1'
:style='{ height: winStore.GetListHeight }'
:style="{ height: adsUrl === '' || vip ? winStore.GetListHeight : winStore.GetListHeightWithAds }"
@keydown.space.prevent='() => true'
@drop='onPanDrop'
@dragenter='onPanDragEnter'>
Expand All @@ -659,9 +696,9 @@ const onPanDragEnd = (ev: any) => {
ref='viewlist'
:bordered='false'
:split='false'
:max-height='winStore.GetListHeightNumber'
:max-height='adsUrl === "" || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds'
:virtual-list-props="{
height: winStore.GetListHeightNumber,
height: adsUrl == '' || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds,
fixedSize: true,
estimatedSize: 50,
threshold: 1,
Expand Down Expand Up @@ -778,9 +815,9 @@ const onPanDragEnd = (ev: any) => {
ref='viewlist'
:bordered='false'
:split='false'
:max-height='winStore.GetListHeightNumber'
:max-height='adsUrl === "" || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds'
:virtual-list-props="{
height: winStore.GetListHeightNumber,
height: adsUrl == '' || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds,
fixedSize: true,
estimatedSize: 200,
threshold: 1,
Expand Down Expand Up @@ -899,9 +936,9 @@ const onPanDragEnd = (ev: any) => {
ref='viewlist'
:bordered='false'
:split='false'
:max-height='winStore.GetListHeightNumber'
:max-height='adsUrl === "" || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds'
:virtual-list-props="{
height: winStore.GetListHeightNumber,
height: adsUrl == '' || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds,
fixedSize: true,
estimatedSize: 260,
threshold: 1,
Expand Down
60 changes: 45 additions & 15 deletions src/resPan/ResPanRight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
useKeyboardStore,
useMouseStore,
useResPanFileStore,
useSettingStore
useSettingStore, useUserStore
} from '../store'
import useWinStore from '../store/winstore'
import {
Expand Down Expand Up @@ -50,6 +50,10 @@ import { throttle } from '../utils/debounce'
import { TestButton } from '../utils/mosehelper'
import useResPanTreeStore from './pantreestore'
import { shell } from 'electron'
import axios, { AxiosResponse } from 'axios'
import ServerHttp from '../aliapi/server'
import AliHttp from '../aliapi/alihttp'
import UserDAL from '../user/userdal'
const viewlist = ref()
const inputsearch = ref()
Expand All @@ -59,7 +63,11 @@ const settingStore = useSettingStore()
const winStore = useWinStore()
const panfileStore = useResPanFileStore()
let adsImage = ''
let adsUrl = ''
let dirID = ''
let vip = ref(false)
panfileStore.$subscribe((_m: any, state: PanFileState) => {
if (state.DirID != dirID) {
dirID = state.DirID
Expand Down Expand Up @@ -245,6 +253,27 @@ const onGridResize = throttle(() => {
}, 100)
onMounted(() => {
axios
.get(ServerHttp.configUrl, {
withCredentials: false,
responseType: 'json',
timeout: 10000
})
.then(async (response: AxiosResponse) => {
const config = response.data
if (config.adsUrl && config.addUrl != '') {
adsUrl = config.adsUrl
adsImage = config.adsImgUrl
}
}).catch((error: any) => {
console.log(error)
})
setTimeout(() => {
AliHttp.isVip(useUserStore().GetUserToken.phone).then((res: any) => {
vip.value = res
})
}, 5000)
resizeObserver.observe(document.getElementById('panfilelist')!)
})
Expand Down Expand Up @@ -466,17 +495,18 @@ const onPanDragEnd = (ev: any) => {
showDragUpload.value = false
}
}
const openExternalLink = (targetUrl: string) => {
shell.openExternal(targetUrl);
}
</script>

<template>
<div style='height: 7px'></div>
<!-- <div class='toppanbtns' style='height: 26px'>-->
<!-- <a id='imageLink' href='https://kdocs.cn/l/cvpwcQWAA22Q'>-->
<!-- <img src='/images/ads.jpg' width='1100' height='100'>-->
<!-- </a>-->
<!-- </div>-->
<!-- <div style='height: 50px'></div>-->
<div >
<a v-if='!vip && adsUrl != ""' id='imageLink' @click="openExternalLink(adsUrl)">
<img :src=adsImage alt="" width='1125' height='100' style='margin-bottom: 10px'>
</a>
</div>
<div class='toppanbtns' style='height: 26px'>
<ResDirTopPath />
<div style='flex-grow: 1'></div>
Expand Down Expand Up @@ -659,7 +689,7 @@ const onPanDragEnd = (ev: any) => {
id='panfilelist'
:class="'toppanlist' + (showDragUpload ? ' pandraging' : '') + (dragingRowItem ? ' draging' : '') + (rangIsSelecting ? ' ranging' : '')"
tabindex='-1'
:style='{ height: winStore.GetListHeight }'
:style="{ height: adsUrl === '' || vip ? winStore.GetListHeight : winStore.GetListHeightWithAds }"
@keydown.space.prevent='() => true'
@drop='onPanDrop'
@dragenter='onPanDragEnter'>
Expand All @@ -671,9 +701,9 @@ const onPanDragEnd = (ev: any) => {
ref='viewlist'
:bordered='false'
:split='false'
:max-height='winStore.GetListHeightNumber'
:max-height='adsUrl === "" || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds'
:virtual-list-props="{
height: winStore.GetListHeightNumber,
height: adsUrl == '' || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds,
fixedSize: true,
estimatedSize: 50,
threshold: 1,
Expand Down Expand Up @@ -790,9 +820,9 @@ const onPanDragEnd = (ev: any) => {
ref='viewlist'
:bordered='false'
:split='false'
:max-height='winStore.GetListHeightNumber'
:max-height='adsUrl === "" || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds'
:virtual-list-props="{
height: winStore.GetListHeightNumber,
height: adsUrl == '' || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds,
fixedSize: true,
estimatedSize: 200,
threshold: 1,
Expand Down Expand Up @@ -911,9 +941,9 @@ const onPanDragEnd = (ev: any) => {
ref='viewlist'
:bordered='false'
:split='false'
:max-height='winStore.GetListHeightNumber'
:max-height='adsUrl === "" || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds'
:virtual-list-props="{
height: winStore.GetListHeightNumber,
height: adsUrl == '' || vip ? winStore.GetListHeightNumber : winStore.GetListHeightNumberWithAds,
fixedSize: true,
estimatedSize: 260,
threshold: 1,
Expand Down
3 changes: 0 additions & 3 deletions src/resource/vipInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ export default defineComponent({
<div class="container1">
<div class="content-text3">
<div class="image-container2">
<!-- <a id='imageLink' @click="openExternalLink('https://kdocs.cn/l/cvpwcQWAA22Q')">-->
<!-- <img src="/images/ads.jpg" alt="公众号" width='1025' height='200' style='margin-bottom: 10px'>-->
<!-- </a>-->
<img src="/images/sales.png" alt="公众号">
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/share/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ import FollowingDAL from './following/FollowingDAL'
import AliHttp from '../aliapi/alihttp'
import UserDAL from '../user/userdal'
import VipInformPage from '../resource/vipInfo.vue'
import { ref } from 'vue'
const appStore = useAppStore()
const userStore = useUserStore()
let vipIdentity = true
let vipIdentity = ref(true)
appStore.$subscribe(async (mutation) => {
const appPage = appStore.GetAppTabMenu
if (appPage == 'ShareSiteRight') {
if (userStore.userLogined) {
vipIdentity = await AliHttp.isVip(UserDAL.GetUserToken(useUserStore().user_id).phone);
AliHttp.isVip(useUserStore().GetUserToken.phone).then((res: any) => {
vipIdentity.value = res
})
}
}
if (appPage == 'MyShareRight') ShareDAL.aReloadMyShare(useUserStore().user_id, false)
Expand Down
2 changes: 1 addition & 1 deletion src/store/appstore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const useAppStore = defineStore('app', {
if (tab == 'setting') DebugLog.aLoadFromDB()
if (tab == 'movie') {
if (useUserStore().userLogined) {
this.isVip = await AliHttp.isVip(UserDAL.GetUserToken(useUserStore().user_id).phone);
this.isVip = await AliHttp.isVip(useUserStore().GetUserToken.phone);
}
}
onHideRightMenu()
Expand Down
7 changes: 6 additions & 1 deletion src/store/winstore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ const useWinStore = defineStore('win', {
}),

getters: {
GetListHeightWithAds(state: WinState): string {
return (state.height - 302).toString() + 'px'
},
GetListHeight(state: WinState): string {
return (state.height - 192).toString() + 'px'
},
GetListHeightNumber(state: WinState): number {
return state.height - 192
},
GetListHeightNumberWithAds(state: WinState): number {
return state.height - 302
}
},

actions: {
updateStore(partial: Partial<WinState>) {
this.$patch(partial)
Expand Down

0 comments on commit 51adfa5

Please sign in to comment.