123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- function setCookie(name, value, day, path, domain) {
- day = day || 30;
- path = path || '/';
- var str = name + '=' + value + '; ';
- if (day) str += 'expires=' + new Date(Date.now() + day * 24 * 3600 * 1000).toGMTString() + '; ';
- if (path) str += 'path=' + path + '; ';
- if (domain) str += 'domain=' + domain;
- document.cookie = str;
- }
- new Vue({
- el:'#transfer',
- data() {
- return {
- }
- },
- methods:{
- },
- mounted() {
- let zlb_token = '';
- if (location.search.includes('zlb_token')) {
- zlb_token = location.search.substring(11);
- const requestURL = 'https://tyyxopenapi.txhlwxx.com/openapi/oauth/zlb/checkticket.php';
- $.ajax({
- url: requestURL,
- async: false,
- type: "POST",
- timeout: 30000,
- dataType: 'json',
- data: {
- type: 'login',
- zlb_token: zlb_token,
- client:'h5'
- },
- success: (res) => {
- if (res.code === '1') {
- localStorage.setItem('userInfo', JSON.stringify(res.data));
- setCookie('token', res.data.token, 30, '/');
- setTimeout(() => {
- location.href = './index.html';
- }, 500)
- } else if(res.code === '501'){
- this.$message({
- message:res.msg,
- type: 'warning',
- showClose: true,
- duration: '1500',
- onClose:()=>{
- localStorage.setItem('userInfo', JSON.stringify(res.data));
- setCookie('token', res.data.token, 30, '/');
- setTimeout(() => {
- location.href = './index.html';
- }, 500)
- },
- });
- } else {
- this.$message({
- message: res.msg,
- type: 'error',
- showClose: true,
- duration: '1500'
- });
- }
- }
- });
- }
- }
- });
|