app.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. var app = new Vue({
  2. el: '#app',
  3. data() {
  4. return {
  5. screenH: 0,
  6. phone: '',
  7. status: false,
  8. memberInfo: {}
  9. }
  10. },
  11. filters: {
  12. showCradNum(str) {
  13. if (!str) {
  14. return ''
  15. }
  16. let arr = str.split('')
  17. if (arr.length === 18) {
  18. arr.splice(6, 8, 'xxxx')
  19. return arr.join('')
  20. } else if (arr.length === 15) {
  21. arr.splice(6, 6, 'xxxx')
  22. return arr.join('')
  23. } else {
  24. return str
  25. }
  26. },
  27. },
  28. mounted() {
  29. this.getScreenH()
  30. },
  31. methods:{
  32. getScreenH() {
  33. this.screenH = document.body.clientHeight
  34. },
  35. toSearch() {
  36. if(!this.phone) {
  37. alert('请输入要查询的手机号')
  38. return false
  39. }
  40. axios.get("http://api.app.jiuweiyun.cn/api/user/auth_sel", {
  41. params: {
  42. phone: this.phone
  43. }
  44. }).then(res => {
  45. if(res.code === 200) {
  46. const { status } = res.data;
  47. if (status !== 3) {
  48. this.status = true
  49. this.memberInfo = res.data
  50. } else {
  51. alert(res.msg || '手机号未授权')
  52. }
  53. } else {
  54. alert('查询失败')
  55. }
  56. }).catch(() => {
  57. alert('服务器发生错误,查询失败')
  58. })
  59. },
  60. toSeeAuth() {
  61. axios.get("http://api.app.jiuweiyun.cn/api/user/auth_show", {
  62. params: {
  63. phone: this.phone
  64. }
  65. }).then(res => {
  66. if(res.code === 200){
  67. const { url } = res.data
  68. window.open(url, '_target')
  69. } else {
  70. alert(res.msg || '查看授权书失败')
  71. }
  72. }).catch(() => {
  73. alert('服务器发生错误,查看授权书失败')
  74. })
  75. }
  76. }
  77. })