index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="search-voice-content">
  3. <speech key="speech-test" ref="speechTest" @success="speechSuccess"></speech>
  4. <view class="desc-model">
  5. <textarea class="desc" v-model="desc" placeholder="请详细描述您的病情(5-200字内)" maxlength="200" />
  6. <button type="primary" class="submit-BT" @click="submit()">提交</button>
  7. </view>
  8. <button type="default" @click="speechHandle" class="speechHandle submit-BT">
  9. <text class="zhcx-iconfont zhcx-icon-yuyin"></text>
  10. </button>
  11. </view>
  12. </template>
  13. <script>
  14. import {notEmpty} from '@/libs';
  15. import speech from '@/components/Speech';
  16. import {searchSubmit} from '@/api/patient';
  17. export default {
  18. components:{
  19. speech
  20. },
  21. data() {
  22. return {
  23. speechModel:false,
  24. desc:""
  25. }
  26. },
  27. methods: {
  28. speechHandle(){
  29. // #ifdef H5
  30. uni.showToast({
  31. icon:"none",
  32. title:"请使用小程序打开!"
  33. })
  34. return;
  35. // #endif
  36. this.$refs.speechTest.startRecordHanlle()
  37. },
  38. speechSuccess(res){
  39. let word=res.data.result[0];
  40. this.desc=word;
  41. },
  42. submit(){
  43. searchSubmit({
  44. diseaseDesc:this.desc,
  45. seekTime:parseTime(new Date())
  46. }).then((res)=>{
  47. if(res.code===0){
  48. /**检索成功返回ai推荐数据 */
  49. uni.setStorageSync('aidiagnoseInfo',res.data)
  50. uni.navigateTo({
  51. url: '/views/patientItems/diagnose/index'
  52. });
  53. }
  54. })
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .search-voice-content{
  61. .submit-BT{
  62. display: block;
  63. width: 702upx;
  64. height: 98upx;
  65. line-height: 98upx;
  66. text-align: center;
  67. color: #fff;
  68. font-size: 32upx;
  69. letter-spacing: 4upx;
  70. margin-top: 40upx;
  71. background-color: #3384FF;
  72. }
  73. .speechHandle{
  74. width:100upx;
  75. height:100upx;
  76. position: fixed;
  77. bottom: 0;
  78. left: 50%;
  79. transform: translateX(-50%);
  80. z-index: 5;
  81. display: flex;
  82. justify-content: center;
  83. align-items: center;
  84. flex-direction: column;
  85. line-height: 1;
  86. margin: 0;
  87. letter-spacing: 2upx;
  88. font-size: 20upx;
  89. color: #fff;
  90. background-color: #409eff;
  91. border-color: #409eff;
  92. border-radius: 50upx 50upx 0 0;
  93. .zhcx-icon-yuyin{
  94. font-size: 100upx;
  95. }
  96. }
  97. }
  98. </style>