Browse Source

token相关修改

yy 3 years ago
parent
commit
393421b2af
3 changed files with 44 additions and 18 deletions
  1. 5 0
      src/api/home.js
  2. 5 4
      src/views/PersonalCenter/PersonalData.vue
  3. 34 14
      src/views/PersonalCenter/index.vue

+ 5 - 0
src/api/home.js

@ -7,6 +7,11 @@ export const getAnnouncementList = (params) => {
7 7
  return req.get('/announce/queryPage', params)
8 8
}
9 9
10
// 个人token
11
export const getStudentToken = (params) => {
12
  return req.post('/stuent/getTokenUserId', params)
13
}
14
10 15
// 个人中心-个人资料
11 16
// 个人资料
12 17
export const getStudentInfo = (params) => {

+ 5 - 4
src/views/PersonalCenter/PersonalData.vue

@ -227,6 +227,7 @@ export default {
227 227
    },
228 228
    // 增加考生个人资料
229 229
    async addStudent() {
230
      this.form['uuid'] = set_id
230 231
      let form = this.form;
231 232
      let res = await addStudentInfo(form);
232 233
@ -249,11 +250,11 @@ export default {
249 250
      this.$refs.form.validate(v => {
250 251
        if(v) {
251 252
          this.$emit("func", true);
252
          if (this.studentData) {
253
            this.updateStudent();
254
          } else {
253
          // if (this.studentData) {
254
          //   this.updateStudent();
255
          // } else {
255 256
            this.addStudent();
256
          }
257
          // }
257 258
        }else {
258 259
          return false;
259 260
        }

+ 34 - 14
src/views/PersonalCenter/index.vue

@ -26,7 +26,7 @@
26 26
                    <div class="left-mid">
27 27
                        <el-button type="primary" class="left-mid-btn" @click="onChange(5)">合格证查询</el-button>
28 28
                    </div>
29
                    <el-button @click="openToken" style="margin:10px 34px;">点击设置id</el-button>
29
                    <!-- <el-button @click="openToken" style="margin:10px 34px;">点击设置id</el-button> -->
30 30
                </div>
31 31
                <div class="right">
32 32
                    <PersonalData v-if="selected_index == 0" @func="change"></PersonalData>
@ -36,7 +36,7 @@
36 36
                    <ScoreInquiry v-if="selected_index == 4"/>
37 37
                    <CertificateInquiry v-if="selected_index == 5"/>
38 38
                </div>
39
                <el-dialog
39
                <!-- <el-dialog
40 40
                    class="examAddDialog"
41 41
                    title="输入id"
42 42
                    :visible.sync="dialog"
@ -53,7 +53,7 @@
53 53
                    <span slot="footer" class="dialog-footer">
54 54
                        <el-button @click="editInfo" type="primary">确 定</el-button>
55 55
                    </span>
56
                </el-dialog>
56
                </el-dialog> -->
57 57
            </div>
58 58
        </div>
59 59
    </div>
@ -70,6 +70,7 @@ import ExamFlow from "@/views/PersonalCenter/ExamFlow";
70 70
import local from "@/utils/local";
71 71
import {
72 72
  getStudentInfo, //获取学生信息列表
73
  getStudentToken,
73 74
} from "@/api/home";
74 75
export default {
75 76
    components: {
@ -92,12 +93,12 @@ export default {
92 93
        }
93 94
    },
94 95
    created() {
95
        this.dialog = !local.get("id");
96
        this.form.id = local.get("id");
97 96
        if(this.$route.query.selected_index) {
98 97
            this.selected_index = this.$route.query.selected_index;
99 98
        };
100
        this.fetchData();
99
        this.fetchToken();
100
        // this.dialog = !local.get("id");
101
        // this.form.id = local.get("id");
101 102
    },
102 103
    methods: {
103 104
        // 获取考生个人资料
@ -115,20 +116,39 @@ export default {
115 116
                this.studentData = data.res.student;
116 117
            }
117 118
        },
119
        // 获取考生token
120
        async fetchToken() {
121
            let res = await getStudentToken({});
122
123
            // 解构数据
124
            let { code, data, msg } = res;
125
126
            // 赋值渲染
127
            if (code === 200) {
128
                if(data.res){
129
                    local.set("id", data.res);
130
                    this.fetchData();
131
                }else{
132
                    this.$message('id为空')
133
                }
134
            }else{
135
                this.$message(msg)
136
            }
137
        },
118 138
        onChange(index) {
119 139
            this.selected_index = index;
120 140
        },
121 141
        change() {
122 142
            this.selected_index = 1;
123 143
        },
124
        openToken() {
125
            this.dialog = true;
126
        },
127
        editInfo() {
128
            local.set("id", this.form.id);
129
            this.dialog = false;
130
            window.location.reload();
131
        },
144
        // openToken() {
145
        //     this.dialog = true;
146
        // },
147
        // editInfo() {
148
        //     local.set("id", this.form.id);
149
        //     this.dialog = false;
150
        //     window.location.reload();
151
        // },
132 152
    }
133 153
}
134 154
</script>