Commit 0079538c authored by huanglu's avatar huanglu

feat: dist

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