common.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. export const goToLink = (item, mine_code) => {
  2. let link = item.link
  3. console.log(link)
  4. // OA系统
  5. if (link.indexOf("oa_system.nxjiewei.com") != -1) {
  6. uni.navigateTo({
  7. url: "../../origanization/OA/h5/h5",
  8. success: (res) => {
  9. // 通过eventChannel向被打开页面传送数据
  10. res.eventChannel.emit('acceptDataFromOpenerPage', {
  11. url: link,
  12. title: item.title
  13. })
  14. }
  15. })
  16. return
  17. }
  18. // 二维码
  19. if (link.indexOf("pageId") != -1 && link.indexOf("app:") == -1) {
  20. let pageId = ""
  21. function GetQueryString(name) {
  22. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  23. var r = link.match(reg);
  24. if (r != null) return unescape(r[2]);
  25. return null;
  26. }
  27. console.log(GetQueryString("pageId"))
  28. if (GetQueryString("pageId")) {
  29. pageId = GetQueryString("pageId")
  30. } else {
  31. pageId = link.split('=')[1]
  32. }
  33. uni.navigateTo({
  34. url: "../../index/record/record?pageId=" + pageId + "&mine_code=" + mine_code,
  35. })
  36. }
  37. // h5
  38. if (link.indexOf("pageId") == -1 && link.indexOf("app:") == -1) {
  39. console.log("H5")
  40. // #ifdef APP
  41. if (plus.os.name == 'Android') {
  42. if (link.indexOf("cmb.pb") != -1) {
  43. plus.runtime.launchApplication({
  44. pname: 'cmb.pb'
  45. }, (e) => {
  46. console.log('Open system default browser failed: ' + e.message)
  47. uni.showToast({
  48. icon: "none",
  49. title: "未安装此应用"
  50. })
  51. })
  52. } else if (link.indexOf("com.icbc") != -1) {
  53. plus.runtime.launchApplication({
  54. pname: 'com.icbc'
  55. }, (e) => {
  56. console.log('Open system default browser failed: ' + e.message)
  57. uni.showToast({
  58. icon: "none",
  59. title: "未安装此应用"
  60. })
  61. })
  62. } else if (link.indexOf("webdevelop.nxjiewei.com/assets/html/pingce") != -1) {
  63. uni.navigateTo({
  64. url: "../../index/h5/h5?url=jinjiaqu_pingce"
  65. })
  66. } else if (link.indexOf("/yinhuanpaicha/yinhuaninfo") != -1) {
  67. uni.navigateTo({
  68. url: "../../index/h5/h5?url=" + link
  69. })
  70. } else {
  71. uni.navigateTo({
  72. url: "../../index/h5/h5?url=" + link
  73. })
  74. }
  75. }
  76. // #endif
  77. // #ifdef H5
  78. if (link.indexOf("webdevelop.nxjiewei.com/assets/html/pingce") != -1) {
  79. uni.navigateTo({
  80. url: "../../index/h5/h5?url=jinjiaqu_pingce"
  81. })
  82. } else if (link.indexOf("/yinhuanpaicha/yinhuaninfo") != -1) {
  83. uni.navigateTo({
  84. url: "../../index/h5/h5?url=" + link
  85. })
  86. } else {
  87. uni.navigateTo({
  88. url: "../../index/h5/h5?url=" + link
  89. })
  90. }
  91. // #endif
  92. }
  93. // 原生
  94. if (link.indexOf("pageId") == -1 && link.indexOf("app:") != -1) {
  95. console.log("原生")
  96. if (link.indexOf("/browseQrcode/gridSubmitItem_win") != -1) {
  97. console.log("网格排查")
  98. uni.navigateTo({
  99. url: "../../workbench/gridding/gridding"
  100. })
  101. } else if (link.indexOf("/wordorder/wordOrderGrid_win") != -1) {
  102. console.log(link)
  103. uni.navigateTo({
  104. url: "../../index/business_approval/business_approval"
  105. })
  106. }
  107. } else {
  108. console.log(link)
  109. }
  110. }