Commit 1723ce0bc97b6ce7465112bd34e7c48af26eb057

Authored by 夏洋涛
1 parent 274c5d5e
Exists in master

feat:浙学码初步搭建,等待appid

src/assets/code.png 0 → 100644

3.51 KB

src/router/index.js
... ... @@ -439,6 +439,16 @@ const routes = [
439 439 title: '撰写意见',
440 440 }
441 441 },
  442 + {
  443 + path: '/ZXCode',
  444 + name: 'ZXCode',
  445 + component: () =>
  446 + import('@/views/Home/ZXCode.vue'),
  447 + meta: {
  448 + title: '浙学码'
  449 +
  450 + }
  451 + },
442 452 ]
443 453  
444 454 const router = new VueRouter({
... ...
src/views/Home/ZXCode.vue 0 → 100644
... ... @@ -0,0 +1,75 @@
  1 +// 浙学码页面
  2 +<template>
  3 + <div class="zx_code">
  4 + <iframe class="zx_iframe" v-if="iframeUrl" :src="iframeUrl" frameborder="0"></iframe>
  5 + </div>
  6 +</template>
  7 +<script>
  8 +export default {
  9 + data() {
  10 + return {
  11 + StudentDetialInfo: {},
  12 + iframeUrl: '',
  13 + }
  14 + },
  15 + mounted() {
  16 + this.setIframe()
  17 + window.addEventListener('message', (e) => {
  18 + if (e.data.type && e.data.type === 'zhexuema') {
  19 + console.log(e.data.data.cubeUserId)
  20 + this.bindLearnCode(e.data.data.cubeUserId)
  21 + }
  22 + })
  23 + },
  24 + destroyed() {
  25 + window.removeEventListener('message', (e) => {
  26 + if (e.data.type && e.data.type === 'zhexuema') {
  27 + console.log(e.data.data.cubeUserId)
  28 + this.bindLearnCode(e.data.data.cubeUserId)
  29 + }
  30 + })
  31 + },
  32 + methods: {
  33 + setIframe() {
  34 + let StudentDetialInfo = localStorage.getItem('StudentDetialInfo')
  35 + if (!StudentDetialInfo) {
  36 + this.$toast('未获取到用户信息,请退出重试')
  37 + } else {
  38 + StudentDetialInfo = JSON.parse(StudentDetialInfo)
  39 + this.StudentDetialInfo = StudentDetialInfo
  40 + let appId = ''
  41 + if (StudentDetialInfo.cubeUserId) {
  42 + this.iframeUrl = `https://zcode-images.zjedu.com:9060/QRCode/index.html?appId=${appId}&areaCode=330600&simple=true&cubeUserId=${StudentDetialInfo.cubeUserId}`
  43 + } else {
  44 + this.iframeUrl = `https://zcode-images.zjedu.com:9060/QRCode/index.html?appId=${appId}&areaCode=330600&simple=true&mobile=${StudentDetialInfo.travelerMobile}&nickName=${StudentDetialInfo.travelerName}&cardNo=${StudentDetialInfo.travelerIdCard}`
  45 + }
  46 + }
  47 + },
  48 + // 绑定浙学码
  49 + bindLearnCode(cubeUserId) {
  50 + this.yxAxios
  51 + .get(`${this.proxyUrl}/user/info/bindLearnCode?travelerId=${this.StudentDetialInfo.id}&cubeUserld=${cubeUserId}`)
  52 + .then((res) => {
  53 + let data = res.data
  54 + if (data.code == 1) {
  55 + // this.datalist = data.data.list
  56 + } else {
  57 + this.$toast.fail(data.message)
  58 + }
  59 + })
  60 + },
  61 + },
  62 +}
  63 +</script>
  64 +<style lang="scss" scoped>
  65 +.zx_code {
  66 + width: 100%;
  67 + height: 100%;
  68 + box-sizing: border-box;
  69 + padding: 100px 50px;
  70 +}
  71 +.zx_iframe {
  72 + width: 100%;
  73 + height: 100%;
  74 +}
  75 +</style>
... ...
src/views/Home/component/HomeChildList.vue
... ... @@ -6,6 +6,7 @@
6 6 <button v-if="item.whiteFlag!=1||item.isBing!=1" @click.stop="Certification(index)">激活认证</button>
7 7 </div>
8 8 <img v-if="item.whiteFlag==1&&item.isBing==1" class="img_auth" src="@/assets/home/auth.png" alt="">
  9 + <img class="code" :class="item.whiteFlag==1&&item.isBing==1?'code_auth':''" @click.stop="handleCode(index)" src="@/assets/code.png" alt="">
9 10 <div class="item">
10 11 <van-icon name="manager" /><span>{{item.travelerName}}</span>
11 12 </div>
... ... @@ -53,6 +54,13 @@ export default {
53 54 this.travelerNum = this.childList[index].travelerNum
54 55 this.showAddChildPopupGroup = true
55 56 },
  57 + // 点击浙学码
  58 + handleCode (index) {
  59 +
  60 + localStorage.setItem('StudentDetialInfo', JSON.stringify(this.childList[index]))
  61 +
  62 + this.$router.push({ name: 'ZXCode' })
  63 + },
56 64 // 进入学生详情页
57 65 handleStudentDetail (index) {
58 66 localStorage.setItem('StudentDetialInfo', JSON.stringify(this.childList[index]))
... ... @@ -75,7 +83,7 @@ export default {
75 83 if (userInfo.schoolNames || userInfo.schoolNames == [] || userInfo.schoolNames == 'null') {
76 84 localStorage.setItem('schoolNames', JSON.stringify(userInfo.schoolNames))
77 85 this.$store.commit('changeSchool', userInfo.schoolNames)
78   - console.log('555',userInfo.schoolNames)
  86 + // console.log('555',userInfo.schoolNames)
79 87 if (!localStorage.getItem('schoolNamesChoose')) {
80 88 localStorage.setItem('schoolNamesChoose', JSON.stringify(userInfo.schoolNames[0]))
81 89 }
... ... @@ -153,6 +161,15 @@ p {
153 161 right: 0;
154 162 width: 196px;
155 163 }
  164 + .code{
  165 + position: absolute;
  166 + bottom: 50px;
  167 + right: 45px;
  168 + width: 72px;
  169 + }
  170 + .code_auth{
  171 + right: 240px;
  172 + }
156 173 .item {
157 174 display: inline-block;
158 175 margin-bottom: 24px;
... ...