|
@@ -14,7 +14,7 @@
|
|
|
<view class="message" :class="[item.userType]">
|
|
<view class="message" :class="[item.userType]">
|
|
|
<image :src="chatData.service" v-if="item.userType === 'friend'" class="avatar" mode="widthFix"></image>
|
|
<image :src="chatData.service" v-if="item.userType === 'friend'" class="avatar" mode="widthFix"></image>
|
|
|
<view class="message-con">
|
|
<view class="message-con">
|
|
|
- <view v-if="item.msgType == 'text'">
|
|
|
|
|
|
|
+ <view v-if="item.msgType == 'text'" @click="clickText(item.content)">
|
|
|
<view v-html="renderTextMessage(item.content)"></view>
|
|
<view v-html="renderTextMessage(item.content)"></view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="m-address" v-if="item.msgType == 'address'">
|
|
<view class="m-address" v-if="item.msgType == 'address'">
|
|
@@ -125,16 +125,18 @@ export default {
|
|
|
screenWidth:0,
|
|
screenWidth:0,
|
|
|
pushData: {
|
|
pushData: {
|
|
|
obj:null,
|
|
obj:null,
|
|
|
- auth:"http://192.168.2.142:9881/plugin/webman/push/auth",
|
|
|
|
|
- url: 'ws://192.168.2.142:3131',
|
|
|
|
|
|
|
+ auth:"http://192.168.3.16:9881/plugin/webman/push/auth",
|
|
|
|
|
+ url: 'ws://192.168.3.16:3131',
|
|
|
},
|
|
},
|
|
|
isFocus:false,
|
|
isFocus:false,
|
|
|
chatData:{
|
|
chatData:{
|
|
|
userId:"",
|
|
userId:"",
|
|
|
self:"",
|
|
self:"",
|
|
|
- service:""
|
|
|
|
|
|
|
+ service:"",
|
|
|
|
|
+ serviceId:0, // 客服ID
|
|
|
},
|
|
},
|
|
|
isServiceUser:0, // 1已转人工 0未转人工
|
|
isServiceUser:0, // 1已转人工 0未转人工
|
|
|
|
|
+ quickData:{}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onLoad() {
|
|
onLoad() {
|
|
@@ -167,6 +169,20 @@ export default {
|
|
|
previewImg(data){
|
|
previewImg(data){
|
|
|
return openimg(1,[data])
|
|
return openimg(1,[data])
|
|
|
},
|
|
},
|
|
|
|
|
+ clickText(text){
|
|
|
|
|
+ const regex = /(1[3-9]\d{9})|(\d{3,4}-\d{7,8})|(\d{7,12})/g;
|
|
|
|
|
+ const matches = text.match(regex);
|
|
|
|
|
+ if (!matches) return ;
|
|
|
|
|
+ uni.makePhoneCall({
|
|
|
|
|
+ phoneNumber:matches[0],
|
|
|
|
|
+ success() {
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ fail(){
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
async getServiceData(){
|
|
async getServiceData(){
|
|
|
var formData = {};
|
|
var formData = {};
|
|
|
const tokenPoi = uni.getStorageSync("contact");
|
|
const tokenPoi = uni.getStorageSync("contact");
|
|
@@ -185,9 +201,11 @@ export default {
|
|
|
app.chatData.userId = resp.data.userId;
|
|
app.chatData.userId = resp.data.userId;
|
|
|
app.chatData.self = resp.data.avatar;
|
|
app.chatData.self = resp.data.avatar;
|
|
|
app.chatData.service = resp.data.service;
|
|
app.chatData.service = resp.data.service;
|
|
|
|
|
+ app.chatData.serviceId = resp.data.chat_id;
|
|
|
var msgData = resp.data.msg.data;
|
|
var msgData = resp.data.msg.data;
|
|
|
var pushData = [];
|
|
var pushData = [];
|
|
|
var quickData = resp.data.quick;
|
|
var quickData = resp.data.quick;
|
|
|
|
|
+ app.quickData = quickData
|
|
|
pushData.push({
|
|
pushData.push({
|
|
|
content: quickData.star_msg,
|
|
content: quickData.star_msg,
|
|
|
userType: 'friend',
|
|
userType: 'friend',
|
|
@@ -366,6 +384,13 @@ export default {
|
|
|
},
|
|
},
|
|
|
async sendingText(){
|
|
async sendingText(){
|
|
|
if (app.text === '') return ;
|
|
if (app.text === '') return ;
|
|
|
|
|
+ console.log("app.chatData.serviceId",app.chatData.serviceId)
|
|
|
|
|
+ if (app.chatData.serviceId == 0) {
|
|
|
|
|
+ app.text = ''
|
|
|
|
|
+ app.sendMessage(app.quickData.unline_msg,"text",'friend');
|
|
|
|
|
+ app.scrollToBottom()
|
|
|
|
|
+ return ;
|
|
|
|
|
+ }
|
|
|
app.msgData.isSend = true;
|
|
app.msgData.isSend = true;
|
|
|
const sendMsg = app.text;
|
|
const sendMsg = app.text;
|
|
|
app.text = ''
|
|
app.text = ''
|
|
@@ -374,6 +399,7 @@ export default {
|
|
|
formData.groupId = tokenPoi.poi_id;
|
|
formData.groupId = tokenPoi.poi_id;
|
|
|
formData.type = "text";
|
|
formData.type = "text";
|
|
|
formData.content = sendMsg;
|
|
formData.content = sendMsg;
|
|
|
|
|
+ formData.chatId = app.chatData.serviceId;
|
|
|
var resp = await app.$api.chat.sendText.post(formData);
|
|
var resp = await app.$api.chat.sendText.post(formData);
|
|
|
app.msgData.isSend = false;
|
|
app.msgData.isSend = false;
|
|
|
if (resp.code == 0) {
|
|
if (resp.code == 0) {
|
|
@@ -382,10 +408,10 @@ export default {
|
|
|
app.sendMessage(sendMsg,"text");
|
|
app.sendMessage(sendMsg,"text");
|
|
|
app.scrollToBottom()
|
|
app.scrollToBottom()
|
|
|
},
|
|
},
|
|
|
- sendMessage(content,type){
|
|
|
|
|
|
|
+ sendMessage(content,type,user = "self"){
|
|
|
const message = {
|
|
const message = {
|
|
|
content: content,
|
|
content: content,
|
|
|
- userType: 'self',
|
|
|
|
|
|
|
+ userType: user,
|
|
|
avatar: "/static/logo.jpg",
|
|
avatar: "/static/logo.jpg",
|
|
|
msgType:type,
|
|
msgType:type,
|
|
|
list:[],
|
|
list:[],
|
|
@@ -416,6 +442,7 @@ export default {
|
|
|
const tokenPoi = uni.getStorageSync("contact");
|
|
const tokenPoi = uni.getStorageSync("contact");
|
|
|
formData.groupId = tokenPoi.poi_id;
|
|
formData.groupId = tokenPoi.poi_id;
|
|
|
formData.type = "image";
|
|
formData.type = "image";
|
|
|
|
|
+ formData.chatId = app.chatData.serviceId;
|
|
|
var resp = await app.$api.chat.sendImage.post({'path':file.path,"param":formData});
|
|
var resp = await app.$api.chat.sendImage.post({'path':file.path,"param":formData});
|
|
|
var respData = JSON.parse(resp);
|
|
var respData = JSON.parse(resp);
|
|
|
app.msgData.isSend = false;
|
|
app.msgData.isSend = false;
|