web.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view>
  3. <web-view src="http://45.113.110.66/privacy/index.html"/>
  4. </view>
  5. </template>
  6. <script>
  7. import _hook from '../../common/_hook';
  8. export default {
  9. components: {
  10. },
  11. data() {
  12. return {
  13. url: 'http://45.113.110.66/privacy/index.html',
  14. agent_user_id:0
  15. }
  16. },
  17. onShow(){
  18. },
  19. onReady() {
  20. setTimeout(function () {
  21. uni.hideLoading();
  22. },1000)
  23. },
  24. onLoad(option) {
  25. uni.showLoading({
  26. title:null,
  27. })
  28. if('url' in option){
  29. option.url = decodeURIComponent(option.url);
  30. if(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$/.test(option.url)){
  31. if(!/^http/.test(option.url)){
  32. option.url = 'http://' + option.url;
  33. }
  34. this.url = option.url;
  35. }
  36. }
  37. // if('title' in option){
  38. // uni.setNavigationBarTitle({
  39. // title: option.title,
  40. // });
  41. // }
  42. if('agent_user_id' in option){
  43. this.agent_user_id = option.agent_user_id;
  44. }
  45. },
  46. computed: {
  47. },
  48. methods: {
  49. },
  50. onNavigationBarButtonTap(e) {
  51. console.log(e.index)
  52. // #ifdef APP-PLUS
  53. let currentWebview = this.$mp.page.$getAppWebview().children()[0]; //获取当前页面的webview对象
  54. // #endif
  55. switch (e.index){
  56. case 0:
  57. //跳转客服
  58. //pages/details/index?user_id=271&is_type=0
  59. if(!this.agent_user_id) uni.showToast({title: '改商户暂未设置客服',icon:'none'});
  60. uni.navigateTo({
  61. url: '/pages/details/index?is_type=0&user_id='+this.agent_user_id
  62. });
  63. break;
  64. case 1:
  65. // #ifdef APP-PLUS
  66. currentWebview.reload();
  67. // #endif
  68. // #ifdef H5
  69. location.reload();
  70. // #endif
  71. break;
  72. case 2:
  73. uni.switchTab({
  74. url: '../push/game',
  75. });
  76. break;
  77. case 3:
  78. uni.navigateBack();
  79. break;
  80. default:
  81. break;
  82. }
  83. },
  84. }
  85. </script>
  86. <style>
  87. </style>