Skip to content

Commit

Permalink
feat(v1.3.4): 调通全屏模式下注入文件
Browse files Browse the repository at this point in the history
  • Loading branch information
aitexiaoy committed Feb 13, 2020
1 parent d43c962 commit e249712
Show file tree
Hide file tree
Showing 33 changed files with 352 additions and 86 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
.DS_Store
dist/*
dist/*
build/*
!build/icons
node_modules/
npm-debug.log
npm-debug.log.*
thumbs.db
.user-config.js
!.gitkeep
.vscode
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
// {
// "type": "node",
// "request": "launch",
// "name": "Electron Main",
// "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
// "program": "${workspaceFolder}/src/main/test.js"
// },
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/get-image/500px.js"
}
]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// 忽略的文件
"csscomb.ignoreFilesOnSave": [
".git/**",
"node_modules/**",
"dist/**",
"dll/**",
],
// 规则路径,也可以为一个对象自定义规则
"csscomb.preset": "csscomb.js",
"csscomb.formatOnSave": true,
}
File renamed without changes
File renamed without changes.
File renamed without changes.
33 changes: 7 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build-win": "electron-builder --win",
"build-mac": "electron-builder --mac",
"build": "npm run build-r && npm run build-win && npm run build-mac",
"build:dir": "cross-env node .electron-vue/build.js && electron-builder --dir",
"build:dir": "cross-env node .electron-vue/build.js && electron-builder --mac --dir",
"clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
"dev": "node .electron-vue/dev-runner.js",
"pack": "npm run pack:main && npm run pack:renderer",
Expand All @@ -30,36 +30,17 @@
"provider": "generic",
"url": "http://sw.taoacat.com/version/"
},
"files": [
"dist/electron/**/*"
],
"dmg": {
"contents": [
{
"x": 410,
"y": 150,
"type": "link",
"path": "/Applications"
},
{
"x": 130,
"y": 150,
"type": "file"
}
]
},
"files": ["dist/electron/**/*"],
"mac": {
"icon": "build/icons/icon.icns"
"icon": "build-config/icons/icon.icns",
"target":["dmg"]
},
"win": {
"icon": "build/icons/icon.ico",
"target": [
"nsis",
"zip"
]
"icon": "build-config/icons/icon.ico",
"target": ["nsis"]
},
"linux": {
"icon": "build/icons"
"icon": "build-config/icons"
}
},
"devDependencies": {
Expand Down
11 changes: 11 additions & 0 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ export const postRegister = data => new Promise((resolve, reject) => {
*/
export const apiStatisticActive = data => instance.post('/active', data)

export const apiGetNotices = () => new Promise((resolve) => {
instance.get('/notice').then((res) => {
if (res.code === 200){
resolve(res.data || [])
}
else {
resolve([])
}
}).catch(() => { resolve([]) })
})

/**
* 百度翻译接口,将用户搜索的中文转成英文
*/
Expand Down
3 changes: 1 addition & 2 deletions src/main/full-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ function createWindow() {
width: 1200,
height: 700,
})
// fullWindow.openDevTools()
fullWindow.loadURL(`${baseUrl}#/full`)

fullWindow.on('close', () => {
Expand All @@ -25,7 +24,7 @@ function createWindow() {
function openWindow(){
if (!fullWindow){
createWindow()
fullWindow.openDevTools()
// fullWindow.openDevTools()
}
else {
fullWindow.show()
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function appOpenInit(){
function createWindow() {
mainWindow = new BrowserWindow({
height: 600,
width: 300,
width: 310,
frame: false,
transparent: true,
show: false,
Expand Down
37 changes: 37 additions & 0 deletions src/renderer/components/content-main/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<div class="content">
<div class="content-main" :class="{'content-win':osType=='win'}">
<slot></slot>
</div>
</div>
</template>

<script>
import { osType } from '../../../utils/utils'
export default {
name: 'content-div',
data(){
return {
osType
}
}
}
</script>

<style lang="less" scoped>
.content {
width: 100%;
overflow: hidden;
.content-main {
width: calc(~"100% + 15px");
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
}
.content-win {
width: calc(~"100% + 17px");
}
}
</style>
25 changes: 25 additions & 0 deletions src/renderer/components/icon/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<i class="icon" @click.stop="handleClick"></i>
</template>

<script>
export default {
name: 'icon',
methods: {
handleClick(){
this.$emit('click')
}
}
}
</script>

<style lang="less" scoped>
.icon {
color: #dddddd;
&:hover{
color: #ffffff;
}
}
</style>
50 changes: 41 additions & 9 deletions src/renderer/page/content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
<h1 class="text">Strawberry</h1>
</div>
<div class="right">
<i class="iconfont icon-quanping" @click.stop="handleOpenFullWindow"></i>
<i class="iconfont icon-wenjianjia" @click.stop="openDownloadFile"></i>
<icon :class="['iconfont icon-gonggao',{'no-watch':noticeNoWatch}]" @click="handleGoToNotice"></icon>
<icon class="iconfont icon-quanping" @click="handleOpenFullWindow"></icon>
<icon class="iconfont icon-wenjianjia" @click="openDownloadFile"></icon>
<div class="header-set">
<i class="iconfont icon-shezhi" @click.stop="setterShow=!setterShow"></i>
<icon class="iconfont icon-shezhi" @click="setterShow=!setterShow"></icon>
</div>
</div>
</el-row>
Expand Down Expand Up @@ -39,7 +40,7 @@
size="small"
@focus="searchKeyFocus=true"
@blur="searchKeyFocus=false"></el-input>
<i class="iconfont icon-sousuo" @click.stop="searchKeyFn"></i>
<icon class="iconfont icon-sousuo" @click="searchKeyFn"></icon>
</div>

<div class="header-tag" v-if="currentImageSource.search&&searchKeyList.length>0">
Expand Down Expand Up @@ -91,7 +92,7 @@
</div>
</div>
<div class="refresh-btn" :class="{'refresh-btn-ing':refreshBtnIng}">
<i class="iconfont icon-shuaxin" @click="refreshFn"></i>
<icon class="iconfont icon-shuaxin" @click="refreshFn"></icon>
</div>

<setter
Expand All @@ -112,13 +113,15 @@ import { version } from '../../../package'
import setter from './setter'
import swProgress from './progress'
import { defaultConfig } from '../../utils/config'
import icon from '../components/icon/index.vue'
const { shell } = require('electron')
const os = require('os')
const osu = require('node-os-utils')
const macaddress = require('macaddress')
const md5 = require('../../utils/md5').md5_32
const { postRegister, apiStatisticActive } = require('../../api/api')
const { postRegister, apiStatisticActive, apiGetNotices } = require('../../api/api')
const { mkdirSync } = require('../../file/file')
const INFOSHOW = {
Expand All @@ -138,6 +141,7 @@ export default {
components: {
setter,
swProgress,
icon
},
data() {
return {
Expand All @@ -160,7 +164,8 @@ export default {
currentImageBacColor: '#ddd', // 进度条的颜色
infoShow: INFOSHOW.loading, // 相关提示信息
paperClass: [], // paper的分类
config: { ...defaultConfig }
config: { ...defaultConfig },
noticeNoWatch: false, // 公告是否已阅
}
},
Expand Down Expand Up @@ -244,6 +249,19 @@ export default {
version
})
this.$localStorage.setStore('statisticTimeFlag', nowDate)
// 获取公告
apiGetNotices().then((res) => {
if (res.length > 0){
// 存公告
this.$localStorage.setStore('noticeList', res)
// 取出最后一次阅读时间
const lastWatchNoticeTime = this.$localStorage.getStore('watchNoticeTime')
if (lastWatchNoticeTime && res[0].time > Number(lastWatchNoticeTime)){
this.noticeNoWatch = true
}
}
})
}
// 7天 自动清除已下载
if (nowDate - lastCleararnDownloadFilesTime >= (this.config.autoClearnDownloadFilesTime || 7) * 24 * 60 * 60) {
Expand Down Expand Up @@ -611,7 +629,15 @@ export default {
}, 100)
}
}
},
handleGoToNotice(){
this.$router.push('/notice')
this.noticeNoWatch = false
// 存最近一次看公告的时间,来判断公告是否已阅
this.$localStorage.setStore('watchNoticeTime', (new Date()).getTime())
}
},
watch: {
imageSource(val, oldVal) {
Expand Down Expand Up @@ -678,11 +704,12 @@ export default {
// z-index: 2;
}
}
}
.iconfont {
margin-left: 10px;
color: #dddddd;
margin-left: 8px;
// color: #dddddd;
}
.left {
Expand All @@ -693,6 +720,11 @@ export default {
display: flex;
flex: none;
align-items: center;
.icon-gonggao{
&.no-watch{
color:#ff3f00;
}
}
}
.header-set {
Expand Down
Loading

0 comments on commit e249712

Please sign in to comment.