<template>
  <u-navbar :titleStyle="{ color: '#fff' }" :autoBack="true" :title="params?.title" :placeholder="true" :safeAreaInsetTop="true" :bgColor="proxy.$settingStore.themeColor.color">
    <template #left>
      <view class="u-navbar__content__left__item">
        <u-icon name="arrow-left" size="20" color="#fff"></u-icon>
      </view>
    </template>
    <template #center>
      <view class="u-navbar__content__left__item" style="color:#fff">{{ state.title }}</view>
    </template>
  </u-navbar>
  <view v-if="params.url">
    <web-view :webview-styles="webviewStyles" :src="`${params.url}`" allow></web-view>
  </view>
</template>

<script setup>
/*----------------------------------依赖引入-----------------------------------*/
import { onReady, onLoad, onShow, onNavigationBarButtonTap } from "@dcloudio/uni-app";
import { ref, onMounted, inject, shallowRef, reactive, getCurrentInstance, toRefs } from "vue";
/*----------------------------------接口引入-----------------------------------*/
/*----------------------------------组件引入-----------------------------------*/
/*----------------------------------store引入-----------------------------------*/
import { useStores, commonStores } from "@/store/modules/index";
/*----------------------------------公共方法引入-----------------------------------*/
/*----------------------------------公共变量-----------------------------------*/
const { proxy } = getCurrentInstance();
const useStore = useStores();
/*----------------------------------变量声明-----------------------------------*/
const props = defineProps({
  // 数据
  src: {
    type: [String],
    default: null,
  },
});

const state = reactive({
  params: {},
  webviewStyles: {
    progress: {
      color: "#FF3333",
    },
  },
  // title:undefined
});

const { params, webviewStyles } = toRefs(state);

onLoad((event) => {
  params.value = event;
  console.log(params._object.params.url)
  if(params._object.params.url.indexOf('login?token=') > 0){
    var name = '智慧办公系统（U8）'
    wx.setNavigationBarTitle({
      title: name
    });
  }
  state.title = name;
});

onShow(() => {
  //调用系统主题颜色
  proxy.$settingStore.systemThemeColor([1]);
});
</script>
