Commit a50a6fe1 by 刘鹏

前置信息收集逻辑完善

parent 94c76795
...@@ -140,6 +140,16 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -140,6 +140,16 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
}, 500L) }, 500L)
} }
override fun showKeyboard() {
//显示输入框
cl_input.visibility = LinearLayout.VISIBLE
tv_problem.visibility = LinearLayout.GONE
hsv_problem_tips.visibility = LinearLayout.VISIBLE
et_input_problem.hint = "请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod(et_input_problem)
}
override fun hideOtherEdit() { override fun hideOtherEdit() {
//隐藏其他软键盘 //隐藏其他软键盘
et_input_problem.setText("") et_input_problem.setText("")
...@@ -185,6 +195,28 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -185,6 +195,28 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
showSkipDialog() showSkipDialog()
} }
tv_finish.setOnClickListener { tv_finish.setOnClickListener {
mType70RequestList.forEach {
instance.lingxiAnswerQuestion(JSON.toJSONString(it))
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe()
}
val answerQuestionType71RequestBean = AnswerQuestionType71RequestBean()
val dataBean = AnswerQuestionType71RequestBean.DataBean()
dataBean.answer = lastAnswer
answerQuestionType71RequestBean.data = dataBean
answerQuestionType71RequestBean.toUid= toUid
answerQuestionType71RequestBean.fromUid=ImIn.getUserInfo()?.uid
instance.lingxiAnswerQuestion(JSON.toJSONString(answerQuestionType71RequestBean))
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe()
Handler().postDelayed({
skipToIm()
}, 500L)
} }
...@@ -194,6 +226,18 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -194,6 +226,18 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
//最后一题 点击发送 //最后一题 点击发送
lastAnswer = et_input_problem.text.toString() lastAnswer = et_input_problem.text.toString()
tv_finish.visibility = View.VISIBLE tv_finish.visibility = View.VISIBLE
val questionMultiItem = QuestionMultiItem()
questionMultiItem.type2Text = lastAnswer
questionMultiItem.viewType = 2
mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged()
//滑动到底部
recycle.scrollToPosition(mData.size - 1)
mData.forEachIndexed { index, _ ->
mData[index].type5CanClick = false
}
} else { } else {
//答题过程中点击 其他的弹窗 //答题过程中点击 其他的弹窗
otherQuestionsBean?.let { it1 -> otherQuestionsBean?.let { it1 ->
...@@ -204,7 +248,6 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -204,7 +248,6 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
} }
} }
et_input_problem.setText("") et_input_problem.setText("")
hideInputMethod(et_input_problem) hideInputMethod(et_input_problem)
//隐藏输入框 //隐藏输入框
...@@ -440,6 +483,9 @@ class CmsExamQuestionPaperActivity : BaseActivity() { ...@@ -440,6 +483,9 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
val type70RequestBean = AnswerQuestionType70RequestBean() val type70RequestBean = AnswerQuestionType70RequestBean()
type70RequestBean.data = answerQuestionRequestBean type70RequestBean.data = answerQuestionRequestBean
type70RequestBean.fromUid=ImIn.getUserInfo()?.uid
type70RequestBean.toUid = toUid
//添加回答数据到 //添加回答数据到
mType70RequestList.add(type70RequestBean) mType70RequestList.add(type70RequestBean)
......
...@@ -103,8 +103,16 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem ...@@ -103,8 +103,16 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
type5_line.setVisibility(View.GONE); type5_line.setVisibility(View.GONE);
example.setVisibility(View.GONE); example.setVisibility(View.GONE);
} }
if (item.type5CanClick){
helper.getView(R.id.type5_parent).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOneCheckListener.showKeyboard();
}
});
helper.addOnClickListener(R.id.tv_notes); helper.addOnClickListener(R.id.tv_notes);
}
break; break;
default: default:
......
...@@ -22,6 +22,7 @@ public class QuestionMultiItem implements MultiItemEntity { ...@@ -22,6 +22,7 @@ public class QuestionMultiItem implements MultiItemEntity {
* type5 * type5
*/ */
public QuestionsBeanExample type5Bean; public QuestionsBeanExample type5Bean;
public boolean type5CanClick = true;
/***type5 展开or 收起*/ /***type5 展开or 收起*/
public boolean type5Open = true; public boolean type5Open = true;
......
...@@ -13,7 +13,10 @@ interface QuestionOneCheckListener { ...@@ -13,7 +13,10 @@ interface QuestionOneCheckListener {
* 展示其他 * 展示其他
*/ */
fun showOtherEdit(list: List<OptionsBean>, question: QuestionsBean) fun showOtherEdit(list: List<OptionsBean>, question: QuestionsBean)
/**
*展示软键盘
* */
fun showKeyboard()
/** /**
* 隐藏其他 * 隐藏其他
*/ */
......
...@@ -3,6 +3,7 @@ package com.yidianling.uikit.custom.http ...@@ -3,6 +3,7 @@ package com.yidianling.uikit.custom.http
import com.alibaba.fastjson.JSON import com.alibaba.fastjson.JSON
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.im.http.ImRetrofitApi
import com.yidianling.uikit.custom.http.response.* import com.yidianling.uikit.custom.http.response.*
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
import io.reactivex.Observable import io.reactivex.Observable
...@@ -157,4 +158,15 @@ class ServiceImpl private constructor() { ...@@ -157,4 +158,15 @@ class ServiceImpl private constructor() {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).answerQuestion(id, body) return YDLHttpUtils.obtainApi(ServiceApi::class.java).answerQuestion(id, body)
} }
/**
* 去聊天 回答问题
*/
fun lingxiAnswerQuestion(params: String): Observable<BaseAPIResponse<Any>> {
val body = RequestBody.create(
MediaType.parse("application/json; charset=utf-8"),
params
) as RequestBody
return YDLHttpUtils.obtainApi(ImRetrofitApi::class.java).lingxiAnswerQuestion(body)
}
} }
\ No newline at end of file
...@@ -10,6 +10,15 @@ package com.yidianling.uikit.custom.http.response.question; ...@@ -10,6 +10,15 @@ package com.yidianling.uikit.custom.http.response.question;
* 地址 https://note.youdao.com/ynoteshare1/index.html?id=ac018cb5b65b7d5fc5e961410b14621a&type=note * 地址 https://note.youdao.com/ynoteshare1/index.html?id=ac018cb5b65b7d5fc5e961410b14621a&type=note
*/ */
public class AnswerQuestionType70RequestBean { public class AnswerQuestionType70RequestBean {
/**
* 顾问or咨询师id
*/
public String toUid;
/**
* 用户id
*/
public String fromUid;
public String type = "70"; public String type = "70";
public AnswerQuestionRequestBean data; public AnswerQuestionRequestBean data;
} }
package com.yidianling.uikit.custom.http.response.question;
/**
* @author liupeng
* <p>
* 测试前置-回答消息(区分其他类型与主诉类型)
* 用户APP -》灵犀
* type 70
* <p>
* 地址 https://note.youdao.com/ynoteshare1/index.html?id=ac018cb5b65b7d5fc5e961410b14621a&type=note
*/
public class AnswerQuestionType71RequestBean {
public String type = "71";
/**
* 顾问or咨询师id
*/
public String toUid;
/**
* 用户id
*/
public String fromUid;
public DataBean data;
public static class DataBean {
public String answer;
}
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:id="@+id/type5_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView <ImageView
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment