提交修改

This commit is contained in:
daihh
2022-11-14 14:20:41 +08:00
parent f098615ec5
commit 4bbb616a1d
4 changed files with 149 additions and 36 deletions

View File

@@ -1,19 +1,28 @@
<template>
<view>
<u-toast ref="messager"></u-toast>
<u-toast ref="messager" style="z-index:100090"></u-toast>
<!--分享窗口-->
<u-popup :show="show" @close="closeShare" @open="openShare" mode="bottom">
<view style="padding: 10px 20px;line-height: 60upx;">
<view style="padding: 10upx;">请输入要分享给人的姓名</view>
<u-popup :show="show" :closeOnClickOverlay="false" @close="closeShare" :round="14" @open="openShare" mode="bottom">
<view style="padding: 20px 20px;line-height: 60upx;">
<view style="padding: 30upx 20upx;color:#666666;text-align: center;">
<text>请输入要分享给人的姓名/工号</text>
<text @click="closeShare" style="float: right;"><image src="/static/images/close.png" style="width: 50upx;height: 50upx;"></image> </text>
</view>
<view style="padding: 10upx;">
<u--input placeholder="请输入人员姓名" border="surround" v-model="keyword"></u--input>
<u-search @search="findUsers()" height="40px" bgColor="#ffffff" borderColor="rgba(153,153,153,0.3)" :showAction="false" shape="round" v-model="keyword" placeholder="姓名/工号"></u-search>
</view>
<view style="padding-top:20upx;">
<!-- <view style="padding-top:20upx;">
<u-button @click="findUsers()" type="primary" text="查询"></u-button>
</view>
</view> -->
<view style="padding-top: 50upx;">
<!--查询内容列表-->
<view style="line-height: 60upx;" v-for="(su,suidx) in users" :key="suidx" @click="confirmShare(su)">{{suidx+1}}, {{su.name}} {{su.code}}</view>
<view v-if="users.length>0" style="overflow-x: auto;height: 160upx;white-space: nowrap;overflow-y: hidden;">
<view style="line-height: 60upx;display: inline-block;margin: 10upx;" v-for="(su,suidx) in users" :key="suidx" @click="confirmShare(su)">
<view style="text-align: center;"><!--用户头像-->
<image src="/static/images/man.png" shape="circle" style="width: 80upx;height: 80upx;"></image>
</view>
<view style="text-align: center;font-size: 22upx;">{{su.name}}({{su.code}})</view>
</view>
</view>
</view>
</view>
</u-popup>
@@ -22,6 +31,8 @@
<script>
import apiShares from '@/api/modules/shares.js'
import apiUser from '@/api/system/user.js'
import apiMessage from '@/api/system/message.js'
import { mapGetters } from 'vuex';
export default {
props: {
@@ -51,13 +62,42 @@
}
},
methods:{
messageSave(refId,title,sendName,acceptName,acceptId,typeText){
let content='';
let conType;
if(this.type==1){ content='课程'; conType = this.data.type; }
if(this.type==2){ content='文章' }
if(this.type==3){ content='案例' }
if(this.type==4){ content='问答' }
content=sendName+typeText+content+'-'+title
let message={
content,
refId,
refType:this.type,
sendName,
acceptName,
acceptId,
title:'系统消息',
sendType:1,
conType,
content,
source:1,
sendAid:this.userInfo.aid,
}
apiMessage.save(message).then(res=>{
if(res.status==200){
}
})
},
openShare(){
this.show=true;
},
findUsers(){
this.users=[];
if(!this.keyword){
return this.$refs.messager.show({message:'请输入工号或姓名',type:'warning'});
this.$refs.messager.show({message:'请输入工号或姓名',type:'warning'});
return
}
var name=this.keyword;
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
@@ -83,7 +123,7 @@
//uni.showToast({title: rs.message,icon: 'none'});
this.$refs.messager.show({message:rs.message,type:'error'});
}else{
this.shareInfo.users=rs.result;
this.users=rs.result;
}
}else{
//uni.showToast({ title: rs.message, icon: 'none' });
@@ -96,6 +136,10 @@
this.show=false;
},
confirmShare(u){
if(this.type==0){
this.$refs.messager.show({message:'未指定源类型',type:'error'});
return;
}
let conType;
if(this.type == 1) {
conType = this.data.type;
@@ -111,7 +155,7 @@
}
if(this.userInfo.aid==postData.toAid){
//uni.showToast({title: '不能分享给自己', icon: 'none' });
this.$refs.messager.show({message:'不能分享给自己',type:'error'});
this.$refs.messager.show({message:'不能分享给自己',type:'error',zIndex:100090});
}
apiShares.save(postData).then(rs=>{
if(rs.status==200){
@@ -122,19 +166,20 @@
if(this.type!=3){
if(this.type==1){
//发送消息
//this.messageSave(this.data.id,this.data.name,this.userInfo.name,u.name,u.aid,'分享给我的');
this.messageSave(this.data.id,this.data.name,this.userInfo.name,u.name,u.aid,'分享给我的');
}else{
//this.messageSave(this.data.id,this.data.title,this.userInfo.name,u.name,u.aid,'分享给我的');
this.messageSave(this.data.id,this.data.title,this.userInfo.name,u.name,u.aid,'分享给我的');
}
}
this.show=false;
}else{
//uni.showToast({title: '分享失败,您不能将同一资源多次分享给同一个人',icon: 'none'});
this.$refs.messager.show({message:'分享失败,您不能将同一资源多次分享给同一个人',type:'warning'});
this.$refs.messager.show({message:'已分享过,不能再分享',type:'warning'});
}
}else{
// this.$message({message:'分享失败',type:'success'});
this.$refs.interactToast.show({message:'分享处理失败',type:'error'});
console.log(rs.message);
this.$refs.messager.show({message:rs.message,type:'error',zIndex:100090});
}
});
},