h5.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.nxjiewei.com:8011',
  44. 'n.oa_system.nxjiewei.com:8011')
  45. let url = escape(link_neiwang)
  46. this.href = "http://n.oa_system.nxjiewei.com:8011/oa_login/index_neiwang.html?staff_num=" + uni
  47. .getStorageSync('user')
  48. .staff_num + "&url=" + url + "&title=" + title
  49. } else {
  50. let url = escape(data.url)
  51. this.href = "http://oa_system.nxjiewei.com:8011/oa_login?staff_num=" + uni.getStorageSync(
  52. 'user')
  53. .staff_num + "&url=" + url + "&title=" + title
  54. }
  55. })
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. </style>