|
@@ -27,6 +27,7 @@ import com.yingyangfly.baselib.widget.BottomAlignedSpinner
|
|
|
import kotlinx.android.synthetic.main.dialog_early_screening.spinner
|
|
|
import java.io.UnsupportedEncodingException
|
|
|
import java.net.URLEncoder
|
|
|
+import java.util.regex.Pattern
|
|
|
|
|
|
|
|
|
class EarlyScreeningDialog: DialogFragment() {
|
|
@@ -128,32 +129,36 @@ class EarlyScreeningDialog: DialogFragment() {
|
|
|
if (goMaiUsername?.text.toString().trim().isEmpty()) {
|
|
|
"请输入手机号".toast()
|
|
|
} else {
|
|
|
- if (selectHospital == null || selectHospital?.id == "-1") {
|
|
|
- "请选择医院".toast()
|
|
|
+ if (Pattern.matches("^\\d{11}$", goMaiUsername?.text.toString().trim()).not()) {
|
|
|
+ "请输入正确的手机号".toast()
|
|
|
}else {
|
|
|
- var mobile = goMaiUsername?.text.toString().trim()
|
|
|
- val base64Encoded = if (mobile.isNotEmpty()) {
|
|
|
- // 使用 Android 内置的 Base64 类进行编码
|
|
|
- Base64.encodeToString(mobile.toByteArray(Charsets.UTF_8), Base64.NO_WRAP)
|
|
|
- } else {
|
|
|
- "" // 处理空字符串情况
|
|
|
+ if (selectHospital == null || selectHospital?.id == "-1") {
|
|
|
+ "请选择医院".toast()
|
|
|
+ }else {
|
|
|
+ var mobile = goMaiUsername?.text.toString().trim()
|
|
|
+ val base64Encoded = if (mobile.isNotEmpty()) {
|
|
|
+ // 使用 Android 内置的 Base64 类进行编码
|
|
|
+ Base64.encodeToString(mobile.toByteArray(Charsets.UTF_8), Base64.NO_WRAP)
|
|
|
+ } else {
|
|
|
+ "" // 处理空字符串情况
|
|
|
+ }
|
|
|
+ val id: String = (selectHospital as Hospital).id
|
|
|
+ val orgName: String = (selectHospital as Hospital).orgName
|
|
|
+ val rawString = "view=android&phone=${base64Encoded}"+"&hospitalId="+id+"&hospitalName="+orgName
|
|
|
+ val encodedString = try {
|
|
|
+ URLEncoder.encode(rawString, "UTF-8")
|
|
|
+ } catch (e: UnsupportedEncodingException) {
|
|
|
+ e.printStackTrace()
|
|
|
+ ""
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(url).not()) {
|
|
|
+ var usl1 = url+"?"+ encodedString
|
|
|
+ JumpUtil.jumpActivityWithUrl(
|
|
|
+ RouterUrlCommon.WEB_VIEW_INTERACTION_JS, usl1, requireContext()
|
|
|
+ )
|
|
|
+ }
|
|
|
+ dismiss()
|
|
|
}
|
|
|
- val id: String = (selectHospital as Hospital).id
|
|
|
- val orgName: String = (selectHospital as Hospital).orgName
|
|
|
- val rawString = "view=android&phone=${base64Encoded}"+"&hospitalId="+id+"&hospitalName="+orgName
|
|
|
- val encodedString = try {
|
|
|
- URLEncoder.encode(rawString, "UTF-8")
|
|
|
- } catch (e: UnsupportedEncodingException) {
|
|
|
- e.printStackTrace()
|
|
|
- ""
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(url).not()) {
|
|
|
- var usl1 = url+"?"+ encodedString
|
|
|
- JumpUtil.jumpActivityWith(
|
|
|
- RouterUrlCommon.WEB_VIEW_INTERACTION_JS,true, usl1, requireContext()
|
|
|
- )
|
|
|
- }
|
|
|
- dismiss()
|
|
|
}
|
|
|
}
|
|
|
}
|