处理图片链接
This commit is contained in:
@ -83,3 +83,11 @@ export function getCityByLevel(params) {
|
|||||||
params
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 中转图片
|
||||||
|
export function handlePic(data) {
|
||||||
|
return request({
|
||||||
|
url: '/mobile/handlePic',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -1,12 +1,33 @@
|
|||||||
export function formatRichText(url) {
|
import { handlePic } from '@/api/policy/library';
|
||||||
let src = document.querySelectorAll('#text .ql-editor img');
|
export function formatRichText(url, id) {
|
||||||
console.log(src);
|
// let src = document.querySelectorAll('#text .ql-editor img');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要判断域名存不存在
|
||||||
|
*/
|
||||||
|
|
||||||
|
let status = true;
|
||||||
|
let src = document.querySelectorAll('#text img');
|
||||||
|
let endUrl = [];
|
||||||
for (let i = 0; i < src.length; i++) {
|
for (let i = 0; i < src.length; i++) {
|
||||||
const string = src[i].getAttribute('src');
|
const string = src[i].getAttribute('src');
|
||||||
const flag = string.includes('http://');
|
endUrl.push(string);
|
||||||
if (!flag) src[i].setAttribute('src', url + string);
|
|
||||||
}
|
}
|
||||||
let src2 = document.querySelectorAll('#text .ql-editor a');
|
if (endUrl.length) {
|
||||||
|
const data = {
|
||||||
|
startUrl: url,
|
||||||
|
policyId: id,
|
||||||
|
endUrl
|
||||||
|
};
|
||||||
|
handlePic(data).then(({ data: res }) => {
|
||||||
|
console.log(res);
|
||||||
|
for (let i = 0; i < src.length; i++) {
|
||||||
|
src[i].setAttribute('src', res[i].name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// let src2 = document.querySelectorAll('#text .ql-editor a');
|
||||||
|
let src2 = document.querySelectorAll('#text a');
|
||||||
for (let i = 0; i < src2.length; i++) {
|
for (let i = 0; i < src2.length; i++) {
|
||||||
const string = src2[i].getAttribute('href');
|
const string = src2[i].getAttribute('href');
|
||||||
const flag = string.includes('http://');
|
const flag = string.includes('http://');
|
||||||
|
@ -73,10 +73,11 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="正文" prop="text">
|
<el-form-item label="正文" prop="text">
|
||||||
<div id="text">
|
<div id="text">
|
||||||
<editor v-model="ruleForm.text" :min-height="192" />
|
<editor v-model="ruleForm.text" :min-height="192" v-if="!editPage" />
|
||||||
|
<el-input v-html="ruleForm.text" v-else></el-input>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="附件">
|
<el-form-item label="附件" v-if="ruleForm.method !== 1">
|
||||||
<!-- <el-upload
|
<!-- <el-upload
|
||||||
action="https://jsonplaceholder.typicode.com/posts/"
|
action="https://jsonplaceholder.typicode.com/posts/"
|
||||||
:on-preview="handlePreview"
|
:on-preview="handlePreview"
|
||||||
@ -100,8 +101,9 @@
|
|||||||
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
||||||
</el-upload> -->
|
</el-upload> -->
|
||||||
|
|
||||||
<el-button type="info" size="small" @click="upload.open = true">添加附件</el-button>
|
<el-button type="info" size="small" @click="upload.open = true"
|
||||||
|
>添加附件</el-button
|
||||||
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="ruleForm.method !== 1">
|
<el-form-item v-if="ruleForm.method !== 1">
|
||||||
<!-- <el-form-item v-if="!editPage"> -->
|
<!-- <el-form-item v-if="!editPage"> -->
|
||||||
@ -111,16 +113,32 @@
|
|||||||
<!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
|
<!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
<el-dialog
|
||||||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls, .docx" :headers="upload.headers"
|
:title="upload.title"
|
||||||
:action="upload.url" :disabled="upload.isUploading"
|
:visible.sync="upload.open"
|
||||||
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
width="400px"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
:limit="1"
|
||||||
|
accept=".xlsx, .xls, .docx"
|
||||||
|
:headers="upload.headers"
|
||||||
|
:action="upload.url"
|
||||||
|
:disabled="upload.isUploading"
|
||||||
|
:on-progress="handleFileUploadProgress"
|
||||||
|
:on-success="handleFileSuccess"
|
||||||
|
:auto-upload="false"
|
||||||
|
drag
|
||||||
|
>
|
||||||
<i class="el-icon-upload"></i>
|
<i class="el-icon-upload"></i>
|
||||||
<div class="el-upload__text">
|
<div class="el-upload__text">
|
||||||
将文件拖到此处,或
|
将文件拖到此处,或
|
||||||
<em>点击上传</em>
|
<em>点击上传</em>
|
||||||
</div>
|
</div>
|
||||||
<div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
|
<div class="el-upload__tip" style="color: red" slot="tip">
|
||||||
|
提示:仅允许导入“xls”或“xlsx”格式文件!
|
||||||
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||||
@ -131,7 +149,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Editor from '@/components/Editor';
|
import Editor from '@/components/Editor';
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from '@/utils/auth';
|
||||||
import { addPolicy, updatePolicy, getPolicyInfo } from '@/api/policy/library';
|
import { addPolicy, updatePolicy, getPolicyInfo } from '@/api/policy/library';
|
||||||
import { getCityByLevel } from '@/api/policy/library';
|
import { getCityByLevel } from '@/api/policy/library';
|
||||||
export default {
|
export default {
|
||||||
@ -144,13 +162,13 @@ export default {
|
|||||||
// 是否显示弹出层(用户导入)
|
// 是否显示弹出层(用户导入)
|
||||||
open: false,
|
open: false,
|
||||||
// 弹出层标题(用户导入)
|
// 弹出层标题(用户导入)
|
||||||
title: "添加附件",
|
title: '添加附件',
|
||||||
// 是否禁用上传
|
// 是否禁用上传
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: { Authorization: "Bearer " + getToken() },
|
headers: { Authorization: 'Bearer ' + getToken() },
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
url: process.env.VUE_APP_BASE_API + "/minio/upload"
|
url: process.env.VUE_APP_BASE_API + '/minio/upload',
|
||||||
},
|
},
|
||||||
editPage: false,
|
editPage: false,
|
||||||
ruleForm: {
|
ruleForm: {
|
||||||
@ -232,7 +250,7 @@ export default {
|
|||||||
this.msgSuccess(message);
|
this.msgSuccess(message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
} else {
|
} else {
|
||||||
console.log('error submit!!');
|
console.log('error submit!!');
|
||||||
return false;
|
return false;
|
||||||
@ -248,11 +266,13 @@ export default {
|
|||||||
},
|
},
|
||||||
// 文件上传成功处理
|
// 文件上传成功处理
|
||||||
handleFileSuccess(response, file, fileList) {
|
handleFileSuccess(response, file, fileList) {
|
||||||
this.ruleForm.text+=`<div>附件<a href="${response.data.url}">${response.data.name}</a></div>`
|
this.ruleForm.text += `<div>附件<a href="${response.data.url}">${response.data.name}</a></div>`;
|
||||||
this.upload.open = false;
|
this.upload.open = false;
|
||||||
this.upload.isUploading = false;
|
this.upload.isUploading = false;
|
||||||
this.$refs.upload.clearFiles();
|
this.$refs.upload.clearFiles();
|
||||||
this.$alert(response.message, "导入结果", { dangerouslyUseHTMLString: true });
|
this.$alert(response.message, '导入结果', {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 提交上传文件
|
// 提交上传文件
|
||||||
submitFileForm() {
|
submitFileForm() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container" style="background-color:#e6e6e6;">
|
<div class="app-container" style="background-color: #e6e6e6">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<div class="box_l">
|
<div class="box_l">
|
||||||
@ -12,23 +12,24 @@
|
|||||||
>
|
>
|
||||||
<div class="user_item_l">
|
<div class="user_item_l">
|
||||||
<div class="el-avatar">
|
<div class="el-avatar">
|
||||||
<span :class="item.status?'el-avatar2':''"></span>
|
<span
|
||||||
<img :src="item.icon" alt="">
|
:class="item.status ? 'el-avatar2' : ''"
|
||||||
|
v-if="item.msgNoReadCount != 0"
|
||||||
|
></span>
|
||||||
|
<img :src="item.icon" alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="phone">{{ item.username }}</div>
|
<div class="phone">{{ item.username }}</div>
|
||||||
<div class="company">科大讯飞股份有限公司</div>
|
<div class="company">{{ num }}--msgNoReadCount:{{item.msgNoReadCount}}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="user_item_r">
|
<div class="user_item_r">14:19</div>
|
||||||
14:19
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="18">
|
<el-col :span="18">
|
||||||
<div class="box_r">
|
<div class="box_r">
|
||||||
<div class="box" v-if="!activeId">
|
<!-- <div class="box" v-if="!activeId">
|
||||||
<div class="famous-box">
|
<div class="famous-box">
|
||||||
<img src="~@/assets/image/chat.png" width="300" />
|
<img src="~@/assets/image/chat.png" width="300" />
|
||||||
<p>
|
<p>
|
||||||
@ -37,9 +38,9 @@
|
|||||||
加油吧! ......
|
加油吧! ......
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="box" v-else>
|
<div class="box">
|
||||||
<div id="content" class="content">
|
<div id="content" class="content" @scroll="scroll">
|
||||||
<div v-for="(item, index) in info" :key="index">
|
<div v-for="(item, index) in info" :key="index">
|
||||||
<div class="info_r info_default" v-if="item.type == 'leftinfo'">
|
<div class="info_r info_default" v-if="item.type == 'leftinfo'">
|
||||||
<span class="circle circle_r"></span>
|
<span class="circle circle_r"></span>
|
||||||
@ -72,13 +73,21 @@
|
|||||||
<div class="setproblem">
|
<div class="setproblem">
|
||||||
<textarea
|
<textarea
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
style="height: 100%;width: 100%;resize:none;padding-right:125px;outline: none;border-color:#ccc;border-radius:5px;"
|
style="
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
resize: none;
|
||||||
|
padding-right: 125px;
|
||||||
|
outline: none;
|
||||||
|
border-color: #ccc;
|
||||||
|
border-radius: 5px;
|
||||||
|
"
|
||||||
id="text"
|
id="text"
|
||||||
v-model="customerText"
|
v-model="customerText"
|
||||||
@keyup.enter="sentMsg()"
|
@keyup.enter="sentMsg()"
|
||||||
></textarea>
|
></textarea>
|
||||||
<button @click="sentMsg()" class="setproblems">
|
<button @click="sentMsg()" class="setproblems">
|
||||||
<span style="vertical-align: 4px;">发 送</span>
|
<span style="vertical-align: 4px">发 送</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -89,10 +98,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getUsers} from '@/api/service'
|
import { getUsers } from '@/api/service';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
num: 0,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@ -100,7 +110,7 @@ export default {
|
|||||||
a: {},
|
a: {},
|
||||||
total: 0,
|
total: 0,
|
||||||
userList: [],
|
userList: [],
|
||||||
activeId: null,
|
activeId: '1424606573631770624',
|
||||||
customerText: '',
|
customerText: '',
|
||||||
info: [
|
info: [
|
||||||
// {
|
// {
|
||||||
@ -119,29 +129,29 @@ export default {
|
|||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
content: '注册网站时需要一次填写完所有的客户资料吗',
|
content: '注册网站时需要一次填写完所有的客户资料吗',
|
||||||
index: 4
|
index: 4,
|
||||||
},
|
},
|
||||||
{ id: 5, content: '注册时使用的手机号变更怎么办', index: 5 }
|
{ id: 5, content: '注册时使用的手机号变更怎么办', index: 5 },
|
||||||
],
|
],
|
||||||
robotAnswer: [
|
robotAnswer: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
content:
|
content:
|
||||||
'答案客户资料完善后是由谁来审批,答案客户资料完善后是由谁来审批,答案客户资料完善后是由谁来审批',
|
'答案客户资料完善后是由谁来审批,答案客户资料完善后是由谁来审批,答案客户资料完善后是由谁来审批',
|
||||||
index: 1
|
index: 1,
|
||||||
},
|
},
|
||||||
{ id: 2, content: '测试', index: 2 },
|
{ id: 2, content: '测试', index: 2 },
|
||||||
{ id: 3, content: '测试', index: 3 },
|
{ id: 3, content: '测试', index: 3 },
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
content: '3333333',
|
content: '3333333',
|
||||||
index: 4
|
index: 4,
|
||||||
},
|
},
|
||||||
{ id: 5, content: '44444444', index: 5 }
|
{ id: 5, content: '44444444', index: 5 },
|
||||||
],
|
],
|
||||||
textarea: '',
|
textarea: '',
|
||||||
path: 'ws://192.168.0.125:1919/webStock/' + this.$store.state.user.userId,
|
path: 'ws://192.168.0.125:1919/webStock/' + this.$store.state.user.userId,
|
||||||
socket: ''
|
socket: '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -151,15 +161,19 @@ export default {
|
|||||||
// this.userList = data.list
|
// this.userList = data.list
|
||||||
// this.total = data.total
|
// this.total = data.total
|
||||||
// })
|
// })
|
||||||
this.getUserList()
|
this.getUserList();
|
||||||
},
|
},
|
||||||
created() {},
|
created() {},
|
||||||
methods: {
|
methods: {
|
||||||
|
scroll(e) {
|
||||||
|
// console.log(e.srcElement.scrollTop);
|
||||||
|
this.num = e.srcElement.scrollTop;
|
||||||
|
},
|
||||||
getUserList() {
|
getUserList() {
|
||||||
getUsers(this.queryParams).then(({ data }) => {
|
getUsers(this.queryParams).then(({ data }) => {
|
||||||
this.userList = data.list
|
this.userList = data.list;
|
||||||
this.total = data.total
|
this.total = data.total;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 用户发送消息
|
// 用户发送消息
|
||||||
sentMsg() {
|
sentMsg() {
|
||||||
@ -169,7 +183,7 @@ export default {
|
|||||||
var obj = {
|
var obj = {
|
||||||
type: 'rightinfo',
|
type: 'rightinfo',
|
||||||
time: this.getTodayTime(),
|
time: this.getTodayTime(),
|
||||||
content: text
|
content: text,
|
||||||
};
|
};
|
||||||
this.info.push(obj);
|
this.info.push(obj);
|
||||||
this.appendRobotMsg(this.customerText);
|
this.appendRobotMsg(this.customerText);
|
||||||
@ -274,7 +288,7 @@ export default {
|
|||||||
getMessage(msg) {
|
getMessage(msg) {
|
||||||
console.log(msg.data);
|
console.log(msg.data);
|
||||||
console.log(JSON.parse(msg.data));
|
console.log(JSON.parse(msg.data));
|
||||||
this.a = JSON.parse(msg.data)
|
this.a = JSON.parse(msg.data);
|
||||||
// sendUserId
|
// sendUserId
|
||||||
},
|
},
|
||||||
send: function (params) {
|
send: function (params) {
|
||||||
@ -282,12 +296,13 @@ export default {
|
|||||||
},
|
},
|
||||||
close: function () {
|
close: function () {
|
||||||
console.log('socket已经关闭');
|
console.log('socket已经关闭');
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
|
console.log('out');
|
||||||
// 销毁监听
|
// 销毁监听
|
||||||
this.socket.onclose = this.close;
|
this.socket.onclose = this.close;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user