Commit 4c1c4420 by SHINDAESUB

1차 업데이트

parent eb020176
{} {"admin":"관리자","aoiUid":281,"counter":3,"createDate":"2021-01-01","name":"테스트 프로젝트","state":true,"successDate":"2021-01-01","uid":191,"user":"작업자","updateDate":"2021-12-16T02:16:50.301Z"}
\ No newline at end of file \ No newline at end of file
...@@ -4,40 +4,62 @@ const router = express.Router() ...@@ -4,40 +4,62 @@ const router = express.Router()
router.get('/',async (req,res) => { router.get('/',async (req,res) => {
const project = JSON.parse( fs.readFileSync('./json/project.json').toString() ) const project = JSON.parse( fs.readFileSync('./json/project.json').toString() )
res.send(project) const learning = JSON.parse( fs.readFileSync('./json/learning.json').toString() )
let result = {
'project':project,
'learning':learning
}
res.send(result)
}) })
router.post('/',async (req,res) => { router.post('/',async (req,res) => {
const project = JSON.parse( fs.readFileSync('./json/project.json').toString() ) const project = JSON.parse( fs.readFileSync('./json/project.json').toString() )
const learning = JSON.parse( fs.readFileSync('./json/learning.json').toString() )
// 받아온 값이 있을경우 // 받아온 값이 있을경우
if(Object.keys(req.body).length !== 0 ){ if(Object.keys(req.body).length !== 0 ){
project.admin = req.body.admin project.admin = req.body.project.admin
project.aoiUid = req.body.aoiUid project.aoiUid = req.body.project.aoiUid
project.counter = req.body.counter project.counter = req.body.project.counter
project.createDate = req.body.createDate project.createDate = req.body.project.createDate
project.name = req.body.name project.name = req.body.project.name
project.state = req.body.state project.state = req.body.project.state
project.successDate = req.body.successDate project.successDate = req.body.project.successDate
project.uid = req.body.uid project.uid = req.body.project.uid
project.user = req.body.user project.user = req.body.project.user
project.infos = req.body.infos
project.updateDate = new Date() project.updateDate = new Date()
project.total = req.body.total project.total = req.body.project.total
project.success = req.body.success project.success = req.body.project.success
project.fail = req.body.fail project.fail = req.body.project.fail
project.result = req.body.result project.result = req.body.project.result
learning.learning = req.body.learning
fs.writeFileSync('./json/project.json',JSON.stringify(project) , (err) =>{ fs.writeFileSync('./json/project.json',JSON.stringify(project) , (err) =>{
if ( err ) return err; if ( err ) return err;
}) })
fs.writeFileSync('./json/learning.json',JSON.stringify(learning) , (err) =>{
if ( err ) return err;
})
}else{ }else{
fs.writeFileSync('./json/project.json',JSON.stringify({}) , (err) =>{ fs.writeFileSync('./json/project.json',JSON.stringify({}) , (err) =>{
if ( err ) return err; if ( err ) return err;
}) })
fs.writeFileSync('./json/learning.json',JSON.stringify({}) , (err) =>{
if ( err ) return err;
})
}
let result = {
'project':project,
'learning':learning.learning
} }
res.status(200).send(project) res.status(200).send(result)
}) })
module.exports = router module.exports = router
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><%= htmlWebpackPlugin.options.title %></title> <title>사용자 모드</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
......
...@@ -28,7 +28,6 @@ import Alert from './components/Alert.vue' ...@@ -28,7 +28,6 @@ import Alert from './components/Alert.vue'
import Loading from './components/Loading.vue' import Loading from './components/Loading.vue'
import Bluetooth from './components/Bluetooth.vue' import Bluetooth from './components/Bluetooth.vue'
export default { export default {
name: 'App', name: 'App',
...@@ -39,6 +38,8 @@ export default { ...@@ -39,6 +38,8 @@ export default {
}, },
created() { created() {
this.$store.dispatch('getSerial')
EventBus.$on('openAlert',( massage , type) => { EventBus.$on('openAlert',( massage , type) => {
this.alertOpen = true, this.alertOpen = true,
this.message = massage, this.message = massage,
...@@ -57,7 +58,6 @@ export default { ...@@ -57,7 +58,6 @@ export default {
EventBus.$on('openBluetooth',() => { this.bluetoothModal = true }), EventBus.$on('openBluetooth',() => { this.bluetoothModal = true }),
EventBus.$on('closeBluetooth',() => { this.bluetoothModal = false }) EventBus.$on('closeBluetooth',() => { this.bluetoothModal = false })
}, },
data: () => ({ data: () => ({
...@@ -68,15 +68,12 @@ export default { ...@@ -68,15 +68,12 @@ export default {
type:'', type:'',
}), }),
mounted(){
// this.$store.dispatch('getProjectList')
},
beforeDestroy(){ beforeDestroy(){
EventBus.$off('openAlert'); EventBus.$off('openAlert');
EventBus.$off('closeAlert'); EventBus.$off('closeAlert');
EventBus.$off('openLoading'); EventBus.$off('openLoading');
EventBus.$off('closeLoading'); EventBus.$off('closeLoading');
} }
}; };
</script> </script>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</v-toolbar> </v-toolbar>
<v-row class='px-4'> <v-row class='px-4'>
<v-col cols="6"> <v-col cols="6">
<v-subhaeder>안드로이드</v-subhaeder> <v-subheader>안드로이드</v-subheader>
<v-card> <v-card>
<v-row no-gutters> <v-row no-gutters>
<v-col cols="6"> <v-col cols="6">
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</v-card> </v-card>
</v-col> </v-col>
<v-col cols="6"> <v-col cols="6">
<v-subhaeder>아이폰</v-subhaeder> <v-subheader>아이폰</v-subheader>
<v-card color=""> <v-card color="">
<v-row no-gutters> <v-row no-gutters>
<v-col cols="6"> <v-col cols="6">
......
import gql from 'graphql-tag' // eslint-disable-line no-unused-vars import gql from 'graphql-tag' // eslint-disable-line no-unused-vars
import apolloProvider from '../plugins/apollo' import apolloProvider from '../plugins/apollo'
// import store from '@/store'
export default { export default {
async conncetion(input){ async get(serial){
try{ try{
const response = await apolloProvider.defaultClient.query({ const response = await apolloProvider.defaultClient.query({
query: gql` query: gql`
query neuroAoiSerial($serial: String!) { query aoiSerial($serial:String!){
neuroAoiSerial(serial: $serial) { aoiSerial(serial:$serial){
uid uid
projectUid
name name
state state
serial serial
etc
updateDate
createDate
}
}`,
fetchPolicy: 'no-cache',
variables: { serial: input }
})
let aoi = response.data.neuroAoiSerial
console.log('aoi :',aoi)
return aoi
}catch (e) {
return false
}
},
async getAois(){
try{
const response = await apolloProvider.defaultClient.query({
query: gql`
{
neuroAois{
uid
name
state
serial
etc
projectUid projectUid
createDate
updateDate
} }
} }
`, `,
fetchPolicy: 'no-cache' fetchPolicy: 'no-cache',
variables: { serial: serial }
}) })
console.log('gql 에서 생성하는 :', response.data.neuroAois) let aoi = response.data.aoiSerial
let aois = response.data.neuroAois
if (!aois) return '' if (!aoi) return ''
if (aois.errors) throw new Error(aois.errors[0]) if (aoi.errors) throw new Error(aoi.errors[0])
return aois return aoi
}catch (e) { }catch (e) {
console.log(e) console.log(e)
...@@ -70,29 +35,25 @@ export default { ...@@ -70,29 +35,25 @@ export default {
} }
}, },
async updateAoi(input){ async update(input){
try{ try{
const response = await apolloProvider.defaultClient.mutate({ const response = await apolloProvider.defaultClient.mutate({
mutation: gql` mutation: gql`
mutation updateNeuroAoi( $name: String! ,$state: Boolean! ,$createDate: String! , $serial:String! , $etc:String! ,$updateDate:String! ,$uid:Int! , $projectUid:Int ){ mutation updateAoi( $name: String! ,$state: Boolean! , $serial:String! ,$updateDate:String! ,$uid:Int! , $projectUid:Int ){
updateNeuroAoi(input:{ updateAoi(input:{
name:$name name:$name
state:$state state:$state
createDate:$createDate
serial:$serial serial:$serial
etc:$etc
updateDate:$updateDate updateDate:$updateDate
projectUid:$projectUid projectUid:$projectUid
uid:$uid uid:$uid
}) })
{ {
neuroAoi{ aoi{
uid uid
name name
state state
serial serial
etc
createDate
updateDate updateDate
projectUid projectUid
} }
...@@ -104,14 +65,12 @@ export default { ...@@ -104,14 +65,12 @@ export default {
name:input.name, name:input.name,
state:input.state, state:input.state,
serial:input.serial, serial:input.serial,
etc:input.etc,
createDate:input.createDate,
updateDate:new Date(), updateDate:new Date(),
projectUid:0 projectUid:0
} }
}) })
let aoi = response.data.updateNeuroAoi.neuroAoi let aoi = response.data.updateAoi.aoi
if (!aoi) return '' if (!aoi) return ''
...@@ -126,5 +85,4 @@ export default { ...@@ -126,5 +85,4 @@ export default {
throw e throw e
} }
}, },
} }
\ No newline at end of file
...@@ -2,14 +2,12 @@ import gql from 'graphql-tag' // eslint-disable-line no-unused-vars ...@@ -2,14 +2,12 @@ import gql from 'graphql-tag' // eslint-disable-line no-unused-vars
import apolloProvider from '../plugins/apollo' import apolloProvider from '../plugins/apollo'
export default { export default {
async getLearning(projectUid){ async get(projectUid){
console.log(projectUid)
try{ try{
const response = await apolloProvider.defaultClient.query({ const response = await apolloProvider.defaultClient.query({
query: gql` query: gql`
query neuroInfo($projectUid: Int!) { query learning($projectUid: Int!) {
neuroInfo(projectUid: $projectUid) { learning(projectUid: $projectUid) {
projectUid projectUid
order order
type type
...@@ -26,10 +24,12 @@ export default { ...@@ -26,10 +24,12 @@ export default {
} }
}`, }`,
fetchPolicy: 'no-cache',
variables: { projectUid: projectUid } variables: { projectUid: projectUid }
}) })
let learning = response.data.neuroInfo let learning = response.data.learning
if (!learning) return '' if (!learning) return ''
......
import gql from 'graphql-tag' // eslint-disable-line no-unused-vars import gql from 'graphql-tag' // eslint-disable-line no-unused-vars
import apolloProvider from '../plugins/apollo' import apolloProvider from '../plugins/apollo'
// import store from '@/store'
export default { export default {
async get(uid){ async get(uid){
try{ try{
const response = await apolloProvider.defaultClient.query({ const response = await apolloProvider.defaultClient.query({
query: gql` query: gql`
query neuroProject($aoiUid:Int!) { query nProject($aoiUid:Int!) {
neuroProject(aoiUid:$aoiUid) { nProject(aoiUid:$aoiUid) {
name name
admin admin
user user
...@@ -25,7 +26,7 @@ export default { ...@@ -25,7 +26,7 @@ export default {
variables: { aoiUid: uid } variables: { aoiUid: uid }
}) })
let project = response.data.neuroProject let project = response.data.nProject
if (!project) return '' if (!project) return ''
...@@ -42,7 +43,7 @@ export default { ...@@ -42,7 +43,7 @@ export default {
try{ try{
const response = await apolloProvider.defaultClient.mutate({ const response = await apolloProvider.defaultClient.mutate({
mutation: gql` mutation: gql`
mutation updateNeuroProject( mutation updateNproject(
$name: String! , $name: String! ,
$admin: String! , $admin: String! ,
$user: String! , $user: String! ,
...@@ -58,7 +59,7 @@ export default { ...@@ -58,7 +59,7 @@ export default {
$total:Int, $total:Int,
$result:Boolean $result:Boolean
){ ){
updateNeuroProject(input:{ updateNproject(input:{
name:$name name:$name
admin:$admin admin:$admin
user:$user user:$user
...@@ -75,7 +76,7 @@ export default { ...@@ -75,7 +76,7 @@ export default {
result:$result result:$result
}) })
{ {
neuroProject{ nProject{
name name
admin admin
user user
...@@ -112,7 +113,7 @@ export default { ...@@ -112,7 +113,7 @@ export default {
} }
}) })
let project = response.data.updateNeuroProject.neuroProject let project = response.data.updateNproject.nProject
if (!project) return '' if (!project) return ''
......
...@@ -11,12 +11,10 @@ export default { ...@@ -11,12 +11,10 @@ export default {
} }
}, },
async save(project , infos ) { async save(data) {
if(Object.keys(project).length !== 0) project.infos = infos
try{ try{
let repsone = await axios.post('/project',project) let response = await axios.post('/project', data )
return repsone return response.data
}catch(e){ }catch(e){
console.error(e.message) console.error(e.message)
} }
......
...@@ -2,19 +2,21 @@ import Vue from 'vue' ...@@ -2,19 +2,21 @@ import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
// import projectStore from './modules/projectStore.js' // import projectStore from './modules/projectStore.js'
import aoiStore from './modules/aoiStore' import aoiStore from './modules/aoiStore'
import projectStore from './modules/projectStore'
import createPersistedState from 'vuex-persistedstate'; import createPersistedState from 'vuex-persistedstate';
Vue.use(Vuex) Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
modules:{ modules:{
// project:projectStore, project:projectStore,
aoi:aoiStore aoi:aoiStore
}, },
plugins:[ plugins:[
createPersistedState({ createPersistedState({
paths:['aoi'] paths:['aoi' , 'project']
}), }),
] ]
}) })
import aoiGQL from '../../gql/aoi' import aoiGql from '@/gql/aoi'
import wpoService from '@/service/wpo'
const state = { const state = {
aois: [], aoi: {},
serial: '',
} }
const getters = { const getters = {
} }
const actions = { const actions = {
async getAois({commit}){ async getSerial({commit}){
let result = await aoiGQL.getAois() let serial = await wpoService.getWpoId() //웹서버에 지정한 WPO ID 가져오기
commit('GETSERIAL' , serial)
commit('GETAOIS' , result)
}, },
async createAoi({commit} , input){ async getAoi({commit}, serial){
let result = await aoiGQL.createAoi(input) let aoi = await aoiGql.get(serial)
commit('CREATEPAOI' , result)
commit('GETAOI' , aoi)
}, },
async updateAoi({commit} , input){ async updateAoi({commit} , input){
let result = await aoiGql.update(input)
let result = await aoiGQL.updateAoi(input)
commit('UPDATEAOI' , result) commit('UPDATEAOI' , result)
}, },
async deleteAoi({commit} , uid){
let result = await aoiGQL.deleteAoi(uid)
commit('DELETEAOI' , result)
}
} }
const mutations = { const mutations = {
GETAOIS(state,payload ){ GETSERIAL(state,payload ){
state.aois = payload state.serial = payload
}, },
CREATEPAOI(state,payload ){ GETAOI(state,payload ){
state.aois.push(payload) state.aoi = payload
}, },
UPDATEAOI(state,payload){ UPDATEAOI(state,payload){
let updateIndex =state.aois.findIndex( aoi => aoi.uid === payload.uid ) state.aoi = { ...payload};
state.aois.splice(updateIndex , 1 ,payload)
}, },
DELETEAOI(state,payload ){
let removeIndex = state.aois.findIndex( aoi => aoi.uid === payload )
state.aois.splice(removeIndex , 1 )
}
} }
export default { export default {
......
import projectGql from '@/gql/project'
const state = {
project: [],
}
const getters = {
}
const actions = {
async setProject({commit}, project){
commit('SETPROJECT' , project)
},
async updateAoi({commit} , input){
let result = await projectGql.update(input)
commit('UPDATEAOI' , result)
},
}
const mutations = {
SETPROJECT(state,payload ){
state.project = payload
},
UPDATEAOI(state,payload){
state.aoi = { ...payload};
},
}
export default {
state: {
...state
},
getters,
mutations,
actions
}
\ No newline at end of file
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
<Teaching <Teaching
v-else-if="stepper === 2" v-else-if="stepper === 2"
:project="project" :project="project"
:infos="infos" :learnings="learnings"
/> />
<Project <Project
v-else-if="stepper === 3" v-else-if="stepper === 3"
:project="project" :project="project"
:infos="infos" :learnings="learnings"
/> />
</v-row> </v-row>
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
<script> <script>
// import wpoService from '../service/wpo' // import wpoService from '../service/wpo'
import projectService from '../service/project' import projectService from '../service/project'
// import learningService from '../service/learning'
// import teachingService from '@/service/teaching' // import teachingService from '@/service/teaching'
import projectGql from '@/gql/project' import projectGql from '@/gql/project'
...@@ -46,7 +48,7 @@ export default { ...@@ -46,7 +48,7 @@ export default {
message:'Setting ...', message:'Setting ...',
projectUid: 0 , projectUid: 0 ,
project:{}, project:{},
infos:[], learnings:[],
} }
}, },
...@@ -70,40 +72,53 @@ export default { ...@@ -70,40 +72,53 @@ export default {
methods: { methods: {
async getProject(){ async getProject(){
let response = await projectService.get() let local = await projectService.get()
console.log('local :',local)
if(Object.keys(response).length === 0){ if(Object.keys(local.learning).length === 0 || Object.keys(local.project).length === 0){
this.stepper = 1 this.stepper = 1
}else if(response.result){ }else if(local.project.result){
this.stepper = 3 this.stepper = 3
this.project = response this.project = local.project
}else if(!response.result){ this.learnings = local.learning.learning
this.project = response this.$store.dispatch('setProject' ,this.project )
this.infos = response.infos }else if(!local.project.result){
this.project = local.project
this.learnings = local.learning.learning
this.stepper = 2 this.stepper = 2
this.$store.dispatch('setProject' ,this.project )
} }
}, },
async setTeaching(step , aoiUid){ async setTeaching(aoiUid){
this.stepper = 0 this.stepper = 0
this.message ="Setting..." this.message ="프로젝트 세팅..."
let project = await projectGql.get(aoiUid)
console.log('project :', project ) let gqlProject = await projectGql.get(aoiUid)
this.$store.dispatch('setProject',gqlProject)
let learning = await learningGql.getLearning(project.uid) this.message ="학습 세팅..."
if(Object.keys(project).length !== 0 && Object.keys(learning).length !== 0){ let gqlLearning = await learningGql.get(gqlProject.uid)
let localData = await projectService.save(project ,learning ) this.message ="프로젝트 저장..."
if(Object.keys(localData).length !== 0 ){
this.project = localData.data let saveData = {
this.infos = localData.data.infos 'project':gqlProject,
this.stepper = step 'learning': gqlLearning
} }
if(Object.keys(gqlProject).length !== 0 && gqlLearning.length !== 0){
let response = await projectService.save(saveData)
this.project = response.project
this.learnings = response.learning
if(Object.keys(this.project).length !== 0 && this.learnings.length !== 0) this.stepper = 2
} }
}, },
async setProject(step , project){ async setProject( project){
this.stepper = step this.stepper = 3
this.project = project this.project = project
} }
}, },
......
...@@ -112,8 +112,7 @@ export default { ...@@ -112,8 +112,7 @@ export default {
props: { props: {
step:Number, step:Number,
wpo:String, learnings:Array,
infos:Array,
project:Object, project:Object,
counter:Number, counter:Number,
result:Array, result:Array,
...@@ -128,7 +127,7 @@ export default { ...@@ -128,7 +127,7 @@ export default {
result(current){ result(current){
if(current.length !== 0){ if(current.length !== 0){
this.rect =[] this.rect =[]
this.rect = [...this.infos] this.rect = [...this.learnings]
for(let i = 0; i < current.length; i++ ){ for(let i = 0; i < current.length; i++ ){
Number(current[i]) === 0 ? (this.rect[i].fill = '#0D47A1' , this.rect[i].stroke = '#0D47A1' ) : (this.rect[i].fill = '#B71C1C' , this.rect[i].stroke = '#B71C1C' ) Number(current[i]) === 0 ? (this.rect[i].fill = '#0D47A1' , this.rect[i].stroke = '#0D47A1' ) : (this.rect[i].fill = '#B71C1C' , this.rect[i].stroke = '#B71C1C' )
......
...@@ -48,8 +48,6 @@ export default { ...@@ -48,8 +48,6 @@ export default {
props: { props: {
step:Number, step:Number,
wpo:String,
infos:Array,
project:Object, project:Object,
result:Array result:Array
}, },
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<span v-if="step > 1" class="text-h4">AOI 연결 <v-icon color="success" class="pb-4" x-large>mdi-check-bold</v-icon> </span> <span v-if="step > 1" class="text-h4">AOI 연결 <v-icon color="success" class="pb-4" x-large>mdi-check-bold</v-icon> </span>
<div v-else class="text-h4 "><strong>AOI 장비</strong>와 연결해주세요 <div v-else class="text-h4 "><strong>AOI 장비</strong>와 연결해주세요
<p class="text-h4 "><strong>S/N : {{id}}</strong></p></div> <p class="text-h4 "><strong>S/N : {{serial}}</strong></p></div>
</v-col> </v-col>
<v-col v-if="step === 1" cols="8"> <v-col v-if="step === 1" cols="8">
<v-progress-linear <v-progress-linear
...@@ -106,40 +106,38 @@ ...@@ -106,40 +106,38 @@
</template> </template>
<script> <script>
import wpoService from '@/service/wpo'
import managerService from '@/service/manager' import managerService from '@/service/manager'
import { mapActions } from 'vuex'
import { EventBus } from '@/event-bus' import { EventBus } from '@/event-bus'
export default { export default {
data () { data () {
return { return {
message: '준비중...', message: '준비중...',
step:0, step:1, //테스트로 실행
// step:0,
id:'', id:'',
} }
}, },
created(){ computed: {
this.getAoi() serial() {
this.network() return this.$store.state.aoi.serial
this.getAois()
}, },
methods: { aoi(){
...mapActions([ return this.$store.state.aoi.aoi
'getAois', }
]), },
created(){
// this.network()
async getAoi(){ this.getAoi() // 테스트로 실행
let id = await wpoService.getWpoId() //웹서버에 지정한 WPO ID 가져오기
this.id = id
}, },
methods: {
async network(){ async network(){
EventBus.$emit('openBluetooth') EventBus.$emit('openBluetooth')
try{ try{
...@@ -148,8 +146,9 @@ export default { ...@@ -148,8 +146,9 @@ export default {
let response = await managerService.request(msg) let response = await managerService.request(msg)
if(JSON.parse(response.data).status){ if(JSON.parse(response.data).status){
EventBus.$emit('closeBluetooth') EventBus.$emit('closeBluetooth')
setTimeout(() => {
this.step = 1 this.step = 1
}, 1000);
}else{ }else{
this.network() this.network()
} }
...@@ -158,39 +157,33 @@ export default { ...@@ -158,39 +157,33 @@ export default {
} }
}, },
getAoi(){
aoi(){ this.$store.dispatch('getAoi',this.serial)
let delay = 1000; let delay = 1000;
let timer = setInterval(()=> { let timer = setInterval(()=> {
let test = this.$store.state.aoi.aois.filter( aoi => { return aoi.serial === this.id } ) if(this.aoi.serial === this.serial){
console.log('test :',test)
console.log(' this.$store.state.aoi.aois :', this.$store.state.aoi.aois)
if(test.length !== 0){
clearInterval(timer) clearInterval(timer)
setTimeout(() => {
this.step = 2 this.step = 2
}, 2000);
}else{ }else{
this.getAois() this.$store.dispatch('getAoi',this.serial)
} }
},delay) },delay)
}, },
project(){ getAoiProject(){
let delay = 1000; let delay = 1000;
let timer = setInterval(()=> { let timer = setInterval(()=> {
let test = this.$store.state.aoi.aois.filter( aoi => { return aoi.serial === this.id } ) if(this.aoi.projectUid !== 0){
console.log('test :',test[0].projectUid)
if(test[0].projectUid !== 0){
clearInterval(timer) clearInterval(timer)
this.step = 3 this.step = 3
setTimeout(EventBus.$emit('setTeaching' , 2 , test[0].uid ), 3000); setTimeout(() => {
setTimeout(EventBus.$emit('setTeaching' , this.aoi.uid ), 3000);
}, 2000);
}else{ }else{
this.getAois() this.$store.dispatch('getAoi',this.serial)
} }
},delay) },delay)
} }
...@@ -200,11 +193,11 @@ export default { ...@@ -200,11 +193,11 @@ export default {
async step(current) { async step(current) {
switch(current) { switch(current) {
case 1: case 1:
this.aoi() this.getAoi()
break; break;
case 2: case 2:
this.project() this.getAoiProject()
break; break;
} }
} }
......
...@@ -105,15 +105,13 @@ ...@@ -105,15 +105,13 @@
</template> </template>
<script> <script>
import wpoService from '@/service/wpo'
import managerService from '@/service/manager' import managerService from '@/service/manager'
import projectService from '@/service/project' import projectService from '@/service/project'
import projectGQL from '@/gql/project' import projectGQL from '@/gql/project'
import aoiGQL from '@/gql/aoi' import aoiGQL from '@/gql/aoi'
import { mapActions } from 'vuex'
import { EventBus } from '@/event-bus' import { EventBus } from '@/event-bus'
export default { export default {
...@@ -129,22 +127,17 @@ export default { ...@@ -129,22 +127,17 @@ export default {
project: Object, project: Object,
}, },
computed: {
aoi(){
return this.$store.state.aoi.aoi
}
},
created(){ created(){
this.getAoi()
this.getAois()
this.network() this.network()
}, },
methods: { methods: {
...mapActions([
'getAois',
]),
async getAoi(){
let id = await wpoService.getWpoId() //웹서버에 지정한 WPO ID 가져오기
this.id = id
},
async network(){ async network(){
EventBus.$emit('openBluetooth') EventBus.$emit('openBluetooth')
...@@ -156,7 +149,7 @@ export default { ...@@ -156,7 +149,7 @@ export default {
EventBus.$emit('closeBluetooth') EventBus.$emit('closeBluetooth')
setTimeout(() => { setTimeout(() => {
this.step = 1 this.step = 1
}, 3000); }, 1000);
}else{ }else{
this.network() this.network()
} }
...@@ -165,7 +158,6 @@ export default { ...@@ -165,7 +158,6 @@ export default {
} }
}, },
async projectUpdate(){ async projectUpdate(){
let result = await projectGQL.update(this.project) let result = await projectGQL.update(this.project)
...@@ -178,9 +170,7 @@ export default { ...@@ -178,9 +170,7 @@ export default {
}, },
async aoiInit(){ async aoiInit(){
let aoi = this.$store.state.aoi.aois.filter( aoi => { return aoi.serial === this.id } ) let result = await aoiGQL.update(this.aoi)
let result = await aoiGQL.updateAoi(aoi[0])
if(Object.keys(result).length !== 0){ if(Object.keys(result).length !== 0){
setTimeout(() => { setTimeout(() => {
......
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
</v-row> </v-row>
<Result <Result
:step="step" :step="step"
:infos="infos"
:project="project" :project="project"
:result="result" :result="result"
/> />
...@@ -84,7 +83,7 @@ ...@@ -84,7 +83,7 @@
<v-col cols="9" > <v-col cols="9" >
<Board <Board
:step="step" :step="step"
:infos="infos" :learnings="learnings"
:project="project" :project="project"
:counter="success" :counter="success"
:result="resultRect" :result="resultRect"
...@@ -111,7 +110,6 @@ export default { ...@@ -111,7 +110,6 @@ export default {
return { return {
step:0, step:0,
wpo:'',
aoi:{}, aoi:{},
...@@ -132,7 +130,7 @@ export default { ...@@ -132,7 +130,7 @@ export default {
props: { props: {
project: Object, project: Object,
infos: Array, learnings: Array,
}, },
components:{ components:{
...@@ -194,7 +192,7 @@ export default { ...@@ -194,7 +192,7 @@ export default {
try{ try{
let teachingInfo = '' let teachingInfo = ''
this.infos.forEach((rect) => { this.learnings.forEach((rect) => {
let str = `(${Math.ceil(rect.startX * 1.5)},${Math.ceil(rect.startY * 1.5)},${Math.ceil(rect.lastX * 1.5)},${Math.ceil( rect.lastY * 1.5) })` let str = `(${Math.ceil(rect.startX * 1.5)},${Math.ceil(rect.startY * 1.5)},${Math.ceil(rect.lastX * 1.5)},${Math.ceil( rect.lastY * 1.5) })`
teachingInfo= teachingInfo + "-" + str teachingInfo= teachingInfo + "-" + str
}) })
...@@ -246,11 +244,16 @@ export default { ...@@ -246,11 +244,16 @@ export default {
this.project.fail = this.fail this.project.fail = this.fail
this.project.result = true this.project.result = true
let localData = await projectService.save(this.project , this.infos) let saveData = {
'project':this.project,
'learning': this.learnings
}
let response = await projectService.save(saveData)
if(Object.keys(localData.data).length !== 0 ){ if(Object.keys(response.project).length !== 0 ){
EventBus.$emit('closeLoading') EventBus.$emit('closeLoading')
EventBus.$emit('setProject' , 3 , localData.data ) EventBus.$emit('setProject' , response.project )
} }
} }
}catch(e){ }catch(e){
......
...@@ -8,6 +8,7 @@ module.exports = { ...@@ -8,6 +8,7 @@ module.exports = {
devServer: { devServer: {
proxy: { proxy: {
'/api/*': { '/api/*': {
// target: 'http://192.168.53.34:3000' // 개발/서버
target: 'http://localhost:3000' // 개발서버 target: 'http://localhost:3000' // 개발서버
} }
} }
......
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