|
@@ -40,13 +40,18 @@
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="user-manual-item-left-schedule-text">
|
|
|
- 已获得{{ item.getPoints }}分 / 上限{{ item.totalPonits }}分
|
|
|
+ 已获得 {{ item.getPoints || 0 }} 分 / 上限
|
|
|
+ {{ item.totalPonits }} 分
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="user-manual-item-right">
|
|
|
<div class="user-manual-item-btn" @click="toManualEarnFun(item)">
|
|
|
- {{ item.rightButton }}
|
|
|
+ {{
|
|
|
+ item.getPoints === item.totalPonits
|
|
|
+ ? "已完成"
|
|
|
+ : item.rightButton
|
|
|
+ }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -70,7 +75,7 @@ export default {
|
|
|
type: "LOGIN",
|
|
|
rule: "1分/登录",
|
|
|
isFinish: false,
|
|
|
- getPoints: 0,
|
|
|
+ getPoints: 1,
|
|
|
totalPonits: 1,
|
|
|
rightButton: "已完成",
|
|
|
router: ""
|
|
@@ -182,7 +187,7 @@ export default {
|
|
|
this.$_http
|
|
|
.get(this.$pathParams(this.$_API.JTXT_GET_USER_DAIYL_POINTS, path))
|
|
|
.then(res => {
|
|
|
- this.todayEarnPoints = res.data;
|
|
|
+ this.todayEarnPoints = res.data || 0;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.$store.commit("toggleLoading", false);
|
|
@@ -196,7 +201,7 @@ export default {
|
|
|
this.$_http
|
|
|
.get(this.$pathParams(this.$_API.JTXT_GET_USER_ALL_POINTS, path))
|
|
|
.then(res => {
|
|
|
- this.userTotalPonits = res.data;
|
|
|
+ this.userTotalPonits = res.data || 0;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.$store.commit("toggleLoading", false);
|
|
@@ -204,6 +209,15 @@ export default {
|
|
|
},
|
|
|
// 格式化已获得的积分/总积分的数
|
|
|
formatePercentageFun(getPoints, totaPonits) {
|
|
|
+ if (
|
|
|
+ (!getPoints && getPoints !== 0) ||
|
|
|
+ (!totaPonits && totaPonits !== 0)
|
|
|
+ ) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ if (isNaN(getPoints) || isNaN(totaPonits)) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
return Math.round((getPoints / totaPonits) * 100) || 0;
|
|
|
},
|
|
|
// 操作:返回
|
|
@@ -216,21 +230,42 @@ export default {
|
|
|
},
|
|
|
// 操作:点击了去看看、去学习、去训练
|
|
|
toManualEarnFun(item) {
|
|
|
- console.log("item" + JSON.stringify(item));
|
|
|
- if (item.name === "今日必答") {
|
|
|
- this.$store.commit("updateAnswerItemStore", {
|
|
|
- field: "answerRecruitId",
|
|
|
- value: "daily-questions" // item.id
|
|
|
- });
|
|
|
- this.$router.push({ name: "answerRecruit" });
|
|
|
- } else if (item.name === "今日必读") {
|
|
|
- this.$router.push({
|
|
|
- name: "home"
|
|
|
- });
|
|
|
- this.$store.commit("updateStudyItemStore", {
|
|
|
- field: "isNeedChangeTab",
|
|
|
- value: true
|
|
|
- });
|
|
|
+ // 获得的积分已满,不作操作
|
|
|
+ if (item.getPoints === item.totalPonits) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ switch (item.rightButton) {
|
|
|
+ case "已完成":
|
|
|
+ break;
|
|
|
+ case "去看看":
|
|
|
+ // 1.跳转到首页
|
|
|
+ this.$router.replace({
|
|
|
+ name: "home"
|
|
|
+ });
|
|
|
+ // 2.告知需要首页切换tab-阅读
|
|
|
+ this.$store.commit("updateStudyItemStore", {
|
|
|
+ field: "homeChangeTabIndex",
|
|
|
+ value: 0
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case "去答题":
|
|
|
+ // 1. 重置vuex的answerRecruitId
|
|
|
+ this.$store.commit("updateAnswerItemStore", {
|
|
|
+ field: "answerRecruitId",
|
|
|
+ value: "daily-questions" // item.id
|
|
|
+ });
|
|
|
+ // 2.跳转到首页
|
|
|
+ this.$router.replace({
|
|
|
+ name: "home"
|
|
|
+ });
|
|
|
+ // 3.告知需要首页切换tab-答题
|
|
|
+ this.$store.commit("updateStudyItemStore", {
|
|
|
+ field: "homeChangeTabIndex",
|
|
|
+ value: 1
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -239,13 +274,13 @@ export default {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.user-manual-box {
|
|
|
- width: 100%;
|
|
|
- height: 100vh;
|
|
|
- font-size: 0.6rem;
|
|
|
- background-color: #fff;
|
|
|
.user-manual-div {
|
|
|
+ width: 100%;
|
|
|
+ height: 100vh;
|
|
|
overflow-y: auto;
|
|
|
padding: 0 0.75rem;
|
|
|
+ background-color: #fff;
|
|
|
+ font-size: 0.6rem;
|
|
|
.user-manual-grades-div {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
@@ -323,11 +358,14 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.user-manual-item-right {
|
|
|
+ margin-left: 1rem;
|
|
|
.user-manual-item-btn {
|
|
|
+ padding: 0.1rem 0.25rem;
|
|
|
border-radius: 0.1rem;
|
|
|
color: #0088e9;
|
|
|
background-color: #d8e9f5;
|
|
|
- padding: 0.1rem 0.25rem;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ white-space: nowrap;
|
|
|
}
|
|
|
}
|
|
|
}
|