master
hua 4 years ago
parent 5a79705fa5
commit 8def448ca7
  1. 13
      Weibo/ContentView.swift
  2. 4
      Weibo/LoginView.swift

@ -17,23 +17,16 @@ struct ContentView: View {
@EnvironmentObject var user:User @EnvironmentObject var user:User
@State var selection=2 @State var selection=2
var body: some View { var body: some View {
TabView(selection: self.$selection) { TabView(selection: self.$selection) {
if self.user.access_token==nil{ if (self.user.access_token != nil){
IndexView().tabItem { VStack { IndexView().tabItem { VStack {
Image("house") Image("house")
Text("首页") Text("首页")
.foregroundColor(Color.black) .foregroundColor(Color.black)
} }.tag(1).hidden() } }.tag(1)
}else{
IndexView().tabItem { VStack {
Image("house")
Text("首页")
.foregroundColor(Color.black)
} }.tag(1)
} }
LoginView().tabItem { VStack { LoginView().tabItem { VStack {

@ -86,12 +86,12 @@ struct UserView:View {
var body:some View{ var body:some View{
VStack { VStack {
HStack { HStack {
ImageView(imageUrl: self.user.avatar_hd!) ImageView(imageUrl: self.user.avatar_hd ?? "")
.frame(width: 60.0, height: 60.0) .frame(width: 60.0, height: 60.0)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/) .clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
VStack { VStack {
Text(self.user.name!) Text(self.user.name!)
Text("简介:\(self.user.desc!)") Text("简介:\(self.user.desc ?? "")")
} }
Spacer() Spacer()
Button(action: { Button(action: {

Loading…
Cancel
Save