YanxueInfo.vue
2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
<div>
<van-field v-model="school" label="学校" readonly placeholder="学校" />
<van-field v-model="name" label="学生姓名" readonly placeholder="姓名" />
<van-field v-model="userNum" label="用户编号" readonly placeholder="用户编号" />
<van-field v-model="codeNum" label="研学码" readonly placeholder="研学码">
<van-button slot="button" size="small" native-type="button" @click="saoYiSao">扫一扫</van-button>
</van-field>
<van-button type="primary" block @click="getbind">提交</van-button>
</div>
</template>
<script>
export default {
data () {
return {
codeNum: '',
userNum: '',
school: '',
name: ''
}
},
created () {
let studentInfo = JSON.parse(localStorage.getItem('StudentDetialInfo'));
this.userNum = studentInfo.travelerNum
this.school = studentInfo.schoolName
this.name = studentInfo.travelerName
this.codeNum = this.GetQueryString('qrresult') || studentInfo.studyCode;
},
methods: {
getbind () {
if (this.userNum == '' || this.codeNum == '') {
this.$toast('请先填写完整信息!');
return ;
}
this.mgop({
api: 'mgop.sz.hswsy.bingStudyCode', // 必须
host: 'https://mapi.zjzwfw.gov.cn/',
dataType: 'JSON',
type: 'GET',
appKey: 'fuxgnukl+2001895516+edccpx', // 必须
headers: {
// 'isTestUrl': '1'
},
data: {
"userNum": this.userNum,
"code": this.codeNum,
},
onSuccess: res => {
if (res.data.code == '200') {
this.$toast('操作成功');
this.$router.push({ name: 'YanxueCode' })
} else {
this.$toast('操作失败:' + res.data.message);
}
},
onFail: err => {
console.log('err', err)
}
});
},
//扫一扫
saoYiSao () {
window.location.href = 'http://sao315.com/w/api/saoyisao?redirect_uri=https://payment.myjxt.com/center/%23/YanxueInfo';
},
// 获取链接参数
GetQueryString (name) {
var reg = new RegExp("\\b" + name + "=([^&]*)");
var r = location.href.match(reg);
if (r != null) return decodeURIComponent(r[1]);
}
}
}
</script>
<style>
</style>