h5.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view>
  3. <web-view :src="href"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. href: ""
  11. };
  12. },
  13. onLoad(option) {
  14. // 获取位置
  15. uni.getLocation({
  16. type: 'gcj02',
  17. geocode: true,
  18. success: (res) => {
  19. console.log(res.address)
  20. // console.log('当前位置的经度:' + res.longitude);
  21. // console.log('当前位置的纬度:' + res.latitude);
  22. this.$api.workflow_save_location({
  23. staff_num: uni.getStorageSync('user').staff_num,
  24. location: JSON.stringify(res)
  25. }).then((res) => {
  26. console.log(res.data)
  27. })
  28. }
  29. });
  30. // #ifndef APP-NVUE
  31. const eventChannel = this.getOpenerEventChannel();
  32. // #endif
  33. // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
  34. eventChannel.on('acceptDataFromOpenerPage', (data) => {
  35. // console.log(data)
  36. uni.setNavigationBarTitle({
  37. title: data.title
  38. })
  39. let mine_code = uni.getStorageSync('mine_code')
  40. let title = escape(data.title)
  41. if (mine_code.indexOf('_neiwang') != -1) {
  42. // 内网
  43. let link_neiwang = data.url.replace('oa_system.nxmy.com:8011',
  44. 'oa_system.nxmy.com:8011')
  45. let url = escape(link_neiwang)
  46. this.href = "http://oa_system.nxmy.com:8011/oa_login/index_neiwang.html?staff_num=" + uni
  47. .getStorageSync('user')
  48. .staff_num + "&url=" + url + "&title=" + title
  49. } else if (mine_code == "zaoquan") {
  50. let url = escape(data.url)
  51. this.href = "http://zq.oa.nxmy.com:8011/zq_oa_login?staff_num=" + uni.getStorageSync('user').staff_num + "&url=" + url + "&title=" + title
  52. } else {
  53. let url = escape(data.url)
  54. this.href = "http://oa_system.nxmy.com:8011/oa_login?staff_num=" + uni.getStorageSync(
  55. 'user')
  56. .staff_num + "&url=" + url + "&title=" + title
  57. }
  58. })
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. </style>