|
@@ -30,11 +30,29 @@ const _sfc_main = {
|
|
|
this.initWS();
|
|
|
this.getDocument();
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ questions: {
|
|
|
+ handler(newValue, oldValue) {
|
|
|
+ let lastItemIndex = this.questions.length - 1;
|
|
|
+ let preouisLastItemIndex = this.questions.length - 2;
|
|
|
+ let lastScore = 100;
|
|
|
+ for (let i in newValue) {
|
|
|
+ if (newValue[i].score != null && newValue[i].score != "") {
|
|
|
+ lastScore = lastScore - parseFloat(newValue[i].score);
|
|
|
+ if (i == preouisLastItemIndex && lastScore >= 0) {
|
|
|
+ this.questions[lastItemIndex].score = lastScore;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
initWS() {
|
|
|
let socket = common_vendor.index.connectSocket({
|
|
|
- //url: 'wss://kps.scdayou.com/ws/apo/ws',
|
|
|
- url: "ws://127.0.0.1:8090/apo/ws",
|
|
|
+ url: "wss://kps.scdayou.com/ws/apo/ws",
|
|
|
+ //url: 'ws://127.0.0.1:8090/apo/ws',
|
|
|
method: "GET",
|
|
|
success: () => {
|
|
|
console.log("socket success");
|
|
@@ -49,13 +67,15 @@ const _sfc_main = {
|
|
|
getDocument() {
|
|
|
var that = this;
|
|
|
common_vendor.index.request({
|
|
|
- url: "http://127.0.0.1:8090/apo/document/current",
|
|
|
- //url: "https://kps.scdayou.com/apo/document/current",
|
|
|
+ //url: "http://127.0.0.1:8090/apo/document/current",
|
|
|
+ url: "https://kps.scdayou.com/apo/document/current",
|
|
|
data: null,
|
|
|
method: "get",
|
|
|
success: function(res) {
|
|
|
that.formData = res.data.data;
|
|
|
- that.questions = that.formData.questions[0];
|
|
|
+ if (that.formData.questions != null) {
|
|
|
+ that.questions = that.formData.questions[0];
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -82,22 +102,19 @@ const _sfc_main = {
|
|
|
for (let i in that.questions) {
|
|
|
that.commitQuestions.push(that.questions[i]);
|
|
|
}
|
|
|
- console.log("当前的", xQuestions);
|
|
|
that.questions = [];
|
|
|
for (let i = this.index; i < that.formData.questions.length; i++) {
|
|
|
- console.log("i", i);
|
|
|
if (that.formData.questions[i].length > 0) {
|
|
|
this.questions = that.formData.questions[i];
|
|
|
this.index = i + 1;
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- console.log("that.commotData", that.commitQuestions);
|
|
|
that.formData.result = that.commitQuestions;
|
|
|
that.formData.questions = [];
|
|
|
common_vendor.index.request({
|
|
|
- url: "http://127.0.0.1:8090/apo/document/commit",
|
|
|
- //url: "https://kps.scdayou.com/apo/document/commit",
|
|
|
+ //url: "http://127.0.0.1:8090/apo/document/commit",
|
|
|
+ url: "https://kps.scdayou.com/apo/document/commit",
|
|
|
data: that.formData,
|
|
|
method: "post",
|
|
|
success: function(res) {
|