123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <template>
- <div class="contentBody">
- <van-nav-bar title="每周答题" left-arrow @click-left="handleBackFun" />
- <van-list
- v-model="loading"
- :finished="finished"
- finished-text="没有更多了"
- @load="onLoad"
- >
- <van-cell
- v-for="(item, index) in weekAnswerList"
- :key="index"
- >
- <div slot="default" class="contentItemDiv">
- <div>
- <div class="contentItemTitle">
- {{ item.name}}
- </div>
- <div class="contentItemDescription">
- <!-- <span>{{
- formateDatesFun(item.addedTime)
- }}</span> -->
- </div>
- <div class="startAnswerBox" @click="clickAnswer(item)">
- <div class="startButtonBox">
- <span class="startText">开始答题</span>
- </div>
- </div>
- </div>
- </div>
- </van-cell>
- </van-list>
- </div>
- </template>
- <script>
- import { mapState } from "vuex";
- export default {
- name: "page-answer-week",
- components: {},
- data() {
- return {
- weekAnswerList: [],
- loading: false,
- finished: false,
- weeklyPage: 0,
- weeklySize: 10
- };
- },
- created() {
- this.getWeekAnswerList();
- },
- destroyed () {
- },
- activated() {
- },
- computed: {
- ...mapState({
- chooseEngneeringWork: state => state.user.chooseEngneeringWork
- })
- },
- methods: {
- getWeekAnswerList() {
- console.log("-------------" + JSON.stringify(this.chooseEngneeringWork));
- this.loading = true;
- let params = {
- page: this.weeklyPage,
- size: this.weeklySize,
- engineertypeid: this.chooseEngneeringWork.id
- };
- this.$_http
- .get(this.$_API.GET_JTXT_WEEKLY_QUESTIONS, { params })
- .then(res => {
- this.weekAnswerList = [...this.weekAnswerList, ...res.data.content];
- console.log("------", +JSON.stringify(this.weekAnswerList));
- this.finished = res.data.last;
- this.weeklyPage++;
- this.loading = false;
- })
- .catch(() => {
- this.$store.commit("toggleLoading", false);
- });
- },
- clickAnswer(item) {
- this.$store.commit("updateAnswerItemStore", {
- field: "answerRecruitId",
- value: "weekly-questions"
- });
- this.$store.commit("updateAnswerItemStore", {
- field: "questionId",
- value: item.id
- });
- this.$router.push({ name: "answerRecruit" });
- },
- onLoad() {
- this.getWeekAnswerList();
- },
- // 操作:返回
- handleBackFun() {
- this.$router.back();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .contentBody {
- background-color: #fff;
- .contentItemDiv {
- .contentItemTitle {
- font-size: 0.65rem;
- font-weight: bold;
- }
- .contentItemDescription {
- margin-top: 0.5rem;
- color: #696969;
- span {
- margin-left: 0.5rem;
- }
- }
- .startAnswerBox {
- width:100%;
- display: flex;
- justify-content: flex-end;
- .startButtonBox{
- border-radius: 2px;
- background-color: #696969;
- }
- .startText{
- margin: 10px 5px;
- color: #fff;
- }
- }
- }
- }
- </style>
|