|
@@ -23,10 +23,22 @@
|
|
|
v-else-if="item.mstatus == 1"
|
|
|
@click="sendToBackend(item.content, index)"
|
|
|
></i>
|
|
|
- <div class="content" v-if="item.content">
|
|
|
- <span>{{ item.content }}</span>
|
|
|
+ <div class="content">
|
|
|
+ <audio
|
|
|
+ v-if="item.mp3url"
|
|
|
+ controls
|
|
|
+ autoplay
|
|
|
+ :src="item.mp3url"
|
|
|
+ ></audio>
|
|
|
+ <div>
|
|
|
+ <span>{{ item.content }}</span>
|
|
|
+ <i
|
|
|
+ v-if="item.content"
|
|
|
+ class="el-icon-document-copy"
|
|
|
+ @click="copy(item)"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <audio v-else controls autoplay :src="item.mp3url"></audio>
|
|
|
<div class="header-img">
|
|
|
<img src="/static/images/aiModel/default.png" />
|
|
|
</div>
|
|
@@ -77,6 +89,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { AddFzxz } from "../../api/ghss/ghxz.js";
|
|
|
+import { GetMsg, uploadAudio } from "../../api/aiModel.js";
|
|
|
import record from "./record.js";
|
|
|
let recognition = null;
|
|
|
export default {
|
|
@@ -155,24 +168,24 @@ export default {
|
|
|
mp3url: (window.URL || webkitURL).createObjectURL(res.blob),
|
|
|
mstatus: 0,
|
|
|
});
|
|
|
+ let mindex = _this.questionList.length - 1;
|
|
|
/**处理 */
|
|
|
- axios({
|
|
|
- method: "POST",
|
|
|
- url: `${window.aiURI}/upload`,
|
|
|
- data: res.formData,
|
|
|
- headers: {
|
|
|
- "Content-Type": "application/json",
|
|
|
- },
|
|
|
- })
|
|
|
- .then((mres) => {
|
|
|
- if (mres.status == 200) {
|
|
|
+ uploadAudio(res.formData)
|
|
|
+ .then((ares) => {
|
|
|
+ if (ares.status == 200) {
|
|
|
+ _this.questionList[mindex].content = ares.data.voiceMsg;
|
|
|
+ _this.sendToBackend(ares.data.voiceMsg, mindex);
|
|
|
} else {
|
|
|
+ _this.$message.error(ares.data.msg);
|
|
|
}
|
|
|
})
|
|
|
.catch(() => {});
|
|
|
});
|
|
|
this.spdisabled = false;
|
|
|
},
|
|
|
+ copy(item) {
|
|
|
+ this.sendContent = item.content;
|
|
|
+ },
|
|
|
sendDefault() {
|
|
|
this.sendContent = this.defaultMsg;
|
|
|
// this.send();
|
|
@@ -201,42 +214,17 @@ export default {
|
|
|
},
|
|
|
sendToBackend(msg, mindex) {
|
|
|
this.questionList[mindex].mstatus = 0;
|
|
|
- axios({
|
|
|
- method: "POST",
|
|
|
- url: `${window.aiURI}/msg`,
|
|
|
- data: JSON.stringify({ msg }),
|
|
|
- headers: {
|
|
|
- "Content-Type": "application/json",
|
|
|
- },
|
|
|
- })
|
|
|
+ GetMsg(msg)
|
|
|
.then((mres) => {
|
|
|
if (mres.status == 200) {
|
|
|
this.questionList[mindex].mstatus = 2;
|
|
|
if (mres.data.type == "selectLand") {
|
|
|
- this.questionList.push({ content: "分析中...请稍等" });
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: "分析中",
|
|
|
- spinner: "el-icon-loading",
|
|
|
- background: "rgba(0, 0, 0, 0.7)",
|
|
|
- });
|
|
|
- AddFzxz(mres.data.data)
|
|
|
- .then((res) => {
|
|
|
- loading.close();
|
|
|
- this.questionList.push({
|
|
|
- type: mres.data.type,
|
|
|
- content: "查看智能选址结果",
|
|
|
- data: res.data,
|
|
|
- });
|
|
|
- this.$message({
|
|
|
- message: res.message,
|
|
|
- type: res.success ? "success" : "warning",
|
|
|
- });
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- loading.close();
|
|
|
- this.$message.error(error);
|
|
|
- });
|
|
|
+ if (mres.data.data) {
|
|
|
+ this.questionList.push({ content: "分析中...请稍等" });
|
|
|
+ this.AddFzxz(mres.data.data, mres.data.type);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.questionList.push({ content: "抱歉!缺少分析数据" });
|
|
|
}
|
|
|
} else {
|
|
|
this.questionList[mindex].mstatus = 1;
|
|
@@ -248,6 +236,32 @@ export default {
|
|
|
// this.$message.error("发送到后台时发生错误:");
|
|
|
});
|
|
|
},
|
|
|
+ AddFzxz(xzdata, type) {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: "分析中",
|
|
|
+ spinner: "el-icon-loading",
|
|
|
+ background: "rgba(0, 0, 0, 0.7)",
|
|
|
+ });
|
|
|
+ AddFzxz(xzdata)
|
|
|
+ .then((res) => {
|
|
|
+ console.log("xuanz", res);
|
|
|
+ loading.close();
|
|
|
+ this.questionList.push({
|
|
|
+ type,
|
|
|
+ content: "查看智能选址结果",
|
|
|
+ data: res.data,
|
|
|
+ });
|
|
|
+ this.$message({
|
|
|
+ message: res.message,
|
|
|
+ type: res.success ? "success" : "warning",
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.error(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
onClick(item) {
|
|
|
if (item.type == "selectLand") {
|
|
|
this.$router.push({
|
|
@@ -357,8 +371,8 @@ export default {
|
|
|
height: 40px;
|
|
|
}
|
|
|
audio::-webkit-media-controls-enclosure {
|
|
|
- background-color: #b6e1ff3b;
|
|
|
- color: #fff;
|
|
|
+ // background-color: #40a0ff6c;
|
|
|
+ // color: #fff;
|
|
|
}
|
|
|
}
|
|
|
.voice {
|
|
@@ -401,6 +415,9 @@ export default {
|
|
|
font-size: 40px;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
+ .el-icon-warning {
|
|
|
+ color: red;
|
|
|
+ }
|
|
|
.no {
|
|
|
color: #2f2f39;
|
|
|
}
|