mirror of
https://github.com/timepill/timepill-app.git
synced 2025-04-30 09:59:31 +08:00
提醒页面增加创可贴展示
This commit is contained in:
parent
da7ff8050a
commit
ecac562fc3
4 changed files with 59 additions and 5 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -10660,7 +10660,7 @@
|
||||||
},
|
},
|
||||||
"prop-types": {
|
"prop-types": {
|
||||||
"version": "15.7.2",
|
"version": "15.7.2",
|
||||||
"resolved": "http://registry.npm.taobao.org/prop-types/download/prop-types-15.7.2.tgz",
|
"resolved": "https://registry.npm.taobao.org/prop-types/download/prop-types-15.7.2.tgz",
|
||||||
"integrity": "sha1-UsQedbjIfnK52TYOAga5ncv/psU=",
|
"integrity": "sha1-UsQedbjIfnK52TYOAga5ncv/psU=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"loose-envify": "^1.4.0",
|
"loose-envify": "^1.4.0",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import {StyleSheet, Text, View} from 'react-native';
|
import {Image, StyleSheet, Text, View} from 'react-native';
|
||||||
import Ionicons from 'react-native-vector-icons/Ionicons';
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
||||||
|
|
||||||
import Touchable from '../touchable';
|
import Touchable from '../touchable';
|
||||||
|
@ -27,6 +27,8 @@ export default class Notification extends Component {
|
||||||
|
|
||||||
} else if(msg.type == 2) {
|
} else if(msg.type == 2) {
|
||||||
return this.renderFollow(msg);
|
return this.renderFollow(msg);
|
||||||
|
} else if(msg.type == 3) {
|
||||||
|
return this.renderLike(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +36,7 @@ export default class Notification extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderComment(msg) {
|
renderComment(msg) {
|
||||||
|
console.log(msg);
|
||||||
const users = unique(msg.list.map(it => it.content.author.name)).join('、');
|
const users = unique(msg.list.map(it => it.content.author.name)).join('、');
|
||||||
const body = `${users} 回复了你`;
|
const body = `${users} 回复了你`;
|
||||||
|
|
||||||
|
@ -59,6 +62,26 @@ export default class Notification extends Component {
|
||||||
</Touchable>
|
</Touchable>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderLike(msg) {
|
||||||
|
console.log(msg);
|
||||||
|
const body = `${msg.content.user.name} 给了你一个创可贴`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Touchable key={msg.link_id} onPress={() => this.props.onLikePress(msg)}>
|
||||||
|
<View style={localStyle.container}>
|
||||||
|
<Image
|
||||||
|
source={
|
||||||
|
|
||||||
|
require('../../img/ok-beng2.png')
|
||||||
|
}
|
||||||
|
style={localStyle.icon2}
|
||||||
|
/>
|
||||||
|
<Text style={localStyle.text}>{body}</Text>
|
||||||
|
</View>
|
||||||
|
</Touchable>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const localStyle = StyleSheet.create({
|
const localStyle = StyleSheet.create({
|
||||||
|
@ -76,5 +99,11 @@ const localStyle = StyleSheet.create({
|
||||||
text: {
|
text: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
lineHeight: 20
|
lineHeight: 20
|
||||||
}
|
},
|
||||||
|
icon2: {
|
||||||
|
width: 14,
|
||||||
|
height: 14,
|
||||||
|
marginRight: 10,
|
||||||
|
marginTop: 4,
|
||||||
|
},
|
||||||
});
|
});
|
|
@ -62,7 +62,7 @@ export default class NotificationList extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (v.type == 2) {
|
} else if (v.type == 2 || v.type == 3) {
|
||||||
ret.push(v);
|
ret.push(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +149,30 @@ export default class NotificationList extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onLikePress(msg) {
|
||||||
|
Navigation.push(this.props.componentId, {
|
||||||
|
component: {
|
||||||
|
name: 'User',
|
||||||
|
options: {
|
||||||
|
bottomTabs: {
|
||||||
|
visible: false,
|
||||||
|
|
||||||
|
// hide bottom tab for android
|
||||||
|
drawBehind: true,
|
||||||
|
animate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
passProps: {
|
||||||
|
user: msg.content.user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(this.props.isSetRead) {
|
||||||
|
//this._setRead(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let hasData = this.state.notifications && this.state.notifications.length > 0;
|
let hasData = this.state.notifications && this.state.notifications.length > 0;
|
||||||
return hasData ? (
|
return hasData ? (
|
||||||
|
@ -164,6 +188,7 @@ export default class NotificationList extends Component {
|
||||||
<Notification msg={item}
|
<Notification msg={item}
|
||||||
onCommentPress={this._onCommentPress.bind(this)}
|
onCommentPress={this._onCommentPress.bind(this)}
|
||||||
onFollowPress={this._onFollowPress.bind(this)}
|
onFollowPress={this._onFollowPress.bind(this)}
|
||||||
|
onLikePress={this._onLikePress.bind(this)}
|
||||||
></Notification>
|
></Notification>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -248,7 +248,7 @@ async function addFollow(user_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMessages() {
|
async function getMessages() {
|
||||||
return call('GET', '/tip');
|
return callV2('GET', '/tips');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getMessagesHistory() {
|
async function getMessagesHistory() {
|
||||||
|
|
Loading…
Reference in a new issue