From 83e6ad1951a772c5bbe68c7c5b28ed7ef74419c2 Mon Sep 17 00:00:00 2001 From: czy0729 <402731062@qq.com> Date: Sat, 31 Aug 2019 16:53:34 +0800 Subject: [PATCH] =?UTF-8?q?-=20[x]=20[=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= =?UTF-8?q?]=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=8A=A8=E4=BD=9C=E5=AD=97?= =?UTF-8?q?=E7=9C=BC,=20=E5=A6=82=E6=B8=B8=E6=88=8F:=20=E5=9C=A8=E7=9C=8B?= =?UTF-8?q?=20->=20=E5=9C=A8=E7=8E=A9=20-=20[x]=20=E5=8F=96=E6=B6=88App?= =?UTF-8?q?=E5=86=85=E6=89=80=E6=9C=89=E6=9B=B4=E6=96=B0=E5=AD=97=E7=9C=BC?= =?UTF-8?q?=E5=92=8C=E6=8F=90=E7=A4=BA=20-=20[x]=20UGC=20(=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BA=A7=E7=94=9F=E5=86=85=E5=AE=B9)=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E5=BF=85=E9=A1=BB=E6=8F=90=E4=BE=9B=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8D=8F=E8=AE=AE=20(=E5=BA=94=E4=BB=98=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E7=94=A8)=20-=20[x]=20=E7=A4=BE=E5=8C=BA=E6=8C=87?= =?UTF-8?q?=E5=AF=BC=E5=8E=9F=E5=88=99=E9=A1=B5=E9=9D=A2=20(=E5=BA=94?= =?UTF-8?q?=E4=BB=98=E5=AE=A1=E6=A0=B8=E7=94=A8)=20-=20[x]=20=E4=B8=BE?= =?UTF-8?q?=E6=8A=A5=E5=85=A5=E5=8F=A3,=20=E5=8F=AA=E6=98=AF=E4=B8=AA?= =?UTF-8?q?=E6=A0=B7=E5=AD=90=20(=E5=BA=94=E4=BB=98=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E7=94=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- navigations/index.js | 6 +- screens/_/item/friends.js | 8 +- screens/auth/index.js | 4 +- screens/home/index.js | 4 +- screens/index.js | 7 +- screens/rakuen/index.js | 7 +- screens/setting/index.js | 18 +- screens/tinygrail/index/award.js | 113 ++++++++++++ screens/tinygrail/index/header.js | 37 ++++ screens/tinygrail/index/index.js | 64 +++++++ screens/tinygrail/index/list.js | 198 ++++++++++++++++++++++ screens/tinygrail/index/section.js | 101 +++++++++++ screens/tinygrail/index/section2.js | 87 ++++++++++ screens/tinygrail/index/store.js | 87 ++++++++++ screens/tinygrail/{ => overview}/index.js | 15 +- screens/tinygrail/{ => overview}/item.js | 4 +- screens/tinygrail/{ => overview}/list.js | 2 +- screens/tinygrail/{ => overview}/store.js | 0 screens/tinygrail/{ => overview}/tabs.js | 2 +- screens/topic/index.js | 36 +++- screens/topic/store.js | 14 +- screens/ugc-agree/index.js | 83 +++++++++ screens/user/store.js | 17 +- screens/user/tabs.js | 4 +- stores/system/index.js | 32 +++- styles/index.js | 4 +- utils/decorators/withHeader.js | 28 +-- 27 files changed, 928 insertions(+), 54 deletions(-) create mode 100644 screens/tinygrail/index/award.js create mode 100644 screens/tinygrail/index/header.js create mode 100644 screens/tinygrail/index/index.js create mode 100644 screens/tinygrail/index/list.js create mode 100644 screens/tinygrail/index/section.js create mode 100644 screens/tinygrail/index/section2.js create mode 100644 screens/tinygrail/index/store.js rename screens/tinygrail/{ => overview}/index.js (83%) rename screens/tinygrail/{ => overview}/item.js (97%) rename screens/tinygrail/{ => overview}/list.js (95%) rename screens/tinygrail/{ => overview}/store.js (100%) rename screens/tinygrail/{ => overview}/tabs.js (92%) create mode 100644 screens/ugc-agree/index.js diff --git a/navigations/index.js b/navigations/index.js index 39a22aae2..22e569de0 100644 --- a/navigations/index.js +++ b/navigations/index.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-03-29 10:38:12 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-31 01:06:47 + * @Last Modified time: 2019-08-31 16:11:30 */ import React from 'react' import { StyleSheet, View } from 'react-native' @@ -35,7 +35,9 @@ import { Tag, Timeline, Tinygrail, + TinygrailOverview, Topic, + UGCAgree, User, Video, WebView, @@ -107,7 +109,9 @@ const HomeStack = createStackNavigator( Tag, Timeline, Tinygrail, + TinygrailOverview, Topic, + UGCAgree, User, Video, WebView, diff --git a/screens/_/item/friends.js b/screens/_/item/friends.js index b2c532a0e..3cc98be6f 100644 --- a/screens/_/item/friends.js +++ b/screens/_/item/friends.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-07-24 13:59:03 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-29 17:14:15 + * @Last Modified time: 2019-08-31 16:31:04 */ import React from 'react' import { StyleSheet } from 'react-native' @@ -41,9 +41,11 @@ function ItemFriends({ - {userName} + {userName} - {recent} + + {recent} + {!!doing && `${doing}在看`} diff --git a/screens/auth/index.js b/screens/auth/index.js index 162a86dab..44454f093 100644 --- a/screens/auth/index.js +++ b/screens/auth/index.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-03-31 10:25:46 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-30 23:50:18 + * @Last Modified time: 2019-08-31 15:00:10 */ import React from 'react' import { View } from 'react-native' @@ -55,7 +55,7 @@ class Auth extends React.Component { ]} name='trophy-full' color={_.colorYellow} - onPress={() => navigation.push('Tinygrail')} + onPress={() => navigation.push('TinygrailOverview')} /> { diff --git a/screens/home/index.js b/screens/home/index.js index 2b8363d1a..e3b04d662 100644 --- a/screens/home/index.js +++ b/screens/home/index.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-03-13 08:34:37 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-30 23:50:31 + * @Last Modified time: 2019-08-31 14:59:55 */ import React from 'react' import { NavigationEvents, SafeAreaView } from 'react-navigation' @@ -36,7 +36,7 @@ class Home extends React.Component { navigation.push('Tinygrail')} + onPress={() => navigation.push('TinygrailOverview')} /> , headerRight: ( { switch (title) { case '设置': @@ -64,6 +64,9 @@ class Rakuen extends React.Component { case '新讨论': open(HTML_NEW_TOPIC()) break + case '社区指导原则': + navigation.push('UGCAgree') + break default: break } diff --git a/screens/setting/index.js b/screens/setting/index.js index 87b9a3755..1859f4613 100644 --- a/screens/setting/index.js +++ b/screens/setting/index.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-05-24 01:34:26 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-31 00:21:54 + * @Last Modified time: 2019-08-31 15:05:18 */ import React from 'react' import { ScrollView, View } from 'react-native' @@ -15,6 +15,7 @@ import { info } from '@utils/ui' import { appNavigate } from '@utils/app' import { hm } from '@utils/fetch' import { + IOS, FEEDBACK_URL, GITHUB_URL, GITHUB_RELEASE_URL, @@ -180,10 +181,7 @@ class Setting extends React.Component { border hd='章节讨论热力图' ft={ - + } withoutFeedback /> @@ -193,9 +191,9 @@ class Setting extends React.Component { 有新版本{name} @@ -239,7 +237,11 @@ class Setting extends React.Component { /> + 退出登陆 + + } arrow highlight onPress={() => Stores.logout(navigation)} diff --git a/screens/tinygrail/index/award.js b/screens/tinygrail/index/award.js new file mode 100644 index 000000000..ddfeea02f --- /dev/null +++ b/screens/tinygrail/index/award.js @@ -0,0 +1,113 @@ +/* + * @Author: czy0729 + * @Date: 2019-05-29 16:08:10 + * @Last Modified by: czy0729 + * @Last Modified time: 2019-08-22 16:59:26 + */ +import React from 'react' +import { StyleSheet, ScrollView, View } from 'react-native' +import PropTypes from 'prop-types' +import { Touchable, Image, Text, Flex } from '@components' +import { HOST } from '@constants' +import _ from '@styles' + +function Award(props, { navigation }) { + return ( + + + navigation.push('Award', { + uri: `${HOST}/award/2018` + }) + } + > + + + + + + {[2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010].map((item, index) => ( + + navigation.push('Award', { + uri: `${HOST}/award/${item}` + }) + } + > + + {index === 0 && ( + + BEST OF + + )} + + {item} + + + + ))} + + ) +} + +Award.contextTypes = { + navigation: PropTypes.object +} + +export default Award + +const styles = StyleSheet.create({ + container: { + padding: _.wind + }, + item: { + width: 312 + }, + itemSquare: { + width: 148, + height: 148, + borderRadius: _.radiusMd, + overflow: 'hidden' + }, + image: { + backgroundColor: _.colorDanger, + borderRadius: _.radiusMd, + overflow: 'hidden' + }, + imageTitle: { + position: 'absolute', + top: 0, + right: 0, + marginRight: -8 + } +}) diff --git a/screens/tinygrail/index/header.js b/screens/tinygrail/index/header.js new file mode 100644 index 000000000..a8d216a95 --- /dev/null +++ b/screens/tinygrail/index/header.js @@ -0,0 +1,37 @@ +/* + * @Author: czy0729 + * @Date: 2019-08-10 17:53:18 + * @Last Modified by: czy0729 + * @Last Modified time: 2019-08-18 21:40:03 + */ +import React from 'react' +import { View } from 'react-native' +import PropTypes from 'prop-types' +import { observer } from 'mobx-react' +import { Text } from '@components' +import { StatusBarPlaceholder } from '@screens/_' +import _ from '@styles' +import Award from './award' +import Section from './section' +import Section2 from './section2' + +function Header(props, { $ }) { + const { today } = $.home + return ( + <> + + +
+ + + {today} + + + ) +} + +Header.contextTypes = { + $: PropTypes.object +} + +export default observer(Header) diff --git a/screens/tinygrail/index/index.js b/screens/tinygrail/index/index.js new file mode 100644 index 000000000..c74bf754b --- /dev/null +++ b/screens/tinygrail/index/index.js @@ -0,0 +1,64 @@ +/* + * @Author: czy0729 + * @Date: 2019-03-22 08:46:49 + * @Last Modified by: czy0729 + * @Last Modified time: 2019-08-27 19:50:48 + */ +import React from 'react' +import PropTypes from 'prop-types' +import { Loading, ListView } from '@components' +import { StatusBarEvents, IconTabBar } from '@screens/_' +import { inject, observer } from '@utils/decorators' +import { hm } from '@utils/fetch' +import _ from '@styles' +import Header from './header' +import List from './list' +import Store from './store' + +const title = '发现' + +export default +@inject(Store) +@observer +class Discovery extends React.Component { + static navigationOptions = { + header: null, + tabBarIcon: ({ tintColor }) => , + tabBarLabel: '发现' + } + + static contextTypes = { + $: PropTypes.object + } + + componentDidMount() { + const { $ } = this.context + $.init() + + hm('discovery', title) + } + + render() { + const { $ } = this.context + const { _loaded } = $.home + if (!_loaded) { + return + } + + return ( + <> + + item.type} + data={$.state.home} + ListHeaderComponent={
} + renderItem={({ item }) => } + onHeaderRefresh={$.init} + onFooterRefresh={$.fetchHome} + /> + + ) + } +} diff --git a/screens/tinygrail/index/list.js b/screens/tinygrail/index/list.js new file mode 100644 index 000000000..fc1df1b10 --- /dev/null +++ b/screens/tinygrail/index/list.js @@ -0,0 +1,198 @@ +/* + * @Author: czy0729 + * @Date: 2019-05-29 04:03:46 + * @Last Modified by: czy0729 + * @Last Modified time: 2019-08-25 14:29:08 + */ +import React from 'react' +import { StyleSheet, ScrollView, View } from 'react-native' +import PropTypes from 'prop-types' +import { observer } from 'mobx-react' +import { LinearGradient } from 'expo-linear-gradient' +import { Image, Text } from '@components' +import { SectionTitle, IconHeader } from '@screens/_' +import { findBangumiCn, getCoverLarge, getCoverMedium } from '@utils/app' +import { HOST, IMG_DEFAULT } from '@constants' +import { MODEL_SUBJECT_TYPE } from '@constants/model' +import _ from '@styles' + +const imageBigWidth = _.window.width - _.wind * 2 +const imageBigHeight = imageBigWidth * 1.28 +const imageWidth = _.window.width * 0.32 +const imageHeight = imageWidth * 1.28 +const linearColorLg = [ + 'rgba(0, 0, 0, 0)', + 'rgba(0, 0, 0, 0)', + 'rgba(0, 0, 0, 0)', + 'rgba(0, 0, 0, 0.8)' +] +const linearColorSm = [ + 'rgba(0, 0, 0, 0)', + 'rgba(0, 0, 0, 0)', + 'rgba(0, 0, 0, 0.8)' +] + +function List({ style, type }, { $, navigation }) { + if (!$.home[type].length) { + return null + } + + const data = $.home[type].sort(() => 0.5 - Math.random()) + const title = MODEL_SUBJECT_TYPE.getTitle(type) + return ( + <> + + navigation.push('WebView', { + uri: `${HOST}/${type}`, + title + }) + } + /> + } + > + {title} + + {[0].map(item => { + const src = getCoverLarge(data[item].cover) || IMG_DEFAULT + return ( + + + navigation.push('Subject', { + subjectId: data[item].subjectId, + _jp: data[item].title, + _image: src + }) + } + /> + + + + {data[item].info} + + + {findBangumiCn(data[item].title)} + + + + ) + })} + + {data + .filter((item, index) => index > 0) + .map(item => { + const src = getCoverMedium(item.cover) || IMG_DEFAULT + return ( + + + navigation.push('Subject', { + subjectId: item.subjectId, + _jp: item.title, + _image: src + }) + } + /> + + + + {item.info} + + + {findBangumiCn(item.title)} + + + + ) + })} + + + ) +} + +List.contextTypes = { + $: PropTypes.object, + navigation: PropTypes.object +} + +List.defaultProps = { + type: 'anime' +} + +export default observer(List) + +const styles = StyleSheet.create({ + contentContainerStyle: { + padding: _.wind, + paddingRight: 0 + }, + section: { + marginTop: _.wind, + marginHorizontal: _.wind + }, + big: { + marginTop: _.wind, + marginHorizontal: _.wind, + backgroundColor: _.colorIcon, + borderRadius: _.radiusMd, + overflow: 'hidden' + }, + desc: { + position: 'absolute', + zIndex: 1, + right: _.wind, + bottom: _.wind, + left: _.wind + }, + info: { + opacity: 0.88 + }, + title: { + opacity: 0.92 + }, + image: { + marginRight: _.wind, + backgroundColor: _.colorIcon, + borderRadius: _.radiusSm, + overflow: 'hidden' + } +}) diff --git a/screens/tinygrail/index/section.js b/screens/tinygrail/index/section.js new file mode 100644 index 000000000..5ca5f67cf --- /dev/null +++ b/screens/tinygrail/index/section.js @@ -0,0 +1,101 @@ +/* + * @Author: czy0729 + * @Date: 2019-06-23 21:34:23 + * @Last Modified by: czy0729 + * @Last Modified time: 2019-08-29 16:40:43 + */ +import React from 'react' +import { StyleSheet, View } from 'react-native' +import PropTypes from 'prop-types' +import { Flex, Text, Image, Touchable } from '@components' +import { random } from '@utils' +import { observer } from '@utils/decorators' +import { getCoverMedium } from '@utils/app' +import _ from '@styles' +import { sectionWidth, sectionHeight } from './store' + +function Section(props, { $, navigation }) { + let rankCover = '' + if ($.rank._loaded) { + rankCover = + $.rank.list.length && $.rank.list[random(0, $.rank.list.length - 1)].cover + } + + let calendarCover = '' + if ($.calendar._loaded) { + // 今天星期几的数据排最前 + let day = new Date().getDay() + if (day === 0) { + day = 7 + } + calendarCover = + $.calendar.list.slice(day - 1)[0].items[0].images.large || '' + } + + return ( + + navigation.push('Rank')}> + + {!!rankCover && ( + + )} + + + 排行榜 + + + + + navigation.push('Calendar')}> + + {!!calendarCover && ( + + )} + + + 每日放送 + + + + + + ) +} + +Section.contextTypes = { + $: PropTypes.object, + navigation: PropTypes.object +} + +export default observer(Section) + +const styles = StyleSheet.create({ + section: { + marginTop: _.wind, + marginHorizontal: _.wind + }, + desc: { + ...StyleSheet.absoluteFill, + zIndex: 1, + backgroundColor: _.colorMask + }, + image: { + width: sectionWidth, + height: sectionHeight, + marginRight: _.wind, + borderRadius: _.radiusSm, + overflow: 'hidden' + } +}) diff --git a/screens/tinygrail/index/section2.js b/screens/tinygrail/index/section2.js new file mode 100644 index 000000000..c850f4e7a --- /dev/null +++ b/screens/tinygrail/index/section2.js @@ -0,0 +1,87 @@ +/* + * @Author: czy0729 + * @Date: 2019-07-28 18:16:49 + * @Last Modified by: czy0729 + * @Last Modified time: 2019-08-10 17:43:05 + */ +import React from 'react' +import { StyleSheet, View } from 'react-native' +import PropTypes from 'prop-types' +import { Flex, Text, Image, Touchable } from '@components' +import { observer } from '@utils/decorators' +import { getCoverMedium } from '@utils/app' +import _ from '@styles' +import { sectionWidth, sectionHeight } from './store' + +function Section2(props, { $, navigation }) { + let randomCover = '' + if ($.random._loaded) { + randomCover = $.random.list.length && $.random.list[0].cover + } + return ( + + navigation.push('Random')}> + + {!!randomCover && ( + + )} + + + 随便看看 + + + + + navigation.push('Anitama')}> + + + + + + ) +} + +Section2.contextTypes = { + $: PropTypes.object, + navigation: PropTypes.object +} + +export default observer(Section2) + +const styles = StyleSheet.create({ + section: { + marginTop: _.wind, + marginHorizontal: _.wind + }, + desc: { + ...StyleSheet.absoluteFill, + zIndex: 1, + backgroundColor: _.colorMask + }, + image: { + width: sectionWidth, + height: sectionHeight, + marginRight: _.wind, + borderRadius: _.radiusSm, + overflow: 'hidden' + } +}) diff --git a/screens/tinygrail/index/store.js b/screens/tinygrail/index/store.js new file mode 100644 index 000000000..c87b47702 --- /dev/null +++ b/screens/tinygrail/index/store.js @@ -0,0 +1,87 @@ +/* + * @Author: czy0729 + * @Date: 2019-03-22 08:49:20 + * @Last Modified by: czy0729 + * @Last Modified time: 2019-08-30 23:25:44 + */ +import { observable, computed } from 'mobx' +import { calendarStore, discoveryStore, tagStore } from '@stores' +import { getTimestamp } from '@utils' +import store from '@utils/store' +import { MODEL_SUBJECT_TYPE } from '@constants/model' +import _ from '@styles' + +export const sectionWidth = (_.window.width - _.wind * 3) / 2 +export const sectionHeight = sectionWidth / 1.68 + +export default class ScreenDiscovery extends store { + state = observable({ + home: { + list: [ + { + type: MODEL_SUBJECT_TYPE.getLabel('动画') + }, + { + type: MODEL_SUBJECT_TYPE.getLabel('书籍') + } + ], + pagination: { + page: 1, + pageTotal: 2 + }, + _loaded: getTimestamp() + } + }) + + init = async () => { + // 随便看看 + if (!this.random._loaded) { + await discoveryStore.fetchRandom(true) + } + + // 每日放送 + if (!this.calendar._loaded) { + await calendarStore.fetchCalendar() + } + + // 排行版 + if (!this.rank._loaded) { + await tagStore.fetchRank() + } + + // 推荐数据 + return calendarStore.fetchHome() + } + + fetchHome = () => { + this.setState({ + home: { + list: MODEL_SUBJECT_TYPE.data.map(item => ({ + type: item.label + })), + pagination: { + page: 2, + pageTotal: 2 + }, + _loaded: getTimestamp() + } + }) + } + + // -------------------- get -------------------- + @computed get home() { + return calendarStore.home + } + + @computed get random() { + return discoveryStore.random + } + + @computed get calendar() { + return calendarStore.calendar + } + + @computed get rank() { + return tagStore.rank() + } +} diff --git a/screens/tinygrail/index.js b/screens/tinygrail/overview/index.js similarity index 83% rename from screens/tinygrail/index.js rename to screens/tinygrail/overview/index.js index daa02e34c..4d28d628e 100644 --- a/screens/tinygrail/index.js +++ b/screens/tinygrail/overview/index.js @@ -2,12 +2,13 @@ * @Author: czy0729 * @Date: 2019-08-25 19:12:19 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-27 18:40:40 + * @Last Modified time: 2019-08-31 15:29:24 */ import React from 'react' import { View } from 'react-native' import PropTypes from 'prop-types' import { observer } from 'mobx-react' +import { IconHeader } from '@screens/_' import { open } from '@utils' import { inject, withHeader } from '@utils/decorators' import { hm } from '@utils/fetch' @@ -48,7 +49,17 @@ class Tinygrail extends React.Component { break } } - } + }, + extra: ( + + navigation.push('Group', { + groupId: 'tinygrail' + }) + } + /> + ) }) hm('tinygrail', title) diff --git a/screens/tinygrail/item.js b/screens/tinygrail/overview/item.js similarity index 97% rename from screens/tinygrail/item.js rename to screens/tinygrail/overview/item.js index da44aa673..1b0c27fae 100644 --- a/screens/tinygrail/item.js +++ b/screens/tinygrail/overview/item.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-08-25 19:51:55 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-27 18:46:23 + * @Last Modified time: 2019-08-31 14:39:52 */ import React from 'react' import { StyleSheet, View } from 'react-native' @@ -68,7 +68,7 @@ function Item(props, { navigation }) { /> - + navigation.goBack() + }, + { + text: '查看', + onPress: () => { + navigation.goBack() + navigation.push('UGCAgree', { + topicId + }) + } + } + ] + ) + return + } + await $.init() const { title } = $.topic withTransitionHeader.setTitle(navigation, title) - const { topicId } = $.params const url = navigation.getParam('_url') || `${HOST}/rakuen/topic/${topicId}` navigation.setParams({ popover: { - data: ['浏览器查看'], + data: ['浏览器查看', '举报'], onSelect: key => { switch (key) { case '浏览器查看': open(url) break + case '举报': + open(`${HOST}/group/forum`) + break default: break } diff --git a/screens/topic/store.js b/screens/topic/store.js index f87dbbc8c..ade26e387 100644 --- a/screens/topic/store.js +++ b/screens/topic/store.js @@ -2,10 +2,16 @@ * @Author: czy0729 * @Date: 2019-04-29 19:55:09 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-16 21:27:59 + * @Last Modified time: 2019-08-31 15:43:07 */ import { observable, computed } from 'mobx' -import { rakuenStore, subjectStore, userStore, usersStore } from '@stores' +import { + systemStore, + rakuenStore, + subjectStore, + userStore, + usersStore +} from '@stores' import store from '@utils/store' import { removeHTMLTag } from '@utils/html' import decoder from '@utils/thirdParty/html-entities-decoder' @@ -155,6 +161,10 @@ export default class ScreenTopic extends store { return usersStore.myFriendsMap } + @computed get isUGCAgree() { + return systemStore.isUGCAgree + } + // -------------------- page -------------------- /** * 吐槽箱倒序 diff --git a/screens/ugc-agree/index.js b/screens/ugc-agree/index.js new file mode 100644 index 000000000..6756f1ecb --- /dev/null +++ b/screens/ugc-agree/index.js @@ -0,0 +1,83 @@ +/* eslint-disable max-len */ +/* + * @Author: czy0729 + * @Date: 2019-08-31 15:45:18 + * @Last Modified by: czy0729 + * @Last Modified time: 2019-08-31 16:46:40 + */ +import React from 'react' +import { ScrollView } from 'react-native' +import { RenderHtml, Flex, Button } from '@components' +import { systemStore } from '@stores' +import { appNavigate } from '@utils/app' +import { withHeader } from '@utils/decorators' +import { hm } from '@utils/fetch' +import _ from '@styles' + +const title = '社区指导原则' +const html = + '
生命有限,Bangumi 是一个纯粹的ACG网络,只要明确这一点,你完全可以跳过以下内容的阅读

/ Chobits 鼓励

  1. 鼓励分享、互助和开放;
  2. 鼓励宽容和理性地对待不同的看法、喜好和意见;
  3. 鼓励尊重他人的隐私和个人空间;
  4. 鼓励转载注明原作者及来源;
  5. 鼓励精彩原创内容;
  6. 鼓励明确、及时的资源分享和点评;
  7. 鼓励有始有终的自发福利活动。

/ Bangumi 不提倡

  1. 针对种族、国家、民族、宗教、性别、年龄、地缘、性取向、生理特征的歧视和仇恨言论;
  2. 不雅词句、人身攻击、故意骚扰和恶意使用;
  3. 色情、激进时政、意识形态方面的话题;
  4. 使用脑残体等妨碍视觉与心灵的文字;
  5. 无授权转载,盗图、盗链、盗资源;
  6. 不提倡情绪激动而心灵枯槁的内容;
  7. 不提倡转载过期变质内容;
  8. 不提倡不知所谓的长篇大论;
  9. 不提倡调查贴、投票贴、签名贴。

/ Bangumi 禁止

以下行为视情况直接删除、锁定或删除ID、批量删除而不予通知
  1. 违反中国或 Bangumi 成员所在地法律法规的行为和内容(政策法规);
  2. 威胁他人或 Bangumi 成员自身的人身安全、法律安全的行为;
  3. 对网站的运营安全有潜在威胁的内容。

指导原则的编写参考了豆瓣以及XQ网站,最后更新日期为:2008-08-06 20:32
' + +export default +@withHeader() +class UGCAgree extends React.Component { + static navigationOptions = { + title + } + + componentDidMount() { + hm('/about/guideline', title) + } + + updateUGCAgree = value => { + const { navigation } = this.props + systemStore.updateUGCAgree(value) + + if (value) { + const topicId = navigation.getParam('topicId') + if (topicId) { + navigation.goBack() + navigation.push('Topic', { + topicId + }) + } else { + navigation.goBack() + } + } else { + navigation.goBack() + } + } + + render() { + const { navigation } = this.props + return ( + + appNavigate(href, navigation)} + /> + + + + + + + + + + ) + } +} diff --git a/screens/user/store.js b/screens/user/store.js index fccae41c9..534be82e3 100644 --- a/screens/user/store.js +++ b/screens/user/store.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-05-25 22:03:14 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-16 21:30:56 + * @Last Modified time: 2019-08-31 01:49:18 */ import { observable, computed } from 'mobx' import { userStore, collectionStore } from '@stores' @@ -84,6 +84,21 @@ export default class ScreenUser extends store { return MODEL_COLLECTION_STATUS.getValue(tabs[page].title) } + /** + * 条目动作 + */ + @computed get action() { + const { subjectType } = this.state + switch (MODEL_SUBJECT_TYPE.getTitle(subjectType)) { + case '音乐': + return '听' + case '游戏': + return '玩' + default: + return '看' + } + } + userCollections(subjectType, type) { const { username } = this.usersInfo const { userId } = this.params diff --git a/screens/user/tabs.js b/screens/user/tabs.js index 1a002f72e..835adb838 100644 --- a/screens/user/tabs.js +++ b/screens/user/tabs.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-05-25 22:03:23 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-27 16:18:03 + * @Last Modified time: 2019-08-31 01:44:03 */ import React from 'react' import { StyleSheet } from 'react-native' @@ -39,7 +39,7 @@ function Tabs({ scrollY, children, ...other }, { $ }) { return { title: ( - {item.title} + {item.title.replace('看', $.action)} {!!count && ( {' '} diff --git a/stores/system/index.js b/stores/system/index.js index 1309361cc..81f937a3e 100644 --- a/stores/system/index.js +++ b/stores/system/index.js @@ -2,7 +2,7 @@ * @Author: czy0729 * @Date: 2019-05-17 21:53:14 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-31 00:18:11 + * @Last Modified time: 2019-08-31 16:45:02 */ import { NetInfo } from 'react-native' import { observable, computed } from 'mobx' @@ -28,19 +28,22 @@ class System extends store { release: INIT_RELEASE, imageViewer: INIT_IMAGE_VIEWER, wifi: false, - dev: false + dev: false, + iosUGCAgree: false // iOS首次进入, 观看用户产生内容需有同意规则选项, 否则不能过审 }) async init() { let res res = Promise.all([ this.getStorage('setting', NAMESPACE), - this.getStorage('release', NAMESPACE) + this.getStorage('release', NAMESPACE), + this.getStorage('iosUGCAgree', NAMESPACE) ]) const state = await res this.setState({ setting: state[0] || INIT_SETTING, - release: state[1] || INIT_RELEASE + release: state[1] || INIT_RELEASE, + iosUGCAgree: state[2] || false }) res = NetInfo.getConnectionInfo() @@ -76,6 +79,13 @@ class System extends store { return this.state.imageViewer } + @computed get isUGCAgree() { + if (!IOS) { + return true + } + return this.state.iosUGCAgree + } + // -------------------- fetch -------------------- /* * 检查新版本 @@ -243,12 +253,26 @@ class System extends store { }) } + /** + * 切换开发模式 + */ toggleDev = () => { const { dev } = this.state this.setState({ dev: !dev }) } + + /** + * 同意社区指导原则 + */ + updateUGCAgree = value => { + const key = 'iosUGCAgree' + this.setState({ + [key]: value + }) + this.setStorage(key, undefined, NAMESPACE) + } } export default new System() diff --git a/styles/index.js b/styles/index.js index ef8fee6af..38f0a9c77 100644 --- a/styles/index.js +++ b/styles/index.js @@ -3,7 +3,7 @@ * @Author: czy0729 * @Date: 2019-03-14 06:02:03 * @Last Modified by: czy0729 - * @Last Modified time: 2019-08-30 23:51:16 + * @Last Modified time: 2019-08-31 01:53:32 */ import { Dimensions, StyleSheet } from 'react-native' import Constants from 'expo-constants' @@ -31,7 +31,7 @@ export const md = 16 export const lg = 32 export const space = 20 // 上下 export const wind = 16 // 两翼 -export const bottom = tabBarHeight + lg // 底部留空 +export const bottom = tabBarHeight + lg + md // 底部留空 // -------------------- 主题色 -------------------- export const colorPlainRaw = [255, 255, 255] diff --git a/utils/decorators/withHeader.js b/utils/decorators/withHeader.js index 3e992938a..2b6263463 100644 --- a/utils/decorators/withHeader.js +++ b/utils/decorators/withHeader.js @@ -2,11 +2,11 @@ * @Author: czy0729 * @Date: 2019-05-18 00:32:48 * @Last Modified by: czy0729 - * @Last Modified time: 2019-07-27 10:50:56 + * @Last Modified time: 2019-08-31 15:23:38 */ import React from 'react' import { StyleSheet } from 'react-native' -import { Popover, Menu, Iconfont } from '@components' +import { Flex, Popover, Menu, Iconfont } from '@components' import { IconBack } from '@screens/_' import { IOS } from '@constants' import _ from '@styles' @@ -25,6 +25,7 @@ const withHeader = () => ComposedComponent => 'element', ) + const extra = navigation.getParam('extra') if (popover.data.length) { const popoverProps = IOS ? { @@ -41,16 +42,19 @@ const withHeader = () => ComposedComponent => onSelect: popover.onSelect } headerRight = ( - - {element} - + + {extra} + + {element} + + ) }