web - 副本.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <!--pages/web/web.wxml-->
  3. <view>
  4. <web-view :src="webUrl" v-if="webUrl!==''"></web-view>
  5. </view>
  6. </template>
  7. <script>
  8. // pages/web/web.js
  9. const req = require("../../utils/request");
  10. const app = getApp();
  11. export default {
  12. data() {
  13. return {
  14. webUrl: '',
  15. back: false,
  16. };
  17. },
  18. components: {},
  19. props: {},
  20. onLoad: function(options) {
  21. this.query = options;
  22. let that = this;
  23. let token = req.getStorage('AUTH_TOKEN');
  24. let webUrl = req.public.storemanagers + req.header.appId + '&token=' + token;
  25. console.log('地址>>>>>',webUrl)
  26. if (!req.getStorage('userInfo')) {
  27. // console.log("111111111111111");
  28. app.globalData.openPage('pages/authorize/authorize');
  29. } else {
  30. if (this.query.scene) {
  31. let form = {
  32. scene: this.query.scene
  33. };
  34. req.getRequest('/api/code/params', form, data => {
  35. // console.log(
  36. // "====================================================================================" +
  37. // data.scene);
  38. webUrl += '&orderId=' + data.scene;
  39. this.setData({
  40. webUrl: webUrl
  41. });
  42. // console.log(webUrl, "+++++++++++");
  43. });
  44. } else {
  45. that.setData({
  46. webUrl: webUrl
  47. });
  48. // console.log(webUrl);
  49. }
  50. }
  51. },
  52. onShow() {
  53. if (this.back) {
  54. uni.navigateBack();
  55. }
  56. },
  57. methods: {}
  58. };
  59. </script>
  60. <style>
  61. @import "./web.css";
  62. </style>