作者 Liming

微信绑定

<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
... ...
... ... @@ -29,6 +29,8 @@
</value>
</option>
</component>
=======
>>>>>>> liming
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
</list>
</value>
</option>
</component>
=======
>>>>>>> liming
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitSharedSettings">
<option name="FORCE_PUSH_PROHIBITED_PATTERNS">
<list>
<option value="liming" />
</list>
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
... ...
... ... @@ -2,6 +2,7 @@ package com.hh.xuetubao;
import com.hh.xuetubao.bean.AddressBean;
import com.hh.xuetubao.bean.AnswerBean;
import com.hh.xuetubao.bean.BdPhoneBean;
import com.hh.xuetubao.bean.CertListBean;
import com.hh.xuetubao.bean.ChapterLstBean;
import com.hh.xuetubao.bean.CompanyBean;
... ... @@ -25,6 +26,8 @@ import com.hh.xuetubao.bean.UserBean;
import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
... ... @@ -147,6 +150,22 @@ public interface MyServer {
Observable<UserBean> mobileLogin(@Query("mobileNumber") String mobileNumber, @Query("verCode") String verCode);
/**
<<<<<<< HEAD
=======
* 微信绑定手机
*
* @param OpenId
* @param phone
* @param verCode
* @return
*/
@FormUrlEncoded
@POST("SaveWxBinding")
Observable<BdPhoneBean> bd_phone(@Field("wxOpenId") String OpenId, @Field("mobileNumber") String phone, @Field("verCode") String verCode);
/**
>>>>>>> liming
* 微信登录接口
*
* @param wxOpenId 微信用户的OpenId
... ...
package com.hh.xuetubao.activity.login;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.hh.xuetubao.R;
import com.hh.xuetubao.bean.UserBean;
import com.hh.xuetubao.model.AccountModel;
import com.hh.xuetubao.mvp.BaseMvpActivity;
import com.hh.xuetubao.mvp.CommonPresenter;
import com.hh.xuetubao.mvp.ICommonView;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class BdsjActivity extends BaseMvpActivity<CommonPresenter, AccountModel> implements ICommonView {
@BindView(R.id.ed_phone)
EditText edPhone;
@BindView(R.id.ed_code)
EditText edCode;
@BindView(R.id.tv_yanzheng)
TextView tvYanzheng;
@BindView(R.id.bdsj_sure)
TextView bdsjSure;
@BindView(R.id.bdsj_fhdl)
TextView bdsjFhdl;
private CountDownTimer timer;
private int time = 60;
@Override
public void initView() {
}
@Override
public int initLayout() {
return R.layout.activity_bdsj;
}
@Override
public void initData() {
}
@Override
public CommonPresenter getPresenter() {
return new CommonPresenter();
}
@Override
public AccountModel getModel() {
return new AccountModel();
}
@Override
public void getData(Object o, int api, int intent) {
switch (intent) {
case 1: // 验证码
UserBean bean = (UserBean) o;
if (bean.getSuccess()) {
Toast.makeText(this, "验证码发送成功", Toast.LENGTH_LONG).show();
timer = new CountDownTimer(60000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
time--;
try {
tvYanzheng.setText(String.valueOf(time) + "s");
tvYanzheng.setFocusable(false);
} catch (Exception e) {
Log.e("zhangtao", e.toString());
}
}
@Override
public void onFinish() {
tvYanzheng.setText("获取验证码");
tvYanzheng.setFocusable(true);
time = 60;
}
}.start();
} else {
Toast.makeText(this, "验证码发送失败", Toast.LENGTH_LONG).show();
}
break;
case 3: // 绑定
break;
}
}
@Override
public void onComplete(int api) {
}
@Override
public void onError(Throwable e, int api) {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
}
@OnClick({R.id.tv_yanzheng, R.id.bdsj_sure, R.id.bdsj_fhdl})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_yanzheng: // - > 验证码
if (isCellphone(edPhone.getText().toString()))
mPresenter.getPresenter(1, 1, edPhone.getText().toString(), String.valueOf(1)); // 1 -> 微信或手机号码绑定时发送
else
Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
break;
case R.id.bdsj_sure: // - > 确定
if (isCellphone(edPhone.getText().toString())) {
Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
return;
} else if (edPhone.getText().length() > 0 && edCode.getText().length() > 0) {
Toast.makeText(this, "手机号和验证码不可为空", Toast.LENGTH_LONG).show();
return;
} else {
mPresenter.getPresenter(1, 3, edPhone.getText().toString().trim(), edCode.getText().toString().trim()); // - > 绑定
}
break;
case R.id.bdsj_fhdl: // - > 返回登录
this.finish();
break;
}
}
public static boolean isCellphone(String str) {
Pattern pattern = Pattern.compile("^((13[0-9])|(14[5,7,9])|(15[^4])|(18[0-9])|(17[0,1,3,5,6,7,8]))\\d{8}$");
Matcher matcher = pattern.matcher(str);
return matcher.matches();
}
}
... ...
... ... @@ -4,6 +4,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
... ... @@ -30,7 +31,6 @@ import butterknife.ButterKnife;
*/
public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel> implements ICommonView, View.OnClickListener {
@BindView(R.id.login)
TextView login;
@BindView(R.id.ed_phone)
... ... @@ -96,6 +96,12 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
tvYanzheng.setFocusable(false);
tvYanzheng.setFocusableInTouchMode(false);
tvYanzheng.setClickable(false);
try {
tvYanzheng.setText(String.valueOf(time) + "s");
tvYanzheng.setFocusable(false);
} catch (Exception e) {
Log.e("zhangtao", e.toString());
}
}
@Override
... ... @@ -104,6 +110,7 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
tvYanzheng.setFocusable(true);
tvYanzheng.setFocusableInTouchMode(true);
tvYanzheng.setClickable(true);
time = 60;
}
}.start();
} else {
... ... @@ -120,6 +127,7 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
this.finish();
} else {
Toast.makeText(this, bean.getErrorMsg(), Toast.LENGTH_LONG).show();
Toast.makeText(this, "登录失败", Toast.LENGTH_LONG).show();
}
}
... ... @@ -151,8 +159,9 @@ public class LoginActivity extends BaseMvpActivity<CommonPresenter, AccountModel
else
Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
break;
case R.id.tv_yanzheng:
if (isCellphone(edPhone.getText().toString()) && !TextUtils.isEmpty(edPhone.getText().toString()))
if (isCellphone(edPhone.getText().toString()))
mPresenter.getPresenter(1, 1, edPhone.getText().toString(), String.valueOf(0));
else
Toast.makeText(this, "请输入正确的手机号码", Toast.LENGTH_LONG).show();
... ...
package com.hh.xuetubao.bean;
public class BdPhoneBean {
/**
* IsSuccess : true
* AccountOid : 16EA2C01-20E3-420D-AB4E-4E44F0539349
*/
private boolean IsSuccess;
private String AccountOid;
public boolean isIsSuccess() {
return IsSuccess;
}
public void setIsSuccess(boolean IsSuccess) {
this.IsSuccess = IsSuccess;
}
public String getAccountOid() {
return AccountOid;
}
public void setAccountOid(String AccountOid) {
this.AccountOid = AccountOid;
}
}
... ...
... ... @@ -202,6 +202,10 @@ public class HomeFragment extends BaseMvpFragment<CommonPresenter, LearnModel> i
transaction.replace(R.id.frame, fragment);
transaction.commit();*/
startActivity(new Intent(getActivity(),StudyActivity.class));
CourseFragment fragment = new CourseFragment();
FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.frame, fragment);
transaction.commit();
break;
case R.id.tv_more_qiye:
startActivity(new Intent(getActivity(), CompanyActivity.class));
... ...
... ... @@ -27,6 +27,23 @@ public class AccountModel implements ICommonModel {
}
/* 获取验证码 */
private void sendValidateCode(final ICommonView commonView, final int api, final int intent, String... params) {
if (api == 1 && intent == 1)
mServers.sendValidateCode(params[0], Integer.valueOf(params[1]))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BaseObsever() {
@Override
public void onNext(Object value) {
super.onNext(value);
commonView.getData(value, api, intent);
}
});
}
/* 手机号登录 */
private void mobileLogin(final ICommonView commonView, final int api, final int intent, String... params) {
if (api == 1 && intent == 2)
mServers.mobileLogin(params[0], params[1])
... ... @@ -42,18 +59,20 @@ public class AccountModel implements ICommonModel {
});
}
private void sendValidateCode(final ICommonView commonView, final int api, final int intent, String... params) {
if (api == 1 && intent == 1)
mServers.sendValidateCode(params[0], Integer.valueOf(params[1]))
private void bd_phone(final ICommonView commonView, final int api, final int tag, String... params) {
if (api == 1 && tag == 2) {
mServers.bd_phone(params[0], params[1], params[2])
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BaseObsever() {
@Override
public void onNext(Object value) {
super.onNext(value);
commonView.getData(value, api, intent);
commonView.getData(value, api, tag);
}
});
}
}
}
... ...
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_25" />
<solid android:color="@color/color_dddddd" />
</shape>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/tv_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_60"
android:text="绑定手机号"
android:textColor="#232323"
android:textSize="17sp" />
<ImageView
android:id="@+id/img_phone"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_18"
android:layout_below="@+id/tv_login"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_50"
android:src="@mipmap/login_phone" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/img_phone"
android:layout_marginLeft="@dimen/dp_5"
android:layout_toRightOf="@+id/img_phone"
android:text="手机号"
android:textColor="#666666"
android:textSize="12sp" />
<!--<View-->
<!--android:layout_width="@dimen/dp_1"-->
<!--android:layout_height="@dimen/dp_15"-->
<!--android:background="@color/color_333333"-->
<!--android:layout_toRightOf="@+id/tv_phone"-->
<!--android:layout_alignTop="@+id/tv_phone"-->
<!--android:layout_marginLeft="@dimen/dp_10"-->
<!--/>-->
<EditText
android:id="@+id/ed_phone"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_18"
android:layout_alignBottom="@id/img_phone"
android:layout_marginLeft="@dimen/dp_15"
android:layout_toRightOf="@id/tv_phone"
android:background="@null"
android:hint="|请输入手机号"
android:textColorHint="#C7C7C7"
android:textSize="12sp" />
<View
android:id="@+id/line2"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_below="@id/img_phone"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_25"
android:background="#333333" />
<ImageView
android:id="@+id/img_message"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_18"
android:layout_below="@id/line2"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_35"
android:src="@mipmap/login_message" />
<TextView
android:id="@+id/tv_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/img_message"
android:layout_marginLeft="@dimen/dp_5"
android:layout_toRightOf="@+id/img_phone"
android:text="验证码"
android:textColor="#666666"
android:textSize="12sp" />
<EditText
android:id="@+id/ed_code"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_18"
android:layout_alignBottom="@id/img_message"
android:layout_marginLeft="@dimen/dp_15"
android:layout_toRightOf="@id/tv_message"
android:background="@null"
android:hint="请输入短信验证码"
android:textColorHint="#C7C7C7"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_yanzheng"
android:layout_width="@dimen/dp_75"
android:layout_height="@dimen/dp_25"
android:layout_alignBottom="@id/img_message"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/dp_25"
android:background="@drawable/login_circle"
android:gravity="center"
android:text="获取验证码"
android:textColor="#FFFFFF"
android:textSize="11sp" />
<View
android:id="@+id/ling2"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:layout_below="@+id/tv_yanzheng"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_25"
android:background="#D5D5D5" />
<TextView
android:id="@+id/bdsj_sure"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_below="@id/ling2"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_240"
android:layout_marginRight="@dimen/dp_25"
android:background="@drawable/circle_orange"
android:gravity="center"
android:text="确定"
android:textColor="#FFFFFF"
android:textSize="16sp" />
<TextView
android:id="@+id/bdsj_fhdl"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_below="@id/bdsj_sure"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_25"
android:background="@drawable/circle_grey_25"
android:gravity="center"
android:text="返回登录"
android:textColor="@color/color_6666666"
android:textSize="16sp" />
</RelativeLayout>
\ No newline at end of file
... ...
... ... @@ -71,7 +71,7 @@
android:layout_height="30dp"
android:layout_below="@+id/grid_hotLesson"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_20"
android:background="@drawable/stroke_gray"
android:gravity="center"
... ...
... ... @@ -338,7 +338,7 @@
android:layout_height="@dimen/dp_50"
android:layout_below="@+id/rl_toudi"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_60"
android:layout_marginRight="@dimen/dp_20"
android:background="@drawable/circle_bigconners_orange">
... ...
... ... @@ -20,4 +20,7 @@
<color name="color_575757">#575757</color>
<color name="color_333333">#333333</color>
<color name="color_e4e4e4">#E4E4E4</color>
<color name="color_232323">#232323</color>
<color name="color_6666666">#666666</color>
<color name="color_dddddd">#dddddd</color>
</resources>
... ...