Commit 0079538c authored by huanglu's avatar huanglu

feat: dist

parent 9d138982
.DS_Store
node_modules
/dist
/gk-online
plugins/*
......
......@@ -13,4 +13,3 @@ module.exports = {
publicPath: '/gk-online',
outputDir: 'gk-online'
}
\ No newline at end of file
......@@ -45,6 +45,7 @@
"node-sass": "^4.14.1",
"sass": "^1.26.8",
"sass-loader": "^8.0.2",
"sass-resources-loader": "^2.1.1",
"speed-measure-webpack-plugin": "^1.3.3",
"validate-commit-msg": "^2.14.0",
"vue-template-compiler": "^2.6.11"
......
......@@ -9,9 +9,6 @@
<script>
// import { mapMutations } from 'vuex';
// import { login, userinfo } from '@/api';
export default {
data() {
return {
......@@ -19,22 +16,8 @@ export default {
}
},
mounted() {
// login('huanglu', '123').then((res) => {
// console.log(res);
// });
// userinfo({ id: '2424' }).then((res) => {
// console.log('userinfo ----> ', res);
// });
},
methods: {
// ...mapMutations(['changeName']),
},
};
</script>
<style lang="scss">
.wrap {
// color: $good;
}
</style>
body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,
html,body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,
fieldset,legend,input,textarea, select {
margin: 0;
padding: 0;
......
@import './clear.scss';
// @import './clear.scss';
@import './variable.scss';
.bordered {
......
......@@ -4,6 +4,7 @@ import router from '@/router';
import store from '@/store';
import App from './App.vue';
import '@/utils/debug'
import '@/assets/styles/clear.scss'
Vue.config.productionTip = false;
......
......@@ -17,15 +17,10 @@ Vue.use(VueRouter);
// 单入口路由配置
const routes = [
{
path: '/',
path: '/home',
name: 'online-room',
component: OnlineRoom
},
{
path: '/home',
name: 'home',
component: Home
},
{
path: '/paint',
name: 'paint',
......@@ -40,7 +35,12 @@ const routes = [
path: '/big-screen',
name: 'big-screen',
component: DashScreen
}
},
{
path: '/',
name: 'home',
component: Home
},
];
const router = new VueRouter({
......
/* eslint-disable no-unused-expressions */
/* eslint-disable class-methods-use-this */
import {
ErrorCode, RtcError, LogLevel, Logger, ClientConfig, Client, StreamConfig, Stream, HRTC
} from 'hrtc'
import { HRTC } from 'hrtc'
import CryptoJS from 'crypto-js/crypto-js'
export default class HWOnline {
......@@ -17,7 +15,7 @@ export default class HWOnline {
if (navigator.getUserMedia) {
navigator.getUserMedia({audio: true,video: true}, () => {
r(true)
}, (err) => {
}, () => {
r(false)
})
} else {
......@@ -131,7 +129,7 @@ export default class HWOnline {
// 创建屏幕共享流
async createScreenShareStream() {
const supported = this.isScreenShareSupported()
if (!supported) {
if (supported) {
try {
// eslint-disable-next-line no-underscore-dangle
const stream = await this._startCapture({ audio: true, video: true, peerIdentity: true })
......
import io from 'socket.io-client'
import axios from 'axios'
const socketUrl = 'http://192.168.32.53:7001/'
const socketUrl = 'http://172.10.1.201:7001/'
const http = axios.create({
baseURL: socketUrl,
......@@ -9,7 +9,6 @@ const http = axios.create({
})
let skt = null
let resListeners = []
let msgListeners = []
const connect = (userId, cb) => {
......@@ -28,15 +27,7 @@ const connect = (userId, cb) => {
socket.on('disconnect', (data) => {
console.log('disconnect:', data)
})
// 接收在线用户信息
socket.on('res', (msg) => {
console.log('消息回执', msg);
// eslint-disable-next-line no-use-before-define
resListeners.forEach((item) => {
// eslint-disable-next-line no-unused-expressions
item && item(msg)
})
});
socket.on('msg', (msg) => {
console.log('接收消息', msg);
msgListeners.forEach((item) => {
......@@ -47,11 +38,6 @@ const connect = (userId, cb) => {
skt = socket
}
const onRes = (cb) => {
const data = resListeners.find((item) => cb === item)
// eslint-disable-next-line no-unused-expressions
cb && !data && resListeners.push(cb)
}
const onMsg = (cb) => {
const data = msgListeners.find((item) => cb === item)
console.log('data',data)
......@@ -60,11 +46,6 @@ const onMsg = (cb) => {
console.log('msgListeners',msgListeners)
}
const offRes = (cb) => {
const data = resListeners.filter((item) => cb !== item)
// eslint-disable-next-line no-const-assign
resListeners = data
}
const offMsg = (cb) => {
const data = msgListeners.filter((item) => cb !== item)
console.log('data====',data)
......@@ -72,14 +53,14 @@ const offMsg = (cb) => {
msgListeners = data
}
const sendMsg = (target, payload) => {
const sendMsg = (target, payload, cb) => {
skt.emit('msg', {
target,
payload
})
}, 'afafa', cb);
}
const sendGroupMsg = (payload) => {
skt.emit('msg',{from: skt.id,...payload})
const sendGroupMsg = (payload, cb) => {
skt.emit('msg',{from: skt.id,...payload}, cb);
}
const on = (name, cb) => {
......@@ -99,7 +80,6 @@ const createRoom = (groupId, groupName) => {
}
const joinRoom = (groupId,cb) => {
console.log('socket id: ', skt.id)
http.post('/socket/joinroom', {
groupId,
socketId: (skt && skt.id) || ''
......@@ -129,8 +109,6 @@ export default {
joinRoom,
queryRooms,
sendGroupMsg,
onRes,
onMsg,
offRes,
offMsg
}
......@@ -33,9 +33,9 @@ export default {
await this.rtc.joinRoom('123')
this.rtc.subscribedStreamCb((streams) => {
const stream = streams.find((itm) => itm.getUserId().includes('teacher'))
console.log('=======: ', streams)
if (stream) this.playStream = stream;
})
}
}
</script>
......
......@@ -5,15 +5,20 @@
<el-form ref="form" label-width="90px">
<el-row :gutter="10">
<el-col :span="24">
<el-form-item label="用户名">
<el-input class="input" v-model="username" placeholder="请输入用户名"></el-input>
</el-form-item>
</el-col>
<!-- <el-col :span="24">
<el-form-item label="输入房间号">
<el-input class="input" v-model="roomId" placeholder="请输入房间号" type="number"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
</el-col> -->
<!-- <el-col :span="24">
<el-form-item label="房间名">
<el-input class="input" v-model="roomName" placeholder="请输入房间名"></el-input>
</el-form-item>
</el-col>
</el-col> -->
</el-row>
<el-row :gutter="10">
<el-col :span="24">
......@@ -49,7 +54,8 @@ export default {
components: {},
data() {
return {
roomId: '',
username: '',
roomId: '1234',
roomName: '',
joinType: '学生大屏',
joinTypes
......@@ -66,9 +72,7 @@ export default {
}
const routeName = joinObj.path
socket.connect(userId, () => {
socket.joinRoom('teacherid', () => {
this.$router.push({ name: routeName, query: { userId }})
})
this.$router.push({ name: routeName, query: { userId }})
})
}
},
......@@ -78,19 +82,18 @@ export default {
</script>
<style lang="scss" scoped>
.gk-online-home {
background: url(~@/assets/images/bg.png) no-repeat;
background-size: 100% 100%;
background: url(~@/assets/images/bg.png) no-repeat fixed top;
background-origin: border-box;
background-repeat:no-repeat;
height: 100vh;
width: 100vw;
position: relative;
color: white;
top: 0; left: 0;
.content {
padding: 30px;
position: absolute;
top: 50%; left: 70%; transform: translateX(-50%) translateY(-50%);
width: 500px;
height: 400px;
background: rgba(47, 79, 109, 0.4);
border-radius: 10px;
.title {
......
<template>
<div class="paint-main" ref="pain_main">
<img :src="videoBg" class="bg"/>
<geek-draw-board ref="draw" :paintType="paintType" class="draw-board" />
<div class="tools-wrap">
<el-button class="itm" type="info" @click="changeTool(itm.title)"
v-for="itm in paintTypes" :key="itm.title">{{ itm.name }}</el-button>
</div>
<div class="stream-wrap">
<el-button class="itm" type="text" @click="steamAction(itm.title)"
v-for="itm in streamTypes" :key="itm.title">{{ itm.name }}</el-button>
</div>
<div class="reply-wrap">
<span class="itm" v-for="(itm, index) in replyList"
:key="index">{{ JSON.stringify(itm) }}</span>
</div>
<el-dialog title="推流设置"
width="400px"
:visible.sync="modal">
......@@ -39,6 +45,7 @@ import { GeekDrawBoard } from '@geek/geekui'
import Vue from 'vue'
import { videoBg } from '@/assets/images/index'
import HWRTC from '@/utils/hwrtc'
import socket from '@/utils/socket'
const paintTypes = [
{ title: 'pencil', name: '铅笔', width: 20 },
......@@ -48,10 +55,11 @@ const paintTypes = [
]
const streamTypes = [
{ title: 'ans', name: '学生答题' },
{ title: 'publish', name: '开始推流' },
{ title: 'unpublish', name: '停止推流' },
{ title: 'setting', name: '设置' },
{ title: 'full', name: '全屏' }
{ title: 'full', name: '全屏' },
]
Vue.use(GeekDrawBoard)
......@@ -70,7 +78,9 @@ export default {
cameras: [],
camera: '',
modal: false,
rtc: null
rtc: null,
replyList: [],
paints: []
};
},
methods: {
......@@ -89,13 +99,28 @@ export default {
if (action === 'publish') {
this.rtc.createScreenShareStream()
}
// if (action === 'unpublish') {
// }
if (action === 'ans') {
this.sendAnswerTag();
}
if (action === 'full') {
// eslint-disable-next-line no-unused-expressions
this.$refs.pain_main && this.$refs.pain_main.requestFullscreen();
}
},
sendAnswerTag() {
this.replyList = []
socket.sendGroupMsg({
type: 'question',
options: ['A', 'B', 'C', 'D'],
message: '请答题'
}, (res) => {
console.log('teacher send success: ', res);
})
},
registerMsgReceived() {
socket.onMsg((data) => {
this.replyList.push(data);
})
}
},
async mounted() {
......@@ -112,6 +137,7 @@ export default {
await this.rtc.joinRoom('123')
this.isJoin = true
this.mico = (this.micros[0] || {}).deviceId
this.registerMsgReceived()
}
}
</script>
......@@ -152,5 +178,28 @@ export default {
top: 5px;
right: 5px;
}
.reply-wrap {
position: fixed;
right: 20px;
bottom: 20px;
display: flex;
flex-flow: column;
.itm {
animation: reply 1.2s linear;
}
}
}
@keyframes reply {
0% {
position: relative;
right: -100%;
opacity: 0.2;
}
100% {
right: 0;
opacity: 1;
}
}
</style>
......@@ -57,12 +57,13 @@ module.exports = {
})
},
css: {
extract: true,
loaderOptions: {
sass: {
prependData: `
@import "@/assets/styles/common.scss";
`
}
`,
},
}
},
publicPath: config.publicPath || '/',
......
......@@ -1826,6 +1826,11 @@ async@^2.6.2:
dependencies:
lodash "^4.17.14"
async@^3.2.0:
version "3.2.0"
resolved "http://git.jksxb.cn:8081/repository/geek/async/-/async-3.2.0.tgz#b3a2685c5ebb641d3de02d161002c60fc9f85720"
integrity sha1-s6JoXF67ZB094C0WEALGD8n4VyA=
asynckit@^0.4.0:
version "0.4.0"
resolved "http://git.jksxb.cn:8081/repository/geek/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
......@@ -4591,7 +4596,7 @@ glob-to-regexp@^0.3.0:
resolved "http://git.jksxb.cn:8081/repository/geek/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=
glob@^7.0.0, glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@~7.1.1:
glob@^7.0.0, glob@^7.0.3, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@~7.1.1:
version "7.1.6"
resolved "http://git.jksxb.cn:8081/repository/geek/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=
......@@ -5917,6 +5922,15 @@ loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4
emojis-list "^3.0.0"
json5 "^1.0.1"
loader-utils@^2.0.0:
version "2.0.0"
resolved "http://git.jksxb.cn:8081/repository/geek/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
integrity sha1-5MrOW4FtQloWa18JfhDNErNgZLA=
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"
json5 "^2.1.2"
locate-path@^2.0.0:
version "2.0.0"
resolved "http://git.jksxb.cn:8081/repository/geek/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
......@@ -8132,6 +8146,16 @@ sass-loader@^8.0.2:
schema-utils "^2.6.1"
semver "^6.3.0"
sass-resources-loader@^2.1.1:
version "2.1.1"
resolved "http://git.jksxb.cn:8081/repository/geek/sass-resources-loader/-/sass-resources-loader-2.1.1.tgz#a231b7c4e326d9c8d141909c901233bef9453151"
integrity sha1-ojG3xOMm2cjRQZCckBIzvvlFMVE=
dependencies:
async "^3.2.0"
chalk "^4.1.0"
glob "^7.1.6"
loader-utils "^2.0.0"
sass@^1.26.8:
version "1.29.0"
resolved "http://git.jksxb.cn:8081/repository/geek/sass/-/sass-1.29.0.tgz#ec4e1842c146d8ea9258c28c141b8c2b7c6ab7f1"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment