|
@@ -63,23 +63,25 @@
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
|
|
|
- <view style="display: flex;width: 70vw;height: 90upx;position: absolute;bottom:500upx;">
|
|
|
- <view style="display: flex;width: 90%; border-radius: 25px 25px 25px 25px;opacity: 1;border: 1px solid #32B3AA;width: 100%;" class="textarea-box">
|
|
|
-
|
|
|
- <view style="width: 90%; height: 100%; display: flex;align-items: center;justify-content: center" >
|
|
|
- <textarea v-model="inputValue" :cursor-spacing="15" class="textarea" auto-height="true"
|
|
|
- @keydown.enter="onKeydown('enter')" :disabled="disabled"
|
|
|
- @input="onKeyInput"
|
|
|
- placeholder="请输入消息内容(使用 Enter 发送)" :maxlength="-1"
|
|
|
- placeholder-class="input-placeholder"></textarea>
|
|
|
- </view>
|
|
|
- <view v-if="recvStatus==false" style="width: 10%; height: 100%; display: flex; color: aliceblue;align-items: center;justify-content: center" @click="sendMsg">
|
|
|
- <image src="../../static/img_send.png" style="width: 29.57upx;height: 37.67upx;" ></image>
|
|
|
- </view>
|
|
|
+ <view class="inputbox" style="display: flex;width: 70vw;height: 90upx;position: absolute;bottom:500upx;">
|
|
|
+ <view style="display: flex;align-items: center;justify-content: center;width: 5%;position: relative;">
|
|
|
+ <image @click="onclickchooseImg()" src="../../static/img_upload.png" style="width: 65upx;height: 65upx;"></image>
|
|
|
+ </view>
|
|
|
+ <view style="display: flex;width: 90%; margin-left: 5px; border-radius: 25px 25px 25px 25px;opacity: 1;border: 1px solid #32B3AA;" class="textarea-box">
|
|
|
+ <view style="width: 90%; height: 100%; display: flex;align-items: center;justify-content: center" >
|
|
|
+ <textarea v-model="inputValue" :cursor-spacing="15" class="textarea" auto-height="true"
|
|
|
+ @keydown.enter="onKeydown('enter')" :disabled="disabled"
|
|
|
+ @input="onKeyInput"
|
|
|
+ placeholder="请输入消息内容(使用 Enter 发送)" :maxlength="-1"
|
|
|
+ placeholder-class="input-placeholder"></textarea>
|
|
|
</view>
|
|
|
- <view style=" display: flex;align-items: center;justify-content: center;width: 5%;position: relative;">
|
|
|
- <image @click="onclickdelete()" src="../../static/img_delete.png" style="width: 50upx;height: 70upx;"></image>
|
|
|
+ <view v-if="recvStatus==false" style="width: 10%; height: 100%; display: flex; color: aliceblue;align-items: center;justify-content: center" @click="sendMsg">
|
|
|
+ <image src="../../static/img_send.png" style="width: 29.57upx;height: 37.67upx;" ></image>
|
|
|
</view>
|
|
|
+ </view>
|
|
|
+ <view style=" display: flex;align-items: center;justify-content: center;width: 5%;position: relative;">
|
|
|
+ <image @click="onclickdelete()" src="../../static/img_delete.png" style="width: 50upx;height: 70upx;"></image>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view style="position: absolute;top: 10%;right: 5%;width: 200upx;display: flex;align-items: center;justify-content: center;">
|
|
@@ -125,10 +127,19 @@
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
+
|
|
|
+ <view v-if="choose_img_tempFilePath != ''" style="position: fixed; top: 500px; left: 20%; width: 130px; height: 90px;">
|
|
|
+ <view style="position: absolute; top: 10px; width: 120px; height: 80px; background-color: #111111;">
|
|
|
+ <image style="width: 100%; height: 100%;" :src="choose_img_tempFilePath" mode="aspectFill"></image>
|
|
|
+ </view>
|
|
|
+ <view style="position: absolute; right: 0; width: 30px; height: 30px;" @click="onclickDeleteChooseImg">
|
|
|
+ <image style="margin-left: 10px; width: 20px; height: 20px;" src="../../static/img_jian.png" mode="aspectFit"></image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
<view v-if="is_up_img_file" style="align-items: center;justify-content: center;display: flex; color: aliceblue; position: absolute; width: 100vw;height:100vh;background-color: black;opacity: 70%;">
|
|
|
- 正在上传
|
|
|
+ 正在上传图片...
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -179,24 +190,26 @@
|
|
|
imageUrl:'',
|
|
|
fileData:null,
|
|
|
cur_select_img:'../../static/import-img.png',
|
|
|
+
|
|
|
+ choose_img_tempFilePath: '',
|
|
|
}
|
|
|
},
|
|
|
mounted(){
|
|
|
- this.user_mobile = this.tools.get_user_info().mobile
|
|
|
- marked.setOptions({
|
|
|
- renderer: new marked.Renderer(),
|
|
|
- gfm: true,
|
|
|
- tables: true,
|
|
|
- breaks: false,
|
|
|
- pedantic: false,
|
|
|
- sanitize: false,
|
|
|
- smartLists: true,
|
|
|
- smartypants: false,
|
|
|
- highlight: function (code) {
|
|
|
- return hljs.highlightAuto(code).value;
|
|
|
- },
|
|
|
- langPrefix:"hljs language-"
|
|
|
- });
|
|
|
+ this.user_mobile = this.tools.get_user_info().mobile
|
|
|
+ marked.setOptions({
|
|
|
+ renderer: new marked.Renderer(),
|
|
|
+ gfm: true,
|
|
|
+ tables: true,
|
|
|
+ breaks: false,
|
|
|
+ pedantic: false,
|
|
|
+ sanitize: false,
|
|
|
+ smartLists: true,
|
|
|
+ smartypants: false,
|
|
|
+ highlight: function (code) {
|
|
|
+ return hljs.highlightAuto(code).value;
|
|
|
+ },
|
|
|
+ langPrefix:"hljs language-"
|
|
|
+ });
|
|
|
},
|
|
|
props: {
|
|
|
viewTop: {
|
|
@@ -500,6 +513,11 @@
|
|
|
self.recvMsgQueue[self.recvMsgQueue.length-1].isFinish = true;
|
|
|
},
|
|
|
async sendMsg(){
|
|
|
+ if(this.choose_img_tempFilePath != '') {
|
|
|
+ this.sendImageAndTextOperation()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
// 如果内容为空
|
|
|
if (!this.inputValue) {
|
|
|
// 弹出提示框
|
|
@@ -580,7 +598,112 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
+ onclickDeleteChooseImg() {
|
|
|
+ let self = this
|
|
|
+ uni.showModal({
|
|
|
+ showCancel:true,
|
|
|
+ content:"是否删除",
|
|
|
+ success:(res)=>{
|
|
|
+ if(res.confirm){
|
|
|
+ self.choose_img_tempFilePath = ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onclickchooseImg(event){
|
|
|
+ let self = this;
|
|
|
+ uni.chooseImage({
|
|
|
+ success: (chooseImageRes) => {
|
|
|
+ const tempFilePaths = chooseImageRes.tempFilePaths;
|
|
|
+ this.choose_img_tempFilePath = tempFilePaths[0]
|
|
|
+ if(tempFilePaths.length > 0) {
|
|
|
+ self.choose_img_tempFilePath = tempFilePaths[0]
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon:'error',
|
|
|
+ title:'图片选择失败,请重新选择',
|
|
|
+ duration:2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ sendImageAndTextOperation() {
|
|
|
+ if (this.inputValue.length == 0) {
|
|
|
+ return uni.showToast({
|
|
|
+ title: '请添加描述哦,只支持英文',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ let self = this
|
|
|
+ self.is_up_img_file = true
|
|
|
+ // 上传图片+发送图片链接和文本
|
|
|
+ // 上传图片
|
|
|
+ uni.uploadFile({
|
|
|
+ url: 'https://mlapi.hainanmlwl.com/file/upload_aiimg',
|
|
|
+ filePath: self.choose_img_tempFilePath,
|
|
|
+ name: 'aiimg_url',
|
|
|
+ formData: {
|
|
|
+ // 'aiimg_url': self.cur_select_img
|
|
|
+ },
|
|
|
+ success: (uploadFileRes) => {
|
|
|
+ console.log("uploadFile",obj);
|
|
|
+ self.is_up_img_file = false;
|
|
|
+ let obj = JSON.parse(uploadFileRes.data)
|
|
|
+ uni.showToast({
|
|
|
+ title:obj.message,
|
|
|
+ duration:1500
|
|
|
+ })
|
|
|
+
|
|
|
+ if(obj.code == 10000) {
|
|
|
+ let img_url = obj.content.surl
|
|
|
+ if(img_url == '') {
|
|
|
+ uni.showModal({
|
|
|
+ content:"图片链接为空",
|
|
|
+ showCancel:false
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 发送
|
|
|
+ self.sendSocketMessage(self.inputValue, img_url+" "+self.inputValue ,img_url)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ uni.showModal({
|
|
|
+ showCancel:false,
|
|
|
+ content:obj.msg
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
+ console.log('上传失败err=',err)
|
|
|
+ uni.showModal({
|
|
|
+ content:"上传失败",
|
|
|
+ showCancel:false
|
|
|
+ })
|
|
|
+ self.is_up_img_file = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ // if(this.cur_select_img==="../../static/import-img.png"){
|
|
|
+ // uni.showToast({
|
|
|
+ // title:"请选择图片"
|
|
|
+ // })
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if(this.diy_inputValue.length>0){
|
|
|
+ // this.is_show_import_img_view = false;
|
|
|
+ // let des_img = this.cur_select_img;
|
|
|
+ // this.sendSocketMessage(this.diy_inputValue,this.cur_select_img+" "+this.diy_inputValue,des_img)
|
|
|
+ // this.diy_inputValue = '';
|
|
|
+ // }else{
|
|
|
+ // uni.showToast({
|
|
|
+ // title:"请添加描述,只支持英文哦"
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|