Commit 6e3e048f authored by 张释方's avatar 张释方

修改开通vip点击事件

parent eb1a045a
......@@ -2,7 +2,6 @@ package com.mints.street.main.my
import android.annotation.SuppressLint
import android.app.Dialog
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.text.TextUtils
......@@ -22,21 +21,15 @@ import com.mints.street.bean.PaymentBean
import com.mints.street.bean.VipBean
import com.mints.street.bean.WxPayParamBean
import com.mints.street.databinding.ActivityOpenvipBinding
import com.mints.street.main.MainActivity
import com.mints.street.manager.UserManager
import com.mints.street.utils.json.JsonUtil
import com.mints.street.widget.dialog.DialogListener
import com.mints.street.widget.dialog.DialogUtils
import com.mints.street.widget.dialog.WxLoginDialog
import kotlinx.android.synthetic.main.activity_openvip.*
import kotlinx.android.synthetic.main.activity_openvip.bt_try
import kotlinx.android.synthetic.main.fragment_my.*
import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.AppUtils
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.ToastUtils
import me.goldze.mvvmhabit.utils.systembar.StatusBarUtil
class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>(), View.OnClickListener {
......@@ -81,7 +74,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
ly_weixin.setOnClickListener(this)
ly_alipay.setOnClickListener(this)
loginDialog.setListener(object:WxLoginDialog.WxLoginListener{
loginDialog.setListener(object : WxLoginDialog.WxLoginListener {
override fun loginSuc(wxInfo: String) {
viewModel.wechatlogin(wxInfo)
}
......@@ -113,6 +106,13 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
list.add(page5)
list.add(page8)
// page1.setOnClickListener {
// if (UserManager.INSTANCE.userIsLogin()) {
// payVip()
// } else {
// loginDialog.show()
// }
// }
//设置显示的数据
cfp_data_viewpager.setViewList(list)
......@@ -165,6 +165,17 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
mAdapter = DelegateAdapter(vLayout, false)
binding.listview.adapter = mAdapter
binding.listview.layoutManager = vLayout
}
//添加page点击时间
fun pageOnClick(view: View?) {
if (UserManager.INSTANCE.userIsLogin()) {
payVip()
} else {
loginDialog.show()
}
}
override fun initViewObservable() {
......@@ -191,7 +202,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}
})
viewModel.isPaySuc.observe(this, Observer<Boolean> {
if(it){
if (it) {
finish()
}
})
......@@ -217,6 +228,13 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
}
})
viewModel.isloginSuc.observe(this, Observer {
if (it) {
payVip()
} else {
ToastUtils.showLong("登录失败")
}
})
}
......@@ -359,7 +377,7 @@ class OpenvipActivity : BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
override fun onResume() {
super.onResume()
KLog.e("OpenvipActivity","onResume")
KLog.e("OpenvipActivity", "onResume")
// if(userManager.userIsLogin()&&userManager.getVipFlag()){
// finish()
// }
......
......@@ -110,6 +110,7 @@ class OpenvipViewModel(application: Application) : BaseViewModel(application) {
)
}
var isloginSuc: MutableLiveData<Boolean> = MutableLiveData()
fun wechatlogin(wxInfo: String) {
val vo = HashMap<String, Any>()
vo["wxInfo"] = wxInfo
......@@ -125,11 +126,13 @@ class OpenvipViewModel(application: Application) : BaseViewModel(application) {
KLog.e("wechatlogin","微信登录接口成功")
ToastUtils.showLong("登录成功")
isloginSuc.value=true
}
override fun onError(e: Throwable) {
super.onError(e)
KLog.e("wechatlogin", "微信登录接口失败")
isloginSuc.value=false
}
})
}
......
......@@ -5,6 +5,7 @@
android:background="@mipmap/icon_card"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:onClick="pageOnClick">
</RelativeLayout>
\ No newline at end of file
......@@ -5,7 +5,8 @@
android:background="@mipmap/icon_card1"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:onClick="pageOnClick">
</RelativeLayout>
\ No newline at end of file
......@@ -5,5 +5,6 @@
android:background="@mipmap/icon_card2"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:onClick="pageOnClick">
</RelativeLayout>
\ No newline at end of file
......@@ -5,5 +5,6 @@
android:background="@mipmap/icon_card3"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:onClick="pageOnClick">
</RelativeLayout>
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:background="@mipmap/icon_card4"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:onClick="pageOnClick">
</RelativeLayout>
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:background="@mipmap/icon_card5"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:onClick="pageOnClick">
</RelativeLayout>
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:background="@mipmap/icon_card6"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:onClick="pageOnClick">
</RelativeLayout>
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:background="@mipmap/icon_card7"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingTop="20dp">
android:paddingTop="20dp"
android:onClick="pageOnClick">
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment