新增关闭功能

This commit is contained in:
jia 2023-11-01 15:06:35 +08:00
parent 7c349b94e9
commit 082badc787
11 changed files with 2986 additions and 145 deletions

View File

@ -2,6 +2,11 @@
export default { export default {
onLaunch: function(info) { onLaunch: function(info) {
console.log('App Launch'); console.log('App Launch');
uni.sendHostEvent('log',info, (ret) => {
//
console.log('消息成功app' + JSON.stringify(info));
});
if (info.referrerInfo?.extraData?.uniMP) { if (info.referrerInfo?.extraData?.uniMP) {
uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP); uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token); uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token);
@ -24,4 +29,5 @@
<style> <style>
/*每个页面公共css */ /*每个页面公共css */
</style> </style>

View File

@ -18,6 +18,36 @@ export function ttWss(data) {
return requesta.post(`index/tts`, data); return requesta.post(`index/tts`, data);
} }
//图片识别
export function ttocr(data) {
return request.post(`xun_fei/ocr`, data);
}
// base64 转 二进制流(blob)
export function dataURLtoBlob(dataurl) {
// console.log(dataurl);
// let str = "data:audio/wav;base64," + dataurl.slice(2)
// console.log(str);
let mime = "audio/wav"
// var arr = str.split(","),
// mime = arr[0].match(/:(.*?);/),
// let bstr = atob(arr[1])
let bstr = atob(dataurl)
let n = bstr.length
let u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
console.log(u8arr)
// return new Blob([u8arr], {
// type: mime,
// });
}
// -防抖 // -防抖
export function debounce(fn, wait) { export function debounce(fn, wait) {
let delay = wait || 500 let delay = wait || 500

View File

@ -0,0 +1,92 @@
<template>
<view class="contentgb">
<view class="return_top">
<view class="z-bootm-img1" @click="returnbom()">
<image src="@/static/icon/fb1.png" mode="aspectFit"></image>
</view>
<view class="z-bootm-l"></view>
<view class="z-bootm-img2" @click="returnbom()">
<image src="@/static/icon/fb2.png" mode="aspectFit"></image>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
returnbom() {
uni.sendHostEvent('closeApp', (ret) => {
//
console.log('关闭应用' + JSON.stringify(ret));
});
}
}
}
</script>
<style lang="scss" scoped>
.contentgb {
width: 166rpx;
height: 56rpx;
.return_top {
width: 166rpx;
height: 56rpx;
background: rgba(255, 255, 255, 0.6);
border-radius: 44rpx 44rpx;
position: relative;
.z-bootm-img1 {
width: 41rpx;
height: 13rpx;
position: absolute;
top: 20rpx;
left: 25rpx;
image {
width: 100%;
height: 100%;
}
}
.z-bootm-l {
width: 1px;
height: 32rpx;
background: rgba(0, 0, 0, 0.2);
margin: auto 0;
position: absolute;
top: 10rpx;
left: 85rpx;
}
.z-bootm-img2 {
width: 38rpx;
height: 34rpx;
margin-top: -15rpx;
margin-left: -15rpx;
position: absolute;
right: 25rpx;
top: 25rpx;
image {
width: 100%;
height: 100%;
}
}
}
}
</style>

View File

@ -0,0 +1,444 @@
<template>
<view class="qiqb-ctx" v-bind:class="{'on':show}">
<view class="qiqb-ctx-box">
<!-- <text @click="show=false"></text> -->
<canvas canvas-id="ctx" style="width:330px;height:300px" v-show="img_show"></canvas>
</view>
<view class="qiqb-ctx-btns u-border-bottom">
<view>分享至</view>
<view>长按海报可转发分享</view>
<view>
<!-- <text>微信好友</text><text>分享朋友圈</text> -->
<text @click="down">保存图片</text>
</view>
</view>
<view class="qiqb-ctx-close" @click="show=false">取消</view>
</view>
</template>
<!-- https://crmeb-test.shop.lihaink.cn/api/upload/image/field -->
<script>
export default {
name: "share",
data() {
return {
show: false,
img_show: true,
mode: 'img',
list: [],
pext1: '',
pext2: ''
}
},
onLoad() {
uni.$on('add', function(res) {
console.log(res.listData) // B
})
},
mounted() {
// console.log(this.list,'222222')
},
methods: {
//
refresh(index) {
this.list = index;
this.pext1 = index[index.length - 2].content
this.pext2 = index[index.length - 1].content
// console.log(this.list)
},
init() { // opt
uni.showLoading({
title: '生成中'
})
let self = this
let ctx = uni.createCanvasContext('ctx')
//
self.drawBg(ctx, 330, 300, 8, '#fff')
//
uni.downloadFile({
url: 'http://banbai.oss-cn-beijing.aliyuncs.com/20230524/96e80fb572e35d4acebdce67dbd41f30.jpg',
success: function(e) {
let img = e.tempFilePath //
uni.downloadFile({
url: 'http://banbai.oss-cn-beijing.aliyuncs.com/20230524/96e80fb572e35d4acebdce67dbd41f30.jpg',
success: function(e) {
let photo = e.tempFilePath //
uni.downloadFile({
url: 'http://banbai.oss-cn-beijing.aliyuncs.com/20230606/f0738e1ff432c08b369ca5e4b906a34a.png',
success: function(e) {
uni.hideLoading()
let qrcode = e.tempFilePath //
self.drawTxtOne(ctx, '农业咨询小程序', 220, 35, 100,
'#222', 12, false)
//
self.drawImg(ctx,
'https://lihai001.oss-cn-chengdu.aliyuncs.com/storage/202310/20231013091310.png',
170, 10, 40, 40, 20)
self.drawImg(ctx,
'https://lihai001.oss-cn-chengdu.aliyuncs.com/storage/202310/20231013091059.png',
10, 50, 40, 40, 20)
self.drawImg(ctx,
'https://lihai001.oss-cn-chengdu.aliyuncs.com/storage/202310/20231013091310.png',
10, 118, 40, 40, 20)
//
// self.drawImg(ctx, img, 10, 120, 210, 260, 8)
//
self.drawImg(ctx,
'https://lihai001.oss-cn-chengdu.aliyuncs.com/storage/202310/ai_qr_20231013091327.jpg',
174, 195, 100, 100, 0)
//
self.drawTxtOne(ctx, self.pext1, 60, 70, 100,
'#222', 12, false)
// self.drawTxtTwo(ctx, self.pext1, 60, 64, 80,
// '#222', 13)
// self.drawTxtTwo(ctx, self.pext1, 60,64,
// 190, 20, '#222', 12)
//
// self.drawTxtOne(ctx, '', 60, 80, 100,
// '#666', 9, false)
//
self.drawTxtFour(ctx,
self.pext2,
60, 120,
190, 20, '#222', 12)
//
self.drawTxtOne(ctx, '下载二维码', 15, 250, 100,
'#666', 11, false)
//
// self.drawTxtOne(ctx, '', 15, 350, 100,
// '#ED3327', 11, false)
//
// self.drawTxtOne(ctx, '86.00', 82, 350, 100,
// '#ED3327', 11, true)
//
// self.drawTxtDel(ctx, ':20', 15, 370, 4,
// '#818181', 10, false)
//
ctx.draw()
self.show = true
}
})
}
})
}
})
},
down() {
uni.showLoading({
title: '保存中'
})
uni.canvasToTempFilePath({
canvasId: 'ctx',
quality: 1,
success: (res) => {
uni.hideLoading()
console.log(res)
this.$emit('down', res)
this.show = false
//
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: (res) => {
console.log('保存')
uni.showModal({
title: '保存成功'
})
}
})
}
})
},
//
drawBg(ctx, w, h, r, color) {
let x = 0
let y = 0
ctx.setFillStyle(color)
ctx.save()
ctx.beginPath()
ctx.moveTo(x + r, y)
ctx.arcTo(x + w, y, x + w, y + h, r)
ctx.arcTo(x + w, y + h, x, y + h, r)
ctx.arcTo(x, y + h, x, y, r)
ctx.arcTo(x, y, x + w, y, r)
ctx.closePath()
ctx.fill()
},
//
drawImg(ctx, img, x, y, w, h, r) {
let self = this
ctx.save()
ctx.beginPath()
ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5)
ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2)
ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5)
ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI)
ctx.clip()
ctx.drawImage(img, x, y, w, h)
ctx.restore()
},
//
drawTxtOne(ctx, text, x, y, maxWidth, color, size, bold) {
ctx.save()
ctx.beginPath()
let chr = text.split("")
let temp = ""
let row = []
ctx.setFontSize(size)
ctx.setFillStyle(color)
for (let a = 0; a < chr.length; a++) {
if (ctx.measureText(temp).width < maxWidth) {
temp += chr[a]
}
}
row.push(temp)
if (ctx.measureText(temp).width > maxWidth) row[0] = row[0] + '...'
for (var b = 0; b < row.length; b++) {
ctx.fillStyle = color
if (bold) {
ctx.font = 'normal bold ' + size + 'px sans-serif'
} else {
ctx.font = 'normal ' + size + 'px sans-serif'
}
ctx.fillText(row[b], x, y)
}
},
//
drawTxtTwo(ctx, text, x, y, maxWidth, lineHeight, color, size) {
ctx.save()
ctx.beginPath()
let chr = text.split("")
let temp = ""
let row = []
ctx.setFontSize(size)
ctx.setFillStyle(color)
for (let a = 0; a < chr.length; a++) {
if (ctx.measureText(temp).width < maxWidth) {
temp += chr[a];
} else {
a--
row.push(temp)
temp = ""
}
}
row.push(temp)
if (row.length > 2) {
let rowCut = row.slice(0, 2)
let rowPart = rowCut[1]
let test = ""
let empty = []
for (var a = 0; a < rowPart.length; a++) {
if (ctx.measureText(test).width < maxWidth) {
test += rowPart[a]
} else {
break
}
}
empty.push(test)
var group = empty[0] + "..."
rowCut.splice(1, 1, group)
row = rowCut
}
for (var b = 0; b < row.length; b++) {
ctx.fillStyle = color
ctx.font = 'normal ' + size + 'px sans-serif'
ctx.fillText(row[b], x, y + b * lineHeight, 300)
}
},
drawTxtFour(ctx, text, x, y, maxWidth, lineHeight, color, size) {
ctx.save()
ctx.beginPath()
let chr = text.split("")
let temp = ""
let row = []
ctx.setFontSize(size)
ctx.setFillStyle(color)
for (let a = 0; a < chr.length; a++) {
if (ctx.measureText(temp).width < maxWidth) {
temp += chr[a];
} else {
a--
row.push(temp)
temp = ""
}
}
row.push(temp)
if (row.length > 4) {
let rowCut = row.slice(0, 4)
let rowPart = rowCut[1]
let test = ""
let empty = []
for (var a = 0; a < rowPart.length; a++) {
if (ctx.measureText(test).width < maxWidth) {
test += rowPart[a]
} else {
break
}
}
empty.push(test)
var group = empty[0] + "..."
rowCut.splice(1, 1, group)
row = rowCut
}
for (var b = 0; b < row.length; b++) {
ctx.fillStyle = color
ctx.font = 'normal ' + size + 'px sans-serif'
ctx.fillText(row[b], x, y + b * lineHeight, 300)
}
},
// 线
drawTxtDel(ctx, txt, x, y, h, color, size) {
ctx.fillStyle = color
ctx.font = 'normal ' + size + 'px sans-serif'
ctx.fillText(txt, x, y)
ctx.beginPath()
let width = ctx.measureText(txt).width;
ctx.rect(x, y - h, width, 1)
ctx.fillStyle = color
ctx.fill()
}
}
}
</script>
<style>
.qiqb-ctx {
position: fixed;
top: 0;
right: 0;
bottom: 0;
bottom: 0;
left: 0;
z-index: -1;
display: flex;
background: rgba(0, 0, 0, .6);
opacity: 0;
transition: all .3s;
flex-direction: column;
align-items: flex-end;
justify-content: flex-end
}
.qiqb-ctx.on {
z-index: 2000;
opacity: 1
}
.qiqb-ctx-box {
position: relative;
display: flex;
padding: 30upx 0 40upx;
width: 750upx;
justify-content: center
}
.qiqb-ctx-box text {
position: absolute;
top: -40upx;
right: 145upx;
display: inline-flex;
width: 47upx;
height: 47upx;
background: url('img/close.png');
background-size: 100% 100%
}
.qiqb-ctx-btns {
display: flex;
width: 750upx;
height: 330upx;
border-radius: 20upx 20upx 0 0;
background: #fff;
flex-direction: row;
flex-direction: column;
align-items: center
}
.qiqb-ctx-btns view:nth-child(1) {
display: flex;
padding-top: 10upx;
height: 80upx;
font-weight: 700;
font-size: 30upx;
align-items: center
}
.qiqb-ctx-btns view:nth-child(2) {
height: 80upx;
color: #666;
font-size: 24upx
}
.qiqb-ctx-btns view:nth-child(3) {
display: flex;
padding-bottom: 30upx;
font-size: 26upx;
flex-direction: row;
align-items: center
}
.qiqb-ctx-btns view:nth-child(3) text {
display: flex;
width: 250upx;
flex-direction: column;
align-items: center;
justify-content: center
}
.qiqb-ctx-btns view:nth-child(3) text:nth-child(1)::before {
display: inline-flex;
margin-bottom: 20upx;
width: 86upx;
height: 86upx;
background: url('img/3.png');
background-size: 100% 100%;
content: ''
}
.qiqb-ctx-btns view:nth-child(3) text:nth-child(2)::before {
display: inline-flex;
margin-bottom: 20upx;
width: 86upx;
height: 86upx;
background: url('img/1.png');
background-size: 100% 100%;
content: ''
}
.qiqb-ctx-btns view:nth-child(3) text:nth-child(3)::before {
display: inline-flex;
margin-bottom: 20upx;
width: 86upx;
height: 86upx;
background: url('img/2.png');
background-size: 100% 100%;
content: ''
}
.qiqb-ctx-close {
display: flex;
padding-bottom: 50upx;
width: 100%;
height: 150upx;
background: #fff;
font-size: 32upx;
align-items: center;
justify-content: center
}
</style>

