From 91cc5b40cc411ba76091302eac297e1318c5aa12 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 4 Sep 2017 12:27:36 +0100 Subject: [PATCH] vuetify 0.15.2 --- src/vue-poc/components/core.js | 17 ++++++- src/vue-poc/components/vue-ace.vue | 15 +++--- src/vue-poc/features/edit/edit.vue | 7 ++- src/vue-poc/features/eval/eval.vue | 24 ++++++---- src/vue-poc/features/login/login.vue | 7 ++- src/vue-poc/static/app-gen.js | 72 +++++++++++++++++----------- src/vue-poc/static/app.html | 4 +- 7 files changed, 87 insertions(+), 59 deletions(-) diff --git a/src/vue-poc/components/core.js b/src/vue-poc/components/core.js index 262c374..ec0670c 100644 --- a/src/vue-poc/components/core.js +++ b/src/vue-poc/components/core.js @@ -2,11 +2,25 @@ localforage.config({ name: 'vuepoc' }); + const HTTP = axios.create({ baseURL: "/vue-poc/api/", headers: { 'X-Custom-Header': 'vue-poc', accept: 'application/json' + }, + paramsSerializer: function(params) { + return Qs.stringify(params) + } +}); +const HTTPNE = axios.create({ + baseURL: "/vue-poc/api/", + headers: { + 'X-Custom-Header': 'vue-poc', + accept: 'application/json' + }, + paramsSerializer: function(params) { + return Qs.stringify(params) } }); const axios_json={ headers: {accept: 'application/json'}}; @@ -290,7 +304,8 @@ const app = new Vue({ return response; }, (error) =>{ - // interupt restxq single + // interupt restxq single + console.log("$$$$$$$$$$$",error) if(460 != error.response.status)this.showAlert("http error:\n"+error.response.data) return Promise.reject(error); }); diff --git a/src/vue-poc/components/vue-ace.vue b/src/vue-poc/components/vue-ace.vue index b9095aa..b9d7d39 100644 --- a/src/vue-poc/components/vue-ace.vue +++ b/src/vue-poc/components/vue-ace.vue @@ -46,8 +46,8 @@ ace editor for vue.js session.setUseWrapMode(value) }, 'settings' (value) { - //console.log("--settings--",value) - this.applySettings() + console.log("--settings--",value) + this.applySettings(value) } }, methods:{ @@ -68,9 +68,8 @@ ace editor for vue.js }]); }, - applySettings(){ - const aceSettings=this.settings - //console.log("font: ",aceSettings.fontsize) + applySettings(aceSettings){ + console.log("apply: ",aceSettings) this.editor.setTheme(`ace/theme/${aceSettings.theme}`) //this.editor.setKeyboardHandler(`ace/keyboard//${aceSettings.keybinding}`) this.editor.setFontSize(parseInt(aceSettings.fontsize,10)) @@ -88,12 +87,10 @@ ace editor for vue.js const mode = this.mode || 'text' const wrap = this.wrap || false - const aceSettings=this.settings - console.log("QA: ",this.settings.theme) const readOnly = this.readOnly || false ace.config.set("workerPath", "/vue-poc/ui/ace-workers") this.editor = window.ace.edit(this.$el) - + this.applySettings(this.aceSettings) this.editor.$blockScrolling = Infinity this.editor.setValue(this.content, 1) this.editor.setOptions({ readOnly:this.readOnly }) @@ -112,7 +109,7 @@ ace editor for vue.js }) this.editor.on('change', () => { this.beforeContent = this.editor.getValue() - this.$emit('change-content', this.editor.getValue()) + this.$emit('change-content', this.beforeContent) }); this.editor.getSession().on("changeAnnotation", ()=>{ diff --git a/src/vue-poc/features/edit/edit.vue b/src/vue-poc/features/edit/edit.vue index 281f939..4e37196 100644 --- a/src/vue-poc/features/edit/edit.vue +++ b/src/vue-poc/features/edit/edit.vue @@ -208,13 +208,12 @@ v-on:annotation="annotation"> }, save(){ alert("TODO save: "+this.url); - var data=Qs.stringify( - { + var data= { protocol:this.protocol, url: this.url, //gave the values directly for testing data: this.contentA - }) - HTTP.post("edit", data,{ + } + HTTP.post("edit", Qs.stringify(data),{ headers: { "Content-Type": "application/x-www-form-urlencoded"} }).then(r=>{ alert("AAA") diff --git a/src/vue-poc/features/eval/eval.vue b/src/vue-poc/features/eval/eval.vue index 16352b3..8c53c67 100644 --- a/src/vue-poc/features/eval/eval.vue +++ b/src/vue-poc/features/eval/eval.vue @@ -55,13 +55,11 @@ - - {{result}} - + Error - @@ -96,7 +94,7 @@ run(){ this.awaitResult(false) this.start = performance.now(); - HTTP.post("eval/execute",Qs.stringify({xq:this.xq})) + HTTPNE.post("eval/execute",Qs.stringify({xq:this.xq})) .then(r=>{ this.elapsed=Math.floor(performance.now() - this.start); this.result=r.data.result @@ -111,10 +109,9 @@ localforage.setItem('eval/xq', this.xq) }, submit(){ - var data={xq:this.xq} - this.showResult=this.show=false + this.showError=this.showResult=this.show=false this.start = performance.now(); - HTTP.post("eval/submit",Qs.stringify(data)) + HTTPNE.post("eval/submit",Qs.stringify({xq:this.xq})) .then(r=>{ this.elapsed=Math.floor(performance.now() - this.start); this.jobId=r.data.job @@ -123,6 +120,7 @@ }) .catch(r=> { + alert("catch") console.log("error",r) this.jobId=r.response.job this.showError=true; @@ -145,10 +143,16 @@ }, getResult(){ this.awaitResult(true) - HTTP.post("eval/result/"+this.jobId) + HTTPNE.post("eval/result/"+this.jobId) .then(r=>{ this.result=r.data.result+" " - }) + }).catch(r=> { + // alert("catch") + console.log("error",r) + this.result=r.response.data + this.showError=true; + + }); }, hitme(){ this.showResult=true diff --git a/src/vue-poc/features/login/login.vue b/src/vue-poc/features/login/login.vue index f7b55e2..d17da94 100644 --- a/src/vue-poc/features/login/login.vue +++ b/src/vue-poc/features/login/login.vue @@ -54,13 +54,12 @@ go () { this.hidepass=true this.showMessage=false - var data=Qs.stringify( - { + var data={ username: this.name, //gave the values directly for testing password: this.password, redirect: this.redirect - }) - HTTP.post("login-check", data) + } + HTTP.post("login-check",Qs.stringify( data)) .then(r=>{ console.log("login",r.data) if(r.data.status){ diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js index f94a9bb..119fcaf 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,4 +1,4 @@ -// generated 2017-09-03T23:24:46.005+01:00 +// generated 2017-09-04T12:26:20.994+01:00 Vue.component('qd-fullscreen',{template:` {{ fullscreenIcon }} @@ -182,8 +182,8 @@ session.setUseWrapMode(value) }, 'settings' (value) { - //console.log("--settings--",value) - this.applySettings() + console.log("--settings--",value) + this.applySettings(value) } }, methods:{ @@ -204,9 +204,8 @@ }]); }, - applySettings(){ - const aceSettings=this.settings - //console.log("font: ",aceSettings.fontsize) + applySettings(aceSettings){ + console.log("apply: ",aceSettings) this.editor.setTheme(`ace/theme/${aceSettings.theme}`) //this.editor.setKeyboardHandler(`ace/keyboard//${aceSettings.keybinding}`) this.editor.setFontSize(parseInt(aceSettings.fontsize,10)) @@ -224,12 +223,10 @@ const mode = this.mode || 'text' const wrap = this.wrap || false - const aceSettings=this.settings - console.log("QA: ",this.settings.theme) const readOnly = this.readOnly || false ace.config.set("workerPath", "/vue-poc/ui/ace-workers") this.editor = window.ace.edit(this.$el) - + this.applySettings(this.aceSettings) this.editor.$blockScrolling = Infinity this.editor.setValue(this.content, 1) this.editor.setOptions({ readOnly:this.readOnly }) @@ -248,7 +245,7 @@ }) this.editor.on('change', () => { this.beforeContent = this.editor.getValue() - this.$emit('change-content', this.editor.getValue()) + this.$emit('change-content', this.beforeContent) }); this.editor.getSession().on("changeAnnotation", ()=>{ @@ -850,13 +847,12 @@ Vue.filter('round', function(value, decimals) { }, save(){ alert("TODO save: "+this.url); - var data=Qs.stringify( - { + var data= { protocol:this.protocol, url: this.url, //gave the values directly for testing data: this.contentA - }) - HTTP.post("edit", data,{ + } + HTTP.post("edit", Qs.stringify(data),{ headers: { "Content-Type": "application/x-www-form-urlencoded"} }).then(r=>{ alert("AAA") @@ -989,13 +985,11 @@ Vue.filter('round', function(value, decimals) { - - {{result}} - + Error - + @@ -1028,7 +1022,7 @@ Vue.filter('round', function(value, decimals) { run(){ this.awaitResult(false) this.start = performance.now(); - HTTP.post("eval/execute",Qs.stringify({xq:this.xq})) + HTTPNE.post("eval/execute",Qs.stringify({xq:this.xq})) .then(r=>{ this.elapsed=Math.floor(performance.now() - this.start); this.result=r.data.result @@ -1043,10 +1037,9 @@ Vue.filter('round', function(value, decimals) { localforage.setItem('eval/xq', this.xq) }, submit(){ - var data={xq:this.xq} - this.showResult=this.show=false + this.showError=this.showResult=this.show=false this.start = performance.now(); - HTTP.post("eval/submit",Qs.stringify(data)) + HTTPNE.post("eval/submit",Qs.stringify({xq:this.xq})) .then(r=>{ this.elapsed=Math.floor(performance.now() - this.start); this.jobId=r.data.job @@ -1055,6 +1048,7 @@ Vue.filter('round', function(value, decimals) { }) .catch(r=> { + alert("catch") console.log("error",r) this.jobId=r.response.job this.showError=true; @@ -1077,10 +1071,16 @@ Vue.filter('round', function(value, decimals) { }, getResult(){ this.awaitResult(true) - HTTP.post("eval/result/"+this.jobId) + HTTPNE.post("eval/result/"+this.jobId) .then(r=>{ this.result=r.data.result+" " - }) + }).catch(r=> { + // alert("catch") + console.log("error",r) + this.result=r.response.data + this.showError=true; + + }); }, hitme(){ this.showResult=true @@ -1810,13 +1810,12 @@ body go () { this.hidepass=true this.showMessage=false - var data=Qs.stringify( - { + var data={ username: this.name, //gave the values directly for testing password: this.password, redirect: this.redirect - }) - HTTP.post("login-check", data) + } + HTTP.post("login-check",Qs.stringify( data)) .then(r=>{ console.log("login",r.data) if(r.data.status){ @@ -3060,11 +3059,25 @@ users todo localforage.config({ name: 'vuepoc' }); + const HTTP = axios.create({ baseURL: "/vue-poc/api/", headers: { 'X-Custom-Header': 'vue-poc', accept: 'application/json' + }, + paramsSerializer: function(params) { + return Qs.stringify(params) + } +}); +const HTTPNE = axios.create({ + baseURL: "/vue-poc/api/", + headers: { + 'X-Custom-Header': 'vue-poc', + accept: 'application/json' + }, + paramsSerializer: function(params) { + return Qs.stringify(params) } }); const axios_json={ headers: {accept: 'application/json'}}; @@ -3348,7 +3361,8 @@ const app = new Vue({ return response; }, (error) =>{ - // interupt restxq single + // interupt restxq single + console.log("$$$$$$$$$$$",error) if(460 != error.response.status)this.showAlert("http error:\n"+error.response.data) return Promise.reject(error); }); diff --git a/src/vue-poc/static/app.html b/src/vue-poc/static/app.html index 49e991d..9687cd7 100644 --- a/src/vue-poc/static/app.html +++ b/src/vue-poc/static/app.html @@ -9,7 +9,7 @@ Vue Router Test - + @@ -19,7 +19,7 @@ - +