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
  return req.get('/announce/queryPage', params)
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
export const getStudentInfo = (params) => {
17
export const getStudentInfo = (params) => {

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

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

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

26
                    <div class="left-mid">
26
                    <div class="left-mid">
27
                        <el-button type="primary" class="left-mid-btn" @click="onChange(5)">合格证查询</el-button>
27
                        <el-button type="primary" class="left-mid-btn" @click="onChange(5)">合格证查询</el-button>
28
                    </div>
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
                </div>
30
                </div>
31
                <div class="right">
31
                <div class="right">
32
                    <PersonalData v-if="selected_index == 0" @func="change"></PersonalData>
32
                    <PersonalData v-if="selected_index == 0" @func="change"></PersonalData>
36
                    <ScoreInquiry v-if="selected_index == 4"/>
36
                    <ScoreInquiry v-if="selected_index == 4"/>
37
                    <CertificateInquiry v-if="selected_index == 5"/>
37
                    <CertificateInquiry v-if="selected_index == 5"/>
38
                </div>
38
                </div>
39
                <el-dialog
39
                <!-- <el-dialog
40
                    class="examAddDialog"
40
                    class="examAddDialog"
41
                    title="输入id"
41
                    title="输入id"
42
                    :visible.sync="dialog"
42
                    :visible.sync="dialog"
53
                    <span slot="footer" class="dialog-footer">
53
                    <span slot="footer" class="dialog-footer">
54
                        <el-button @click="editInfo" type="primary">确 定</el-button>
54
                        <el-button @click="editInfo" type="primary">确 定</el-button>
55
                    </span>
55
                    </span>
56
                </el-dialog>
56
                </el-dialog> -->
57
            </div>
57
            </div>
58
        </div>
58
        </div>
59
    </div>
59
    </div>
70
import local from "@/utils/local";
70
import local from "@/utils/local";
71
import {
71
import {
72
  getStudentInfo, //获取学生信息列表
72
  getStudentInfo, //获取学生信息列表
73
  getStudentToken,
73
} from "@/api/home";
74
} from "@/api/home";
74
export default {
75
export default {
75
    components: {
76
    components: {
92
        }
93
        }
93
    },
94
    },
94
    created() {
95
    created() {
95
        this.dialog = !local.get("id");
96
        this.form.id = local.get("id");
97
        if(this.$route.query.selected_index) {
96
        if(this.$route.query.selected_index) {
98
            this.selected_index = this.$route.query.selected_index;
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
    methods: {
103
    methods: {
103
        // 获取考生个人资料
104
        // 获取考生个人资料
115
                this.studentData = data.res.student;
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
        onChange(index) {
138
        onChange(index) {
119
            this.selected_index = index;
139
            this.selected_index = index;
120
        },
140
        },
121
        change() {
141
        change() {
122
            this.selected_index = 1;
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
</script>
154
</script>