View File

@ -39,7 +39,7 @@ function baseRequest(url, method, data, {
data: data || {}, data: data || {},
success: (res) => { success: (res) => {
// #ifdef APP-PLUS // #ifdef APP-PLUS
// console.log('app', Url + '/api/' + url, res.data);
// #endif // #endif
if (noVerify) if (noVerify)

View File

@ -40,7 +40,7 @@ function baseRequest(url, method, data, {
success: (res) => { success: (res) => {
// #ifdef APP-PLUS // #ifdef APP-PLUS
// console.log('app', Url + '/api/' + url, res.data); console.log('app', Url + '/api/' + url, res.data);
// #endif // #endif
if (noVerify) if (noVerify)

View File

@ -1,6 +1,6 @@
{ {
"name" : "情感咨询", "name" : "农业咨询",
"appid" : "__UNI__8080F14", "appid" : "__UNI__9620511",
"description" : "", "description" : "",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
@ -17,26 +17,34 @@
"delay" : 0 "delay" : 0
}, },
/* */ /* */
"modules" : {}, "modules" : {
"Record" : {},
"Speech" : {},
"Camera" : {}
},
/* */ /* */
"distribute" : { "distribute" : {
/* android */ /* android */
"android" : { "android" : {
"permissions" : [ "permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>", "<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
], ],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ] "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
@ -47,7 +55,25 @@
}, },
/* SDK */ /* SDK */
"sdkConfigs" : { "sdkConfigs" : {
"ad" : {} "ad" : {},
"speech" : {},
"share" : {}
}
},
"nativePlugins" : {
"YL-SpeechRecognition" : {
"__plugin_info__" : {
"name" : "YL-SpeechRecognition-语音合成,语音听写,基于科大讯飞,双端 - [试用版,仅用于自定义调试基座]",
"description" : "语音合成语音听写基于科大讯飞双端QQ453503875微信同",
"platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=9512",
"android_package_name" : "",
"ios_bundle_id" : "",
"isCloud" : true,
"bought" : 0,
"pid" : "9512",
"parameters" : {}
}
} }
} }
}, },
@ -55,7 +81,7 @@
"quickapp" : {}, "quickapp" : {},
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
"appid" : "", "appid" : "wx3267f87bc81f2890",
"setting" : { "setting" : {
"urlCheck" : false "urlCheck" : false
}, },

View File

@ -5,9 +5,10 @@
<view class="conten-top"> <view class="conten-top">
<view class="" style="position: absolute;left: 30rpx;"><i class="iconfont icon-xiangzuo" <view class="" style="position: absolute;left: 30rpx;"><i class="iconfont icon-xiangzuo"
style="font-size: 40rpx;text-align: left;"></i></view> style="font-size: 40rpx;text-align: left;"></i></view>
<view class="" style="font-size: 30rpx;"> <view class="" style="font-size: 30rpx;margin-top: 10rpx;">
情感咨询 情感咨询
</view> </view>
<returntop class="container-retun"/>
</view> </view>
<view style="padding-top:var(--status-bar-height);padding-bottom: 30rpx; margin-bottom: 30rpx;"></view> <view style="padding-top:var(--status-bar-height);padding-bottom: 30rpx; margin-bottom: 30rpx;"></view>
@ -17,23 +18,23 @@
<view class="placeholder"></view> <view class="placeholder"></view>
<view class="box-1" id="list-box" ref="box"> <view class="box-1" id="list-box" ref="box">
<view class="talk-list"> <view class="talk-list">
<view class="talk-list-con"> <view class="talk-list-con">
<view class="talk-list-con-title"> <view class="talk-list-con-title">
您好 您好
</view> </view>
<view class="talk-list-con-title1"> <view class="talk-list-con-title1">
您可以和我说任何有关情感的问题<br /> 您可以和我说任何有关情感的问题<br />
例如下面的问题赶快试试吧 例如下面的问题赶快试试吧
</view> </view>
<view class="talk-list-con-title2"> <view class="talk-list-con-title2">
<text style="margin-top: 15rpx;"> 下方输入</text> <text style="margin-top: 15rpx;"> 下方输入</text>
<view class="" @click="sendDetail('当我被爱情伤害时,我该如何重新振作起来?')"> <view class="" @click="sendDetail('怎么保持心情愉快')">
当我被爱情伤害时我该如何重新振作起来 怎么保持心情愉快
<image src="../../static/icon/airight.png" mode=""></image> <image src="../../static/icon/airight.png" mode=""></image>
</view>
</view> </view>
</view>
</view> </view>
<view v-for="(item,index) in talkList" :key="index" :id="`msg-${item.id}`"> <view v-for="(item,index) in talkList" :key="index" :id="`msg-${item.id}`">
<view class="item flex_col" :class="item.type == 1 ? 'push':'pull' "> <view class="item flex_col" :class="item.type == 1 ? 'push':'pull' ">
@ -49,11 +50,9 @@
<view class="" v-else> <view class="" v-else>
<view v-if="talkList.length-1==index" class="multiline-text"> <view v-if="talkList.length-1==index" class="multiline-text">
<view class="content"> <view class="content">
<view class="" v-if="item.type==3" <view class="" v-if="item.type==3" style="border: 1px solid #2573fb;margin-left: 20rpx;">
style="border: 1px solid #2573fb;margin-left: 20rpx;"> <image :src="item.Image" mode="" style="width: 200rpx;height: 200rpx;" @click="previewImage(item.Image)"></image>
<image :src="item.Image" mode="" style="width: 200rpx;height: 200rpx;" <view class="">{{c_content}}</view>
@click="previewImage(item.Image)"></image>
<view class="">{{c_content}}</view>
</view> </view>
<view class="" v-else> <view class="" v-else>
<bing-math v-if="c_content!=''" :key="`math-${item.id}`" class="bing-math1" <bing-math v-if="c_content!=''" :key="`math-${item.id}`" class="bing-math1"
@ -91,10 +90,8 @@
<!-- <rich-text :nodes="item.content"></rich-text> --> <!-- <rich-text :nodes="item.content"></rich-text> -->
<view class="" v-if="item.type==3" <view class="" v-if="item.type==3" style="border: 1px solid #2573fb;margin-left: 20rpx;">
style="border: 1px solid #2573fb;margin-left: 20rpx;"> <image :src="item.Image" mode="" style="width: 200rpx;height: 200rpx;" @click="previewImage(item.Image)"></image>
<image :src="item.Image" mode="" style="width: 200rpx;height: 200rpx;"
@click="previewImage(item.Image)"></image>
</view> </view>
<view class="" v-else> <view class="" v-else>
<view class="content multiline-text"> <view class="content multiline-text">
@ -251,19 +248,20 @@
import qiqbshare from "@/components/qiqb-share/qiqb-share.vue" import qiqbshare from "@/components/qiqb-share/qiqb-share.vue"
import returntop from '@/components/content-top/index.vue'
const recorderManager = uni.getRecorderManager() const recorderManager = uni.getRecorderManager()
const innerAudioContext = uni.createInnerAudioContext() const innerAudioContext = uni.createInnerAudioContext()
export default { export default {
components: { components: {
'bing-math': BingMath, 'bing-math': BingMath,
'qiqbshare': qiqbshare, 'qiqbshare': qiqbshare,
returntop
}, },
data() { data() {
return { return {
wssType: 'qinggan', // wssType: 'qinggan', //
avatarType: "/static/icon/qg.png", // AI avatarType: "/static/icon/qg.png", // AI
talkList: [], talkList: [],
ajax: { ajax: {
rows: 15, // rows: 15, //
@ -479,7 +477,7 @@
sourceType: ['album'], //cameraalbum sourceType: ['album'], //cameraalbum
success: (res) => { success: (res) => {
// const tempFilePaths = res.tempFilePaths; // const tempFilePaths = res.tempFilePaths;
console.log(res.tempFilePaths, '2222222222') console.log(res.tempFilePaths,'2222222222')
uni.uploadFile({ uni.uploadFile({
url: HTTP_REQUEST_URL + '/api/upload/image', // url: HTTP_REQUEST_URL + '/api/upload/image', //
filePath: res.tempFilePaths[0], // filePath: res.tempFilePaths[0], //
@ -490,7 +488,7 @@
success: function(res) { success: function(res) {
let data = JSON.parse(res.data) let data = JSON.parse(res.data)
console.log(data, '222222222222') console.log(data,'222222222222')
if (data.code == 1) { if (data.code == 1) {
// this.File() // this.File()
let data1 = { let data1 = {
@ -590,22 +588,22 @@
}, },
// //
previewImage(url) { previewImage(url){
uni.previewImage({ uni.previewImage({
urls: [url], // urls: [url], //
current: url, // current: url, //
success: function() { success: function() {
console.log('预览图片成功'); console.log('预览图片成功');
}, },
fail: function(error) { fail: function(error) {
console.error('预览图片失败', error); console.error('预览图片失败', error);
} }
}); });
}, },
// //
imgfile(tempFilePath) { imgfile(tempFilePath) {
let that = this let that = this
that.content1 = '' that.content1=''
// console.log(tempFilePath, '2') // console.log(tempFilePath, '2')
ttocr({ ttocr({
image: tempFilePath image: tempFilePath
@ -817,25 +815,25 @@
start(e) { start(e) {
this.onFeedTap() this.onFeedTap()
this.touchT = new Date().getTime(); this.touchT = new Date().getTime();
this.islong = true this.islong = true
this.risshow = false this.risshow = false
this.$refs.popup.open('center') this.$refs.popup.open('center')
// //
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.num++ this.num++
}, 1000) }, 1000)
this.btnStatus = 1 this.btnStatus = 1
recorderManager.start({ recorderManager.start({
//5, //5,
duration: 300000, duration: 300000,
// format: "pcm", // format: "pcm",
}); });
this.touchStartX = e.touches[0].pageX; // this.touchStartX = e.touches[0].pageX; //
this.touchStartY = e.touches[0].pageY; // this.touchStartY = e.touches[0].pageY; //
}, },
move(e) { move(e) {
@ -1017,12 +1015,12 @@
if (!this.talkList[i].playStatus) { if (!this.talkList[i].playStatus) {
if (items.audio_file.length > 0) { if(items.audio_file.length>0){
innerAudioContext.src = items.audio_file; innerAudioContext.src = items.audio_file;
innerAudioContext.play() innerAudioContext.play()
this.talkList[i].playStatus = false this.talkList[i].playStatus = false
} else { }else{
this.talkList[i].playStatus = true this.talkList[i].playStatus = true
} }
@ -1185,25 +1183,25 @@
// //
closeSocketTask() { closeSocketTask() {
try { try {
this.talkList = this.talkList.filter(item => item.id !== '@'); this.talkList = this.talkList.filter(item => item.id !== '@');
clearInterval(this.timer); clearInterval(this.timer);
this.talkList[this.talkList.length - 1].audio_file = '' this.talkList[this.talkList.length - 1].audio_file=''
this.talkList[this.talkList.length - 1].content = this.c_content + ''; this.talkList[this.talkList.length - 1].content = this.c_content + '';
// console.log(this.talkList[this.talkList.length - 1].content); // console.log(this.talkList[this.talkList.length - 1].content);
// this.c_content = ''; // this.c_content = '';
// this.n_content = ''; // this.n_content = '';
this.socketTask.close({ this.socketTask.close({
code: 500, // APPBUG,code1000,,code code: 500, // APPBUG,code1000,,code
complete: (res) => { complete: (res) => {
this.showStop = false; this.showStop = false;
console.log('主动断开', res); console.log('主动断开', res);
this.wsLiveFlag = false; this.wsLiveFlag = false;
} }
}) })
} catch (e) { } catch (e) {
//TODO handle the exception //TODO handle the exception
} }
}, },
@ -1367,11 +1365,11 @@
realThis.tempRes = realThis.tempRes + dataArray[i].content realThis.tempRes = realThis.tempRes + dataArray[i].content
} }
if (this.n_content.length > 0) { if(this.n_content.length>0){
this.nums = this.talkList.length - 1 this.nums = this.talkList.length - 1
this.txtspeech(this.n_content, this.talkList.length - this.txtspeech(this.n_content, this.talkList.length -
1) 1)
this.showStop = true; this.showStop = true;
} }
this.cavshare(this.talkList) this.cavshare(this.talkList)
let temp = JSON.parse(res.data) let temp = JSON.parse(res.data)
@ -1605,8 +1603,14 @@
top: 0; top: 0;
position: fixed; position: fixed;
z-index: 10; z-index: 10;
} .container-retun{
position: absolute;
right: 20rpx;
padding-top: var(--status-bar-height);
top: 0;
}
}
.popup_box { .popup_box {
height: 100vh; height: 100vh;

2239
pages/index/index1.vue Normal file

File diff suppressed because it is too large Load Diff

BIN
static/icon/fb1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

BIN
static/icon/fb2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB