wujingjing
2024-08-12 9de6cf5226f7df076449a39c5adeb431b12fe923
miniprogram/pages/question/question.ts
@@ -7,10 +7,6 @@
  roleImageMap
} from "@/model/chat/types";
import {
  CHAT_GROUP_DATA,
  TEST_DATA
} from "./testData";
import {
  TAB_BAR_HEIGHT
} from "@/custom-tab-bar/constants";
import {
@@ -21,6 +17,9 @@
import { ErrorCode } from "@/utils/http";
import { ComponentWithComputed, } from "miniprogram-computed";
import { uuid } from "@/utils/uuid";
import { getStorage } from "@/utils/storage";
import { getCurrentUrl } from "@/utils/common";
import { SHARE_CONFIG } from "@/config/constants";
const app = getApp();
// pages/question/question.js
@@ -132,8 +131,29 @@
    displaySampleList: [],
    section_a_id: '',
    sample_id: '',
  },
    userName: getStorage('username'),
    keyboardHeight: 0,
  },
  onClickClear() {
    console.log('clear');
    this.setData({
      sendText: ''
    })
  },
  inputFocus(e) {
    if (e.detail.height > 0) {
      this.setData({
        keyboardHeight: e.detail.height - 55
      })
    }
  },
  changeInputBlur(e) {
    this.setData({
      keyboardHeight: 0
    })
  },
  async getSampleList() {
    const res = await getSelectSample({
      section_b_id: '',
@@ -374,7 +394,7 @@
    })
  },
  async getHistoryDetail( ) {
  async getHistoryDetail() {
    const res = await QueryHistoryDetail({
      history_group_id: this.data.activeChatRoom.id,
@@ -419,8 +439,9 @@
      i++;
    });
    // 过滤为null的结果
    this.setData({
      chatHistory: this.data.chatHistory
      chatHistory: this.data.chatHistory.filter(item => !!item)
    })
    this.scrollToBottom()
@@ -491,6 +512,12 @@
    if (!isPassed) return;
    this.getHistoryGroupData();
    this.getSampleList();
  },
  onShow() {
    this.setData({
      userName: getStorage('username')
    })
  },
  async onRouteDone() {
@@ -501,12 +528,12 @@
    }
    this.setData(
      {
        section_a_id:sectionAId
        section_a_id: sectionAId
      }
    )
    if (!this.data.activeChatRoom.isInitial) {
      try {
        await this.newChatRoomClick(false)
      } finally {
        wx.hideLoading();
@@ -519,8 +546,14 @@
    this.sendText();
    app.globalData.sectionAId = '';
    app.globalData.sectionB = null;
  },
  onShareAppMessage() {
    return wx.$_.defaults(SHARE_CONFIG, {
      // path: getCurrentUrl(),
    })
  }
  // pageLifetimes: {
  //   show() {
  //     if (typeof this.getTabBar === 'function' &&