Skip to content

Commit

Permalink
接口修改
Browse files Browse the repository at this point in the history
  • Loading branch information
TEo-so committed Sep 29, 2019
1 parent 2f63d12 commit d90ad94
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 22 deletions.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

</script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion src/common/config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const API = 'https://cyxbsmobile.redrock.team/234/puzzleofthemap/'
export const API = 'https://wx.redrock.team/wxapi/puzzleofthemap/api'
9 changes: 6 additions & 3 deletions src/views/first.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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里,便于下一个排行榜页面拿到数据
Expand Down
36 changes: 31 additions & 5 deletions src/views/fourth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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++) {
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions src/views/second.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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++) {
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions src/views/third.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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++) {
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ module.exports = {
'views': '@/views',

}
}
},

},
publicPath: './',
devServer: {
// 设置代理
proxy: {
Expand Down

0 comments on commit d90ad94

Please sign in to comment.