webviewPage.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view>
  3. <web-view :webview-styles="webviewStyles" :src="url"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. url: "",
  11. webviewStyles: {
  12. progress: {
  13. color: '#F07423'
  14. }
  15. },
  16. type: "",
  17. };
  18. },
  19. onLoad(param) {
  20. this.type = param.type;
  21. let title = ""
  22. if (this.type == 1) {
  23. title = "用户使用协议"
  24. } else if (this.type == 2) {
  25. title = "隐私协议"
  26. } else if (this.type == 3) {
  27. title = "入驻协议"
  28. }
  29. uni.setNavigationBarTitle({
  30. title: title
  31. })
  32. this.webviewStyles.progress.color = getApp().globalData.color1;
  33. this.queryProtocolConfigView();
  34. },
  35. methods: {
  36. async queryProtocolConfigView() {
  37. let res = await this.$myRequest({
  38. url: "/project/queryProtocolConfigView",
  39. data: {},
  40. })
  41. if (res.data.success) {
  42. if (this.type == '1') { //使用协议
  43. this.url = "/hybrid/html/web/viewer.html?file="+res.data.single.userUseProtocol;
  44. } else if (this.type == '2') { //隐私协议
  45. this.url = "/hybrid/html/web/viewer.html?file="+res.data.single.userPrivacyProtocol;
  46. } else if (this.type == '3') { //业主注册协议
  47. this.url = "/hybrid/html/web/viewer.html?file="+res.data.single.ownerRegistProtocol;
  48. }
  49. }
  50. },
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. </style>