index.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import * as api from '@/api'
  2. import Storage from '@/utils/storage'
  3. const lStorage = new Storage('localStorage')
  4. export default {
  5. data() {
  6. return {
  7. TITLE: '问卷调查结果',
  8. data: {
  9. result: []
  10. },
  11. loading: {
  12. submit: false
  13. }
  14. };
  15. },
  16. created() {
  17. this.inData()
  18. },
  19. computed: {
  20. putIsAbnormal () {
  21. try {
  22. return this.data.result.some(item => item.type === 'radio' && item.val === '是')
  23. } catch (err) {
  24. }
  25. }
  26. },
  27. methods: {
  28. vueWatchRoute () {
  29. this.inData()
  30. },
  31. async inData() {
  32. this.loading.data = true
  33. try {
  34. // let { result_id } = this.$route.query
  35. // let res = await api.apiGetVolumeResult({ result_id })
  36. // let data = res.data
  37. let data = lStorage.getItem('FormResultAbnormal')
  38. this.$set(this, 'data', data)
  39. } catch (error) {
  40. console.log(error)
  41. }
  42. this.loading.data = false
  43. },
  44. btnLinkBack() {
  45. var ua = navigator.userAgent.toLowerCase();
  46. let { go, replace, to } = this.$route.query
  47. if (replace) {
  48. location.replace(decodeURIComponent(replace))
  49. } else if (to) {
  50. location.href = decodeURIComponent(to)
  51. } else if (go) {
  52. this.$router.go(go)
  53. }
  54. else if (ua.match(/MicroMessenger/i) == "micromessenger") {
  55. //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
  56. wx.miniProgram.getEnv((res) => {
  57. if (res.miniprogram) {
  58. // 在小程序里
  59. console.log('miniprogram')
  60. wx.miniProgram.switchTab({ url: '/pages/index/index' })
  61. }
  62. })
  63. } else {
  64. this.$router.go(-1)
  65. }
  66. }
  67. }
  68. }