var app = new Vue({ el: '#app', data() { return { screenH: 0, phone: '', status: false, memberInfo: {} } }, filters: { showCradNum(str) { if (!str) { return '' } let arr = str.split('') if (arr.length === 18) { arr.splice(6, 8, 'xxxx') return arr.join('') } else if (arr.length === 15) { arr.splice(6, 6, 'xxxx') return arr.join('') } else { return str } }, }, mounted() { this.getScreenH() }, methods:{ getScreenH() { this.screenH = document.body.clientHeight }, toSearch() { if(!this.phone) { alert('请输入要查询的手机号') return false } axios.get("http://api.app.jiuweiyun.cn/api/user/auth_sel", { params: { phone: this.phone } }).then(res => { if(res.code === 200) { const { status } = res.data; if (status !== 3) { this.status = true this.memberInfo = res.data } else { alert(res.msg || '手机号未授权') } } else { alert('查询失败') } }).catch(() => { alert('服务器发生错误,查询失败') }) }, toSeeAuth() { axios.get("http://api.app.jiuweiyun.cn/api/user/auth_show", { params: { phone: this.phone } }).then(res => { if(res.code === 200){ const { url } = res.data window.open(url, '_target') } else { alert(res.msg || '查看授权书失败') } }).catch(() => { alert('服务器发生错误,查看授权书失败') }) } } })