h5.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view >
  3. <!-- <web-view :src="webUrl"></web-view> -->
  4. <view v-html="text"></view>
  5. </view>
  6. </template>
  7. <script>
  8. import {getConfigByKey} from '@/api/index.js'
  9. export default {
  10. data() {
  11. return {
  12. webUrl:"",
  13. vaule:'',
  14. text:''
  15. }
  16. },
  17. onLoad(val) {
  18. this.webUrl=uni.getStorageSync('url');
  19. console.log(val)
  20. this.vaule=val.data
  21. this.getConfigByKeys()
  22. },
  23. methods:{
  24. getConfigByKeys(){
  25. const data={
  26. key:"his.agreementConfig",
  27. appId:wx.getAccountInfoSync().miniProgram.appId,
  28. }
  29. getConfigByKey(data).then(res=>{
  30. if(res.code==200){
  31. if(this.vaule=='userRegister'){
  32. this.text=JSON.parse(res.data).userRegister
  33. }else{
  34. this.text=JSON.parse(res.data).userPrivacy
  35. }
  36. console.log(JSON.parse(res.data))
  37. }else{
  38. if (res.msg.length >14) {
  39. uni.showModal({
  40. title: '提示',
  41. content: res.msg,
  42. showCancel: false,
  43. confirmText: '我知道了'
  44. })
  45. } else {
  46. uni.showToast({
  47. title: res.msg,
  48. icon: 'none'
  49. })
  50. }
  51. }
  52. })
  53. }
  54. }
  55. }
  56. </script>
  57. <style scoped lang="scss">
  58. page{
  59. height: 100%;
  60. }
  61. .content{
  62. width: 100%;
  63. height: 100%;
  64. display: flex;
  65. align-items: center;
  66. justify-content: center;
  67. }
  68. </style>