Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yangpeng committed Jun 19, 2020
2 parents 95c10be + d6baf97 commit 299a2e3
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 59 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ Works on macOS 10.12+, and Windows 10+.

## 更新日志

> v1.4.2
- 修复1.4.1已知问题

> v1.4.1
- 修复新安装用户不能设置壁纸问题

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Strawberry Wallpaper",
"version": "v1.4.1",
"version": "v1.4.2",
"author": "taoacat,流浪记",
"description": "a wallpaper app by electron",
"license": "",
Expand Down
9 changes: 8 additions & 1 deletion src/renderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import './assets/css/base.css'
import vueModules from './components'
import vueFn from './assets/js/vue-fn'

const log = require('electron-log')


Vue.use(require('vue-electron'))

Vue.use(ElementUI)
Expand All @@ -25,4 +28,8 @@ const mainVue = new Vue({
template: '<App/>'
}).$mount('#app')

global.Vue = mainVue
window.Vue = mainVue

window.addEventListener('error', (error) => {
log.info('=====', error)
})
20 changes: 12 additions & 8 deletions src/renderer/page/content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
:class="['setter-content',osType=='mac'?'setter-content-mac':'']"
:show.sync="setterShow"
@imageSourceChange="imageSourceChange"
@change="handleSetterChange"
:getDataFlag="getDataFlag">
</setter>

