Commit 49da6868 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/viitto/madara

parents 27d1f42c 9d0c39a9
......@@ -544,7 +544,37 @@ ipc.on('get-face', function(event, keyword) {
})
})
req.end()
})
ipc.on('get-url-info', function (event, url, id) {
let html = "",
list = [],
buffer = null,
newslist = [];
let req = https.request(url, function(res) {
res.on("data", function(data) {
list.push(data)
})
res.on("end", function() {
buffer = Buffer.concat(list)
html = buffer.toString()
let $ = cheerio.load(html)
let src = ""
if ($("img")) {
for (var i = 1; i <= 1; i++) {
$("img").each((index, ele) => {
src = $(ele).attr("data-original-src") ? $(ele).attr("data-original-src") : $(ele).attr("src")
})
}
}
let obj = {
text: $("title").text() ? $("title").text() : url,
img: src ? src : "http://imgfile.oytour.com/New/Upload/Cloud/2019-07/20190719083952562.png",
id: id
}
event.sender.send('show-url-info', obj)
})
})
req.end()
})
ipc.on('download', (evt, pdownloadpath, pfolderpath, dfileName, pmsgId) => {
try {
......
This diff is collapsed.
This diff is collapsed.
......@@ -21,6 +21,11 @@
<i class="iconfont iconkongjian" @click="changeMenu(2,'空间')"></i>
</el-tooltip>
</li>
<li :class="{'active':chosenState.val==3}">
<el-tooltip class="item" effect="dark" content="收藏" placement="right">
<i class="iconfont iconshoucang" @click="changeMenu(3,'收藏')"></i>
</el-tooltip>
</li>
</ul>
<div class="last">
<el-tooltip class="item" effect="dark" content="设置" placement="right">
......@@ -54,6 +59,7 @@
<msg :user=user v-show="chosenState.val==0"></msg>
<mail v-show="chosenState.val==1"></mail>
<empty v-show="chosenState.val==2"></empty>
<Collection v-if="chosenState.val==3"></Collection>
</div>
</div>
<user-card v-if='usercardInfo.searchName!=""' :usercard='usercardInfo'></user-card>
......@@ -66,13 +72,15 @@ import msg from './msssage/index'
import mail from './team/maillist'
import userCard from './team/usercard'
import empty from './tools/emptyPage'
import Collection from './tools/Collection'
import { setInterval } from 'timers'
export default {
components: {
msg,
mail,
userCard,
empty
empty,
Collection
},
data() {
return {
......
......@@ -32,10 +32,11 @@
<v-contextmenu-item @click="setClipboard" v-if="msg.type=='text' || msg.type=='image'">复制</v-contextmenu-item>
<v-contextmenu-item @click="selectText" v-if="msg.type=='text'">全部选择</v-contextmenu-item>
<v-contextmenu-item
v-if="msg.type=='image' || msg.type=='video' || msg.type=='audio'"
v-if="msg.type=='image' || msg.type=='video' || msg.type=='audio' || msg.type=='file'"
@click="downloadFile(msg,1)"
>另存为...</v-contextmenu-item>
<v-contextmenu-item @click="forwardMsg(msg)">转发</v-contextmenu-item>
<v-contextmenu-item v-if="msg.type !== 'custom-type4'" @click="Collection">收藏</v-contextmenu-item>
<v-contextmenu-item divider v-if="msg.flow==='out'"></v-contextmenu-item>
<v-contextmenu-item @click="revocateMsg" v-if="msg.flow==='out'">撤回消息</v-contextmenu-item>
</v-contextmenu>
......@@ -63,7 +64,9 @@
<img class="rili-img" src="http://staticfile.oytour.com/New/Upload/Cloud/2019-10/20191009110135253.png" alt="">
<el-row>
<el-col :span="18">
<p class="custom-type4-name">{{msg.emojiCnt.name}}</p>
<el-tooltip class="item" effect="dark" :content="msg.emojiCnt.name" placement="top">
<p class="custom-type4-name">{{msg.emojiCnt.name}}</p>
</el-tooltip>
<p class="custom-type4-type">の工作汇报</p>
<div class="custom-type4-time">
<img src="http://staticfile.oytour.com/New/Upload/Cloud/2019-10/20191009110135257.png" alt="">
......@@ -82,7 +85,9 @@
<img class="ren-img" src="http://staticfile.oytour.com/New/Upload/Cloud/2019-10/20191009110135341.png" alt="">
</el-col>
<el-col :span="18">
<p class="custom-type4-name">{{msg.emojiCnt.name}}</p>
<el-tooltip class="item" effect="dark" :content="msg.emojiCnt.name" placement="top">
<p class="custom-type4-name">{{msg.emojiCnt.name}}</p>
</el-tooltip>
<p class="custom-type4-type">の工作汇报</p>
<div class="custom-type4-time">
<img src="http://staticfile.oytour.com/New/Upload/Cloud/2019-10/20191009110135257.png" alt="">
......@@ -143,7 +148,7 @@
</div>
<audio ref="msgAudio" class="msgAudio" :src="msg.file.url"></audio>
</span>
<span v-else-if="msg.type==='file'" class="msg-text">
<span v-else-if="msg.type==='file'" class="msg-text" v-contextmenu:msg-contextmenu>
<div class="file-box">
<div class="split">
<div class="icon">
......@@ -198,6 +203,8 @@
import util from "../../../utils";
import config from "../../../configs";
import emojiObj from "../../../configs/emoji";
const reg = "^(?=^.{3,255}$)(http(s)?:\/\/)?(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/\w+\.\w+)*([\?&]\w+=\w*)*$"
export default {
props: {
type: String, // 类型,chatroom, session
......@@ -326,6 +333,44 @@ export default {
}); // end this.nextTick
},
methods: {
// 收藏
Collection: function(e){
let msg = this.msg
let sendMsg = {
PicURL: '',
URL: '',
Title: '',
Content: '',
FromUser: '',
CollectionType: '',
FromContent: JSON.stringify(msg)
}
if (msg.type === 'text') {
if(/.*[\u4e00-\u9fa5]+.*$/.test(msg.showText)) {
sendMsg.CollectionType = 3
} else if (msg.showText.match(new RegExp(reg,'i'))){
sendMsg.CollectionType = 1
} else {
sendMsg.CollectionType = 3
}
} else if (msg.type === 'image' || msg.type === 'video' || msg.type === 'custom-type1' || msg.type === 'custom-type3') {
sendMsg.CollectionType = 2
sendMsg.PicURL = msg.type === 'video' ? msg.file.url + '?V10086' : msg.originLink
} else {
sendMsg.Title = msg.file.icon
sendMsg.CollectionType = 4
sendMsg.PicURL = msg.fileLink
}
sendMsg.Content = msg.showText
sendMsg.FromUser = msg.fromNick
this.apipost("user_post_SetCollection", sendMsg, res => {
if (res.data.resultCode === 1) {
this.$message.success('收藏成功')
} else {
this.$message.error('操作失败')
}
}, err => {})
},
openWorkWin(id, time){
//打开工作日志详情窗口
let msg = {
......@@ -1375,6 +1420,11 @@ export default {
}
.custom-type4-out .custom-type4-name{
padding-left: 15px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.custom-type4-out .custom-type4-type{
padding-right: 40px;
......@@ -1400,6 +1450,11 @@ export default {
margin-bottom: 0;
font-weight: 600;
font-family: "pingfangR" !important;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
.custom-type4-type{
color: #E7AC5F;
......
......@@ -40,6 +40,7 @@ export default {
mounted() {
this.maxPage = Math.ceil(this.faces.length / 6);
this.init();
this.addTime()
},
methods: {
clearTime() {
......@@ -48,7 +49,7 @@ export default {
addTime() {
this.timer = setTimeout(() => {
this.close(0);
}, 1000 * 5);
}, 1000 * 4);
},
init() {
if (this.index >= 0 && this.index < this.maxPage) {
......
<template>
<div class="CollectionContentList">
<v-contextmenu ref="msg-contextmenu">
<v-contextmenu-item @click="">转发</v-contextmenu-item>
<v-contextmenu-item @click="">删除</v-contextmenu-item>
</v-contextmenu>
<ul>
<template v-for="item in showData" v-contextmenu:msg-contextmenu>
<listItem :item="item"/>
</template>
</ul>
</div>
</template>
<script>
import listItem from './CollectionContentListItem'
export default {
components: {
listItem
},
props:{
showData: {
type: Array,
default: []
},
},
data(){
return{
}
},mounted() {
},methods: {
}
}
</script>
<style>
.CollectionContentList ul{
padding: 0;
}
.CollectionContentList p{
margin: 0;
padding: 0;
}
.CollectionContentList ul li{
list-style: none;
padding: 15px 0;
border-bottom: 1px solid rgb(231, 231, 231);
}
.CollectionContentList{
padding: 0 60px;
position: absolute;
top: 0px;
left: 240px;
right: 0;
bottom: 0px;
cursor: default;
overflow: auto;
}
.CollectionContentList .item {
cursor: pointer;
}
.CollectionContentList .item .images img{
width: 120px;
height: 60px;
}
.CollectionContentList .from-date p{
text-align: right;
font-size: 12px;
}
.CollectionContentList .from-date p:nth-child(1){
margin-bottom: 5px;
}
.CollectionContentList .item .file{
display: flex;
}
.CollectionContentList .item .file i.iconfont{
font-size: 56px;
padding-right: 10px;
color: rgb(71, 140, 255)
}
.file-name{
color: #111;
font-size: 14px;
}
.CollectionContentList .item .https{
display: flex;
}
.CollectionContentList .item .https .https-img{
width: 60px;
height: 60px;
font-size: 28px;
background-color: rgb(232, 232, 232);
margin-right: 10px;
flex:0 0 auto;
display: flex;
align-items: center;
justify-content: center;
}
.text-row1{
overflow: hidden;
white-space: normal;
word-break: break-all;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
</style>
\ No newline at end of file
<template>
<li v-contextmenu:msg-contextmenu @click="preview">
<v-contextmenu ref="msg-contextmenu">
<v-contextmenu-item @click="forwardMsg">转发</v-contextmenu-item>
<v-contextmenu-item @click="deleteCollection(item.ID)">删除</v-contextmenu-item>
</v-contextmenu>
<el-row class="item" :gutter="30">
<el-col :span="16">
<div class="images" v-if="item.CollectionType === 2">
<img :src="imgUrl" alt="">
</div>
<div class="file" v-if="item.CollectionType === 4">
<div class="fileIcon" :class="[item.Title]"></div>
<div>
<el-tooltip popper-class="tooltip-item" effect="dark" :content="item.Content" placement="top">
<p class="text-row1 file-name">{{item.Content}}</p>
</el-tooltip>
<!-- <p>56.8K</p> -->
</div>
</div>
<div class="file" v-if="item.CollectionType === 3 || item.CollectionType === 1">
<div class="images" style="margin-right: 10px" v-if="item.CollectionType === 1">
<img :src="addrObj.img" alt="">
</div>
<div>
<el-tooltip popper-class="tooltip-item" effect="dark" :content="item.Content" placement="top">
<p v-if="item.CollectionType !== 1" class="text-row1 file-name">{{item.Content}}</p>
</el-tooltip>
<el-tooltip popper-class="tooltip-item" effect="dark" :content="addrObj.text" placement="top">
<p v-if="item.CollectionType === 1" class="text-row1 file-name">{{addrObj.text}}</p>
</el-tooltip>
</div>
</div>
</el-col>
<el-col :span="8" class="from-date">
<!-- <p>今天</p> -->
<p class="text-row1">来自:{{item.FromUser}}</p>
</el-col>
<video v-if="url!==''" id="video" :src="url" controls="controls" ></video>
</el-row>
</li>
</template>
<script>
export default {
props:{
item: {
type: Object,
default: {}
},
},
data(){
return{
url: '',
imgUrl: '',
addrObj: {
text: '',
img: '',
id: 0
},
}
}, watch: {
item(newVal, oldVal) {
console.log(newVal)
this.setData()
}
},mounted() {
this.setData()
},
methods: {
setData: function (){
if (this.item.CollectionType === 2) {
let url = this.item.PicURL
this.imgUrl = ''
let _this = this
if (url.indexOf('V10086') !== -1){
this.url = url
let scale = 0.8
setTimeout(()=>{
let video = document.getElementById("video");
var canvas = document.createElement("canvas");//创建一个canvas
canvas.width = video.videoWidth * scale;//设置canvas的宽度为视频的宽度
canvas.height = video.videoHeight * scale;//设置canvas的高度为视频的高度
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);//绘制图像
_this.imgUrl = canvas.toDataURL("image/png");//将绘制的图像用img显示出来
}, 500)
} else {
this.imgUrl = this.item.PicURL
}
} else if (this.item.CollectionType === 1) {
this.$electron.ipcRenderer.send("get-url-info", this.item.Content, this.item.ID)
this.$electron.ipcRenderer.on('show-url-info', (event, html) => {
if(html.id === this.item.ID) {
this.addrObj = html
this.$forceUpdate()
}
})
}
},
// 转发
forwardMsg: function(){
let msg = JSON.parse(this.item.FromContent)
this.MsgBus.$emit("forward",msg);
},
// 预览
preview: function () {
let url = this.item.PicURL
let name = this.item.Content
let openUrl = ''
if (this.item.CollectionType === 2) { // 图片、视频
if (url.indexOf('V10086') !== -1){
this.$electron.ipcRenderer.send("openPreviwerVideo", url);
} else {
this.$electron.ipcRenderer.send("openPreviwerImg", url);
}
} else if (this.item.CollectionType === 4) { // 文件
if (/(.doc|.docx|.xls|.xlsx|.ppt|.pptx)/i.test(name)) {
openUrl = `https://view.officeapps.live.com/op/view.aspx?src=${url}`;
} else if (/(.pdf|.txt)/i.test(name)) {
openUrl = `http://reborn.oytour.com/plug/pdf/web/viewer.html?file=${url}`;
}
this.$electron.ipcRenderer.send("openPreviwerfile", openUrl);
} else if (this.item.CollectionType === 1) { //网址
let url = this.item.Content;
this.$electron.ipcRenderer.send("openUrl", url);
}
},
// 删除
deleteCollection: function(id){
this.apipost("user_post_RemoveCollection", {ID: id}, res => {
if (res.data.resultCode === 1) {
this.$message.success('操作成功')
this.MsgBus.$emit('get-collection-list')
} else {
this.$message.error('操作失败')
}
}, err => {})
}
}, beforeDestroy() {
// 重复图片问题解决方案
// 事件处理中心msgBus,vue页面销毁后,原先的监听事件并没有销毁,导致组件再次载入的时候会重复相同的事件监听,所以当组件销毁时同时需要在 beforeDestroy 钩子中销毁对应的事件监听!!!
this.$electron.ipcRenderer.removeAllListeners(['show-url-info'])
}
}
</script>
<style>
#video{
position: absolute;
left: -999px;
top: -999px
}
.fileIcon{
width: 60px;
height: 60px;
}
.tooltip-item{
max-width: 300px;
}
</style>
\ No newline at end of file
<template>
<div class="CollectionSearchBox">
<div class="search__session__box">
<div class="seach_ctr">
<span class="seach__item__icon">
<i class="iconfont iconsearch"></i>
</span>
<input type="text" placeholder="搜2索" class="seach__item__input">
</div>
</div>
<ul class="type-box">
<li v-for="item in list" @click="switchType(item)" :class="{active: activeID === item.id}">
<div>
<i :class="[item.icon, 'iconfont']"></i>
<span>{{item.name}}</span>
</div>
</li>
</ul>
</div>
</template>
<script>
export default {
props:{
list: {
type: Array,
default: []
},
activeID: {
type: Number,
default: 0
}
},
data(){
return{
}
},mounted() {
},methods: {
switchType: function (obj){
this.$emit("changeType", obj.id)
}
}
}
</script>
<style>
.CollectionSearchBox{
position: absolute;
left: 0;
width: 240px;
bottom: 0;
top: 0px;
box-sizing: border-box;
border-right: 1px solid #eee;
}
.CollectionSearchBox .search__session__box {
margin-top: 12px;
padding: 0 20px;
display: flex;
}
.CollectionSearchBox .search__session__box .seach_ctr {
flex: 1;
position: relative;
}
.CollectionSearchBox .search__session__box .seach_ctr .seach__item__input {
width: 100%;
text-indent: 23px;
height: 23px;
line-height: 23px;
border: none;
border-bottom: 1px solid #ddd;
outline: none;
font-size: 14px;
color: #000;
background: transparent;
box-sizing: border-box;
}
.CollectionSearchBox .search__session__box .seach_ctr .seach__item__input:focus {
border-bottom: 1px solid #999;
}
.CollectionSearchBox .search__session__box .seach_ctr .seach__item__icon {
font-size: 14px;
color: #999;
position: absolute;
top: 2px;
left: 0;
}
.CollectionSearchBox .type-box{
padding: 0;
}
.CollectionSearchBox .type-box li{
list-style: none;
padding: 7px 20px;
cursor: pointer;
}
.CollectionSearchBox .type-box li.active{
background-color: rgb(196, 196, 196);
}
.CollectionSearchBox .type-box li:hover{
background-color: rgb(218, 218, 218);
}
.CollectionSearchBox .type-box li div{
display: flex;
align-items: center;
}
.CollectionSearchBox .type-box li div i.iconfont{
color: #555;
font-size: 20px;
padding-right: 15px;
}
.CollectionSearchBox .type-box li div span{
color: #333;
font-size: 14px;
}
</style>
\ No newline at end of file
<template>
<div>
<searchBox :list="list" :activeID="activeID" @changeType="changeType"/>
<contentList :showData="showData" :loading="loading"/>
</div>
</template>
<script>
import searchBox from '../team/CollectionSearchBox'
import contentList from '../team/CollectionContentList'
export default {
components: {
searchBox,
contentList
},
data(){
return{
activeID: 0,
list: [
{
id: 0,
name: '全部收藏',
icon: 'iconquanbu'
},
{
id: 1,
name: '链接',
icon: 'iconlianjie'
},
{
id: 2,
name: '相册',
icon: 'iconshangchuanzhaopian'
},
{
id: 4,
name: '文件',
icon: 'iconwenjian'
}
,
{
id: 3,
name: '笔记',
icon: 'iconwenjian'
}
],
dataList: [],
showData: [],
loading: false,
}
},mounted() {
this.getDataList()
let _this = this
this.MsgBus.$on('get-collection-list', function (){
_this.getDataList()
_this.activeID = 0
})
},methods: {
//获取数据
getDataList: function (){
this.loading = true
this.apipost("user_post_GetCollectionList", {}, res => {
if (res.data.resultCode === 1) {
this.showData = res.data.data
this.dataList = res.data.data
} else {
this.$message.error('操作失败')
}
this.loading = false
}, err => {})
},
// 改变收藏类型
changeType: function (id){
this.showData = []
this.activeID = id;
if (id === 0) {
this.showData = this.dataList
} else {
let data = []
this.dataList.map(x=>{
if (x.CollectionType === id) {
data.push(x)
}
})
this.showData = data
}
}
}
}
</script>
<style>
@import url("../../assets/css/icon.css");
</style>
\ No newline at end of file
......@@ -62,6 +62,16 @@ export default new Router({
path: '/forwardMsg',
name: 'forwardMsg',
component: require('@/components/team/forwardMsg')
},
{
path: '/CollectionContentList',
name: 'CollectionContentList',
component: require('@/components/team/CollectionContentList')
},
{
path: '/CollectionSearchBox',
name: 'CollectionSearchBox',
component: require('@/components/team/CollectionSearchBox')
}
]
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment