罗广聪

OK

... ... @@ -11,7 +11,8 @@ import {
ListView,
Share,
TouchableOpacity,
AsyncStorage
AsyncStorage,
Alert
} from "react-native";
import { StackNavigator, TabNavigator } from "react-navigation";
import post from "../utils/fetch";
... ... @@ -56,6 +57,19 @@ export default class ArticleTemplate extends Component {
share() {
const that = this;
AsyncStorage.multiGet(["IS_LOGIN", "USER_ID"], (err, result) => {
if (err) {
console.error(err);
}
that.setState(
{
IS_LOGIN: result[0][1],
USER_ID: result[1][1] != null ? result[1][1] : ""
},
() => {
if (that.state.IS_LOGIN != "yes") {
Alert.alert("请先登录账号");
} else {
Share.share(
{
title: "保护神",
... ... @@ -63,17 +77,25 @@ export default class ArticleTemplate extends Component {
url:
that.state.type == "home"
? `https://devpay.brae.co/insurance.html?uid=${this.state
.USER_ID}&tid=${this.state.id}`
.USER_ID}&tid=${that.state.id}`
: `https://devpay.brae.co/insurance.html?uid=${this.state
.USER_ID}&sid=${this.state.id}`
.USER_ID}&sid=${that.state.id}`
},
{
excludedActivityTypes: ["com.apple.UIKit.activity.PostToTwitter"],
excludedActivityTypes: [
"com.apple.UIKit.activity.PostToTwitter"
],
tintColor: "green"
}
)
.then(that._showResult)
.catch(error => this.setState({ result: "error: " + error.message }));
.catch(error =>
this.setState({ result: "error: " + error.message })
);
}
}
);
});
}
getAsyncStorage() {
... ...