| | |
| | | package com.moral.yunfushao.activity; |
| | | |
| | | import android.animation.ObjectAnimator; |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.support.annotation.Nullable; |
| | |
| | | import android.view.View; |
| | | import android.widget.Button; |
| | | import android.widget.EditText; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | |
| | | import com.lzy.okgo.cache.CacheMode; |
| | |
| | | import com.moral.yunfushao.httputils.HttpCallBack; |
| | | import com.moral.yunfushao.httputils.HttpUtils; |
| | | import com.moral.yunfushao.model.User; |
| | | import com.tencent.mm.opensdk.modelmsg.SendAuth; |
| | | import com.tencent.mm.opensdk.openapi.IWXAPI; |
| | | import com.tencent.mm.opensdk.openapi.WXAPIFactory; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | |
| | | public class LoginActivity extends BaseActivity { |
| | | private Button bt_sure, weixinlogin; |
| | | private Button bt_sure; |
| | | private ImageView weixinlogin; |
| | | private TextView tv_forget, tv_register; |
| | | private EditText et_phone, et_pwd; |
| | | private IWXAPI iwxapi; |
| | | private ObjectAnimator animator; |
| | | |
| | | @Override |
| | | protected void getBundleExtras(Bundle extras) { |
| | |
| | | protected void onCreate(@Nullable Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | StatusBarUtil.translucentStatusBar(LoginActivity.this); |
| | | regToWx(); |
| | | } |
| | | |
| | | private void regToWx() { |
| | | iwxapi = WXAPIFactory.createWXAPI(this, "app_id", true); |
| | | iwxapi.registerApp("app_id"); |
| | | } |
| | | |
| | | private void sendReq() { |
| | | //授权 |
| | | SendAuth.Req req = new SendAuth.Req(); |
| | | req.scope = "snsapi_userinfo"; |
| | | req.state = "wechat_sdk_demo_test"; |
| | | iwxapi.sendReq(req); |
| | | System.out.println("chenqi fasongcehngqo"); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void onStop() { |
| | | super.onStop(); |
| | | finish(); |
| | | } |
| | | |
| | | private void login(String tel, final String pwd) { |
| | | String url = API.LOGIN; |
| | | final String url = API.LOGIN; |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("phone", tel); |
| | | params.put("password", pwd); |
| | |
| | | User user = FastJsonTools.getJson(res, User.class); |
| | | if (user != null) { |
| | | MainApp.theApp.sharedPreferencesUtil.saveLoginInfo(user); |
| | | user.setLogin_type(1); |
| | | MainApp.theApp.userId = user.get_id(); |
| | | Intent intent = new Intent(getApplicationContext(), MainActivity.class); |
| | | Bundle bundle = new Bundle(); |