Skip to content

Commit

Permalink
- [x] [发现] 新增17年鉴, 优化样式
Browse files Browse the repository at this point in the history
- [x] 调整了搜索、个人收藏的图片默认质量
  • Loading branch information
czy0729 committed Aug 19, 2019
1 parent b755461 commit eee1cfa
Show file tree
Hide file tree
Showing 17 changed files with 203 additions and 89 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2019-03-13 05:15:36
* @Last Modified by: czy0729
* @Last Modified time: 2019-07-28 13:10:55
* @Last Modified time: 2019-08-19 22:23:58
*/
module.exports = {
root: true,
Expand Down Expand Up @@ -59,6 +59,7 @@ module.exports = {
'implicit-arrow-linebreak': 0,
'import/extensions': 0,
'import/no-unresolved': 0,
'import/order': 0,
'import/prefer-default-export': 0,
'linebreak-style': ['error', 'unix'],
'lines-between-class-members': 0,
Expand Down
4 changes: 2 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ios",
"android"
],
"version": "0.12.0",
"version": "0.11.5",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"splash": {
Expand All @@ -31,4 +31,4 @@
"description": "A React Native App for https://bangumi.tv ",
"githubUrl": "https://github.com/czy0729/Bangumi"
}
}
}
8 changes: 4 additions & 4 deletions constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Author: czy0729
* @Date: 2019-02-22 01:25:31
* @Last Modified by: czy0729
* @Last Modified time: 2019-08-18 13:51:18
* @Last Modified time: 2019-08-19 22:36:56
*/
import { Platform } from 'react-native'
import { Constants } from 'expo'
Expand Down Expand Up @@ -33,9 +33,9 @@ export const GITHUB_URL = 'https://github.com/czy0729/Bangumi'
export const GITHUB_RELEASE_URL = `${GITHUB_URL}/releases`
export const GITHUB_RELEASE_REPOS_URL =
'https://api.github.com/repos/czy0729/Bangumi/releases'
export const GITHUB_RELEASE_VERSION = '0.12.0' // 20190816
export const CODE_PUSH_VERSION = ''
export const DEV = true
export const GITHUB_RELEASE_VERSION = '0.11.5'
export const CODE_PUSH_VERSION = '热推送08/19'
export const DEV = false

// 图片
export const IMG_DEFAULT_AVATAR = '//lain.bgm.tv/pic/user/s/icon.jpg'
Expand Down
3 changes: 2 additions & 1 deletion navigations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2019-06-02 14:42:28
* @Last Modified by: czy0729
* @Last Modified time: 2019-08-16 21:59:39
* @Last Modified time: 2019-08-19 22:21:59
*/
export default {
initialRouteName: 'HomeTab', // HomeTab
Expand All @@ -14,6 +14,7 @@ export default {
// groupId: 'fillgrids',
// type: 'anime',
// tag: '水树奈奈',
// uri: 'https://bangumi.tv/award/2017'
}
}

Expand Down
8 changes: 5 additions & 3 deletions screens/_/item/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
* @Author: czy0729
* @Date: 2019-05-25 23:00:45
* @Last Modified by: czy0729
* @Last Modified time: 2019-08-11 04:27:35
* @Last Modified time: 2019-08-19 22:27:26
*/
import React from 'react'
import { StyleSheet, View } from 'react-native'
import { observer } from 'mobx-react'
import { Flex, Text, Image, Touchable } from '@components'
import { getTimestamp } from '@utils'
import { getCoverMedium } from '@utils/app'
import { HTMLDecode } from '@utils/html'
import { IMG_DEFAULT } from '@constants'
import _ from '@styles'
Expand All @@ -31,6 +32,7 @@ const ItemCollections = ({
comments,
isOnHold
}) => {
const _cover = getCoverMedium(cover)
const isFirst = index === 0
const hasName = !!name
const hasTip = !!tip
Expand All @@ -50,15 +52,15 @@ const ItemCollections = ({
subjectId: id,
_jp: name,
_cn: nameCn,
_image: cover
_image: _cover
})
}
>
<Flex align='start' style={[styles.wrap, !isFirst && styles.border]}>
<View style={styles.imgContainer}>
<Image
style={styles.image}
src={cover || IMG_DEFAULT}
src={_cover || IMG_DEFAULT}
width={imgWidth}
height={imgHeight}
radius
Expand Down
13 changes: 6 additions & 7 deletions screens/_/item/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* @Author: czy0729
* @Date: 2019-05-15 16:26:34
* @Last Modified by: czy0729
* @Last Modified time: 2019-08-11 04:36:56
* @Last Modified time: 2019-08-19 22:33:45
*/
import React from 'react'
import { StyleSheet, View } from 'react-native'
import { observer } from 'mobx-react'
import { Flex, Text, Image, Touchable } from '@components'
import { appNavigate } from '@utils/app'
import { appNavigate, getCoverMedium } from '@utils/app'
import { HTMLDecode } from '@utils/html'
import { IMG_DEFAULT } from '@constants'
import { MODEL_SUBJECT_TYPE } from '@constants/model'
Expand All @@ -19,7 +19,7 @@ import Stars from '../base/stars'
const imgWidth = 96
const imgHeight = 1.28 * imgWidth

const ItemSearch = ({
function ItemSearch({
navigation,
index,
id,
Expand All @@ -33,11 +33,10 @@ const ItemSearch = ({
type,
collected,
comments
}) => {
const isFirst = index === 0

}) {
// 人物高清图不是正方形的图, 所以要特殊处理
const isMono = !id.includes('/subject/')
const isFirst = index === 0
return (
<Touchable
style={styles.container}
Expand All @@ -48,7 +47,7 @@ const ItemSearch = ({
<View style={styles.imgContainer}>
<Image
style={styles.image}
src={cover || IMG_DEFAULT}
src={getCoverMedium(cover) || IMG_DEFAULT}
resizeMode={isMono ? 'contain' : undefined}
placeholder={!isMono}
width={imgWidth}
Expand Down
35 changes: 24 additions & 11 deletions screens/award/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
* @Author: czy0729
* @Date: 2019-05-29 19:37:12
* @Last Modified by: czy0729
* @Last Modified time: 2019-06-23 11:41:04
* @Last Modified time: 2019-08-19 22:24:05
*/
import React from 'react'
import { StyleSheet, View } from 'react-native'
import { Loading, WebView as CompWebView } from '@components'
import { StatusBar } from '@screens/_'
import { Loading, WebView as CompWebView } from '@components'
import { withHeader, observer } from '@utils/decorators'
import { appNavigate } from '@utils/app'
import { info } from '@utils/ui'
import { hm } from '@utils/fetch'
import { HTMLTrim } from '@utils/html'
import { userStore } from '@stores'
import _ from '@styles'
import resetStyle from './reset-style'

const title = '18年鉴'
const redirectMaxCount = 8 // 最大跳转次数
const title = '年鉴'
const redirectMaxCount = 3 // 最大跳转次数

export default
@withHeader()
Expand All @@ -36,7 +38,7 @@ class Award extends React.Component {
redirectCount = 0 // 跳转次数

componentDidMount() {
hm('award/2018', title)
hm(`award/${this.year}`, title)
}

onError = () => {
Expand Down Expand Up @@ -79,38 +81,49 @@ class Award extends React.Component {
}
}

get year() {
const { navigation } = this.props
const uri = navigation.getParam('uri')
const uris = uri.split('/')
return uris[uris.length - 1]
}

render() {
const { cookie } = userStore.userCookie
const { navigation } = this.props
const uri = navigation.getParam('uri')
const { loading } = this.state
const widthSubject = parseInt((_.window.width - 24) / 3)
const widthMono = parseInt((_.window.width - 48) / 4)
const heightMono = widthMono * 1.2

const injectedJavaScript = `(function(){
// 注入cookie
document.cookie = '${cookie}';
// 为了美观, 修改条目宽度, 每行达到3个
var styleSubject = document.createElement("style");
try {
styleSubject.appendChild(document.createTextNode(".channelStatsWrapper .columnGrid ul.grid li span.cover,.channelStatsWrapper .columnGrid ul.grid li span.cover span.overlay{width:${widthSubject}px !important;height:${widthSubject}px !important;}"));
styleSubject.appendChild(document.createTextNode("${HTMLTrim(
resetStyle[this.year].subject
)}"));
} catch(ex){
}
document.body.append(styleSubject);
// 为了美观, 修改人物宽度, 每行达到4个
var styleSubject = document.createElement("style");
try {
styleSubject.appendChild(document.createTextNode(".columnGrid ul.grid li.avatar{width:${widthMono}px !important;height:${heightMono}px !important;}"));
styleSubject.appendChild(document.createTextNode("${HTMLTrim(
resetStyle[this.year].mono
)}"));
} catch(ex){
}
document.body.append(styleSubject);
// 隐藏部分样式, 使页面更沉浸
var styleDeep = document.createElement("style");
try {
styleDeep.appendChild(document.createTextNode("#headerNeue2, #personalTabStats, .shareBtn, #dock{display:none !important}"));
styleDeep.appendChild(document.createTextNode("${HTMLTrim(
resetStyle[this.year].hidden
)}"));
} catch(ex){
}
document.body.append(styleDeep);
Expand Down
57 changes: 57 additions & 0 deletions screens/award/reset-style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 年鉴样式
* @Author: czy0729
* @Date: 2019-08-18 22:44:40
* @Last Modified by: czy0729
* @Last Modified time: 2019-08-18 22:45:26
*/
import _ from '@styles'

const widthSubject = parseInt((_.window.width - 24) / 3)
const widthMono = parseInt((_.window.width - 48) / 4)
const heightMono = widthMono * 1.2

export default {
2018: {
subject: `
.channelStatsWrapper .columnGrid ul.grid li span.cover,
.channelStatsWrapper .columnGrid ul.grid li span.cover span.overlay {
width: ${widthSubject}px !important;
height: ${widthSubject}px !important;
background-size: ${widthSubject}px !important;
}`,
mono: `
.columnGrid ul.grid li.avatar {
width: ${widthMono}px !important;
height:${heightMono}px !important;
}`,
hidden: `
#headerNeue2,
#personalTabStats,
.shareBtn,
#dock {
display:none !important;
}`
},
2017: {
subject: `
.channelStatsWrapper .columnGrid ul.grid li span.cover,
.channelStatsWrapper .columnGrid ul.grid li span.cover span.overlay {
width: ${widthSubject - 4}px !important;
height: ${widthSubject - 4}px !important;
background-size: ${widthSubject - 4}px !important;
}`,
mono: `
.columnGrid ul.grid li.avatar {
width: ${widthMono - 4}px !important;
height: ${heightMono - 4}px !important;
}`,
hidden: `
#headerNeue2,
#personalTabStats,
.shareBtn,
#dock {
display:none !important;
}`
}
}
3 changes: 1 addition & 2 deletions screens/calendar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2019-03-22 08:46:49
* @Last Modified by: czy0729
* @Last Modified time: 2019-07-21 16:37:00
* @Last Modified time: 2019-08-18 21:47:56
*/
import React from 'react'
import PropTypes from 'prop-types'
Expand Down Expand Up @@ -58,7 +58,6 @@ class Calendar extends React.Component {
if (!$.calendar._loaded) {
return <Loading style={_.container.flex} />
}

return <List />
}
}
Loading

0 comments on commit eee1cfa

Please sign in to comment.