123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629 |
- <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 class="rrrrbox" v-if="item && item.remarks && !item.photo && !item.video" @click="check(index, 3)">
- <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>
- </div>
- <div
- v-else-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" style="color:#3E8DE6;">https://cloud.cocorobo.cn/</div>
- </div>
- <div class="invite_num" ref="invite3">
- 房间号:
- <span style="color:#3E8DE6;">{{ goNum }}</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: this.$route.query.goNum ? this.$route.query.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.mindInfo2(
- this.dragging,
- "move",
- dst,
- "us.mindNetwork",
- this.userinfo ? this.userinfo.userid : this.userid,
- this.RoomInfo.id,
- this.draggingE,
- src
- );
- 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(
- index,
- "delete",
- this.data[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.remarks == "") {
- 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 if (this.file.video) {
- // 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];
- if(this.goNum != ""){
- this.goRoom(this.goNum);
- }else{
- this.checkNum();
- }
- 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();
- this.goNum = this.numNum;
- 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.getRoom(res.data[0][0].fid);
- })
- .catch((err) => {
- this.$message.error("创建失败");
- console.error(err);
- });
- },
- getRoom(fid) {
- let params = {
- fid: fid,
- };
- this.ajax
- .get(this.$store.state.api + "getRoom", 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);
- });
- },
- 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 下一行
- */
- // messageInfo: {
- // sendId: userid,
- // moveIndex1: id, //第几个网格
- // moveIndex2: moveIndex, //移动到的网格
- // type: type, //类型
- // data: content, //内容
- // docId: roomid, //文档id
- // // pageId: US.pageId, //当前页面id
- // },
- mindInfo(id, type, content, navid, userid, roomid, moveIndex) {
- var _data = {
- "us.mindNetwork": [
- {
- sendId: userid, //发送人id
- receiveId: roomid, //文件id
- type: navid, //消息类型
- messageInfo: {
- id: id, //操作ID
- type: type, //类型
- content: content, //内容
- docId: roomid, //文档id
- pageId: top.US.pageId, //当前页面id
- },
- },
- ],
- };
- return _data;
- },
- mindInfo2(id, type, content, navid, userid, roomid, moveIndex, moveData) {
- var _data = {
- "us.mindNetwork": [
- {
- sendId: userid, //发送人id
- receiveId: roomid, //文件id
- type: navid, //消息类型
- messageInfo: {
- id: id, //操作ID
- type: type, //类型
- content: content, //内容
- docId: roomid, //文档id
- pageId: top.US.pageId, //当前页面id
- },
- },
- {
- sendId: userid, //发送人id
- receiveId: roomid, //文件id
- type: navid, //消息类型
- messageInfo: {
- id: moveIndex, //操作ID
- type: type, //类型
- content: moveData, //内容
- docId: roomid, //文档id
- pageId: top.US.pageId, //当前页面id
- },
- },
- ],
- };
- return _data;
- },
- updateSocket(mindinfo) {
- let params = [
- {
- type: "send",
- mindinfo: encodeURIComponent(
- encodeURIComponent(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];
- try {
- this.data = JSON.parse(res.data[0][0].data);
- } catch (error) {
- this.data = 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();
- let _this = this;
- window.addEventListener("message", function (e) {
- // 监听 message 事件
- if (
- e.data.type &&
- e.data.type == "mindNetwork_update" &&
- e.data.info.docId == _this.RoomInfo.id &&
- !(e.data.sendId == _this.userinfo.userid)
- ) {
- _this.data[e.data.info.id] = e.data.info.content;
- } else if (
- e.data.type &&
- e.data.type == "mindNetwork_delete" &&
- e.data.info.docId == _this.RoomInfo.id &&
- !(e.data.sendId == _this.userinfo.userid)
- ) {
- _this.data[e.data.info.id] = "";
- } else if (
- e.data.type &&
- e.data.type == "mindNetwork_move" &&
- e.data.info.docId == _this.RoomInfo.id &&
- !(e.data.sendId == _this.userinfo.userid)
- ) {
- _this.data[e.data.info.id] = e.data.info.content;
- // var newItems = [...JSON.parse(JSON.stringify(_this.data))]; //拷贝一份数据进行交换操作。
- // _this.data[e.data.info.id] = newItems[e.data.info.moveIndex2];
- // _this.data[e.data.info.moveIndex2] = newItems[e.data.info.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;
- }
- .rrrrbox {
- width: 95%;
- height: 95%;
- background: #fff;
- padding: 10px 20px;
- box-sizing: border-box;
- border-radius: 5px;
- position: absolute;
- z-index: 9;
- overflow: auto;
- }
- </style>
|