Expand Down Expand Up @@ -162,7 +163,7 @@ export default {
currentImageBacColor: '#ddd', // 进度条的颜色
infoShow: INFOSHOW.loading, // 相关提示信息
paperClass: [], // paper的分类
config: { ...defaultConfig },
config: { ...defaultConfig, ...(this.$localStorage.getStore('userConfig') || {}) },
noticeNoWatch: false, // 公告是否已阅
}
},
Expand All @@ -174,16 +175,14 @@ export default {
mounted() {
// 安装量的统计
this.firstInstall()
// 获得配置
const config = this.$localStorage.getStore('userConfig') || {}
this.config = { ...this.config, ...config }
// 更新一下配置
this.$localStorage.setStore('userConfig', this.config)
this.imageSource = this.config.imageSource
this.searchKey = this.$localStorage.getStore('searchKey') || ''
this.searchKeyList = this.$localStorage.getStore('searchKeyList') || this.searchKeyList
this.images = []
this.images = 0
this.cleartLocalStorage()
if (this.imageSource === 'paper'){
this.paperInit()
Expand Down Expand Up @@ -549,6 +548,11 @@ export default {
}, 100)
},
// 设置变更
handleSetterChange(){
this.config = this.$localStorage.getStore('userConfig') || {}
},
/**
* 对获取到的地址进行处理
* @function urlsDeal
Expand Down Expand Up @@ -655,9 +659,9 @@ export default {
.setter-content {
top: 45px;
&.setter-content-mac {
top: 55px;
}
// &.setter-content-mac {
// top: 55px;
// }
}
.main-content {
Expand Down
13 changes: 8 additions & 5 deletions src/renderer/page/setter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@

<div class="setter-row">
<span class="checkbox-text setter-header">自定义过滤方向:</span>
<i :class="['iconfont icon-heng-ping icon-direction',{'active':config.wallpaperSizeDirection.includes('heng')}]" @click="handleWallpaperSizeDirectionChange('heng')"></i>
<i :class="['iconfont icon-su-ping icon-direction',{'active':config.wallpaperSizeDirection.includes('su')}]" @click="handleWallpaperSizeDirectionChange('su')"></i>
<i :class="['iconfont icon-heng-ping icon-direction',
{'active': config.wallpaperSizeDirection && config.wallpaperSizeDirection.includes('heng')}]" @click="handleWallpaperSizeDirectionChange('heng')"></i>
<i :class="['iconfont icon-su-ping icon-direction',
{'active': config.wallpaperSizeDirection && config.wallpaperSizeDirection.includes('su')}]" @click="handleWallpaperSizeDirectionChange('su')"></i>
</div>

<div class="setter-row">
Expand Down Expand Up @@ -161,7 +163,7 @@ export default {
data() {
return {
version1: version, // 版本
...defaultConfig,
// ...defaultConfig,
isMac: isMac(),
config: this.$localStorage.getStore('userConfig'),
imageSourceType,
Expand Down Expand Up @@ -211,11 +213,12 @@ export default {
/** *将配置信息存到localstorage中 */
setLocation() {
this.$localStorage.setStore('userConfig', this.config)
this.$emit('change')
},
// 壁纸自动更新
wallpaperAutoChange() {
this.handleUpdataTimeInputChange(!this.config.wallpaperAutoUp ? -1 : 3600)
this.handleUpdataTimeInputChange(!this.config.wallpaperAutoUp ? -1 : this.config.updataTime)
},
// 设置更新周期
Expand Down Expand Up @@ -270,7 +273,7 @@ export default {
*/
handleNewVersionClick() {
this.$ipcRenderer.send('btn', {
type: 'handleNewVersionClick',
type: 'checkNewVersion',
data: true
})
},
Expand Down
6 changes: 4 additions & 2 deletions src/utils/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isWin } from './utils.js'

const os = require('os')
/**
* 浏览器请求头
Expand All @@ -13,12 +15,12 @@ export const browserHeader = {
export const apiBaseUrl = 'http://strawberry.wangkaibo.com'

export const defaultConfig = {
imageSource: 'pexels', // 图片来源
imageSource: '500px', // 图片来源
isOpenStatr: false, // 开机启动
wallpaperAutoUp: false, // 壁纸自动更新
updataTime: 3600, // 自动更新时间
timingWipeData: true, // 定时清空已下载图库
downloadImagePath: `${os.homedir()}/Downloads/wallpaper`,
downloadImagePath: `${os.homedir()}${isWin() ? '\\Downloads\\wallpaper' : '/Downloads/wallpaper'} `,
wallpaperScale: 'auto', // 壁纸填充方式
autoClearnDownloadFilesTime: 7, // 自动清空下载文件夹

Expand Down
85 changes: 43 additions & 42 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,48 +37,49 @@ export function isDev() {
return process.env.NODE_ENV === 'development'
}

export const imageSourceType = [{
name: 'pexels',
value: 'pexels',
home: 'https://www.pexels.com/',
search: true,
},
{
name: '500px',
value: '500px',
home: 'https://500px.com/popular',
search: true
},
{
name: 'paper',
value: 'paper',
search: false
},
{
name: 'unsplash',
value: 'unsplash',
home: 'https://unsplash.com/',
search: true
},
{
name: 'wallhaven',
value: 'wallhaven',
home: 'https://wallhaven.cc/latest',
search: true
},
{
name: 'NASA',
value: 'nasa',
home: 'https://www.nasa.gov/multimedia/imagegallery/iotd.html',
search: false,
},
{
name: '电影',
value: 'themoviedb',
home: 'https://www.themoviedb.org/',
search: true,
isSupportChinaSearch: true // 是否支持中文搜索
}
export const imageSourceType = [
{
name: '500px',
value: '500px',
home: 'https://500px.com/popular',
search: true
},
{
name: 'pexels',
value: 'pexels',
home: 'https://www.pexels.com/',
search: true,
},
{
name: 'paper',
value: 'paper',
search: false
},
{
name: 'unsplash',
value: 'unsplash',
home: 'https://unsplash.com/',
search: true
},
{
name: 'wallhaven',
value: 'wallhaven',
home: 'https://wallhaven.cc/latest',
search: true
},
{
name: 'NASA',
value: 'nasa',
home: 'https://www.nasa.gov/multimedia/imagegallery/iotd.html',
search: false,
},
{
name: '电影',
value: 'themoviedb',
home: 'https://www.themoviedb.org/',
search: true,
isSupportChinaSearch: true // 是否支持中文搜索
}
]

export const wallpaperScaleOptions = [
Expand Down

0 comments on commit 299a2e3

Please sign in to comment.