diff --git a/public/index.html b/public/index.html index aecd747..825f450 100644 --- a/public/index.html +++ b/public/index.html @@ -14,14 +14,14 @@ const token = document.location.hash.split('#/?token=')[1]; if (!localStorage.getItem('id_token') && !token) { window.location.href = - 'https://wx.redrock.team/magicloop/rushb?b=https://cyxbsmobile.redrock.team/234/puzzleofthemap/enter&scope=tmpbase'; + 'https://wx.redrock.team/magicloop/rushb?b=' + encodeURI( + 'https://wx.redrock.team/wxapi/puzzleofthemap/api/enter') + '&scope=tmpbase'; } if (token && token.length) { document.location.hash = '#/'; localStorage.setItem('id_token', token) } - diff --git a/src/common/config.js b/src/common/config.js index 18bdd6c..cdf18cf 100644 --- a/src/common/config.js +++ b/src/common/config.js @@ -1 +1 @@ -export const API = 'https://cyxbsmobile.redrock.team/234/puzzleofthemap/' \ No newline at end of file +export const API = 'https://wx.redrock.team/wxapi/puzzleofthemap/api' \ No newline at end of file diff --git a/src/views/first.vue b/src/views/first.vue index b8bbd02..1684139 100644 --- a/src/views/first.vue +++ b/src/views/first.vue @@ -61,7 +61,7 @@ export default { methods: { refresh() { - let func = require("../assets/js/puzzle.js"); + let func = require("@/assets/js/puzzle.js"); func.initPuzzle(2); // 随机打乱 for (var i = 0; i < 5; i++) { @@ -93,7 +93,7 @@ export default { this.firstId = id; this.change_flag = true; } else { - let func = require("../assets/js/puzzle.js"); + let func = require("@/assets/js/puzzle.js"); func.move(id, this.firstId, 2); this.change_flag = false; this.activeName = null; @@ -103,7 +103,8 @@ export default { for (var i = 0, k = 0; i < this.num; i++) { for (var j = 0; j < this.num; j++, k++) { // 当二维数组每个位置存储的数据即拼图块的id正好为原始状态即按行优先编写的序号相等时,即表示拼图完成 - this.finish_flag = chart[i][j] == k; + let flag = chart[i][j] == k + this.finish_flag = flag; } } if (this.finish_flag) { @@ -114,6 +115,8 @@ export default { let data = new FormData(); data.append("level", 1); data.append("time", this.time); + console.log(this.time); + console.log(data); // 停止计时 this.stop(); // 向后端发送请求,后端返回处理了用户当前成绩后的排行榜和用户自己本关卡的时间和名次,将返回的数据存在state里,便于下一个排行榜页面拿到数据 diff --git a/src/views/fourth.vue b/src/views/fourth.vue index 12d9185..72e321d 100644 --- a/src/views/fourth.vue +++ b/src/views/fourth.vue @@ -35,10 +35,35 @@ import showPic from "../components/showPic.vue"; import { SET_FOURTH } from "../store/type/mutations"; import { FETCH_SUCCESS } from "../store/type/actions"; export default { - data() { return { - pieces: [{}, {}, {}, {},{}, {}, {}, {},{}, {}, {}, {},{}, {},{}, {}, {}, {},{},{},{},{}, {},{},{}], + pieces: [ + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {}, + {} + ], firstId: null, change_flag: false, finish_flag: false, @@ -62,7 +87,7 @@ export default { methods: { refresh() { - let func = require("../assets/js/puzzle.js"); + let func = require("@/assets/js/puzzle.js"); func.initPuzzle(5); // 随机打乱 for (var i = 0; i < 25; i++) { @@ -94,7 +119,7 @@ export default { this.firstId = id; this.change_flag = true; } else { - let func = require("../assets/js/puzzle.js"); + let func = require("@/assets/js/puzzle.js"); func.move(id, this.firstId, 5); this.change_flag = false; this.activeName = null; @@ -104,7 +129,8 @@ export default { for (var i = 0, k = 0; i < this.num; i++) { for (var j = 0; j < this.num; j++, k++) { // 当二维数组每个位置存储的数据即拼图块的id正好为原始状态即按行优先编写的序号相等时,即表示拼图完成 - this.finish_flag = chart[i][j] == k; + let flag = chart[i][j] == k; + this.finish_flag = flag; } } if (this.finish_flag) { diff --git a/src/views/second.vue b/src/views/second.vue index 0bbb3ca..169e872 100644 --- a/src/views/second.vue +++ b/src/views/second.vue @@ -35,10 +35,9 @@ import showPic from "../components/showPic.vue"; import { SET_SECOND } from "../store/type/mutations"; import { FETCH_SUCCESS } from "../store/type/actions"; export default { - data() { return { - pieces: [{}, {}, {}, {},{}, {}, {}, {},{}], + pieces: [{}, {}, {}, {}, {}, {}, {}, {}, {}], firstId: null, change_flag: false, finish_flag: false, @@ -62,7 +61,7 @@ export default { methods: { refresh() { - let func = require("../assets/js/puzzle.js"); + let func = require("@/assets/js/puzzle.js"); func.initPuzzle(3); // 随机打乱 for (var i = 0; i < 10; i++) { @@ -94,7 +93,7 @@ export default { this.firstId = id; this.change_flag = true; } else { - let func = require("../assets/js/puzzle.js"); + let func = require("@/assets/js/puzzle.js"); func.move(id, this.firstId, 3); this.change_flag = false; this.activeName = null; @@ -104,7 +103,8 @@ export default { for (var i = 0, k = 0; i < this.num; i++) { for (var j = 0; j < this.num; j++, k++) { // 当二维数组每个位置存储的数据即拼图块的id正好为原始状态即按行优先编写的序号相等时,即表示拼图完成 - this.finish_flag = chart[i][j] == k; + let flag = chart[i][j] == k; + this.finish_flag = flag; } } if (this.finish_flag) { diff --git a/src/views/third.vue b/src/views/third.vue index d48bc99..23e91b3 100644 --- a/src/views/third.vue +++ b/src/views/third.vue @@ -35,10 +35,9 @@ import showPic from "../components/showPic.vue"; import { SET_THIRD } from "../store/type/mutations"; import { FETCH_SUCCESS } from "../store/type/actions"; export default { - data() { return { - pieces: [{}, {}, {}, {},{}, {}, {}, {},{}, {},{}, {}, {}, {},{},{}], + pieces: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}], firstId: null, change_flag: false, finish_flag: false, @@ -62,7 +61,7 @@ export default { methods: { refresh() { - let func = require("../assets/js/puzzle.js"); + let func = require("@/assets/js/puzzle.js"); func.initPuzzle(4); // 随机打乱 for (var i = 0; i < 20; i++) { @@ -94,7 +93,7 @@ export default { this.firstId = id; this.change_flag = true; } else { - let func = require("../assets/js/puzzle.js"); + let func = require("@/assets/js/puzzle.js"); func.move(id, this.firstId, 4); this.change_flag = false; this.activeName = null; @@ -104,7 +103,8 @@ export default { for (var i = 0, k = 0; i < this.num; i++) { for (var j = 0; j < this.num; j++, k++) { // 当二维数组每个位置存储的数据即拼图块的id正好为原始状态即按行优先编写的序号相等时,即表示拼图完成 - this.finish_flag = chart[i][j] == k; + let flag = chart[i][j] == k; + this.finish_flag = flag; } } if (this.finish_flag) { diff --git a/vue.config.js b/vue.config.js index 499456c..391e1f5 100644 --- a/vue.config.js +++ b/vue.config.js @@ -9,8 +9,10 @@ module.exports = { 'views': '@/views', } - } + }, + }, + publicPath: './', devServer: { // 设置代理 proxy: {