1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432 |
- <template>
- <div class="pb_content g_body">
- <div>
- <el-image class="coin coin1" :src="require('../../assets/grid/coin1.png')" fit="cover"></el-image>
- <el-image class="coin coin2" :src="require('../../assets/grid/coin2.png')" fit="cover"></el-image>
- <el-image class="coin coin3" :src="require('../../assets/grid/coin3.png')" fit="cover"></el-image>
- <el-image class="coin coin4" :src="require('../../assets/grid/coin4.png')" fit="cover"></el-image>
- </div>
- <div class="grid_member">
- <!-- <div class="member_imgbox">
- <el-image
- v-for="item in 4"
- :key="item"
- class="member_img"
- :src="require('../../assets/grid/portal.png')"
- fit="cover"
- ></el-image>
- </div>-->
- <el-button type="text" @click="dialogVisible2 = true">邀请成员</el-button>
- <!-- <el-button type="text">成员</el-button> -->
- <el-button type="text" v-if="RoomInfo.userid == userid" @click="dismiss">解散房间</el-button>
- </div>
- <draggable
- element="div"
- v-model="data"
- class="g_body"
- @change="handleDraggableFormItemChange"
- @end="dragEnd"
- :move="checkMove"
- >
- <div
- v-for="(item,index) in data"
- :key="index"
- class="g_box"
- @mouseover="pIndex = index"
- @mouseleave="pIndex = ''"
- @dragstart="handleDragStart($event, index)"
- @dragover.prevent="handleDragOver($event, index)"
- @dragenter="handleDragEnter($event, index)"
- @dragend="handleDragEnd($event, index)"
- >
- <div
- :class="{'left-popover':index<3,'right-popover':index==3,'top-popover':index>3,'visibleO':pIndex === index && item && (item.video || item.photo)}"
- >
- <div class="pChild" @click="check(index)">
- <el-image :src="require('../../assets/grid/upload.png')" fit="cover"></el-image>
- <span>修改</span>
- </div>
- <div class="pChild" @click="deleteGrid(index)">
- <el-image :src="require('../../assets/grid/deleteT.png')" fit="cover"></el-image>
- <span>删除</span>
- </div>
- <div class="pChild" @click="check(index,2)">
- <el-image :src="require('../../assets/grid/edit.png')" fit="cover"></el-image>
- <span>添加备注</span>
- </div>
- </div>
- <div
- v-if="item && item.remarks"
- :class="{'remark-right-popover':index>11 && index!=15,'remark-left-popover':index==15,'remark-bottom-popover':index<12,'visibleO':pIndex === index && item && item.remarks}"
- >
- <div class="Rbox" v-for="(x,y) in item.remarks" :key="y">
- <div v-if="x.remarks!=''" style="display:flex">
- <el-image class="Rportal" :src="require('../../assets/grid/portal.png')" fit="cover"></el-image>
- <div class="RContent">
- <div>{{x.username}}</div>
- <div>{{x.remarks}}</div>
- </div>
- </div>
- <div v-else-if="x.remarks==''&& y==0">{{x.username}}暂无备注</div>
- </div>
- </div>
- <el-image
- v-if="item && item.photo"
- v-viewer
- class="photo_img"
- :src="item.photo"
- fit="cover"
- ></el-image>
- <video-player
- v-else-if="item && item.video"
- class="video-player vjs-custom-skin"
- ref="videoPlayer"
- :playsinline="true"
- :options="item.video"
- style="width: 85%;"
- ></video-player>
- <el-image
- v-else
- class="add_img"
- :src="require('../../assets/grid/add.png')"
- fit="cover"
- @click="check(index,3)"
- ></el-image>
- </div>
- </draggable>
- <el-dialog
- title="上传文件"
- :visible.sync="dialogVisible"
- :append-to-body="true"
- width="800px"
- :before-close="handleClose"
- class="look_notice"
- >
- <div slot="title" class="header-title">
- <div class="title_add_student">上传文件</div>
- </div>
- <div>
- <div class="upload_box" v-show="!file.userid || file.userid == userid">
- <el-image class="list_img" :src="require('../../assets/grid/list.png')" fit="cover"></el-image>
- <div class="upload_content">
- <div
- @click="addEvent($event)"
- @mouseover="file.photo ? deleteVisible1 = true:''"
- @mouseleave="file.photo ? deleteVisible1 = false:''"
- >
- <el-image
- class="delete_img"
- :src="require('../../assets/grid/delete.png')"
- fit="cover"
- v-if="deleteVisible1"
- @click.stop="deleteFile(1)"
- ></el-image>
- <el-image
- class="upload_img"
- :src="file.photo ? file.photo : require('../../assets/grid/image.png')"
- fit="cover"
- ></el-image>
- <input
- type="file"
- accept="image/*"
- style="display: none"
- ref="pathClear1"
- @change="beforeUpload($event, 1)"
- />
- </div>
- <div
- style="margin-left: 20px;"
- @click="addEvent($event)"
- @mouseover="file.video ? deleteVisible2 = true:''"
- @mouseleave="file.video ? deleteVisible2 = false:''"
- >
- <el-image
- class="delete_img"
- :src="require('../../assets/grid/delete.png')"
- fit="cover"
- v-if="deleteVisible2"
- @click.stop="deleteFile(2)"
- ></el-image>
- <el-image
- class="upload_img"
- :src="file.video ? require('../../assets/grid/videoH.png') : require('../../assets/grid/video.png')"
- fit="cover"
- ></el-image>
- <input
- type="file"
- accept="video/mp4, video/quicktime, video/x-msvideo"
- style="display: none"
- ref="pathClear2"
- @change="beforeUpload($event, 2)"
- />
- </div>
- </div>
- </div>
- <div class="textarea_box">
- <div class="textarea_title">添加描述</div>
- <el-input
- type="textarea"
- v-model="remarks"
- placeholder="请输入描述..."
- class="textarea_content"
- :rows="5"
- resize="none"
- ></el-input>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button class="close" @click="addGrid()" type="primary">确定</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="邀请成员"
- :visible.sync="dialogVisible2"
- :append-to-body="true"
- width="400px"
- :before-close="handleClose"
- class="look_notice invite_dialog"
- >
- <div slot="title" class="header-title">
- <div class="title_add_student">邀请成员</div>
- </div>
- <div>
- <div class="invite_box">
- <div class="invite_title" ref="inviteT">{{userinfo ? this.userinfo.name: "用户"}}邀请您参加思维网格</div>
- <div class="line"></div>
- <div class="invite_link">
- <div ref="invite1">复制链接加入房间:</div>
- <div ref="invite2">https://baidu.com</div>
- </div>
- <div class="invite_num" ref="invite3">
- 房间号:
- <span>{{RoomInfo.num}}</span>
- </div>
- <div class="invite_num" ref="invite4">复制房间号信息,打开思维网格输入即可加入。</div>
- </div>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button
- class="close tag-read"
- @click="copy"
- type="primary"
- :data-clipboard-text="copyText"
- >一键复制信息</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="创建/加入房间"
- :visible.sync="dialogVisible3"
- :append-to-body="true"
- width="400px"
- :before-close="handleClose2"
- class="look_notice invite_dialog room_dialog"
- >
- <div slot="title" class="header-title">
- <div class="title_add_student">创建/加入房间</div>
- </div>
- <div class="addRoom_box">
- <div>
- <el-input v-model="goNum" placeholder="请输入要加入的房间号"></el-input>
- <div class="room_b">备注:输入房间号点击加入房间或点击创建房间直接创建房间</div>
- <div class="room_btn">
- <el-button class="roomBtn" type="primary" @click="goRoom(goNum)">加入房间</el-button>
- <el-button class="roomBtn" type="primary" @click="checkNum">创建房间</el-button>
- </div>
- </div>
- </div>
- </el-dialog>
- <div v-if="proVisible" class="mask">
- <div class="progressBox">
- <div class="lbox">
- <img :src="require('../../assets/loading.gif')" />上传中,请稍后
- </div>
- <el-progress
- :text-inside="true"
- :stroke-width="20"
- :percentage="progress"
- style="width:80%"
- ></el-progress>
- </div>
- </div>
- </div>
- </template>
- <script>
- import Clipboard from "clipboard";
- import draggable from "vuedraggable";
- export default {
- components: {
- //调用组件
- draggable,
- },
- data() {
- return {
- timer: null,
- userinfo: [],
- RoomInfo: [],
- copyText: "",
- userid: this.$route.query.userid,
- data: [],
- dialogVisible: false,
- dialogVisible2: false,
- dialogVisible3: true,
- deleteVisible1: false,
- deleteVisible2: false,
- dialogImgVisible: false,
- dialogImageUrl: "",
- remarks: "",
- goNum: "",
- numNum: "",
- file: {},
- gIndex: "",
- pIndex: "",
- proVisible: false,
- progress: 0,
- playerOptions: {
- playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
- autoplay: false, //如果true,浏览器准备好时开始回放。
- muted: false, // 默认情况下将会消除任何音频。
- loop: false, // 导致视频一结束就重新开始。
- preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
- language: "zh-CN",
- aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
- fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
- sources: [
- {
- type: "video/mp4", //这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目 || "video/ogg"|| "video/webm"
- src: "", //url地址require("../../assets/media/aaa.mp4")
- },
- ],
- // poster: require("../../assets/tu31.png"), //你的封面地址
- // poster: dataRes.imgUrl, //你的封面地址
- notSupportedMessage: "此视频暂无法播放,请稍后再试", //允许覆盖Video.js无法播放媒体源时显示的默认信息。
- controlBar: {
- timeDivider: true, //当前时间和持续时间的分隔符
- durationDisplay: true, //显示持续时间
- remainingTimeDisplay: false, //是否显示剩余时间功能
- fullscreenToggle: true, //全屏按钮
- },
- },
- playerO: {},
- dragging: null,
- draggingE: null,
- };
- },
- methods: {
- handleDragStart(e, items) {
- this.dragging = items; //开始拖动时,暂时保存当前拖动的数据。
- if (!this.data[items]) {
- return;
- }
- },
- handleDragEnd(e, items) {
- if (!this.data[this.dragging]) {
- return;
- }
- e.dataTransfer.effectAllowed = "move"; //为需要移动的元素设置dragstart事件
- if (this.draggingE == this.dragging) return;
- var newItems = [...JSON.parse(JSON.stringify(this.data))]; //拷贝一份数据进行交换操作。
- var src = newItems[this.dragging]; //获取数组下标
- var dst = newItems[this.draggingE];
- // newItems[this.dragging] = dst;
- // newItems[this.draggingE] = src;
- // // newItems2.splice(dst, 0, ...newItems.splice(src, 1)); //交换位置
- // this.data = newItems;
- this.data[this.dragging] = dst;
- this.data[this.draggingE] = src;
- let mindinfo = this.mindInfo(
- this.dragging,
- "move",
- this.data[this.gIndex],
- "us.mindNetwork",
- this.userinfo ? this.userinfo.userid : this.userid,
- this.RoomInfo.id,
- this.draggingE
- );
- this.updateSocket(mindinfo);
- this.updateRoomData();
- this.dragging = null; //拖动结束后,清除数据
- this.draggingE = null;
- },
- handleDragOver(e) {
- e.dataTransfer.dropEffect = "move"; //在dragenter中针对放置目标来设置!
- },
- handleDragEnter(e, items) {
- this.draggingE = items;
- e.dataTransfer.effectAllowed = "move"; //为需要移动的元素设置dragstart事件
- // if (items == this.dragging) return;
- // var newItems = [...JSON.parse(JSON.stringify(this.data))]; //拷贝一份数据进行交换操作。
- // var src = this.dragging; //获取数组下标
- // var dst = items;
- // newItems.splice(dst, 0, ...newItems.splice(src, 1)); //交换位置
- // this.data = newItems;
- // this.updateRoomData();
- },
- handleDraggableFormItemChange(val) {
- // console.log(val);
- // console.log(this.data[val.moved.newIndex]);
- // console.log(this.data[val.moved.oldIndex]);
- },
- dragEnd(val) {
- // if (this.data[val.newIndex].userid != this.userinfo.userid) {
- // this.$message.error("不是您上传的作品不能拖动哦");
- // return;
- // }
- // this.updateRoomData();
- },
- checkMove(evt) {
- // console.log(evt);
- // if (evt.draggedContext.element.userid != this.userinfo.userid) {
- // return false;
- // } else {
- // return true;
- // }
- return false;
- },
- copy() {
- this.copyText =
- this.$refs.inviteT.innerHTML +
- "\n" +
- this.$refs.invite1.innerHTML +
- "\n" +
- this.$refs.invite2.innerHTML +
- "\n" +
- this.$refs.invite3.innerText +
- "\n" +
- this.$refs.invite4.innerHTML;
- var clipboard = new Clipboard(".tag-read");
- clipboard.on("success", (e) => {
- this.$message.success("复制成功");
- console.log("复制成功");
- clipboard.destroy(); // 释放内存
- });
- clipboard.on("error", (e) => {
- console.log("不支持复制,该浏览器不支持自动复制");
- clipboard.destroy(); // 释放内存
- });
- },
- handleClose(done) {
- this.restart();
- done();
- },
- handleClose2(done) {
- // done();
- },
- restart() {
- this.file = {};
- this.gIndex = "";
- this.remarks = "";
- if (this.$refs.pathClear1) {
- this.$refs.pathClear1.value = "";
- this.$refs.pathClear2.value = "";
- }
- },
- deleteGrid(index) {
- if (this.data[index].userid != this.userid) {
- this.$message.error("你不是上传人无权限删除");
- return;
- }
- this.$confirm("确定删除吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- this.data[index] = "";
- let mindinfo = this.mindInfo(
- this.index,
- "delete",
- this.data[this.index],
- "us.mindNetwork",
- this.userinfo ? this.userinfo.userid : this.userid,
- this.RoomInfo.id,
- ""
- );
- this.updateSocket(mindinfo);
- this.updateRoomData();
- this.$forceUpdate();
- })
- .catch(() => {});
- },
- updateRoomData() {
- let params = [
- {
- data: JSON.stringify(this.data),
- idL: this.RoomInfo.id,
- },
- ];
- this.ajax
- .post(this.$store.state.api + "updateRoomData", params)
- .then((res) => {})
- .catch((err) => {});
- },
- check(index, type) {
- this.gIndex = index;
- if (this.data[index].userid != this.userid && type != 2 && type != 3) {
- this.$message.error("你不是上传人无权限修改");
- return;
- }
- if (this.data[index] && this.data[index].userid == this.userid) {
- if (this.data[index].userid != this.userid) {
- this.$message.error("你不是上传人无权限修改");
- return;
- }
- this.file = {
- photo: this.data[index].photo,
- userid: this.data[index].userid,
- video:
- this.data[index].video &&
- this.data[index].video.sources &&
- this.data[index].video.sources[0].src,
- };
- this.remarks = this.data[index].remarks[0].remarks;
- } else if (this.data[index] && type == 2) {
- this.file = {
- userid: this.data[index].userid,
- };
- for (var i = 0; i < this.data[index].remarks.length; i++) {
- if (this.data[index].remarks[i].userid == this.userid) {
- this.remarks = this.data[index].remarks[i].remarks;
- break;
- }
- }
- this.remarks = this.remarks ? this.remarks : "";
- }
- this.dialogVisible = true;
- },
- addEvent(e) {
- var el = e.currentTarget;
- el.getElementsByTagName("input")[0].click();
- },
- deleteFile(type) {
- if (type == 1) {
- this.file.photo = "";
- this.deleteVisible1 = false;
- this.$refs.pathClear1.value = "";
- } else {
- this.file.video = "";
- this.deleteVisible2 = false;
- this.$refs.pathClear2.value = "";
- }
- this.$forceUpdate();
- },
- addGrid() {
- if (!this.file.userid || this.file.userid == this.userid) {
- if (!this.file.video && !this.file.photo) {
- this.$message.error("至少上传一个视频或者一张图片");
- return;
- }
- if (!this.data[this.gIndex]) {
- this.data[this.gIndex] = {};
- }
- if (this.file.photo) {
- this.data[this.gIndex].photo = this.file.photo;
- } else {
- // this.playerOptions.sources[0].src = ""
- var video = JSON.parse(JSON.stringify(this.playerOptions));
- video.sources[0].src = this.file.video;
- this.data[this.gIndex].video = video;
- }
- if (this.data[this.gIndex].remarks) {
- this.data[this.gIndex].remarks[0] = {
- remarks: this.remarks,
- userid: this.userinfo ? this.userinfo.userid : this.userid,
- username: this.userinfo ? this.userinfo.name : "用户",
- };
- } else {
- this.data[this.gIndex].remarks = [
- {
- remarks: this.remarks,
- userid: this.userinfo ? this.userinfo.userid : this.userid,
- username: this.userinfo ? this.userinfo.name : "用户",
- },
- ];
- }
- this.data[this.gIndex].userid = this.userinfo
- ? this.userinfo.userid
- : this.userid;
- } else {
- if (!this.remarks) {
- this.$message.error("备注不能为空");
- return;
- }
- var a = 0;
- for (var i = 0; i < this.data[this.gIndex].remarks.length; i++) {
- if (this.data[this.gIndex].remarks[i].userid == this.userid) {
- a++;
- this.data[this.gIndex].remarks[i] = {
- remarks: this.remarks,
- userid: this.userinfo ? this.userinfo.userid : this.userid,
- username: this.userinfo ? this.userinfo.name : "用户",
- };
- break;
- }
- }
- if (a < 1) {
- this.data[this.gIndex].remarks.push({
- remarks: this.remarks,
- userid: this.userinfo ? this.userinfo.userid : this.userid,
- username: this.userinfo ? this.userinfo.name : "用户",
- });
- }
- }
- let mindinfo = this.mindInfo(
- this.gIndex,
- "update",
- this.data[this.gIndex],
- "us.mindNetwork",
- this.userinfo ? this.userinfo.userid : this.userid,
- this.RoomInfo.id,
- ""
- );
- this.updateSocket(mindinfo);
- this.updateRoomData();
- this.dialogVisible = false;
- this.$forceUpdate();
- this.restart();
- },
- beforeUpload(event, type) {
- // debugger;
- if (this.file.photo && type != 1) {
- this.$message.error("只能上传一个视频或者一张图片");
- this.$refs.pathClear2.value = "";
- return;
- } else if (this.file.video && type != 2) {
- this.$message.error("只能上传一个视频或者一张图片");
- this.$refs.pathClear1.value = "";
- return;
- }
- var file = event.target.files[0];
- var credentials = {
- accessKeyId: "AKIATLPEDU37QV5CHLMH",
- secretAccessKey: "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",
- }; //秘钥形式的登录上传
- window.AWS.config.update(credentials);
- window.AWS.config.region = "cn-northwest-1"; //设置区域
- var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
- var _this = this;
- if (type == 1) {
- var mediaFormatList = ["png", "jpg", "jpeg"];
- if (
- mediaFormatList.indexOf(
- file.name
- .split(".")
- [file.name.split(".").length - 1].toLocaleLowerCase()
- ) == "-1"
- ) {
- _this.$message.error("请上传jpg或者png的图片格式文件");
- return;
- }
- } else {
- var mediaFormatList = ["mp4"];
- if (
- mediaFormatList.indexOf(
- file.name
- .split(".")
- [file.name.split(".").length - 1].toLocaleLowerCase()
- ) == "-1"
- ) {
- _this.$message.error("请上传mp4视频格式文件");
- return;
- }
- }
- _this.progress = 0;
- _this.proVisible = true;
- if (file) {
- var params = {
- Key:
- file.name.split(".")[0] +
- new Date().getTime() +
- "." +
- file.name.split(".")[1],
- ContentType: file.type,
- Body: file,
- "Access-Control-Allow-Credentials": "*",
- ACL: "public-read",
- }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
- var options = {
- partSize: 2048 * 1024 * 1024,
- queueSize: 2,
- leavePartsOnError: true,
- };
- bucket
- .upload(params, options)
- .on("httpUploadProgress", function (evt) {
- //这里可以写进度条
- // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
- _this.progress = parseInt((evt.loaded * 80) / evt.total);
- })
- .send(function (err, data) {
- this.progress = 100;
- setTimeout(() => {
- _this.proVisible = false;
- }, 1000);
- if (err) {
- _this.$message.error("上传失败");
- } else {
- if (type == 1) {
- _this.file.photo = data.Location;
- } else {
- _this.file.video = data.Location;
- }
- _this.$forceUpdate();
- console.log(data.Location);
- }
- });
- }
- },
- getUser() {
- let params = { uid: this.userid };
- this.ajax
- .get(this.$store.state.api + "getUser", params)
- .then((res) => {
- this.userinfo = res.data[0][0];
- console.log(res.data[0][0]);
- })
- .catch((err) => {
- console.error(err);
- });
- },
- MathRand() {
- var Num = "";
- for (var i = 0; i < 6; i++) {
- Num += Math.floor(Math.random() * 10);
- }
- return Num;
- },
- checkNum() {
- this.numNum = this.MathRand();
- let params = {
- num: this.numNum,
- };
- this.ajax
- .get(this.$store.state.api + "checkRoomNum", params)
- .then((res) => {
- console.log(res.data[0].length);
- if (res.data[0].length) {
- this.checkNum();
- } else {
- this.addRoom();
- }
- })
- .catch((err) => {
- console.error(err);
- });
- },
- addRoom() {
- let params = [
- {
- uid: this.userid,
- n: this.numNum,
- d: JSON.stringify(this.data),
- },
- ];
- this.ajax
- .post(this.$store.state.api + "insertRoom", params)
- .then((res) => {
- this.$message.success("创建成功");
- this.selectRoom(this.userid);
- })
- .catch((err) => {
- this.$message.error("创建失败");
- console.error(err);
- });
- },
- selectRoom(uid) {
- let params = {
- uid: uid,
- };
- this.ajax
- .get(this.$store.state.api + "selectRoom", params)
- .then((res) => {
- if (res.data[0].length) {
- // this.RoomInfo = res.data[0][0];
- // this.data = JSON.parse(res.data[0][0].data);
- // this.dialogVisible3 = false;
- // this.dialogVisible2 = true;
- this.getMindNetwork(res.data[0][0].id, this.userinfo.userid);
- // this.data.splice(0,1)
- // this.updateRoomData()
- // this.timer = setInterval(() => {
- // this.selectRoom2(uid);
- // }, 5000);
- } else {
- // this.$message.error("此房间不存在或已被解散");
- }
- })
- .catch((err) => {
- console.error(err);
- });
- },
- goRoom(uid) {
- let params = {
- uid: uid,
- };
- this.ajax
- .get(this.$store.state.api + "selectRoom", params)
- .then((res) => {
- if (res.data[0].length) {
- this.$message.success("加入成功");
- // this.RoomInfo = res.data[0][0];
- // this.data = JSON.parse(res.data[0][0].data);
- this.dialogVisible3 = false;
- this.dialogVisible2 = true;
- this.getMindNetwork(res.data[0][0].id, this.userinfo.userid);
- // this.timer = setInterval(() => {
- // this.selectRoom2(uid);
- // }, 5000);
- } else {
- this.$message.error("此房间不存在或已被解散");
- }
- })
- .catch((err) => {
- console.error(err);
- });
- },
- selectRoom2(uid) {
- let params = {
- uid: uid,
- };
- this.ajax
- .get(this.$store.state.api + "selectRoom", params)
- .then((res) => {
- this.RoomInfo = res.data[0][0];
- this.data = JSON.parse(res.data[0][0].data);
- })
- .catch((err) => {
- console.error(err);
- });
- },
- dismiss() {
- this.$confirm("确定解散房间吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- let params = [
- {
- id: this.RoomInfo.id,
- },
- ];
- this.ajax
- .post(this.$store.state.api + "dismiss", params)
- .then((res) => {
- this.$message.success("解散成功");
- this.$router.go(0);
- })
- .catch((err) => {
- console.error(err);
- });
- })
- .catch(() => {});
- },
- /*
- * mind 消息类
- * 参数一 : 第几个网格
- * 参数二 : type 操作类型
- * 参数三 : content 行内容
- * 参数四 : next 下一行
- */
- mindInfo(id, type, content, navid, userid, roomid, moveIndex) {
- var _data = {
- sendId: userid, //发送人id
- receiveId: roomid, //文件id
- type: navid, //消息类型
- messageInfo: {
- moveIndex1: id, //第几个网格
- moveIndex2: moveIndex, //移动到的网格
- type: type, //类型
- data: content, //内容
- docId: roomid, //文档id
- // pageId: US.pageId, //当前页面id
- },
- };
- return _data;
- },
- updateSocket(mindinfo) {
- let params = [
- {
- type: "send",
- mindinfo: JSON.stringify(mindinfo),
- post: 1,
- },
- ];
- this.ajax
- .post(this.$store.state.socket, params)
- .then((res) => {
- console.log(res);
- })
- .catch((err) => {
- console.error(err);
- });
- },
- getMindNetwork(id, uid) {
- let params = [
- {
- type: "getMindNetwork",
- docid: id,
- pageid: window.parent.US.pageId,
- userid: uid,
- post: "1",
- },
- ];
- this.ajax
- .post(this.$store.state.socket, params)
- .then((res) => {
- if (res.data[0].length) {
- this.RoomInfo = res.data[0][0];
- this.data = JSON.parse(res.data[0][0].data);
- this.dialogVisible3 = false;
- this.dialogVisible2 = true;
- }
- console.log(res);
- })
- .catch((err) => {
- console.error(err);
- });
- },
- },
- beforeDestroy() {
- // clearInterval(this.timer);
- window.removeEventListener("message");
- },
- created() {
- document.domain = "cocorobo.cn";
- // window.parent.postMessage({ cid: cid, type: "U.MD.O.P.pollingAsyn" }, "*");
- for (var i = 0; i < 16; i++) {
- this.data.push("");
- }
- this.getUser();
- window.addEventListener("message", function (e) {
- // 监听 message 事件
- if (e.data.type && e.data.type == "mindNetwork_update") {
- this.data[e.data.moveIndex1] = e.data.data;
- this.$forceUpdate();
- } else if (e.data.close && e.data.type == "mindNetwork_delete") {
- this.data.splice(e.data.moveIndex1, 1);
- this.$forceUpdate();
- } else if (e.data.close && e.data.type == "mindNetwork_move") {
- var newItems = [...JSON.parse(JSON.stringify(this.data))]; //拷贝一份数据进行交换操作。
- this.data[e.data.moveIndex1] = newItems[e.data.moveIndex2];
- this.data[e.data.moveIndex2] = newItems[e.data.moveIndex1];
- this.$forceUpdate();
- }
- });
- },
- };
- </script>
- <style scoped>
- .g_body {
- width: 100%;
- height: 100%;
- background: #fff;
- border-radius: 5px;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-wrap: wrap;
- position: relative;
- min-height: 750px;
- }
- .coin {
- position: absolute;
- width: 50px;
- z-index: 1;
- user-select: none;
- }
- .coin1 {
- top: 10px;
- left: 20px;
- }
- .coin2 {
- top: 10px;
- right: 20px;
- }
- .coin3 {
- bottom: 10px;
- left: 20px;
- }
- .coin4 {
- bottom: 10px;
- right: 20px;
- }
- .g_box {
- background: rgb(227 228 232);
- width: calc(100% / 4 - 15px);
- height: calc(100% / 4 - 15px);
- margin: 5px;
- border-radius: 5px;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- /* overflow: hidden; */
- position: relative;
- user-select: none;
- }
- .photo_img {
- width: 100%;
- height: 100%;
- border-radius: 5px;
- }
- .g_box .add_img {
- width: 100px;
- display: none;
- }
- .g_box:hover .add_img {
- display: block;
- }
- .look_notice >>> .el-dialog__header {
- padding: 10px 20px;
- text-align: center;
- background: #32455b;
- }
- .look_notice >>> .el-dialog__title {
- font-size: 14px !important;
- color: #fff !important;
- }
- .look_notice >>> .el-dialog__headerbtn {
- font-size: 20px !important;
- top: 10px;
- }
- .look_notice >>> .el-form-item__label {
- margin-left: 65px;
- }
- .look_notice >>> .el-form-item {
- display: flex;
- }
- .look_notice >>> .el-form-item__content {
- margin: 0 !important;
- }
- .look_notice >>> .el-dialog__footer {
- text-align: center !important;
- }
- .look_notice >>> .el-dialog {
- min-width: 450px;
- background: #f3f3f3;
- }
- .notice_content {
- width: 100%;
- word-wrap: break-word;
- word-break: break-all;
- overflow: hidden;
- font-size: 18px;
- line-height: 35px;
- text-indent: 35px;
- min-width: 385px;
- }
- .roomBtn {
- background: rgb(112 183 79);
- /* padding: 0 !important; */
- border: none;
- }
- .close {
- width: 150px;
- height: 40px;
- border-radius: 30px;
- line-height: 30px;
- font-size: 14px;
- background: rgb(112 183 79);
- padding: 0 !important;
- border: none;
- }
- .header-title {
- display: flex;
- }
- .logoImg {
- width: 30px;
- }
- .logoImg > img {
- width: 100%;
- height: 100%;
- }
- .title_add_student {
- /* margin: 0 auto; */
- color: #fff;
- }
- .grid_member {
- position: absolute;
- background: #fff;
- right: 70px;
- top: 18px;
- /* min-width: 320px; */
- height: 50px;
- border-radius: 5px;
- padding: 0 10px;
- display: flex;
- align-items: center;
- z-index: 1;
- user-select: none;
- }
- .member_imgbox {
- display: flex;
- align-items: center;
- margin: 0 10px;
- width: 185px;
- }
- .member_img {
- height: 40px;
- width: 40px;
- border-radius: 50px;
- overflow: hidden;
- display: block;
- background: aliceblue;
- }
- .member_img + .member_img {
- margin-left: 8px;
- }
- .upload_box {
- border-radius: 5px;
- background: #fff;
- position: relative;
- }
- .upload_box .list_img {
- position: absolute;
- top: 10px;
- left: 10px;
- }
- .upload_box .upload_content {
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 50px 0 20px;
- }
- .upload_box .upload_content div {
- display: flex;
- align-items: center;
- justify-content: center;
- cursor: pointer;
- position: relative;
- }
- .delete_img {
- position: absolute !important;
- width: 25px;
- transform: translate(50%, -50%);
- top: 0;
- z-index: 1;
- right: 0;
- }
- .upload_img {
- width: 306px;
- height: 206px;
- }
- .textarea_box {
- background: #fff;
- margin-top: 20px;
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 20px 0;
- }
- .textarea_title {
- width: 95%;
- margin: 0 auto;
- font-size: 16px;
- }
- .textarea_content {
- width: 95%;
- margin: 10px auto 0;
- border-radius: 10px;
- }
- .textarea_content >>> .el-textarea__inner {
- background: rgb(243, 243, 243);
- border: none;
- }
- .invite_dialog >>> .el-dialog__body {
- padding: 15px 20px;
- }
- .room_dialog >>> .el-dialog {
- margin-top: 50vh !important;
- transform: translateY(-50%);
- min-width: unset;
- }
- .invite_box {
- font-size: 16px;
- background: #fff;
- border-radius: 5px;
- padding: 30px 0 150px;
- }
- .invite_title {
- width: 90%;
- margin: 0 auto 20px;
- }
- .line {
- width: 95%;
- border-top: 1px solid rgb(230, 230, 230);
- margin: 0 auto;
- }
- .invite_link {
- width: 90%;
- margin: 20px auto 30px;
- }
- .invite_link div + div {
- margin-top: 15px;
- }
- .invite_num {
- width: 90%;
- margin: 0 auto 50px;
- }
- .invite_num span {
- color: rgb(112 183 79);
- font-size: 28px;
- }
- .addRoom_box {
- background: #fff;
- padding: 30px 20px;
- border-radius: 5px;
- }
- .room_b {
- margin: 5px 0 30px;
- /* width:300px; */
- }
- .room_btn {
- display: flex;
- justify-content: space-around;
- }
- .mask {
- background-color: rgba(0, 0, 0, 0);
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 20000;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .progressBox {
- width: 500px;
- height: 180px;
- background: #fff;
- border-radius: 10px;
- box-shadow: 0 0 6px 1px #bfbfbf;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- }
- .progressBox .lbox {
- height: 100px;
- font-size: 19px;
- display: flex;
- align-items: center;
- }
- .progressBox .lbox img {
- width: 40px;
- margin-right: 20px;
- }
- .progressBox >>> .el-progress-bar__outer {
- background-color: #d1dfff !important;
- }
- .top-popover {
- position: absolute;
- top: -50px;
- left: 0;
- background: #fff;
- display: flex;
- height: 45px;
- align-items: center;
- padding: 0px 10px 0 20px;
- border-radius: 5px;
- box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
- z-index: 10;
- transition: 0.5s all;
- opacity: 0;
- visibility: hidden;
- }
- .top-popover .pChild {
- display: flex;
- align-items: center;
- }
- .top-popover .pChild + .pChild {
- margin-left: 10px;
- }
- .left-popover {
- position: absolute;
- top: 0px;
- right: -65px;
- background: #fff;
- display: flex;
- width: 45px;
- align-items: center;
- padding: 10px 5px 20px;
- border-radius: 5px;
- box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
- z-index: 10;
- flex-direction: column;
- justify-content: center;
- transition: 0.5s all;
- opacity: 0;
- visibility: hidden;
- }
- .left-popover .pChild {
- display: flex;
- align-items: center;
- flex-direction: column;
- }
- .left-popover .pChild span {
- display: flex;
- align-items: center;
- flex-direction: column;
- text-align: center;
- }
- .left-popover .pChild + .pChild {
- margin-top: 10px;
- }
- .right-popover {
- position: absolute;
- top: 0px;
- left: -65px;
- background: #fff;
- display: flex;
- width: 45px;
- align-items: center;
- padding: 10px 5px 20px;
- border-radius: 5px;
- box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
- z-index: 10;
- flex-direction: column;
- justify-content: center;
- transition: 0.5s all;
- opacity: 0;
- visibility: hidden;
- }
- .right-popover .pChild {
- display: flex;
- align-items: center;
- flex-direction: column;
- }
- .right-popover .pChild span {
- display: flex;
- align-items: center;
- flex-direction: column;
- text-align: center;
- }
- .right-popover .pChild + .pChild {
- margin-top: 10px;
- }
- .visibleO {
- opacity: 1 !important;
- visibility: visible !important;
- }
- .remark-bottom-popover {
- position: absolute;
- bottom: 0px;
- left: 0;
- background: #fff;
- max-height: 150px;
- width: 100%;
- padding: 10px 20px;
- border-radius: 5px;
- box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
- z-index: 10;
- transition: 0.5s all;
- box-sizing: border-box;
- transform: translateY(calc(100% + 5px));
- overflow: auto;
- opacity: 0;
- visibility: hidden;
- }
- .Rbox {
- display: flex;
- word-break: break-all;
- }
- .Rbox + .Rbox {
- border-top: 1px solid rgb(233, 233, 233);
- margin-top: 10px;
- padding-top: 10px;
- }
- .Rportal {
- height: 45px;
- min-width: 45px;
- border-radius: 50px;
- overflow: hidden;
- display: block;
- background: aliceblue;
- user-select: none;
- }
- .RContent {
- margin-left: 10px;
- }
- .RContent div:nth-child(1) {
- user-select: none;
- color: rgb(80, 80, 80);
- margin-bottom: 5px;
- font-size: 14px;
- }
- .RContent div:nth-child(2) {
- font-family: "微软雅黑";
- font-size: 15px;
- }
- .remark-right-popover {
- position: absolute;
- top: 0;
- right: 0;
- background: #fff;
- max-height: 100%;
- width: 300px;
- padding: 10px 20px;
- border-radius: 5px;
- box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
- z-index: 10;
- transition: 0.5s all;
- box-sizing: border-box;
- transform: translateX(calc(100% + 5px));
- overflow: auto;
- opacity: 0;
- visibility: hidden;
- }
- .remark-left-popover {
- position: absolute;
- top: 0;
- left: 0;
- background: #fff;
- max-height: 100%;
- width: 300px;
- padding: 10px 20px;
- border-radius: 5px;
- box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
- z-index: 10;
- transition: 0.5s all;
- box-sizing: border-box;
- transform: translateX(calc(-100% - 5px));
- overflow: auto;
- opacity: 0;
- visibility: hidden;
- }
- </style>
|