| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <template>
- <view>
- <!-- 签约页面 -->
- </view>
- </template>
- <script>
- // md5加密文件
- import md5 from '@/js_sdk/js-md5/src/md5.js';
- // base64加密文件
- import {
- Base64
- } from '@/js_sdk/js-base64/base64.js';
- export default {
- data() {
- return {
- newTime: ""
- }
- },
- onLoad() {
- this.getIdCard()
- },
- methods: {
- // 获取用户身份证
- getIdCard() {
- let idCard = sessionStorage.getItem("idCard")
- if (!idCard) {
- let idCard = this.getQueryString("idCard");
- if (!idCard) {
- window.location.href =
- `https://open.wecard.qq.com/connect/oauth/authorize?app_key=EE28EE2C93296F4E&response_type=code&scope=snsapi_base&ocode=1015730314&redirect_uri=https://jtishfw.ncjti.edu.cn/baoxiu/repairApi/wx/weixiao/auth&state=https://jtishfw.ncjti.edu.cn/baoxiu/repairApi/wx/weixiao/auth`;
- } else {
- sessionStorage.setItem("idCard", idCard)
- this.getName()
- }
- } else {
- this.getName()
- }
- },
- // 获取用户姓名
- getName() {
- let name = sessionStorage.getItem("name")
- if (!name) {
- let name = this.getQueryString("name");
- if (!name) {
- window.location.href =
- `https://open.wecard.qq.com/connect/oauth/authorize?app_key=EE28EE2C93296F4E&response_type=code&scope=snsapi_base&ocode=1015730314&redirect_uri=https://jtishfw.ncjti.edu.cn/baoxiu/repairApi/wx/weixiao/auth&state=https://jtishfw.ncjti.edu.cn/baoxiu/repairApi/wx/weixiao/auth`;
- } else {
- sessionStorage.setItem("name", name)
- this.getUrl()
- }
- } else {
- this.getUrl()
- }
- },
- // 获取跳转地址
- getUrl() {
- // md5加密 处理token参数
- this.getTime()
- let token = md5(md5("JANCJTISCHOOLSIGNING" + this.newTime))
- // base64加密 处理data参数
- let student_id = sessionStorage.getItem("idCard")
- let student_name = sessionStorage.getItem("name")
- let id_number = sessionStorage.getItem("idCard")
- // 收集参数
- let data = {
- student_id,
- student_name,
- id_number
- }
- // 把参数转换成JSON格式
- data = JSON.stringify(data)
- // 加密处理
- data = Base64.encode(encodeURIComponent(data))
- // // 获取授权签约地址
- let newUrl = `https://sa.jxnxs.com/SchoolAgreement/index?token=${token}&data=${data}`
- // // 跳转授权签约地址
- window.location.href = newUrl
- },
- // 获取当前时间
- getTime() {
- // 获取当前时间戳
- var date = new Date()
- // 获取年份
- var year = date.getFullYear()
- // 获取月份并补0
- var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
- // 获取日期并补0
- var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
- // 获取小时并补0
- var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
- // 拼接后赋值
- this.newTime = String(year) + String(month) + String(day) + String(hours) + "00" + "00"
- },
- //获取当前URL指定参数
- getQueryString(name) {
- // 获取URL
- let url = window.location.href;
- // 正则匹配URL
- let pattern = new RegExp("[?&]" + name + "=([^&]+)", "i");
- let matcher = pattern.exec(url);
- if (matcher == null || matcher.length < 1) {
- return false;
- }
- // 输出指定的参数值中文也可以
- return decodeURIComponent(matcher[1]);
- },
- }
- }
- </script>
- <style>
- </style>
|