Grid.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225
  1. <template>
  2. <div class="pb_content g_body">
  3. <div>
  4. <el-image class="coin coin1" :src="require('../../assets/grid/coin1.png')" fit="cover"></el-image>
  5. <el-image class="coin coin2" :src="require('../../assets/grid/coin2.png')" fit="cover"></el-image>
  6. <el-image class="coin coin3" :src="require('../../assets/grid/coin3.png')" fit="cover"></el-image>
  7. <el-image class="coin coin4" :src="require('../../assets/grid/coin4.png')" fit="cover"></el-image>
  8. </div>
  9. <div class="grid_member">
  10. <div class="member_imgbox">
  11. <el-image
  12. v-for="item in 4"
  13. :key="item"
  14. class="member_img"
  15. :src="require('../../assets/grid/portal.png')"
  16. fit="cover"
  17. ></el-image>
  18. </div>
  19. <el-button type="text" @click="dialogVisible2 = true">邀请成员</el-button>
  20. <el-button type="text">成员</el-button>
  21. <el-button type="text" v-if="RoomInfo.userid == userid" @click="dismiss">解散房间</el-button>
  22. </div>
  23. <div
  24. v-for="(item,index) in data"
  25. :key="index"
  26. class="g_box"
  27. @mouseover="pIndex = index"
  28. @mouseleave="pIndex = ''"
  29. >
  30. <div
  31. :class="{'left-popover':index<3,'right-popover':index==3,'top-popover':index>3,'visibleO':pIndex === index && item && (item.video || item.photo)}"
  32. >
  33. <div class="pChild" @click="check(index)">
  34. <el-image :src="require('../../assets/grid/upload.png')" fit="cover"></el-image>
  35. <span>修改</span>
  36. </div>
  37. <div class="pChild" @click="deleteGrid(index)">
  38. <el-image :src="require('../../assets/grid/deleteT.png')" fit="cover"></el-image>
  39. <span>删除</span>
  40. </div>
  41. <div class="pChild" @click="check(index,2)">
  42. <el-image :src="require('../../assets/grid/edit.png')" fit="cover"></el-image>
  43. <span>添加备注</span>
  44. </div>
  45. </div>
  46. <div
  47. v-if="item && item.remarks"
  48. :class="{'remark-right-popover':index>12 && index!=15,'remark-left-popover':index==15,'remark-bottom-popover':index<12,'visibleO':pIndex === index && item && item.remarks}"
  49. >
  50. <div class="Rbox" v-for="(x,y) in item.remarks" :key="y">
  51. <div v-if="x.remarks!=''" style="display:flex">
  52. <el-image class="Rportal" :src="require('../../assets/grid/portal.png')" fit="cover"></el-image>
  53. <div class="RContent">
  54. <div>{{x.username}}</div>
  55. <div>{{x.remarks}}</div>
  56. </div>
  57. </div>
  58. <div v-else-if="x.remarks==''&& y==0">{{x.username}}暂无备注</div>
  59. </div>
  60. </div>
  61. <el-image v-if="item && item.photo" v-viewer class="photo_img" :src="item.photo" fit="cover"></el-image>
  62. <video-player
  63. v-else-if="item && item.video"
  64. class="video-player vjs-custom-skin"
  65. ref="videoPlayer"
  66. :playsinline="true"
  67. :options="item.video"
  68. style="width: 85%;"
  69. ></video-player>
  70. <el-image
  71. v-else
  72. class="add_img"
  73. :src="require('../../assets/grid/add.png')"
  74. fit="cover"
  75. @click="check(index,3)"
  76. ></el-image>
  77. </div>
  78. <el-dialog
  79. title="上传文件"
  80. :visible.sync="dialogVisible"
  81. :append-to-body="true"
  82. width="800px"
  83. :before-close="handleClose"
  84. class="look_notice"
  85. >
  86. <div slot="title" class="header-title">
  87. <div class="title_add_student">上传文件</div>
  88. </div>
  89. <div>
  90. <div class="upload_box" v-show="!file.userid || file.userid == userid">
  91. <el-image class="list_img" :src="require('../../assets/grid/list.png')" fit="cover"></el-image>
  92. <div class="upload_content">
  93. <div
  94. @click="addEvent($event)"
  95. @mouseover="file.photo ? deleteVisible1 = true:''"
  96. @mouseleave="file.photo ? deleteVisible1 = false:''"
  97. >
  98. <el-image
  99. class="delete_img"
  100. :src="require('../../assets/grid/delete.png')"
  101. fit="cover"
  102. v-if="deleteVisible1"
  103. @click.stop="deleteFile(1)"
  104. ></el-image>
  105. <el-image
  106. class="upload_img"
  107. :src="file.photo ? file.photo : require('../../assets/grid/image.png')"
  108. fit="cover"
  109. ></el-image>
  110. <input
  111. type="file"
  112. accept="image/*"
  113. style="display: none"
  114. ref="pathClear1"
  115. @change="beforeUpload($event, 1)"
  116. />
  117. </div>
  118. <div
  119. style="margin-left: 20px;"
  120. @click="addEvent($event)"
  121. @mouseover="file.video ? deleteVisible2 = true:''"
  122. @mouseleave="file.video ? deleteVisible2 = false:''"
  123. >
  124. <el-image
  125. class="delete_img"
  126. :src="require('../../assets/grid/delete.png')"
  127. fit="cover"
  128. v-if="deleteVisible2"
  129. @click.stop="deleteFile(2)"
  130. ></el-image>
  131. <el-image
  132. class="upload_img"
  133. :src="file.video ? require('../../assets/grid/videoH.png') : require('../../assets/grid/video.png')"
  134. fit="cover"
  135. ></el-image>
  136. <input
  137. type="file"
  138. accept="video/mp4, video/quicktime, video/x-msvideo"
  139. style="display: none"
  140. ref="pathClear2"
  141. @change="beforeUpload($event, 2)"
  142. />
  143. </div>
  144. </div>
  145. </div>
  146. <div class="textarea_box">
  147. <div class="textarea_title">添加描述</div>
  148. <el-input
  149. type="textarea"
  150. v-model="remarks"
  151. placeholder="请输入描述..."
  152. class="textarea_content"
  153. :rows="5"
  154. resize="none"
  155. ></el-input>
  156. </div>
  157. </div>
  158. <span slot="footer" class="dialog-footer">
  159. <el-button class="close" @click="addGrid()" type="primary">确定</el-button>
  160. </span>
  161. </el-dialog>
  162. <el-dialog
  163. title="邀请成员"
  164. :visible.sync="dialogVisible2"
  165. :append-to-body="true"
  166. width="400px"
  167. :before-close="handleClose"
  168. class="look_notice invite_dialog"
  169. >
  170. <div slot="title" class="header-title">
  171. <div class="title_add_student">邀请成员</div>
  172. </div>
  173. <div>
  174. <div class="invite_box">
  175. <div class="invite_title" ref="inviteT">{{userinfo.name}}邀请您参加思维网格</div>
  176. <div class="line"></div>
  177. <div class="invite_link">
  178. <div ref="invite1">复制链接加入房间:</div>
  179. <div ref="invite2">https://baidu.com</div>
  180. </div>
  181. <div class="invite_num" ref="invite3">
  182. 房间号:
  183. <span>{{RoomInfo.num}}</span>
  184. </div>
  185. <div class="invite_num" ref="invite4">复制房间号信息,打开思维网格输入即可加入。</div>
  186. </div>
  187. </div>
  188. <span slot="footer" class="dialog-footer">
  189. <el-button
  190. class="close tag-read"
  191. @click="copy"
  192. type="primary"
  193. :data-clipboard-text="copyText"
  194. >一键复制信息</el-button>
  195. </span>
  196. </el-dialog>
  197. <el-dialog
  198. title="创建/加入房间"
  199. :visible.sync="dialogVisible3"
  200. :append-to-body="true"
  201. width="400px"
  202. :before-close="handleClose2"
  203. class="look_notice invite_dialog room_dialog"
  204. >
  205. <div slot="title" class="header-title">
  206. <div class="title_add_student">创建/加入房间</div>
  207. </div>
  208. <div class="addRoom_box">
  209. <div>
  210. <el-input v-model="goNum" placeholder="请输入要加入的房间号"></el-input>
  211. <div class="room_b">备注:输入房间号点击加入房间或点击创建房间直接创建房间</div>
  212. <div class="room_btn">
  213. <el-button class="roomBtn" type="primary" @click="goRoom(goNum)">加入房间</el-button>
  214. <el-button class="roomBtn" type="primary" @click="checkNum">创建房间</el-button>
  215. </div>
  216. </div>
  217. </div>
  218. </el-dialog>
  219. <div v-if="proVisible" class="mask">
  220. <div class="progressBox">
  221. <div class="lbox">
  222. <img :src="require('../../assets/loading.gif')" />上传中,请稍后
  223. </div>
  224. <el-progress
  225. :text-inside="true"
  226. :stroke-width="20"
  227. :percentage="progress"
  228. style="width:80%"
  229. ></el-progress>
  230. </div>
  231. </div>
  232. </div>
  233. </template>
  234. <script>
  235. import Clipboard from "clipboard";
  236. export default {
  237. data() {
  238. return {
  239. timer: null,
  240. userinfo: [],
  241. RoomInfo: [],
  242. copyText: "",
  243. userid: this.$route.query.userid,
  244. data: [],
  245. dialogVisible: false,
  246. dialogVisible2: false,
  247. dialogVisible3: true,
  248. deleteVisible1: false,
  249. deleteVisible2: false,
  250. dialogImgVisible: false,
  251. dialogImageUrl: "",
  252. remarks: "",
  253. goNum: "",
  254. numNum: "",
  255. file: {},
  256. gIndex: "",
  257. pIndex: "",
  258. proVisible: false,
  259. progress: 0,
  260. playerOptions: {
  261. playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
  262. autoplay: false, //如果true,浏览器准备好时开始回放。
  263. muted: false, // 默认情况下将会消除任何音频。
  264. loop: false, // 导致视频一结束就重新开始。
  265. preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
  266. language: "zh-CN",
  267. aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  268. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  269. sources: [
  270. {
  271. type: "video/mp4", //这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目 || "video/ogg"|| "video/webm"
  272. src: "", //url地址require("../../assets/media/aaa.mp4")
  273. },
  274. ],
  275. // poster: require("../../assets/tu31.png"), //你的封面地址
  276. // poster: dataRes.imgUrl, //你的封面地址
  277. notSupportedMessage: "此视频暂无法播放,请稍后再试", //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  278. controlBar: {
  279. timeDivider: true, //当前时间和持续时间的分隔符
  280. durationDisplay: true, //显示持续时间
  281. remainingTimeDisplay: false, //是否显示剩余时间功能
  282. fullscreenToggle: true, //全屏按钮
  283. },
  284. },
  285. playerO: {},
  286. };
  287. },
  288. methods: {
  289. copy() {
  290. this.copyText =
  291. this.$refs.inviteT.innerHTML +
  292. "\n" +
  293. this.$refs.invite1.innerHTML +
  294. "\n" +
  295. this.$refs.invite2.innerHTML +
  296. "\n" +
  297. this.$refs.invite3.innerText +
  298. "\n" +
  299. this.$refs.invite4.innerHTML;
  300. var clipboard = new Clipboard(".tag-read");
  301. clipboard.on("success", (e) => {
  302. this.$message.success("复制成功");
  303. console.log("复制成功");
  304. clipboard.destroy(); // 释放内存
  305. });
  306. clipboard.on("error", (e) => {
  307. console.log("不支持复制,该浏览器不支持自动复制");
  308. clipboard.destroy(); // 释放内存
  309. });
  310. },
  311. handleClose(done) {
  312. this.restart();
  313. done();
  314. },
  315. handleClose2(done) {
  316. // done();
  317. },
  318. restart() {
  319. this.file = {};
  320. this.gIndex = "";
  321. this.remarks = "";
  322. if (this.$refs.pathClear1) {
  323. this.$refs.pathClear1.value = "";
  324. this.$refs.pathClear2.value = "";
  325. }
  326. },
  327. deleteGrid(index) {
  328. if (this.data[index].userid != this.userid) {
  329. this.$message.error("你不是上传人无权限删除");
  330. return;
  331. }
  332. this.$confirm("确定删除吗?", "提示", {
  333. confirmButtonText: "确定",
  334. cancelButtonText: "取消",
  335. type: "warning",
  336. })
  337. .then(() => {
  338. this.data[index] = "";
  339. this.updateRoomData();
  340. this.$forceUpdate();
  341. })
  342. .catch(() => {});
  343. },
  344. updateRoomData() {
  345. let params = [
  346. {
  347. data: JSON.stringify(this.data),
  348. idL: this.RoomInfo.id,
  349. },
  350. ];
  351. this.ajax
  352. .post(this.$store.state.api + "updateRoomData", params)
  353. .then((res) => {})
  354. .catch((err) => {});
  355. },
  356. check(index, type) {
  357. this.gIndex = index;
  358. if (this.data[index].userid != this.userid && type != 2 && type != 3) {
  359. this.$message.error("你不是上传人无权限修改");
  360. return;
  361. }
  362. if (this.data[index] && this.data[index].userid == this.userid) {
  363. if (this.data[index].userid != this.userid) {
  364. this.$message.error("你不是上传人无权限修改");
  365. return;
  366. }
  367. this.file = {
  368. photo: this.data[index].photo,
  369. userid: this.data[index].userid,
  370. video:
  371. this.data[index].video &&
  372. this.data[index].video.sources &&
  373. this.data[index].video.sources[0].src,
  374. };
  375. this.remarks = this.data[index].remarks[0].remarks;
  376. } else if (this.data[index] && type == 2) {
  377. this.file = {
  378. userid: this.data[index].userid,
  379. };
  380. for (var i = 0; i < this.data[index].remarks.length; i++) {
  381. if (this.data[index].remarks[i].userid == this.userid) {
  382. this.remarks = this.data[index].remarks[i].remarks;
  383. break;
  384. }
  385. }
  386. this.remarks = this.remarks ? this.remarks : "";
  387. }
  388. this.dialogVisible = true;
  389. },
  390. addEvent(e) {
  391. var el = e.currentTarget;
  392. el.getElementsByTagName("input")[0].click();
  393. },
  394. deleteFile(type) {
  395. if (type == 1) {
  396. this.file.photo = "";
  397. this.deleteVisible1 = false;
  398. this.$refs.pathClear1.value = "";
  399. } else {
  400. this.file.video = "";
  401. this.deleteVisible2 = false;
  402. this.$refs.pathClear2.value = "";
  403. }
  404. this.$forceUpdate();
  405. },
  406. addGrid() {
  407. if (!this.file.userid || this.file.userid == this.userid) {
  408. if (!this.file.video && !this.file.photo) {
  409. this.$message.error("至少上传一个视频或者一张图片");
  410. return;
  411. }
  412. if(!this.data[this.gIndex]){
  413. this.data[this.gIndex] = {}
  414. }
  415. if (this.file.photo) {
  416. this.data[this.gIndex].photo = this.file.photo;
  417. } else {
  418. // this.playerOptions.sources[0].src = ""
  419. var video = JSON.parse(JSON.stringify(this.playerOptions));
  420. video.sources[0].src = this.file.video;
  421. this.data[this.gIndex].video = video;
  422. }
  423. if (this.data[this.gIndex].remarks) {
  424. this.data[this.gIndex].remarks[0] = {
  425. remarks: this.remarks,
  426. userid: this.userinfo.userid,
  427. username: this.userinfo.name,
  428. };
  429. } else {
  430. this.data[this.gIndex].remarks = [
  431. {
  432. remarks: this.remarks,
  433. userid: this.userinfo.userid,
  434. username: this.userinfo.name,
  435. },
  436. ];
  437. }
  438. this.data[this.gIndex].userid = this.userinfo.userid;
  439. } else {
  440. if (!this.remarks) {
  441. this.$message.error("备注不能为空");
  442. return;
  443. }
  444. var a = 0;
  445. for (var i = 0; i < this.data[this.gIndex].remarks.length; i++) {
  446. if (this.data[this.gIndex].remarks[i].userid == this.userid) {
  447. a++;
  448. this.data[this.gIndex].remarks[i] = {
  449. remarks: this.remarks,
  450. userid: this.userinfo.userid,
  451. username: this.userinfo.name,
  452. };
  453. break;
  454. }
  455. }
  456. if (a < 1) {
  457. this.data[this.gIndex].remarks.push({
  458. remarks: this.remarks,
  459. userid: this.userinfo.userid,
  460. username: this.userinfo.name,
  461. });
  462. }
  463. }
  464. this.updateRoomData();
  465. this.dialogVisible = false;
  466. this.$forceUpdate();
  467. this.restart();
  468. },
  469. beforeUpload(event, type) {
  470. // debugger;
  471. if (this.file.photo && type != 1) {
  472. this.$message.error("只能上传一个视频或者一张图片");
  473. this.$refs.pathClear2.value = "";
  474. return;
  475. } else if (this.file.video && type != 2) {
  476. this.$message.error("只能上传一个视频或者一张图片");
  477. this.$refs.pathClear1.value = "";
  478. return;
  479. }
  480. var file = event.target.files[0];
  481. var credentials = {
  482. accessKeyId: "AKIATLPEDU37QV5CHLMH",
  483. secretAccessKey: "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",
  484. }; //秘钥形式的登录上传
  485. window.AWS.config.update(credentials);
  486. window.AWS.config.region = "cn-northwest-1"; //设置区域
  487. var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
  488. var _this = this;
  489. if (type == 1) {
  490. var mediaFormatList = ["png", "jpg", "jpeg"];
  491. if (
  492. mediaFormatList.indexOf(
  493. file.name
  494. .split(".")
  495. [file.name.split(".").length - 1].toLocaleLowerCase()
  496. ) == "-1"
  497. ) {
  498. _this.$message.error("请上传jpg或者png的图片格式文件");
  499. return;
  500. }
  501. } else {
  502. var mediaFormatList = ["mp4"];
  503. if (
  504. mediaFormatList.indexOf(
  505. file.name
  506. .split(".")
  507. [file.name.split(".").length - 1].toLocaleLowerCase()
  508. ) == "-1"
  509. ) {
  510. _this.$message.error("请上传mp4视频格式文件");
  511. return;
  512. }
  513. }
  514. _this.progress = 0;
  515. _this.proVisible = true;
  516. if (file) {
  517. var params = {
  518. Key:
  519. file.name.split(".")[0] +
  520. new Date().getTime() +
  521. "." +
  522. file.name.split(".")[1],
  523. ContentType: file.type,
  524. Body: file,
  525. "Access-Control-Allow-Credentials": "*",
  526. ACL: "public-read",
  527. }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
  528. var options = {
  529. partSize: 2048 * 1024 * 1024,
  530. queueSize: 2,
  531. leavePartsOnError: true,
  532. };
  533. bucket
  534. .upload(params, options)
  535. .on("httpUploadProgress", function (evt) {
  536. //这里可以写进度条
  537. // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
  538. _this.progress = parseInt((evt.loaded * 80) / evt.total);
  539. })
  540. .send(function (err, data) {
  541. this.progress = 100;
  542. setTimeout(() => {
  543. _this.proVisible = false;
  544. }, 1000);
  545. if (err) {
  546. _this.$message.error("上传失败");
  547. } else {
  548. if (type == 1) {
  549. _this.file.photo = data.Location;
  550. } else {
  551. _this.file.video = data.Location;
  552. }
  553. _this.$forceUpdate();
  554. console.log(data.Location);
  555. }
  556. });
  557. }
  558. },
  559. getUser() {
  560. let params = { uid: this.userid };
  561. this.ajax
  562. .get(this.$store.state.api + "getUser", params)
  563. .then((res) => {
  564. this.userinfo = res.data[0][0];
  565. console.log(res.data[0][0]);
  566. })
  567. .catch((err) => {
  568. console.error(err);
  569. });
  570. },
  571. MathRand() {
  572. var Num = "";
  573. for (var i = 0; i < 6; i++) {
  574. Num += Math.floor(Math.random() * 10);
  575. }
  576. return Num;
  577. },
  578. checkNum() {
  579. this.numNum = this.MathRand();
  580. let params = {
  581. num: this.numNum,
  582. };
  583. this.ajax
  584. .get(this.$store.state.api + "checkRoomNum", params)
  585. .then((res) => {
  586. console.log(res.data[0].length);
  587. if (res.data[0].length) {
  588. this.checkNum();
  589. } else {
  590. this.addRoom();
  591. }
  592. })
  593. .catch((err) => {
  594. console.error(err);
  595. });
  596. },
  597. addRoom() {
  598. let params = [
  599. {
  600. uid: this.userid,
  601. n: this.numNum,
  602. d: JSON.stringify(this.data),
  603. },
  604. ];
  605. this.ajax
  606. .post(this.$store.state.api + "insertRoom", params)
  607. .then((res) => {
  608. this.$message.success("创建成功");
  609. this.selectRoom(this.userid);
  610. })
  611. .catch((err) => {
  612. this.$message.error("创建失败");
  613. console.error(err);
  614. });
  615. },
  616. selectRoom(uid) {
  617. let params = {
  618. uid: uid,
  619. };
  620. this.ajax
  621. .get(this.$store.state.api + "selectRoom", params)
  622. .then((res) => {
  623. if (res.data[0].length) {
  624. this.RoomInfo = res.data[0][0];
  625. this.data = JSON.parse(res.data[0][0].data);
  626. this.dialogVisible3 = false;
  627. this.dialogVisible2 = true;
  628. this.timer = setInterval(() => {
  629. this.selectRoom2(uid);
  630. }, 5000);
  631. } else {
  632. // this.$message.error("此房间不存在或已被解散");
  633. }
  634. })
  635. .catch((err) => {
  636. console.error(err);
  637. });
  638. },
  639. goRoom(uid) {
  640. let params = {
  641. uid: uid,
  642. };
  643. this.ajax
  644. .get(this.$store.state.api + "selectRoom", params)
  645. .then((res) => {
  646. if (res.data[0].length) {
  647. this.$message.success("加入成功");
  648. this.RoomInfo = res.data[0][0];
  649. this.data = JSON.parse(res.data[0][0].data);
  650. this.dialogVisible3 = false;
  651. this.dialogVisible2 = true;
  652. this.timer = setInterval(() => {
  653. this.selectRoom2(uid);
  654. }, 5000);
  655. } else {
  656. this.$message.error("此房间不存在或已被解散");
  657. }
  658. })
  659. .catch((err) => {
  660. console.error(err);
  661. });
  662. },
  663. selectRoom2(uid) {
  664. let params = {
  665. uid: uid,
  666. };
  667. this.ajax
  668. .get(this.$store.state.api + "selectRoom", params)
  669. .then((res) => {
  670. this.RoomInfo = res.data[0][0];
  671. this.data = JSON.parse(res.data[0][0].data);
  672. })
  673. .catch((err) => {
  674. console.error(err);
  675. });
  676. },
  677. dismiss() {
  678. this.$confirm("确定解散房间吗?", "提示", {
  679. confirmButtonText: "确定",
  680. cancelButtonText: "取消",
  681. type: "warning",
  682. })
  683. .then(() => {
  684. let params = [
  685. {
  686. id: this.RoomInfo.id,
  687. },
  688. ];
  689. this.ajax
  690. .post(this.$store.state.api + "dismiss", params)
  691. .then((res) => {
  692. this.$message.success("解散成功");
  693. this.$router.go(0);
  694. })
  695. .catch((err) => {
  696. console.error(err);
  697. });
  698. })
  699. .catch(() => {});
  700. },
  701. },
  702. beforeDestroy() {
  703. clearInterval(this.timer);
  704. },
  705. created() {
  706. for (var i = 0; i < 16; i++) {
  707. this.data.push("");
  708. }
  709. this.getUser();
  710. this.selectRoom(this.userid);
  711. },
  712. };
  713. </script>
  714. <style scoped>
  715. .g_body {
  716. width: 100%;
  717. height: 100%;
  718. background: #fff;
  719. border-radius: 5px;
  720. display: flex;
  721. align-items: center;
  722. justify-content: center;
  723. flex-wrap: wrap;
  724. position: relative;
  725. min-height: 750px;
  726. }
  727. .coin {
  728. position: absolute;
  729. width: 50px;
  730. z-index: 1;
  731. }
  732. .coin1 {
  733. top: 10px;
  734. left: 20px;
  735. }
  736. .coin2 {
  737. top: 10px;
  738. right: 20px;
  739. }
  740. .coin3 {
  741. bottom: 10px;
  742. left: 20px;
  743. }
  744. .coin4 {
  745. bottom: 10px;
  746. right: 20px;
  747. }
  748. .g_box {
  749. background: rgb(227 228 232);
  750. width: calc(100% / 4 - 15px);
  751. height: calc(100% / 4 - 15px);
  752. margin: 5px;
  753. border-radius: 5px;
  754. cursor: pointer;
  755. display: flex;
  756. align-items: center;
  757. justify-content: center;
  758. /* overflow: hidden; */
  759. position: relative;
  760. }
  761. .photo_img {
  762. width: 100%;
  763. height: 100%;
  764. border-radius: 5px;
  765. }
  766. .g_box .add_img {
  767. width: 100px;
  768. display: none;
  769. }
  770. .g_box:hover .add_img {
  771. display: block;
  772. }
  773. .look_notice >>> .el-dialog__header {
  774. padding: 10px 20px;
  775. text-align: center;
  776. background: #32455b;
  777. }
  778. .look_notice >>> .el-dialog__title {
  779. font-size: 14px !important;
  780. color: #fff !important;
  781. }
  782. .look_notice >>> .el-dialog__headerbtn {
  783. font-size: 20px !important;
  784. top: 10px;
  785. }
  786. .look_notice >>> .el-form-item__label {
  787. margin-left: 65px;
  788. }
  789. .look_notice >>> .el-form-item {
  790. display: flex;
  791. }
  792. .look_notice >>> .el-form-item__content {
  793. margin: 0 !important;
  794. }
  795. .look_notice >>> .el-dialog__footer {
  796. text-align: center !important;
  797. }
  798. .look_notice >>> .el-dialog {
  799. min-width: 450px;
  800. background: #f3f3f3;
  801. }
  802. .notice_content {
  803. width: 100%;
  804. word-wrap: break-word;
  805. word-break: break-all;
  806. overflow: hidden;
  807. font-size: 18px;
  808. line-height: 35px;
  809. text-indent: 35px;
  810. min-width: 385px;
  811. }
  812. .roomBtn {
  813. background: rgb(112 183 79);
  814. /* padding: 0 !important; */
  815. border: none;
  816. }
  817. .close {
  818. width: 150px;
  819. height: 40px;
  820. border-radius: 30px;
  821. line-height: 30px;
  822. font-size: 14px;
  823. background: rgb(112 183 79);
  824. padding: 0 !important;
  825. border: none;
  826. }
  827. .header-title {
  828. display: flex;
  829. }
  830. .logoImg {
  831. width: 30px;
  832. }
  833. .logoImg > img {
  834. width: 100%;
  835. height: 100%;
  836. }
  837. .title_add_student {
  838. /* margin: 0 auto; */
  839. color: #fff;
  840. }
  841. .grid_member {
  842. position: absolute;
  843. background: #fff;
  844. right: 70px;
  845. top: 18px;
  846. min-width: 320px;
  847. height: 50px;
  848. border-radius: 5px;
  849. padding-right: 10px;
  850. display: flex;
  851. align-items: center;
  852. z-index: 1;
  853. user-select: none;
  854. }
  855. .member_imgbox {
  856. display: flex;
  857. align-items: center;
  858. margin: 0 10px;
  859. width: 185px;
  860. }
  861. .member_img {
  862. height: 40px;
  863. width: 40px;
  864. border-radius: 50px;
  865. overflow: hidden;
  866. display: block;
  867. background: aliceblue;
  868. }
  869. .member_img + .member_img {
  870. margin-left: 8px;
  871. }
  872. .upload_box {
  873. border-radius: 5px;
  874. background: #fff;
  875. position: relative;
  876. }
  877. .upload_box .list_img {
  878. position: absolute;
  879. top: 10px;
  880. left: 10px;
  881. }
  882. .upload_box .upload_content {
  883. display: flex;
  884. align-items: center;
  885. justify-content: center;
  886. padding: 50px 0 20px;
  887. }
  888. .upload_box .upload_content div {
  889. display: flex;
  890. align-items: center;
  891. justify-content: center;
  892. cursor: pointer;
  893. position: relative;
  894. }
  895. .delete_img {
  896. position: absolute !important;
  897. width: 25px;
  898. transform: translate(50%, -50%);
  899. top: 0;
  900. z-index: 1;
  901. right: 0;
  902. }
  903. .upload_img {
  904. width: 306px;
  905. height: 206px;
  906. }
  907. .textarea_box {
  908. background: #fff;
  909. margin-top: 20px;
  910. display: flex;
  911. flex-direction: column;
  912. align-items: center;
  913. padding: 20px 0;
  914. }
  915. .textarea_title {
  916. width: 95%;
  917. margin: 0 auto;
  918. font-size: 16px;
  919. }
  920. .textarea_content {
  921. width: 95%;
  922. margin: 10px auto 0;
  923. border-radius: 10px;
  924. }
  925. .textarea_content >>> .el-textarea__inner {
  926. background: rgb(243, 243, 243);
  927. border: none;
  928. }
  929. .invite_dialog >>> .el-dialog__body {
  930. padding: 15px 20px;
  931. }
  932. .room_dialog >>> .el-dialog {
  933. margin-top: 50vh !important;
  934. transform: translateY(-50%);
  935. min-width: unset;
  936. }
  937. .invite_box {
  938. font-size: 16px;
  939. background: #fff;
  940. border-radius: 5px;
  941. padding: 30px 0 150px;
  942. }
  943. .invite_title {
  944. width: 90%;
  945. margin: 0 auto 20px;
  946. }
  947. .line {
  948. width: 95%;
  949. border-top: 1px solid rgb(230, 230, 230);
  950. margin: 0 auto;
  951. }
  952. .invite_link {
  953. width: 90%;
  954. margin: 20px auto 30px;
  955. }
  956. .invite_link div + div {
  957. margin-top: 15px;
  958. }
  959. .invite_num {
  960. width: 90%;
  961. margin: 0 auto 50px;
  962. }
  963. .invite_num span {
  964. color: rgb(112 183 79);
  965. font-size: 28px;
  966. }
  967. .addRoom_box {
  968. background: #fff;
  969. padding: 30px 20px;
  970. border-radius: 5px;
  971. }
  972. .room_b {
  973. margin: 5px 0 30px;
  974. /* width:300px; */
  975. }
  976. .room_btn {
  977. display: flex;
  978. justify-content: space-around;
  979. }
  980. .mask {
  981. background-color: rgba(0, 0, 0, 0);
  982. position: fixed;
  983. top: 0;
  984. left: 0;
  985. width: 100%;
  986. height: 100%;
  987. z-index: 20000;
  988. display: flex;
  989. align-items: center;
  990. justify-content: center;
  991. }
  992. .progressBox {
  993. width: 500px;
  994. height: 180px;
  995. background: #fff;
  996. border-radius: 10px;
  997. box-shadow: 0 0 6px 1px #bfbfbf;
  998. display: flex;
  999. align-items: center;
  1000. justify-content: center;
  1001. flex-direction: column;
  1002. }
  1003. .progressBox .lbox {
  1004. height: 100px;
  1005. font-size: 19px;
  1006. display: flex;
  1007. align-items: center;
  1008. }
  1009. .progressBox .lbox img {
  1010. width: 40px;
  1011. margin-right: 20px;
  1012. }
  1013. .progressBox >>> .el-progress-bar__outer {
  1014. background-color: #d1dfff !important;
  1015. }
  1016. .top-popover {
  1017. position: absolute;
  1018. top: -50px;
  1019. left: 0;
  1020. background: #fff;
  1021. display: flex;
  1022. height: 45px;
  1023. align-items: center;
  1024. padding: 0px 10px 0 20px;
  1025. border-radius: 5px;
  1026. box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
  1027. z-index: 10;
  1028. transition: 0.5s all;
  1029. opacity: 0;
  1030. visibility: hidden;
  1031. }
  1032. .top-popover .pChild {
  1033. display: flex;
  1034. align-items: center;
  1035. }
  1036. .top-popover .pChild + .pChild {
  1037. margin-left: 10px;
  1038. }
  1039. .left-popover {
  1040. position: absolute;
  1041. top: 0px;
  1042. right: -65px;
  1043. background: #fff;
  1044. display: flex;
  1045. width: 45px;
  1046. align-items: center;
  1047. padding: 10px 5px 20px;
  1048. border-radius: 5px;
  1049. box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
  1050. z-index: 10;
  1051. flex-direction: column;
  1052. justify-content: center;
  1053. transition: 0.5s all;
  1054. opacity: 0;
  1055. visibility: hidden;
  1056. }
  1057. .left-popover .pChild {
  1058. display: flex;
  1059. align-items: center;
  1060. flex-direction: column;
  1061. }
  1062. .left-popover .pChild span {
  1063. display: flex;
  1064. align-items: center;
  1065. flex-direction: column;
  1066. text-align: center;
  1067. }
  1068. .left-popover .pChild + .pChild {
  1069. margin-top: 10px;
  1070. }
  1071. .right-popover {
  1072. position: absolute;
  1073. top: 0px;
  1074. left: -65px;
  1075. background: #fff;
  1076. display: flex;
  1077. width: 45px;
  1078. align-items: center;
  1079. padding: 10px 5px 20px;
  1080. border-radius: 5px;
  1081. box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
  1082. z-index: 10;
  1083. flex-direction: column;
  1084. justify-content: center;
  1085. transition: 0.5s all;
  1086. opacity: 0;
  1087. visibility: hidden;
  1088. }
  1089. .right-popover .pChild {
  1090. display: flex;
  1091. align-items: center;
  1092. flex-direction: column;
  1093. }
  1094. .right-popover .pChild span {
  1095. display: flex;
  1096. align-items: center;
  1097. flex-direction: column;
  1098. text-align: center;
  1099. }
  1100. .right-popover .pChild + .pChild {
  1101. margin-top: 10px;
  1102. }
  1103. .visibleO {
  1104. opacity: 1 !important;
  1105. visibility: visible !important;
  1106. }
  1107. .remark-bottom-popover {
  1108. position: absolute;
  1109. bottom: 0px;
  1110. left: 0;
  1111. background: #fff;
  1112. max-height: 150px;
  1113. width: 100%;
  1114. padding: 10px 20px;
  1115. border-radius: 5px;
  1116. box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
  1117. z-index: 10;
  1118. transition: 0.5s all;
  1119. box-sizing: border-box;
  1120. transform: translateY(calc(100% + 5px));
  1121. overflow: auto;
  1122. opacity: 0;
  1123. visibility: hidden;
  1124. }
  1125. .Rbox {
  1126. display: flex;
  1127. word-break: break-all;
  1128. }
  1129. .Rbox + .Rbox {
  1130. border-top: 1px solid rgb(233, 233, 233);
  1131. margin-top: 10px;
  1132. padding-top: 10px;
  1133. }
  1134. .Rportal {
  1135. height: 45px;
  1136. min-width: 45px;
  1137. border-radius: 50px;
  1138. overflow: hidden;
  1139. display: block;
  1140. background: aliceblue;
  1141. user-select: none;
  1142. }
  1143. .RContent {
  1144. margin-left: 10px;
  1145. }
  1146. .RContent div:nth-child(1) {
  1147. user-select: none;
  1148. color: rgb(80, 80, 80);
  1149. margin-bottom: 5px;
  1150. font-size: 14px;
  1151. }
  1152. .RContent div:nth-child(2) {
  1153. font-family: "微软雅黑";
  1154. font-size: 15px;
  1155. }
  1156. .remark-right-popover {
  1157. position: absolute;
  1158. top: 0;
  1159. right: 0;
  1160. background: #fff;
  1161. max-height: 100%;
  1162. width: 300px;
  1163. padding: 10px 20px;
  1164. border-radius: 5px;
  1165. box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
  1166. z-index: 10;
  1167. transition: 0.5s all;
  1168. box-sizing: border-box;
  1169. transform: translateX(calc(100% + 5px));
  1170. overflow: auto;
  1171. opacity: 0;
  1172. visibility: hidden;
  1173. }
  1174. .remark-left-popover {
  1175. position: absolute;
  1176. top: 0;
  1177. left: 0;
  1178. background: #fff;
  1179. max-height: 100%;
  1180. width: 300px;
  1181. padding: 10px 20px;
  1182. border-radius: 5px;
  1183. box-shadow: 0 1px 3px 1px rgb(202, 202, 202);
  1184. z-index: 10;
  1185. transition: 0.5s all;
  1186. box-sizing: border-box;
  1187. transform: translateX(calc(-100% - 5px));
  1188. overflow: auto;
  1189. opacity: 0;
  1190. visibility: hidden;
  1191. }
  1192. </style>