罗广聪

share

... ... @@ -25,7 +25,7 @@ export default class ArticleTemplate extends Component {
style={{ marginRight: 13 }}
onPress={() => state.params.share()}
>
<Text>分享</Text>
<Text style={{ fontSize: 16, color: "#0071E1" }}>分享</Text>
</TouchableOpacity>
)
};
... ... @@ -33,10 +33,11 @@ export default class ArticleTemplate extends Component {
constructor(props) {
super(props);
this.state = {
IS_LOGIN: '',
USER_ID: '',
IS_LOGIN: "",
USER_ID: "",
id: this.props.navigation.state.params.item.id,
model: this.props.navigation.state.params.model,
type: this.props.navigation.state.params.type,
articleData: {
paragraph: []
}
... ... @@ -51,23 +52,26 @@ export default class ArticleTemplate extends Component {
share: this.share.bind(this)
});
}
componentDidMount() {
console.log(`https://devpay.brae.co/insurance.html?uid=${this.state.USER_ID}&sid=${this.state.id}`)
}
componentDidMount() {}
share() {
const that = this;
console.log("share")
Share.share({
Share.share(
{
title: "保护神",
message: this.state.articleData.title,
url: `https://devpay.brae.co/insurance.html?uid=${this.state.USER_ID}&sid=${this.state.id}`
},{
// dialogTitle: 'Share React Native website',
excludedActivityTypes: [
'com.apple.UIKit.activity.PostToTwitter'
],
tintColor: 'green'
})
message: that.state.articleData.title,
url:
that.state.type == "home"
? `https://devpay.brae.co/insurance.html?uid=${this.state
.USER_ID}&tid=${this.state.id}`
: `https://devpay.brae.co/insurance.html?uid=${this.state
.USER_ID}&sid=${this.state.id}`
},
{
excludedActivityTypes: ["com.apple.UIKit.activity.PostToTwitter"],
tintColor: "green"
}
)
.then(that._showResult)
.catch(error => this.setState({ result: "error: " + error.message }));
}
... ... @@ -96,7 +100,7 @@ export default class ArticleTemplate extends Component {
}
})
.then(resp => {
console.log("大爷",resp);
console.log("大爷", resp);
if (resp.status === 200) {
return resp.json();
} else {
... ... @@ -135,12 +139,19 @@ export default class ArticleTemplate extends Component {
) : null}
{item.image ? (
<Image
style={{width: item.width,height: item.height,alignSelf: "center",marginBottom: 20}}
style={{
width: item.width,
height: item.height,
alignSelf: "center",
marginBottom: 20
}}
resizeMode="contain"
source={{ uri: item.image }}
/>
) : null}
<Text style={styles.paragraphContent}>{" "+item.content}</Text>
<Text style={styles.paragraphContent}>
{" " + item.content}
</Text>
</View>
);
})}
... ... @@ -194,7 +205,7 @@ const styles = StyleSheet.create({
fontSize: 15,
marginBottom: 15,
lineHeight: 28,
textAlign: "center",
textAlign: "center"
// backgroundColor: "red",
},
paragraphImage: {
... ... @@ -206,7 +217,7 @@ const styles = StyleSheet.create({
paragraphContent: {
color: "#555555",
fontSize: 15,
lineHeight: 25,
lineHeight: 25
// backgroundColor: "yellow",
}
});
... ...
... ... @@ -259,7 +259,7 @@ export default class Home extends Component {
<TouchableOpacity
style={styles.itemContainer}
onPress={() =>
navigate("ArticleTemplate", { item: item, model: "topic" })}
navigate("ArticleTemplate", { item: item, model: "topic",type: "home" })}
>
<View style={styles.itemImgWrapper}>
<Image
... ...
... ... @@ -71,7 +71,7 @@ export default class InsuranceChurch extends Component {
style={styles.itemContainer}
key={index}
onPress={() =>
navigate("ArticleTemplate", { item: item, model: "story" })}
navigate("ArticleTemplate", { item: item, model: "story",type: "church" })}
>
<Image
style={styles.itemImgWrapper}
... ...
... ... @@ -124,14 +124,14 @@ export default class Discover extends Component {
/>
<Text style={styles.btnText}>复制文案</Text>
</TouchableOpacity>
<TouchableOpacity
{/* <TouchableOpacity
style={styles.shareContaier}
onPress={() => {
this.ShareSomething();
}}
>
<Text style={styles.shareText}>分享</Text>
</TouchableOpacity>
</TouchableOpacity> */}
</Image>
);
}
... ...