| | |
| | | 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; |
| | | private Button bt_sure, weixinlogin; |
| | | private TextView tv_forget,tv_register; |
| | | private EditText et_phone, et_pwd; |
| | | private IWXAPI iwxapi; |
| | | |
| | | @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 int getLayoutId() { |
| | |
| | | tv_register = findView(R.id.tv_register); |
| | | et_phone = findView(R.id.et_phone); |
| | | et_pwd = findView(R.id.et_pwd); |
| | | weixinlogin = findView(R.id.weixinlogin); |
| | | // et_phone.setText("18362724160"); |
| | | // et_pwd.setText("123456"); |
| | | } |
| | |
| | | Intent intentRgister = new Intent(LoginActivity.this,RegisterActivity.class); |
| | | startActivity(intentRgister); |
| | | break; |
| | | case R.id.weixinlogin: |
| | | weixinlogin(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | private void weixinlogin() { |
| | | sendReq(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onErrorPageClick() { |
| | | |