GridList.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <div class="pb_content g_body">
  3. <div class="topBg">
  4. <div class="wordIcon">
  5. <div class="docImg">
  6. <img src="../../assets/icon/word/gridIcon.png" alt="" />
  7. </div>
  8. <div>思维网格</div>
  9. </div>
  10. <div class="searchRoom">
  11. <div class="firstTop">
  12. <input
  13. type="text"
  14. placeholder="输入房间名称/号码...."
  15. v-model="roomS"
  16. />
  17. <div @click="getRoomList">确定</div>
  18. </div>
  19. <div class="lastTop">
  20. <div class="notice">
  21. <img src="../../assets/icon/word/notice.png" alt="" />
  22. </div>
  23. <div>若找不到房间,输入房间号或名称进行搜索哦!</div>
  24. </div>
  25. </div>
  26. <div class="addOrCreateRoom">
  27. <div @click="dialogVisible = true">加入房间</div>
  28. <div
  29. v-if="tType == '1'"
  30. @click="
  31. goTo(
  32. '/Grid?userid=' +
  33. userid +
  34. '&oid=' +
  35. oid +
  36. '&cid=' +
  37. cid +
  38. '&tType=' +
  39. tType
  40. )
  41. "
  42. >
  43. 创建房间
  44. </div>
  45. </div>
  46. </div>
  47. <div class="roomBox">
  48. <div class="roomDiv" v-for="(r, rIndex) in roomList" :key="rIndex">
  49. <div class="roomImg">
  50. <img src="../../assets/icon/word/noImg.png" alt="" />
  51. </div>
  52. <div class="roomName">
  53. <div>{{ r.name ? r.name : "暂无房间名称" }}</div>
  54. <div>房间号 {{ r.num }}</div>
  55. </div>
  56. <div class="enterRoom" @click="enterRoom(r.num)">进入房间</div>
  57. </div>
  58. <div v-if="roomList.length == 0" class="noRoom">
  59. <img src="../../assets/icon/word/noRoom.png" alt="" />
  60. </div>
  61. </div>
  62. <el-dialog
  63. title="加入房间"
  64. class="addOrCreateRoom"
  65. :visible.sync="dialogVisible"
  66. :append-to-body="true"
  67. width="500px"
  68. :before-close="handleClose"
  69. >
  70. <div slot="title" class="header-title">
  71. <div class="title_add_student">加入房间</div>
  72. </div>
  73. <div class="addRoom_box">
  74. <div class="inputBox">
  75. <el-input
  76. v-model="goNum"
  77. placeholder="请输入要加入的房间号"
  78. ></el-input>
  79. <div class="room_b">
  80. 备注:输入房间号点击加入房间或点击创建房间直接创建房间
  81. </div>
  82. <div class="room_btn">
  83. <el-button
  84. class="roomBtn"
  85. type="primary"
  86. @click="
  87. goTo(
  88. '/Grid?userid=' +
  89. userid +
  90. '&oid=' +
  91. oid +
  92. '&cid=' +
  93. cid +
  94. '&tType=' +
  95. tType +
  96. '&goNum=' +
  97. goNum
  98. )
  99. "
  100. >加入房间</el-button
  101. >
  102. <!-- <el-button class="roomBtn" type="primary" @click="goRoom(goNum)"
  103. >加入房间</el-button
  104. >
  105. <el-button class="roomBtn" type="primary" @click="checkNum"
  106. >创建房间</el-button
  107. > -->
  108. </div>
  109. </div>
  110. </div>
  111. </el-dialog>
  112. </div>
  113. </template>
  114. <script>
  115. import Clipboard from "clipboard";
  116. import draggable from "vuedraggable";
  117. export default {
  118. components: {
  119. //调用组件
  120. draggable,
  121. },
  122. data() {
  123. return {
  124. dialogVisible: false,
  125. goNum: "",
  126. roomList: [],
  127. copyText: "",
  128. userid: this.$route.query.userid,
  129. oid: this.$route.query.oid,
  130. cid: this.$route.query.cid,
  131. tType: this.$route.query.tType,
  132. roomS: "",
  133. };
  134. },
  135. methods: {
  136. goTo(path) {
  137. this.$router.push(path);
  138. },
  139. copy() {
  140. this.copyText =
  141. this.$refs.inviteT.innerHTML +
  142. "\n" +
  143. this.$refs.invite1.innerHTML +
  144. "\n" +
  145. this.$refs.invite2.innerHTML +
  146. "\n" +
  147. this.$refs.invite3.innerText +
  148. "\n" +
  149. this.$refs.invite4.innerHTML;
  150. var clipboard = new Clipboard(".tag-read");
  151. clipboard.on("success", (e) => {
  152. this.$message.success("复制成功");
  153. console.log("复制成功");
  154. clipboard.destroy(); // 释放内存
  155. });
  156. clipboard.on("error", (e) => {
  157. console.log("不支持复制,该浏览器不支持自动复制");
  158. clipboard.destroy(); // 释放内存
  159. });
  160. },
  161. handleClose(done) {
  162. done();
  163. },
  164. getRoomList() {
  165. let params = {
  166. uid: this.userid,
  167. oid: this.oid,
  168. cid: this.cid,
  169. cu: "",
  170. cn: this.roomS,
  171. };
  172. this.ajax
  173. .get(this.$store.state.api + "selectRoomList", params)
  174. .then((res) => {
  175. this.roomList = res.data[0];
  176. })
  177. .catch((err) => {
  178. console.error(err);
  179. });
  180. },
  181. enterRoom(num) {
  182. this.goNum = num;
  183. this.goTo(
  184. "/Grid?userid=" +
  185. this.userid +
  186. "&oid=" +
  187. this.oid +
  188. "&cid=" +
  189. this.cid +
  190. "&tType=" +
  191. this.tType +
  192. "&goNum=" +
  193. this.goNum
  194. );
  195. },
  196. },
  197. created() {
  198. this.getRoomList();
  199. },
  200. };
  201. </script>
  202. <style scoped>
  203. .g_body {
  204. width: 100%;
  205. height: 100%;
  206. margin: 0 !important;
  207. background: #e6eaf0;
  208. }
  209. .topBg {
  210. background: url("../../assets/icon/word/topBg.png");
  211. width: 100%;
  212. object-fit: cover;
  213. height: 220px;
  214. display: flex;
  215. flex-direction: row;
  216. flex-wrap: nowrap;
  217. align-items: center;
  218. justify-content: space-between;
  219. background-size: 100% 100%;
  220. }
  221. .wordIcon {
  222. display: flex;
  223. flex-direction: row;
  224. flex-wrap: nowrap;
  225. align-items: center;
  226. margin: 0 0 100px 45px;
  227. }
  228. .docImg {
  229. width: 40px;
  230. height: 40px;
  231. }
  232. .docImg > img,
  233. .notice > img,
  234. .roomImg > img,
  235. .noRoom > img {
  236. width: 100%;
  237. height: 100%;
  238. }
  239. .notice {
  240. width: 20px;
  241. height: 20px;
  242. }
  243. .wordIcon > div:nth-child(2) {
  244. font-size: 20px;
  245. color: #fff;
  246. margin-left: 10px;
  247. }
  248. .addOrCreateRoom {
  249. margin: 0 45px 100px 0;
  250. display: flex;
  251. flex-direction: row;
  252. flex-wrap: nowrap;
  253. align-items: center;
  254. }
  255. .addOrCreateRoom > div {
  256. width: 90px;
  257. background: #199cfe;
  258. height: 30px;
  259. color: #fff;
  260. border-radius: 5px;
  261. text-align: center;
  262. line-height: 30px;
  263. font-size: 12px;
  264. cursor: pointer;
  265. }
  266. .addOrCreateRoom > div:nth-child(2) {
  267. margin-left: 20px;
  268. }
  269. .searchRoom {
  270. margin-top: 100px;
  271. }
  272. .firstTop {
  273. display: flex;
  274. flex-direction: row;
  275. flex-wrap: nowrap;
  276. align-items: center;
  277. }
  278. .firstTop > input {
  279. width: 350px;
  280. height: 40px;
  281. outline: none;
  282. border: none;
  283. border-radius: 5px;
  284. text-indent: 10px;
  285. }
  286. .firstTop > div {
  287. width: 65px;
  288. background: #5e5e5e;
  289. color: #fff;
  290. height: 40px;
  291. text-align: center;
  292. line-height: 40px;
  293. border-radius: 5px;
  294. margin-left: 15px;
  295. cursor: pointer;
  296. }
  297. .lastTop {
  298. display: flex;
  299. flex-direction: row;
  300. flex-wrap: nowrap;
  301. align-items: center;
  302. margin-top: 10px;
  303. color: #fff;
  304. }
  305. .roomBox {
  306. width: 98%;
  307. margin: 20px 0 0 20px;
  308. display: flex;
  309. flex-direction: row;
  310. flex-wrap: wrap;
  311. justify-content: flex-start;
  312. align-items: center;
  313. }
  314. .roomDiv {
  315. border-radius: 5px;
  316. background: #fff;
  317. width: 250px;
  318. position: relative;
  319. height: 260px;
  320. margin: 0 30px 30px 0;
  321. }
  322. .roomNumer {
  323. position: absolute;
  324. right: 8px;
  325. color: #bababa;
  326. top: 2px;
  327. }
  328. .roomImg {
  329. width: 250px;
  330. margin: 0 auto;
  331. }
  332. .roomName {
  333. display: flex;
  334. flex-direction: column;
  335. flex-wrap: nowrap;
  336. align-items: flex-start;
  337. padding: 15px 10px;
  338. }
  339. .roomName > div:nth-child(1) {
  340. font-size: 15px;
  341. }
  342. .roomName > div:nth-child(2) {
  343. color: #bdbdbd;
  344. padding-top: 5px;
  345. font-size: 12px;
  346. }
  347. .enterRoom {
  348. background: #3e86ff;
  349. width: 80%;
  350. text-align: center;
  351. margin: 0 auto;
  352. height: 35px;
  353. line-height: 35px;
  354. color: #fff;
  355. border-radius: 3px;
  356. cursor: pointer;
  357. }
  358. body::-webkit-scrollbar {
  359. /*滚动条整体样式*/
  360. width: 6px;
  361. /*高宽分别对应横竖滚动条的尺寸*/
  362. height: 6px;
  363. }
  364. .addOrCreateRoom >>> .el-dialog {
  365. height: 200px;
  366. }
  367. .addOrCreateRoom >>> .el-dialog__header {
  368. background: #32455b;
  369. color: #fff;
  370. height: 40px;
  371. line-height: 40px;
  372. padding: 0 0 0 20px;
  373. }
  374. .addOrCreateRoom >>> .el-dialog__headerbtn {
  375. top: 13px !important;
  376. }
  377. .addOrCreateRoom >>> .el-dialog__body {
  378. background: #f3f3f3;
  379. height: 100%;
  380. }
  381. .addRoom_box {
  382. background: #fff;
  383. width: 100%;
  384. height: 100%;
  385. position: relative;
  386. }
  387. .inputBox {
  388. padding: 30px 0 0 20px;
  389. }
  390. .inputBox >>> .el-input {
  391. width: 95% !important;
  392. }
  393. .room_b {
  394. margin: 10px 0;
  395. }
  396. .room_btn {
  397. position: absolute;
  398. bottom: 35px;
  399. left: 39%;
  400. }
  401. .noRoom {
  402. margin: 10% auto 0;
  403. }
  404. </style>