中建365

develop
wlh 2 years ago
parent 9d31c548f3
commit 8dfa64ec75

@ -36,8 +36,8 @@ android {
OPPO_APPID : "OP-30804697", // OPPOappid OPPO_APPID : "OP-30804697", // OPPOappid
OPPO_APPSECRET: "OP-2ea09012e6a746dfbc503877916ba342",//OPPOappsecret OPPO_APPSECRET: "OP-2ea09012e6a746dfbc503877916ba342",//OPPOappsecret
XIAOMI_APPKEY : "MI-5232015762943",// appkey XIAOMI_APPKEY : "MI-5992028541716",// appkey
XIAOMI_APPID : "MI-2882303761520157943", // appid XIAOMI_APPID : "MI-2882303761520285716", // appid
VIVO_APPKEY:"8e9bb7cc764a56a6862e97ef99c03a61", VIVO_APPKEY:"8e9bb7cc764a56a6862e97ef99c03a61",
VIVO_APPID:"105558697", VIVO_APPID:"105558697",

@ -161,6 +161,10 @@
android:name=".activity.DeviceChoiceAct" android:name=".activity.DeviceChoiceAct"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity android:name=".activity.MessageDetailNewAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity <activity
android:name="com.zj365.mime.act.SettingNewAct" android:name="com.zj365.mime.act.SettingNewAct"
android:launchMode="singleTop" android:launchMode="singleTop"

@ -0,0 +1,28 @@
package com.zj365.dc.activity
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseVmAct
import com.xty.base.vm.BaseVm
import com.xty.common.arouter.ARouterUrl
import com.zj365.dc.databinding.ActMessageDetailNewBinding
@Route(path = ARouterUrl.MESSAGE_DETAIL_NEW)
class MessageDetailNewAct: BaseVmAct<BaseVm>() {
val binding by lazy { ActMessageDetailNewBinding.inflate(layoutInflater) }
override fun liveObserver() {
}
override fun setLayout() = binding.root
override fun initView() {
super.initView()
statusBar(binding.title.mView)
binding.title.mTvTitle.text= "消息详情"
binding.title.mIvBack.setOnClickListener {
finish()
}
}
}

@ -101,16 +101,16 @@ class WelcomeAct : BaseVmAct<WelcomeVm>() {
getBgImage(getImageUrl(MMkvHelper.getString(Const.WELCOME_BG))) getBgImage(getImageUrl(MMkvHelper.getString(Const.WELCOME_BG)))
} else if (MMkvHelper.contains(Const.WELCOME_IMG) && } else if (MMkvHelper.contains(Const.WELCOME_IMG) &&
MMkvHelper.contains(Const.WELCOME_DESC)) {//欢迎语和logo都存在 MMkvHelper.contains(Const.WELCOME_DESC)) {//欢迎语和logo都存在
binding.mBg.setImageResource(R.mipmap.ic_welcome_bg) // binding.mBg.setImageResource(R.mipmap.ic_welcome_bg)
binding.mTxt.text = MMkvHelper.getString(Const.WELCOME_DESC) binding.mTxt.text = MMkvHelper.getString(Const.WELCOME_DESC)
getLogoImage(getImageUrl(MMkvHelper.getString(Const.WELCOME_IMG))) getLogoImage(getImageUrl(MMkvHelper.getString(Const.WELCOME_IMG)))
binding.mLinInfo.visibility = View.VISIBLE binding.mLinInfo.visibility = View.VISIBLE
} else if (MMkvHelper.contains(Const.WELCOME_DESC)) {//只有欢迎语 } else if (MMkvHelper.contains(Const.WELCOME_DESC)) {//只有欢迎语
binding.mBg.setImageResource(R.mipmap.ic_welcome_bg) // binding.mBg.setImageResource(R.mipmap.ic_welcome_bg)
binding.mTxt.text = MMkvHelper.getString(Const.WELCOME_DESC) binding.mTxt.text = MMkvHelper.getString(Const.WELCOME_DESC)
binding.mLinInfo.visibility = View.VISIBLE binding.mLinInfo.visibility = View.VISIBLE
} else if (MMkvHelper.contains(Const.WELCOME_IMG)) {//只有logo存在 } else if (MMkvHelper.contains(Const.WELCOME_IMG)) {//只有logo存在
binding.mBg.setImageResource(R.mipmap.ic_welcome_bg) // binding.mBg.setImageResource(R.mipmap.ic_welcome_bg)
getLogoImage(getImageUrl(MMkvHelper.getString(Const.WELCOME_IMG))) getLogoImage(getImageUrl(MMkvHelper.getString(Const.WELCOME_IMG)))
binding.mLinInfo.visibility = View.VISIBLE binding.mLinInfo.visibility = View.VISIBLE
} else {//上述都无信息,则展示默认欢迎界面 } else {//上述都无信息,则展示默认欢迎界面

@ -3,7 +3,10 @@ package com.zj365.dc.fragment
import android.graphics.Color import android.graphics.Color
import android.view.View import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.fragment.BaseFragList import com.xty.base.fragment.BaseFragList
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.event.LoginOrRegisterEvent import com.xty.common.event.LoginOrRegisterEvent
import com.xty.common.event.LoginOutEvent import com.xty.common.event.LoginOutEvent
import com.zj365.dc.adapter.HomeMessageAdapter import com.zj365.dc.adapter.HomeMessageAdapter
@ -20,6 +23,9 @@ class MessageFragment : BaseFragList<MessageVm>() {
override fun initAdapter() { override fun initAdapter() {
binding.mRecycle.layoutManager= LinearLayoutManager(requireContext()) binding.mRecycle.layoutManager= LinearLayoutManager(requireContext())
binding.mRecycle.adapter=adapter binding.mRecycle.adapter=adapter
adapter.setOnItemClickListener { adapter, view, position ->
RouteManager.goAct(ARouterUrl.MESSAGE_DETAIL_NEW)
}
} }
override fun initView() { override fun initView() {

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/col_6f7">
<include layout="@layout/title_white_bar"
android:id="@+id/title"/>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white"
android:paddingTop="@dimen/dp_27"
android:paddingLeft="@dimen/dp_17"
android:paddingRight="@dimen/dp_17"
android:paddingBottom="@dimen/dp_42">
<TextView
android:id="@+id/tv_msg_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_17"
android:textColor="@color/col_313"
android:textStyle="bold"
tools:text="系统消息"/>
<TextView
android:id="@+id/tv_msg_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/sp_13"
android:textColor="@color/col_c7c"
tools:text="2022-03-24 15:04"
android:layout_marginTop="@dimen/dp_9"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/col_c7c"
android:textSize="@dimen/sp_13"
android:layout_marginTop="@dimen/dp_20"
android:id="@+id/tv_msg_content"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

@ -10,6 +10,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:background="@color/white"
tools:src="@mipmap/ic_welcome_main_bg" /> tools:src="@mipmap/ic_welcome_main_bg" />
<LinearLayout <LinearLayout

@ -8,11 +8,11 @@
android:id="@+id/root" android:id="@+id/root"
tools:ignore="MissingDefaultResource"> tools:ignore="MissingDefaultResource">
<ImageView <de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/img_top" android:id="@+id/img_top"
android:layout_width="@dimen/dp_45" android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45" android:layout_height="@dimen/dp_45"
android:background="@mipmap/icon_daily_benefit"/> tools:background="@mipmap/icon_daily_benefit"/>
<TextView <TextView
android:id="@+id/tv_top_name" android:id="@+id/tv_top_name"

@ -18,6 +18,7 @@ class ARouterUrl {
const val DIET_MANAGEMENT = "/com/zj365/dc/activity/DietManagementAct" const val DIET_MANAGEMENT = "/com/zj365/dc/activity/DietManagementAct"
const val CALORIE_ANALYZE = "/com/zj365/dc/activity/CalorieAnalyzeAct" const val CALORIE_ANALYZE = "/com/zj365/dc/activity/CalorieAnalyzeAct"
const val RECOGNIZE_RESULT = "/com/zj365/dc/activity/RecognizeResultAct" const val RECOGNIZE_RESULT = "/com/zj365/dc/activity/RecognizeResultAct"
const val MESSAGE_DETAIL_NEW = "/com/zj365/dc/activity/MessageDetailNewAct"
// const val FAMILY_INFO="/com/zj365/dc/act/FamilyMainAct" // const val FAMILY_INFO="/com/zj365/dc/act/FamilyMainAct"
@ -118,6 +119,9 @@ class ARouterUrl {
const val TONGUE_ORDER_LIST_ACTIVITY = "/health/com/zj365/health/act/tonguediagnosis/TongueOrderListActivity" const val TONGUE_ORDER_LIST_ACTIVITY = "/health/com/zj365/health/act/tonguediagnosis/TongueOrderListActivity"
const val TONGUE_DETAIL_ACTIVITY = "/health/com/zj365/health/act/tonguediagnosis/TongueDetailActivity" const val TONGUE_DETAIL_ACTIVITY = "/health/com/zj365/health/act/tonguediagnosis/TongueDetailActivity"
//AI 测肤
const val AI_SKIN_MEASUREMENT_ACTIVITY = "/health/com/zj365/health/act/skin/SkinMeasurementMainAct"
//设备绑定相关 //设备绑定相关
const val XUEYAJI_BIND_LIST = "/health/com/zj365/health/act/XueyaDeviceBindListAct" const val XUEYAJI_BIND_LIST = "/health/com/zj365/health/act/XueyaDeviceBindListAct"
const val XUEYAJI_BIND = "/health/com/zj365/health/act/XueyaDeviceBindAct" const val XUEYAJI_BIND = "/health/com/zj365/health/act/XueyaDeviceBindAct"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 52 KiB

@ -235,6 +235,9 @@
<activity android:name=".act.ComparePageDataAct" <activity android:name=".act.ComparePageDataAct"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity android:name=".act.skin.SkinMeasurementMainAct"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>

@ -1,16 +1,262 @@
package com.zj365.health.act.skin package com.zj365.health.act.skin
import android.graphics.Color
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.tencent.mm.opensdk.modelbase.BaseResp
import com.tencent.mm.opensdk.modelpay.PayReq
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.xty.base.act.BaseVmAct import com.xty.base.act.BaseVmAct
import com.xty.common.BuildConfig
import com.xty.common.LogUtils
import com.xty.common.arouter.ARouterUrl
import com.xty.common.arouter.RouteManager
import com.xty.common.event.WxPayEvent
import com.xty.common.util.SpannableUtils
import com.xty.network.model.PayGoodsBean
import com.xty.network.model.WeixinPayBean
import com.zj365.health.R
import com.zj365.health.databinding.ActAiSkinMeasurementBinding import com.zj365.health.databinding.ActAiSkinMeasurementBinding
import com.zj365.health.model.PayResult
import com.zj365.health.vm.SkinMeasurementVm
import com.zj365.health.vm.TongueDiagnosisVm import com.zj365.health.vm.TongueDiagnosisVm
import com.zj365.health.weight.CancerDialog
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import retrofit2.http.Path
class SkinMeasurementMainAct : BaseVmAct<TongueDiagnosisVm>() { @Route(path = ARouterUrl.AI_SKIN_MEASUREMENT_ACTIVITY)
class SkinMeasurementMainAct : BaseVmAct<SkinMeasurementVm>() {
val binding by lazy { ActAiSkinMeasurementBinding.inflate(layoutInflater)} val binding by lazy { ActAiSkinMeasurementBinding.inflate(layoutInflater)}
var type = 0 //0 AI 测肤 1 AI 糖医
var isShowTip = false
var bottomSheetDialog: BottomSheetDialog? = null
lateinit var payGoodsBean: PayGoodsBean
val tipDialog by lazy {
CancerDialog(this, false, "温馨提示", {
bottomSheetDialog?.show()
}, {
bundle.clear()
RouteManager.goAct(ARouterUrl.TONGUE_ORDER_LIST_ACTIVITY, bundle)
})
}
override fun liveObserver() { override fun liveObserver() {
} }
override fun setLayout() = binding.root override fun setLayout() = binding.root
override fun initView() {
super.initView()
statusBar(binding.title.mView)
type = intent.getIntExtra("type",0)
if(type == 0){
binding.title.mTvTitle.text ="AI测肤"
binding.title.mTvRight.text ="测试记录"
binding.title.mTvRight.setTextColor(resources.getColor(R.color.col_02c))
binding.title.mTvRight.visibility = View.VISIBLE
}else{
binding.title.mTvTitle.text ="AI糖医"
}
binding.title.mTvRight.setOnClickListener {
}
binding.title.mIvBack.setOnClickListener {
finish()
}
binding.tvSubmit.setOnClickListener {
if (isShowTip) {
tipDialog.setContent("您的舌诊评估记录中,有存在未完成的记录确认需要再次购买吗?")
tipDialog?.show()
} else {
bottomSheetDialog?.show()
}
}
initBottomDialog()
mViewModel.getAIoods()
mViewModel.aiHasNoFinishOrder()
}
fun initBottomDialog() {
if (bottomSheetDialog == null) {
bottomSheetDialog = BottomSheetDialog(this,R.style.Theme_ChartDialogManager)
bottomSheetDialog?.let { dialog ->
val view = LayoutInflater.from(this).inflate(R.layout.bottom_cancer, null)
dialog.setContentView(view)
val tvprice = view.findViewById<TextView>(R.id.tvPrice)
tvprice.text = SpannableUtils.setSpanMoney(payGoodsBean.price!!)
val ivClose = view.findViewById<ImageView>(R.id.close_button)
ivClose.setOnClickListener {
dialog.dismiss()
}
val tvZhifubao = view.findViewById<TextView>(R.id.tv_gouxuan_zhifubao)
val tvWeixin = view.findViewById<TextView>(R.id.tv_gouxuan_weixin)
tvWeixin.isSelected = true
val tvDuihuanma = view.findViewById<TextView>(R.id.tv_gouxuan_duihuanma)
val llWeixin = view.findViewById<LinearLayout>(R.id.llWeixin)
val llZhifu = view.findViewById<LinearLayout>(R.id.llZhifu)
val tvZhifu = view.findViewById<TextView>(R.id.tvZhifu)
llZhifu.setOnClickListener {
tvZhifubao.isSelected = true
tvDuihuanma.isSelected = false
tvWeixin.isSelected = false
tvZhifu.text = "确认支付"
}
llWeixin.setOnClickListener {
tvZhifubao.isSelected = false
tvDuihuanma.isSelected = false
tvWeixin.isSelected = true
tvZhifu.text = "确认支付"
}
val llDuihuan = view.findViewById<LinearLayout>(R.id.llDuihuan)
llDuihuan.visibility = View.GONE
llDuihuan.setOnClickListener {
tvWeixin.isSelected = false
tvZhifubao.isSelected = false
tvDuihuanma.isSelected = true
tvZhifu.text = "去兑换"
}
tvZhifu.setOnClickListener {
//支付
if (tvZhifubao.isSelected) {
//支付宝
mViewModel.payTongueOrder(payGoodsBean.id.toString(), false)
} else {
//微信
mViewModel.payTongueOrder(payGoodsBean.id.toString(), true)
}
dialog.dismiss()
}
}
}
}
private val SDK_PAY_FLAG = 1
private val WEIXIN_PAY_FLAG = 2
/**
* 微信支付
*/
fun startWechatPay(wxModel: WeixinPayBean) {
LogUtils.i("startWechatPay")
val appId = wxModel.appId
val partnerId = wxModel.partnerid
val prepayId = wxModel.prepayId
val packageValue = wxModel.packageName
val nonceStr = wxModel.noncestr
val timeStamp = wxModel.timestamp
val sign = wxModel.sign
val api = WXAPIFactory.createWXAPI(this, BuildConfig.appid)
api.registerApp(appId)
//以下这些都应该从服务器去获取
val payRequest = PayReq()
payRequest.appId = appId//你的微信appid
payRequest.partnerId = partnerId//微信支付分配的商户号
payRequest.prepayId = prepayId//微信返回的支付交易会话ID
payRequest.packageValue = packageValue//固定值
payRequest.nonceStr = nonceStr//随机字符串
payRequest.timeStamp = timeStamp//时间戳
payRequest.sign = sign//签名
//传入一个标识,以便区分回调
payRequest.extData = "AICancelPay"
//在支付之前如果应用没有注册到微信应该先调用IWXMsg.registerApp将应用注册到微信
//发起请求,调起微信前去支付
api.sendReq(payRequest);
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun getWxPayResult(event: WxPayEvent) {
val msg = mHandler.obtainMessage()
msg.what = WEIXIN_PAY_FLAG
msg.obj = event
mHandler.sendMessage(msg)
}
private val mHandler: Handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
when (msg.what) {
SDK_PAY_FLAG -> {
val payResult = PayResult(msg.obj as Map<String?, String?>)
/**
* 对于支付结果请商户依赖服务端的异步通知结果同步通知结果仅作为支付结束的通知
*/
val resultInfo: String = payResult.getResult() // 同步返回需要验证的信息
val resultStatus: String = payResult.getResultStatus()
// 判断resultStatus 为9000则代表支付成功
if (TextUtils.equals(resultStatus, "9000")) {
// 该笔订单是否真实支付成功,需要依赖服务端的异步通知。
// Toast.makeText(this@PreventCancertAct,"支付成功"+payResult,Toast.LENGTH_SHORT).show()
// com.alipay.sdk.pay.demo.PayDemoActivity.showAlert(
// this@PayDemoActivity,
// getString(R.string.pay_success) + payResult
// )
bundle.clear()
bundle.putString("orderNo", mViewModel.payObservable.value?.data?.orderNo)
bundle.putString("orderType", payGoodsBean.goodsType.toString())
RouteManager.goAct(ARouterUrl.PAY_SUCCESS, bundle)
} else {
Toast.makeText(this@SkinMeasurementMainAct, "支付失败,请联系客服", Toast.LENGTH_SHORT)
.show()
// 该笔订单真实的支付结果,需要依赖服务端的异步通知。
// com.alipay.sdk.pay.demo.PayDemoActivity.showAlert(
// this@PayDemoActivity,
// getString(R.string.pay_failed) + payResult
// )
}
}
WEIXIN_PAY_FLAG -> {
val event = msg.obj as WxPayEvent
when (event.code) {
BaseResp.ErrCode.ERR_OK -> {
bundle.clear()
bundle.putString("orderNo", mViewModel.payObservable.value?.data?.orderNo)
bundle.putString("orderType", payGoodsBean.goodsType.toString())
RouteManager.goAct(ARouterUrl.PAY_SUCCESS, bundle)
}
BaseResp.ErrCode.ERR_USER_CANCEL -> {
}
else -> {
Toast.makeText(
this@SkinMeasurementMainAct,
"支付失败,请联系客服",
Toast.LENGTH_SHORT
).show()
}
}
}
}
}
}
} }

@ -0,0 +1,46 @@
package com.zj365.health.vm
import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.network.model.PayBean
import com.xty.network.model.PayGoodsBean
import com.xty.network.model.RespBody
import org.json.JSONObject
class SkinMeasurementVm: BaseVm() {
val payGoodsObservable by lazy { MutableLiveData<RespBody<PayGoodsBean>>() }
val payObservable by lazy { MutableLiveData<RespBody<PayBean>>() }
val haveOrder by lazy { MutableLiveData<RespBody<Boolean>>() }
fun getAIoods(){
startHttp {
apiInterface().getTongueGoods()
var response = apiInterface().getTongueGoods()
response.getCodeStatus(payGoodsObservable, nowData)
}
}
//获取有无未完成订单
fun aiHasNoFinishOrder() {
startHttp {
var json = JSONObject()
var response =
apiInterface().tongueHasNoFinishOrder(retrofits.getRequestBody(json.toString()))
response.getCodeStatus(haveOrder, nowData)
}
}
//获取支付信息
fun payTongueOrder(goodsId:String,isWeChatPay:Boolean){
startHttp {
var json = JSONObject()
json.put("goodsId",goodsId)
json.put("channelName", if (isWeChatPay) "WEIXIN_APP" else "ALIPAY_APP")
var response = apiInterface().payTongueOrder(retrofits.getRequestBody(json.toString()))
response.getCodeStatus(payObservable, nowData)
}
}
}

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
Loading…
Cancel
Save