update to v3
This commit is contained in:
parent
0cd4893625
commit
a9e730331c
@ -34,5 +34,5 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
```
|
||||
|
||||
## 本地缓存
|
||||
* `localStorage.setItem("storeState",JSON.stringify(this.$store.state))`
|
||||
* `this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("storeState"))));`
|
||||
* `localStorage.setItem("cherry",JSON.stringify(this.$store.state))`
|
||||
* `this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("cherry"))));`
|
@ -2,14 +2,14 @@ import axios from 'axios'
|
||||
|
||||
export const api = axios.create({
|
||||
// baseURL: 'https://beta.powerrain.cn/api/',
|
||||
baseURL: 'https://coc.powerrain.cn/api/',
|
||||
// baseURL: window.location.origin + '/api/',
|
||||
// baseURL: 'http://152.136.99.231:8001' + '/api/',
|
||||
// baseURL: 'https://coc.powerrain.cn/api/',
|
||||
baseURL: window.location.origin + '/api/',
|
||||
// baseURL: 'http://beta.lacus.site' + '/api/',
|
||||
//baseURL: 'http://127.0.0.1:5000/api',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Accept': 'application/json',
|
||||
// 'Access-Control-Allow-Origin': '*'
|
||||
'Access-Control-Allow-Origin': '*'
|
||||
},
|
||||
timeout: 30 * 1000
|
||||
})
|
||||
|
@ -8,8 +8,8 @@
|
||||
<div class="logo-box">
|
||||
<img src="../assets/logo.png" alt />
|
||||
</div>
|
||||
<p class="app-name">Co-Create</p>
|
||||
<p class="version">Version 2.0.1</p>
|
||||
<p class="app-name">Cherry</p>
|
||||
<p class="version">Version 3.0</p>
|
||||
</div>
|
||||
<div class="list">
|
||||
<!-- <div class="list-item">
|
||||
@ -69,7 +69,7 @@ export default {
|
||||
// 初始化
|
||||
init() {
|
||||
// 刷新本页vuex
|
||||
this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("storeState"))));
|
||||
this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("cherry"))));
|
||||
},
|
||||
|
||||
closeDrawer() {
|
||||
@ -92,10 +92,11 @@ export default {
|
||||
},
|
||||
// 退出登录
|
||||
logout() {
|
||||
this.setUserInfo([null, this])
|
||||
this.setGrade([getGradeInitData(), this])
|
||||
this.setUserInfo([{}, this])
|
||||
this.setGrade([null, this])
|
||||
this.setSchedule([null, this])
|
||||
this.closeDrawer()
|
||||
this.$router.replace('/login')
|
||||
},
|
||||
onCopyUrl(e) {
|
||||
this.$message.success("网址复制成功!");
|
||||
|
@ -27,66 +27,6 @@ export function isIOS() {
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化数据
|
||||
export function getGradeInitData() {
|
||||
return {
|
||||
errcode: 103,
|
||||
data: {
|
||||
total: {
|
||||
total_GPA: 5.0,
|
||||
total_credit: "∞",
|
||||
total_kill: "∞",
|
||||
total_dead: "∞",
|
||||
total_bixiu_GPA: 5.0,
|
||||
},
|
||||
split: [{
|
||||
term_GPA: 5.0,
|
||||
term_credit: "∞",
|
||||
term_dead: "∞",
|
||||
term_grade: [{
|
||||
title: "如果你看到这些,先左上角试试获取数据",
|
||||
credit: 0,
|
||||
grade: 0,
|
||||
class: 0
|
||||
},
|
||||
{
|
||||
title: "如果还看到这些",
|
||||
credit: 0,
|
||||
grade: 0,
|
||||
class: 0
|
||||
},
|
||||
{
|
||||
title: "说明教务可能也没有数据",
|
||||
credit: 0,
|
||||
grade: 0,
|
||||
class: 0
|
||||
},
|
||||
{
|
||||
title: "如果教务有数据还看到这些",
|
||||
credit: 0,
|
||||
grade: 0,
|
||||
class: 0
|
||||
},
|
||||
{
|
||||
title: "加群告诉我好吗!1030523678",
|
||||
credit: 0,
|
||||
grade: 0,
|
||||
class: 0
|
||||
},
|
||||
{
|
||||
title: "拜托了!!!!",
|
||||
credit: 0,
|
||||
grade: 0,
|
||||
class: 0
|
||||
}
|
||||
],
|
||||
term_kill: "∞",
|
||||
term_time: "20451"
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getGameInitData() {
|
||||
return [{
|
||||
name: '高等数学',
|
||||
@ -144,3 +84,5 @@ export function getGameInitData() {
|
||||
color: 9
|
||||
}]
|
||||
}
|
||||
|
||||
export var interceptTime = 0
|
@ -6,7 +6,7 @@ Vue.use(Vuex)
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
// 用户信息
|
||||
user_info: null,
|
||||
user_info: {},
|
||||
// 成绩
|
||||
grade: null,
|
||||
// 课表
|
||||
@ -48,32 +48,32 @@ export default new Vuex.Store({
|
||||
// 设置用户信息
|
||||
setUserInfo({ commit }, arg) {
|
||||
commit('SET_USERINFO', arg[0]);
|
||||
localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state));
|
||||
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
|
||||
},
|
||||
// 设置当前页面
|
||||
setCurrentPage({ commit }, arg){
|
||||
commit('SET_CURRENTPAGE', arg[0]);
|
||||
localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state));
|
||||
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
|
||||
},
|
||||
// 设置成绩
|
||||
setGrade({ commit }, arg){
|
||||
commit('SET_GRADE',arg[0]);
|
||||
localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state));
|
||||
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
|
||||
},
|
||||
// 设置课表
|
||||
setSchedule({ commit }, arg){
|
||||
commit('SET_SCHEDULE', arg[0]);
|
||||
localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state));
|
||||
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
|
||||
},
|
||||
// 设置游戏
|
||||
setScheduleGame({ commit }, arg) {
|
||||
commit('SET_SCHEDULE_GAME', arg[0]);
|
||||
localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state));
|
||||
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
|
||||
},
|
||||
// 设置抽屉状态
|
||||
setDrawerState({ commit }, arg) {
|
||||
commit('SET_DRAWER_STATE', arg[0]);
|
||||
localStorage.setItem("storeState", JSON.stringify(arg[1].$store.state));
|
||||
localStorage.setItem("cherry", JSON.stringify(arg[1].$store.state));
|
||||
},
|
||||
},
|
||||
modules: {
|
||||
|
@ -50,9 +50,8 @@
|
||||
您的总点击数:
|
||||
<span>{{click_count}}</span>
|
||||
</p>
|
||||
<input type="text" placeholder="上传的话请在此输入昵称" v-model="nick" />
|
||||
<div class="btn-box">
|
||||
<p @click="closeUploadDialog()">爬</p>
|
||||
<p @click="closeUploadDialog()">取消</p>
|
||||
<p @click="uploadGrade()">上传</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -149,7 +148,7 @@
|
||||
import FooterSpace from "@/components/FooterSpace.vue";
|
||||
import { mapState, mapActions } from "vuex";
|
||||
import { rankGet, rankUpload } from "@/axios/api.js";
|
||||
import { getGameInitData } from "@/lib/utils.js";
|
||||
import { getGameInitData, interceptTime } from "@/lib/utils.js";
|
||||
import { Loading } from "element-ui";
|
||||
|
||||
export default {
|
||||
@ -216,7 +215,7 @@ export default {
|
||||
...mapState(["user_info", "current_page", "schedule", "schedule_game"])
|
||||
},
|
||||
methods: {
|
||||
...mapActions(["setCurrentPage", "setScheduleGame"]),
|
||||
...mapActions(["setUserInfo", "setCurrentPage", "setScheduleGame"]),
|
||||
// 课程颜色
|
||||
lessonStyle(item) {
|
||||
return `background:#${this.bg_color[item.color]};color:#${
|
||||
@ -224,18 +223,38 @@ export default {
|
||||
}`;
|
||||
},
|
||||
|
||||
// 初始化游戏
|
||||
initGame() {
|
||||
init() {
|
||||
// 刷新本页vuex
|
||||
this.$store.replaceState(
|
||||
Object.assign(
|
||||
this.$store.state,
|
||||
JSON.parse(localStorage.getItem("storeState"))
|
||||
JSON.parse(localStorage.getItem("cherry"))
|
||||
)
|
||||
);
|
||||
// 设置本页footerNav
|
||||
this.setCurrentPage(["None", this]);
|
||||
this.getGrade();
|
||||
// 用户登录态过滤
|
||||
if (Object.keys(this.user_info).length != 0) {
|
||||
let now = new Date().getTime(); //毫秒级时间戳
|
||||
if (
|
||||
now - this.user_info.login_time < 1000 * 60 * 60 * 24 * 7 &&
|
||||
this.user_info.login_time > interceptTime
|
||||
) {
|
||||
// 登录时间是7天之内
|
||||
// 判断当前周数
|
||||
// 可能用户刷新了数据,所以activated还得使用,但是维持keepalive是想维持当前显示的周数
|
||||
this.initGame()
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log("未登录拦截");
|
||||
this.setUserInfo([{}, this]);
|
||||
this.$router.replace("/login");
|
||||
},
|
||||
// 初始化游戏
|
||||
initGame() {
|
||||
|
||||
// 初始化游戏数据
|
||||
this.nick = "";
|
||||
this.click_count = 0;
|
||||
@ -374,7 +393,7 @@ export default {
|
||||
target: document.querySelector(".dialog-w")
|
||||
});
|
||||
let data = {
|
||||
nick: this.nick,
|
||||
nick: this.user_info.name,
|
||||
count: this.click_count,
|
||||
time: this.time_finish
|
||||
};
|
||||
@ -441,7 +460,7 @@ export default {
|
||||
},
|
||||
created() {},
|
||||
mounted() {
|
||||
this.initGame();
|
||||
this.init();
|
||||
},
|
||||
activated() {},
|
||||
components: {
|
||||
|
@ -8,27 +8,35 @@
|
||||
<header>
|
||||
<div class="w">
|
||||
<div class="title-bar">
|
||||
<div class="icon-box">
|
||||
<i class="el-icon-refresh reflash" @click="reflash()"></i>
|
||||
</div>
|
||||
<div class="center">
|
||||
<!-- 判断逻辑:默认当前学期是0,那么最大学期index为split.length-1,因为到达最小学期就不能显示左符号,所以为< -->
|
||||
<div
|
||||
class="left-box"
|
||||
@click="changeWeek('left', current_term_index < split.length-1)"
|
||||
>
|
||||
<i class="el-icon-arrow-left icon" v-show="current_term_index < split.length-1"></i>
|
||||
<template v-if="grade">
|
||||
<div class="icon-box">
|
||||
<i class="el-icon-refresh reflash" @click="reflash()"></i>
|
||||
</div>
|
||||
<div
|
||||
class="title-box"
|
||||
>{{split[current_term_index].term_time.slice(0,4)+'-'+'0'+split[current_term_index].term_time[4]}}</div>
|
||||
<div class="right-box" @click="changeWeek('right', current_term_index > 0)">
|
||||
<i class="el-icon-arrow-right icon" v-show="current_term_index > 0"></i>
|
||||
|
||||
<div class="center">
|
||||
<!-- 判断逻辑:默认当前学期是0,那么最大学期index为split.length-1,因为到达最小学期就不能显示左符号,所以为< -->
|
||||
<div
|
||||
class="left-box"
|
||||
@click="changeWeek('left', current_term_index < split.length-1)"
|
||||
>
|
||||
<i class="el-icon-arrow-left icon" v-show="current_term_index < split.length-1"></i>
|
||||
</div>
|
||||
<div
|
||||
class="title-box"
|
||||
>{{split[current_term_index].term_time.slice(0,4)+'-'+'0'+split[current_term_index].term_time[4]}}</div>
|
||||
<div class="right-box" @click="changeWeek('right', current_term_index > 0)">
|
||||
<i class="el-icon-arrow-right icon" v-show="current_term_index > 0"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="total-button" @click="detail = true">总成绩</div>
|
||||
<div class="total-button" @click="detail = true">总成绩</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="center">
|
||||
<div class="title-box">成绩</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="grade-bar">
|
||||
<div class="grade-bar" v-if="grade">
|
||||
<p>
|
||||
本学期绩点:
|
||||
<span>{{split[current_term_index].term_GPA.toPrecision(4)}}</span>
|
||||
@ -46,16 +54,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div :style="'height: 2.9rem;'"></div>
|
||||
<!-- 以下的数据全部基于current_term_index,所以不用做特殊处理 -->
|
||||
<GradeCard
|
||||
v-for="(content, index) in split[current_term_index].term_grade"
|
||||
:content="content"
|
||||
:key="index+current_term_index*30"
|
||||
></GradeCard>
|
||||
<template v-if="grade">
|
||||
<!-- 以下的数据全部基于current_term_index,所以不用做特殊处理 -->
|
||||
<div style="height: 2.9rem;"></div>
|
||||
<GradeCard
|
||||
v-for="(content, index) in split[current_term_index].term_grade"
|
||||
:content="content"
|
||||
:key="index+current_term_index*30"
|
||||
></GradeCard>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div style="height: 1.2rem;"></div>
|
||||
<div class="errMsg">
|
||||
<p class="title">抱歉,暂无数据</p>
|
||||
<p class="content">请访问教务系统</p>
|
||||
<p @click="open('https://webvpn.cust.edu.cn')" class="link">webvpn.cust.edu.cn</p>
|
||||
<p class="content">如在教务能成功查看到成绩信息请</p>
|
||||
<p @click="reflash()" class="link">刷新数据</p>
|
||||
<p class="content">如果教务上都看不到那就与我无瓜了,</p>
|
||||
<p class="content">若刷新后仍无数据请加群</p>
|
||||
<p @click="open('https://jq.qq.com/?_wv=1027&k=5Jeoz9R')" class="link">1030523678</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div style="height:.3rem;"></div>
|
||||
<!-- 总成绩点击弹窗 -->
|
||||
<div class="dialog" v-show="detail" @touchmove.prevent>
|
||||
<div class="dialog" v-if="grade && detail" @touchmove.prevent>
|
||||
<div class="w">
|
||||
<div class="title">
|
||||
总成绩
|
||||
@ -94,8 +118,8 @@
|
||||
import FooterSpace from "@/components/FooterSpace.vue";
|
||||
import GradeCard from "./components/GradeCard.vue";
|
||||
import { mapState, mapActions } from "vuex";
|
||||
import { getGradeInitData } from "@/lib/utils.js";
|
||||
import { decryptMainCode } from "@/lib/aes.js";
|
||||
import { interceptTime } from "@/lib/utils.js";
|
||||
import { Loading } from "element-ui";
|
||||
import { login } from "@/axios/api.js";
|
||||
|
||||
@ -104,7 +128,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
current_term_index: 0,
|
||||
split: null,
|
||||
split: [],
|
||||
total: null,
|
||||
detail: false,
|
||||
init_lock: false
|
||||
@ -117,32 +141,18 @@ export default {
|
||||
...mapActions(["setUserInfo", "setGrade", "setSchedule", "setCurrentPage"]),
|
||||
// 初始化
|
||||
init(lock = false) {
|
||||
// 互斥锁加锁
|
||||
if (this.init_lock) return;
|
||||
this.init_lock = lock;
|
||||
// 刷新本页vuex
|
||||
this.$store.replaceState(
|
||||
Object.assign(
|
||||
this.$store.state,
|
||||
JSON.parse(localStorage.getItem("storeState"))
|
||||
JSON.parse(localStorage.getItem("cherry"))
|
||||
)
|
||||
);
|
||||
// 互斥锁加锁
|
||||
if (this.init_lock) return;
|
||||
console.log("刷新成绩信息");
|
||||
this.init_lock = lock;
|
||||
// 设置footerNav
|
||||
this.setCurrentPage(["grade", this]);
|
||||
// 处理第一次进来没有初始信息的情况
|
||||
if (
|
||||
!this.grade ||
|
||||
Object.keys(this.grade) == 0 ||
|
||||
!this.grade.data.total.total_bixiu_GPA ||
|
||||
this.grade.data.total.total_bixiu_GPA == "∞"
|
||||
) {
|
||||
console.log("重置信息");
|
||||
this.setGrade([getGradeInitData(), this]);
|
||||
}
|
||||
//将grade的信息存到简单的变量里,由于不涉及更改,所以不需要深拷贝
|
||||
this.split = this.grade.data.split;
|
||||
this.total = this.grade.data.total;
|
||||
// 互斥锁解锁
|
||||
setTimeout(
|
||||
function() {
|
||||
@ -150,6 +160,27 @@ export default {
|
||||
}.bind(this),
|
||||
100
|
||||
);
|
||||
// 用户登录态过滤
|
||||
if (Object.keys(this.user_info).length != 0) {
|
||||
let now = new Date().getTime(); //毫秒级时间戳
|
||||
if (
|
||||
now - this.user_info.login_time < 1000 * 60 * 60 * 24 * 7 &&
|
||||
this.user_info.login_time > interceptTime
|
||||
) {
|
||||
// 登录时间是7天之内
|
||||
// 判断当前周数
|
||||
// 可能用户刷新了数据,所以activated还得使用,但是维持keepalive是想维持当前显示的周数
|
||||
if (this.grade) {
|
||||
//将grade的信息存到简单的变量里,由于不涉及更改,所以不需要深拷贝
|
||||
this.split = this.grade.split;
|
||||
this.total = this.grade.total;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log("未登录拦截");
|
||||
this.setUserInfo([{}, this]);
|
||||
this.$router.replace("/login");
|
||||
},
|
||||
|
||||
// 改变周数
|
||||
@ -168,7 +199,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
let load = Loading.service({
|
||||
background: "rgba(255,245,236,.7)",
|
||||
background: "rgba(236,245,255,.7)",
|
||||
target: document.querySelector(".grade")
|
||||
});
|
||||
let cid = this.user_info.cid;
|
||||
@ -184,53 +215,34 @@ export default {
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
load.close();
|
||||
if (
|
||||
error.code === "ECONNABORTED" &&
|
||||
error.message.indexOf("timeout") !== -1
|
||||
) {
|
||||
// 超时
|
||||
this.$message.error("教务挂了");
|
||||
if (error.response && error.response.status != 500) {
|
||||
this.$message.error(
|
||||
`${error.response.status}: ${error.response.data}`
|
||||
);
|
||||
} else {
|
||||
// 服务器挂了
|
||||
this.$message.error("服务器挂了");
|
||||
this.$message.error("网络错误,请稍候重试");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 处理服务器返回的数据
|
||||
// 处理服务器返回的数据
|
||||
manageRes(data, load) {
|
||||
if (data.errcode == 200) {
|
||||
// 登录成功
|
||||
// 后端数据,本地数据,初始化数据,有哪个取哪个,
|
||||
// 成绩保证只存在初始数据和成功返回的数据两种情况
|
||||
let grade =
|
||||
data.grade.errcode == 200
|
||||
? data.grade
|
||||
: this.grade
|
||||
? this.grade
|
||||
: getGradeInitData();
|
||||
let schedule =
|
||||
data.schedule.errcode == 200
|
||||
? data.schedule
|
||||
: this.schedule
|
||||
? this.schedule
|
||||
: {};
|
||||
// 设置localStorage
|
||||
this.setGrade([grade, this]);
|
||||
this.setSchedule([schedule, this]);
|
||||
// 用户侧处理
|
||||
this.split = this.grade.data.split;
|
||||
this.total = this.grade.data.total;
|
||||
load.close();
|
||||
this.$message({
|
||||
message: "信息刷新成功",
|
||||
type: "success"
|
||||
});
|
||||
} else {
|
||||
// 教务挂了
|
||||
load.close();
|
||||
this.$message.error("教务挂了");
|
||||
}
|
||||
// 登录成功
|
||||
let user_info = this.user_info;
|
||||
user_info.login_time = new Date().getTime();
|
||||
let grade = data.grade ? data.grade : this.grade;
|
||||
let schedule = data.schedule ? data.schedule : this.schedule;
|
||||
// 设置localStorage
|
||||
this.setUserInfo([user_info, this]);
|
||||
this.setGrade([grade, this]);
|
||||
this.setSchedule([schedule, this]);
|
||||
// 用户侧处理
|
||||
load.close();
|
||||
this.$message({
|
||||
message: "信息刷新成功",
|
||||
type: "success"
|
||||
});
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -258,6 +270,25 @@ export default {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
touch-action: pan-y !important;
|
||||
.errMsg {
|
||||
width: 80%;
|
||||
margin: 1rem auto;
|
||||
box-sizing: border-box;
|
||||
padding: 0.5rem;
|
||||
font-size: 0.4rem;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 0.3rem 0.1rem rgba(0, 0, 0, 0.1);
|
||||
border-radius: 0.1rem;
|
||||
.title {
|
||||
font-size: 0.6rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.link {
|
||||
margin-bottom: 0.5rem;
|
||||
color: $blue;
|
||||
}
|
||||
}
|
||||
header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
@ -5,20 +5,20 @@
|
||||
<div class="title-bg2 title-bg"></div>
|
||||
<div class="title-bg3 title-bg"></div>
|
||||
</div>
|
||||
<header><i class="el-icon-back" @click="turnToHome()"></i></header>
|
||||
<!-- <header><i class="el-icon-back" @click="turnToHome()"></i></header> -->
|
||||
<div class="logo-box"><img src="../../assets/logo.png" alt class="logo" /></div>
|
||||
<div class="login-box">
|
||||
<div class="title">获取信息</div>
|
||||
<div class="label">教务账号</div>
|
||||
<div class="title">登录</div>
|
||||
<div class="label">教务账号*</div>
|
||||
<input type="text" name="cid" v-model.trim="cid" />
|
||||
<div class="label">教务密码</div>
|
||||
<div class="label">教务密码*</div>
|
||||
<input type="password" name="pwd" v-model.trim="pwd" />
|
||||
<div class="label">手机号码(非必填,仅在rush失败时用于更新教务)</div>
|
||||
<div class="label">手机号码(非必填,仅在登录失败时更新教务)</div>
|
||||
<input type="password" name="phone" v-model.trim="phone" />
|
||||
</div>
|
||||
<div class="submit-box"><div class="submit" @click="submit()">rushBBBB</div></div>
|
||||
<div class="submit-box"><div class="submit" @click="submit()">登录</div></div>
|
||||
<div class="copyRight">
|
||||
<p>Version 2.0</p>
|
||||
<p>Version 3.0</p>
|
||||
<p>Inspire Studio</p>
|
||||
<p>©2020 All Rights Reserved.</p>
|
||||
</div>
|
||||
@ -42,7 +42,6 @@ import { mapState, mapActions } from 'vuex';
|
||||
import { login } from '@/axios/api.js';
|
||||
import { Loading } from 'element-ui';
|
||||
import FooterSpace from '@/components/FooterSpace.vue';
|
||||
import { getGradeInitData } from '@/lib/utils.js'
|
||||
import { encryptMainCode } from '@/lib/aes.js'
|
||||
|
||||
export default {
|
||||
@ -65,7 +64,7 @@ export default {
|
||||
// 初始化
|
||||
init() {
|
||||
// 刷新本页vuex
|
||||
this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("storeState"))));
|
||||
this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("cherry"))));
|
||||
// 设置footerNav
|
||||
this.setCurrentPage(["None", this]);
|
||||
},
|
||||
@ -94,14 +93,16 @@ export default {
|
||||
if (error.code === 'ECONNABORTED' && error.message.indexOf('timeout') !== -1) {
|
||||
// 超时
|
||||
this.net_error_dialog_content = '可能登陆人数过多,再试试吧,实在不行再加群问问。肥肠感谢!!!'
|
||||
} else {
|
||||
// 服务器挂了
|
||||
this.net_error_dialog_content = '服务器出问题了!快加群告诉群主!!肥肠感谢!!!'
|
||||
// 打开加群的dialog
|
||||
this.net_error_dialog = true
|
||||
return
|
||||
}
|
||||
if (error.response && error.response.status != 500) {
|
||||
this.$message.error(`${error.response.status}: ${error.response.data}`);
|
||||
} else {
|
||||
this.$message.error("网络错误,请稍候重试");
|
||||
}
|
||||
// 打开加群的dialog
|
||||
this.net_error_dialog = true
|
||||
});
|
||||
|
||||
} else {
|
||||
// 账户信息不完整
|
||||
this.$message.error('请输入完整的账号密码');
|
||||
@ -110,7 +111,6 @@ export default {
|
||||
|
||||
// 处理服务器返回的数据
|
||||
manageRes(data, load) {
|
||||
if (data.errcode == 200) {
|
||||
// 登录成功
|
||||
let user_info = {
|
||||
login_time: new Date().getTime(),
|
||||
@ -119,10 +119,8 @@ export default {
|
||||
cid: this.cid,
|
||||
pwd: encryptMainCode(this.pwd)
|
||||
};
|
||||
// 后端数据,本地数据,初始化数据,有哪个取哪个,
|
||||
// 成绩保证只存在初始数据和成功返回的数据两种情况
|
||||
let grade = data.grade.errcode == 200 ? data.grade : this.grade ? this.grade : getGradeInitData();
|
||||
let schedule = data.schedule.errcode == 200 ? data.schedule : this.schedule ? this.schedule : {};
|
||||
let grade = data.grade ? data.grade : this.grade
|
||||
let schedule = data.schedule ? data.schedule : this.schedule
|
||||
// 设置localStorage
|
||||
this.setUserInfo([user_info, this]);
|
||||
this.setGrade([grade, this]);
|
||||
@ -135,19 +133,6 @@ export default {
|
||||
});
|
||||
// 跳转回主页
|
||||
this.turnToHome();
|
||||
} else if (data.errcode == 101) {
|
||||
// 用户信息出错
|
||||
load.close();
|
||||
this.$alert('账号或密码错了,笨', '与我无瓜', {
|
||||
confirmButtonText: '阅!'
|
||||
});
|
||||
} else {
|
||||
// 教务挂了
|
||||
load.close();
|
||||
this.$alert('教务挂了,等通知吧', '与我无瓜', {
|
||||
confirmButtonText: '阅!'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 强制跳转回主页
|
||||
|
@ -3,14 +3,14 @@
|
||||
<header>
|
||||
<img src="../../assets/logo_nobg.png" alt="logo" />
|
||||
<p>
|
||||
Co-Create
|
||||
<span>v1.0</span>
|
||||
Cherry
|
||||
<span>v3.0</span>
|
||||
</p>
|
||||
<div class="auth">By:Inspire Studio</div>
|
||||
<!-- <img src="../assets/wave.gif" mode="scaleToFill" class="gif-wave"/> -->
|
||||
<!-- <image src="https://raw.githubusercontent.com/weilanwl/ColorUI/master/demo/images/wave.gif" mode="scaleToFill" class="gif-wave"></image> -->
|
||||
</header>
|
||||
<div class="user-box shadow-warp" v-if="user_info">
|
||||
<div class="user-box shadow-warp" v-if="Object.keys(this.user_info).length != 0">
|
||||
<div class="cid-box">
|
||||
<div class="cid">{{user_info.id}}</div>
|
||||
<div class="label">
|
||||
@ -25,16 +25,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="logout" @click="logout()" v-if="user_info">退出登录</div>
|
||||
<div class="logout" @click="logout()" v-if="Object.keys(this.user_info).length != 0">退出登录</div>
|
||||
<div class="logout" @click="goTo('/login')" v-else>立即登录</div>
|
||||
<div class="qq">
|
||||
反馈及获取最新功能=>
|
||||
<span @click="openQQ()">1030523678</span>
|
||||
</div>
|
||||
<div class="web-addr"
|
||||
v-clipboard:copy="web_addr"
|
||||
v-clipboard:success="onCopyUrl"
|
||||
v-clipboard:error="onErrorUrl">
|
||||
<div
|
||||
class="web-addr"
|
||||
v-clipboard:copy="web_addr"
|
||||
v-clipboard:success="onCopyUrl"
|
||||
v-clipboard:error="onErrorUrl"
|
||||
>
|
||||
coc主站地址=>
|
||||
<span>cherry.lacus.site</span>
|
||||
</div>
|
||||
@ -53,34 +55,34 @@ export default {
|
||||
name: "myaccount",
|
||||
data() {
|
||||
return {
|
||||
web_addr: 'https://cherry.lacus.site'
|
||||
web_addr: "https://cherry.lacus.site"
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["user_info"])
|
||||
},
|
||||
methods: {
|
||||
...mapActions([
|
||||
"setCurrentPage",
|
||||
"setGrade",
|
||||
"setSchedule",
|
||||
"setUserInfo"
|
||||
]),
|
||||
...mapActions(["setCurrentPage", "setGrade", "setSchedule", "setUserInfo"]),
|
||||
init() {
|
||||
// 刷新本页vuex
|
||||
this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("storeState"))));
|
||||
this.$store.replaceState(
|
||||
Object.assign(
|
||||
this.$store.state,
|
||||
JSON.parse(localStorage.getItem("cherry"))
|
||||
)
|
||||
);
|
||||
this.setCurrentPage(["myaccount", this]);
|
||||
},
|
||||
// 登出
|
||||
logout() {
|
||||
this.setUserInfo([null, this]);
|
||||
this.setUserInfo([{}, this]);
|
||||
this.setGrade([null, this]);
|
||||
this.setSchedule([null, this]);
|
||||
localStorage.setItem("storeState", JSON.stringify(this.$store.state));
|
||||
this.$message({
|
||||
message: "本地数据清除完成",
|
||||
type: "success"
|
||||
});
|
||||
this.$router.replace("/login");
|
||||
},
|
||||
// 打开qq群链接
|
||||
openQQ() {
|
||||
@ -96,13 +98,12 @@ export default {
|
||||
this.$message.success("复制失败!");
|
||||
}
|
||||
},
|
||||
created() {
|
||||
created() {},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
mounted(){
|
||||
this.init()
|
||||
},
|
||||
activated (){
|
||||
this.init()
|
||||
activated() {
|
||||
this.init();
|
||||
},
|
||||
components: {
|
||||
FooterSpace
|
||||
@ -116,7 +117,7 @@ export default {
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
margin: 0 auto;
|
||||
background-color: #f1f1f1;
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
@ -221,7 +222,8 @@ export default {
|
||||
border-radius: inherit;
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
.qq ,.web-addr{
|
||||
.qq,
|
||||
.web-addr {
|
||||
font-size: 0.35rem;
|
||||
color: $gray;
|
||||
text-align: center;
|
||||
@ -230,7 +232,7 @@ export default {
|
||||
}
|
||||
}
|
||||
.web-addr {
|
||||
margin-top: .3rem;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,107 +1,131 @@
|
||||
<template>
|
||||
<div class="schedule">
|
||||
<header>
|
||||
<div class="w">
|
||||
<i class="el-icon-s-operation more" @click="openDrawer()"></i>
|
||||
<div class="left-box" @click="changeWeek('left')">
|
||||
<i class="el-icon-arrow-left icon" v-show="show_week!==1"></i>
|
||||
<div class="schedule">
|
||||
<header>
|
||||
<div class="w">
|
||||
<template v-if="schedule">
|
||||
<i class="el-icon-s-operation more" @click="openDrawer()"></i>
|
||||
<div class="left-box" @click="changeWeek('left')">
|
||||
<i class="el-icon-arrow-left icon" v-show="show_week!==1"></i>
|
||||
</div>
|
||||
<div class="week-box">第{{show_week}}周</div>
|
||||
<div class="right-box" @click="changeWeek('right')">
|
||||
<i class="el-icon-arrow-right icon" v-show="show_week!==max_week"></i>
|
||||
</div>
|
||||
<i class="el-icon-refresh refresh" @click="reflash"></i>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="week-box">课表</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="week-box">第{{show_week}}周</div>
|
||||
<div class="right-box" @click="changeWeek('right')">
|
||||
<i class="el-icon-arrow-right icon" v-show="show_week!==max_week"></i>
|
||||
</div>
|
||||
<i class="el-icon-refresh refresh" @click="reflash"></i>
|
||||
</div>
|
||||
</header>
|
||||
<div style="height: 1.2rem;"></div>
|
||||
<body>
|
||||
<nav>
|
||||
<div
|
||||
class="week-title"
|
||||
v-for="i in hide_weekend? 5:7"
|
||||
:class="highlightWeek == i%7? 'highlight':''"
|
||||
:key="i"
|
||||
>
|
||||
<p>{{week_day[i-1]}}</p>
|
||||
<p>{{date_arr[i-1]}}</p>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="main">
|
||||
<v-touch @swiperight="openDrawer()">
|
||||
</header>
|
||||
<div style="height: 1.2rem;"></div>
|
||||
<template v-if="schedule">
|
||||
<nav>
|
||||
<div
|
||||
class="week-title"
|
||||
v-for="i in hide_weekend? 5:7"
|
||||
:class="highlightWeek == i%7? 'highlight':''"
|
||||
:key="i"
|
||||
>
|
||||
<p>{{week_day[i-1]}}</p>
|
||||
<p>{{date_arr[i-1]}}</p>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="main">
|
||||
<v-touch
|
||||
:swipe-options="{direction: 'horizontal'}"
|
||||
@swiperight="openDrawer"
|
||||
>
|
||||
<aside>
|
||||
<div class="lesson-title" v-for="i in 12" :key="i">{{i}}</div>
|
||||
</aside>
|
||||
</v-touch>
|
||||
<v-touch
|
||||
class="lesson-warp"
|
||||
:swipe-options="{direction: 'horizontal'}"
|
||||
@swipeleft="swipeRight"
|
||||
@swiperight="swipeLeft"
|
||||
>
|
||||
<div class="lesson-warp">
|
||||
<div class="day-box" v-for="d in hide_weekend ? 5:7" :key="d">
|
||||
<div class="lesson-box" v-for="i in 6" :key="i">
|
||||
<template
|
||||
v-if="schedule && schedule.errcode === 200 && schedule.data.lesson[d-1][i-1] !== 0"
|
||||
>
|
||||
<template v-for="item in schedule.data.lesson[d-1][i-1]">
|
||||
<template v-if="item.Time_split[show_week]">
|
||||
<div class="lesson" :style="lessonStyle(item)" @click="openDialog(item)">
|
||||
<p class="info">
|
||||
{{item.Lesson}}
|
||||
<br />
|
||||
{{item.Room.replace(/\[.+\]/, "")}}
|
||||
</p>
|
||||
</div>
|
||||
</v-touch>
|
||||
<v-touch
|
||||
class="lesson-warp"
|
||||
:swipe-options="{direction: 'horizontal'}"
|
||||
@swipeleft="swipeRight"
|
||||
@swiperight="swipeLeft"
|
||||
>
|
||||
<div class="lesson-warp">
|
||||
<div class="day-box" v-for="d in hide_weekend ? 5:7" :key="d">
|
||||
<div class="lesson-box" v-for="i in 6" :key="i">
|
||||
<template
|
||||
v-if="schedule && schedule.lesson[d-1][i-1] !== 0"
|
||||
>
|
||||
<template v-for="(item, index) in schedule.lesson[d-1][i-1]">
|
||||
<template v-if="item.Time_split[show_week]">
|
||||
<div
|
||||
class="lesson"
|
||||
:style="lessonStyle(item)"
|
||||
:key="index"
|
||||
@click="openDialog(item)"
|
||||
>
|
||||
<p class="info">
|
||||
{{item.Lesson}}
|
||||
<br />
|
||||
{{item.Room.replace(/\[.+\]/, "")}}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-touch>
|
||||
</div>
|
||||
<!-- 课表点击弹窗 -->
|
||||
<div class="dialog" v-show="detail" @touchmove.prevent>
|
||||
<div class="w">
|
||||
<div class="title">
|
||||
详情
|
||||
<div class="icon-box" @click="closeDialog()">
|
||||
<i class="el-icon-close icon"></i>
|
||||
</v-touch>
|
||||
</div>
|
||||
<!-- 课表点击弹窗 -->
|
||||
<div class="dialog" v-show="detail" @touchmove.prevent>
|
||||
<div class="w">
|
||||
<div class="title">
|
||||
详情
|
||||
<div class="icon-box" @click="closeDialog()">
|
||||
<i class="el-icon-close icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-main">
|
||||
<p>
|
||||
课程名:
|
||||
<span>{{detail.Lesson}}</span>
|
||||
</p>
|
||||
<p>
|
||||
周数:
|
||||
<span>{{detail.Time}}</span>
|
||||
</p>
|
||||
<p>
|
||||
上课地点:
|
||||
<span>{{detail.Room}}</span>
|
||||
</p>
|
||||
<p>
|
||||
任课教师:
|
||||
<span>{{detail.Teacher}}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-main">
|
||||
<p>
|
||||
课程名:
|
||||
<span>{{detail.Lesson}}</span>
|
||||
</p>
|
||||
<p>
|
||||
周数:
|
||||
<span>{{detail.Time}}</span>
|
||||
</p>
|
||||
<p>
|
||||
上课地点:
|
||||
<span>{{detail.Room}}</span>
|
||||
</p>
|
||||
<p>
|
||||
任课教师:
|
||||
<span>{{detail.Teacher}}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<FooterSpace></FooterSpace>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="errMsg">
|
||||
<p class="title">抱歉,暂无数据</p>
|
||||
<p class="content">请访问教务系统</p>
|
||||
<p @click="open('https://webvpn.cust.edu.cn')" class="link">webvpn.cust.edu.cn</p>
|
||||
<p class="content">如在教务能成功查看到成绩信息请</p>
|
||||
<p @click="reflash()" class="link">刷新数据</p>
|
||||
<p class="content">如果教务上都看不到那就与我无瓜了,</p>
|
||||
<p class="content">若刷新后仍无数据请加群</p>
|
||||
<p @click="open('https://jq.qq.com/?_wv=1027&k=5Jeoz9R')" class="link">1030523678</p>
|
||||
</div>
|
||||
</template>
|
||||
<FooterSpace></FooterSpace>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// @ is an alias to /src
|
||||
import FooterSpace from "@/components/FooterSpace.vue";
|
||||
import { mapState, mapActions } from "vuex";
|
||||
import { gameUpload } from "@/axios/api.js";
|
||||
import { getGradeInitData } from "@/lib/utils.js";
|
||||
import { decryptMainCode } from "@/lib/aes.js";
|
||||
import { interceptTime } from "@/lib/utils.js";
|
||||
import { Loading } from "element-ui";
|
||||
import { login } from "@/axios/api.js";
|
||||
|
||||
@ -176,17 +200,16 @@ export default {
|
||||
|
||||
// 初始化课表
|
||||
init(lock = false) {
|
||||
// 互斥锁加锁
|
||||
if (this.init_lock) return;
|
||||
this.init_lock = lock;
|
||||
// 刷新本页vuex
|
||||
this.$store.replaceState(
|
||||
Object.assign(
|
||||
this.$store.state,
|
||||
JSON.parse(localStorage.getItem("storeState"))
|
||||
JSON.parse(localStorage.getItem("cherry"))
|
||||
)
|
||||
);
|
||||
// 互斥锁加锁
|
||||
if (this.init_lock) return;
|
||||
console.log("刷新课表信息");
|
||||
this.init_lock = lock;
|
||||
// 设置footerNav
|
||||
this.setCurrentPage(["schedule", this]);
|
||||
// 互斥锁解锁
|
||||
@ -196,24 +219,31 @@ export default {
|
||||
}.bind(this),
|
||||
100
|
||||
);
|
||||
// 无课表信息拦截器
|
||||
if (!this.schedule) return;
|
||||
// 判断当前周数
|
||||
// 可能用户刷新了数据,所以activated还得使用,但是维持keepalive是想维持当前显示的周数
|
||||
// this.current_week = this.schedule.data.cur_week > 0 ? this.schedule.data.cur_week : 1;
|
||||
this.getCurrentWeek();
|
||||
this.show_week = lock ? this.current_week : this.show_week;
|
||||
this.getDays();
|
||||
// 用户登录态过滤
|
||||
if (Object.keys(this.user_info).length != 0) {
|
||||
let now = new Date().getTime(); //毫秒级时间戳
|
||||
if (
|
||||
now - this.user_info.login_time < 1000 * 60 * 60 * 24 * 7 &&
|
||||
this.user_info.login_time > interceptTime
|
||||
) {
|
||||
// 登录时间是7天之内
|
||||
// 判断当前周数
|
||||
// 可能用户刷新了数据,所以activated还得使用,但是维持keepalive是想维持当前显示的周数
|
||||
this.getCurrentWeek();
|
||||
this.show_week = lock ? this.current_week : this.show_week;
|
||||
this.getDays();
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log('未登录拦截')
|
||||
this.setUserInfo([{}, this]);
|
||||
this.$router.replace("/login");
|
||||
},
|
||||
|
||||
// 改变周数
|
||||
changeWeek(dirction) {
|
||||
if (dirction == "left")
|
||||
if (this.show_week > 1) this.show_week--;
|
||||
else return;
|
||||
else if (this.show_week < this.max_week) this.show_week++;
|
||||
else return;
|
||||
this.getDays();
|
||||
if (dirction == "left") this.swipeLeft();
|
||||
else this.swipeRight();
|
||||
},
|
||||
|
||||
// 打开dialog显示课程详情
|
||||
@ -314,51 +344,37 @@ export default {
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
load.close();
|
||||
if (
|
||||
error.code === "ECONNABORTED" &&
|
||||
error.message.indexOf("timeout") !== -1
|
||||
) {
|
||||
// 超时
|
||||
this.$message.error("教务挂了");
|
||||
if (error.response && error.response.status != 500) {
|
||||
this.$message.error(
|
||||
`${error.response.status}: ${error.response.data}`
|
||||
);
|
||||
} else {
|
||||
// 服务器挂了
|
||||
this.$message.error("服务器挂了");
|
||||
this.$message.error("网络错误,请稍候重试");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 处理服务器返回的数据
|
||||
manageRes(data, load) {
|
||||
if (data.errcode == 200) {
|
||||
// 登录成功
|
||||
// 后端数据,本地数据,初始化数据,有哪个取哪个,
|
||||
// 成绩保证只存在初始数据和成功返回的数据两种情况
|
||||
let grade =
|
||||
data.grade.errcode == 200
|
||||
? data.grade
|
||||
: this.grade
|
||||
? this.grade
|
||||
: getGradeInitData();
|
||||
let schedule =
|
||||
data.schedule.errcode == 200
|
||||
? data.schedule
|
||||
: this.schedule
|
||||
? this.schedule
|
||||
: {};
|
||||
// 设置localStorage
|
||||
this.setGrade([grade, this]);
|
||||
this.setSchedule([schedule, this]);
|
||||
// 用户侧处理
|
||||
load.close();
|
||||
this.$message({
|
||||
message: "信息刷新成功",
|
||||
type: "success"
|
||||
});
|
||||
} else {
|
||||
// 教务挂了
|
||||
load.close();
|
||||
this.$message.error("教务挂了");
|
||||
}
|
||||
// 登录成功
|
||||
let user_info = this.user_info;
|
||||
user_info.login_time = new Date().getTime();
|
||||
let grade = data.grade ? data.grade : this.grade;
|
||||
let schedule = data.schedule ? data.schedule : this.schedule;
|
||||
// 设置localStorage
|
||||
this.setUserInfo([user_info, this]);
|
||||
this.setGrade([grade, this]);
|
||||
this.setSchedule([schedule, this]);
|
||||
// 用户侧处理
|
||||
load.close();
|
||||
this.$message({
|
||||
message: "信息刷新成功",
|
||||
type: "success"
|
||||
});
|
||||
},
|
||||
// 打开链接
|
||||
open(url) {
|
||||
window.open(url);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -384,6 +400,25 @@ export default {
|
||||
min-height: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
.errMsg {
|
||||
width: 80%;
|
||||
margin: 1rem auto;
|
||||
box-sizing: border-box;
|
||||
padding: 0.5rem;
|
||||
font-size: 0.4rem;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 0.3rem 0.1rem rgba(0, 0, 0, 0.1);
|
||||
border-radius: 0.1rem;
|
||||
.title {
|
||||
font-size: 0.6rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.link {
|
||||
margin-bottom: 0.5rem;
|
||||
color: $red;
|
||||
}
|
||||
}
|
||||
header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user