| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8" />
- <meta
- name="viewport"
- content="width=device-width, initial-scale=1.0, user-scalable=no"
- />
- <title></title>
- <script src="/js/mp_base/base.js"></script>
- <style>
- #app {
- background: #f5f5f5;
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- }
- </style>
- </head>
- <body>
- <div id="app" v-cloak>
- <!-- 使用 ss-sub-tab 组件 -->
- <ss-sub-tab
- v-if="tabList.length > 0"
- :tab-list="tabList"
- :base-params="baseParams"
- @tab-change="handleTabChange"
- />
- </div>
- <script>
- // 等待SS框架加载完成
- window.SS.ready(function () {
- // 使用SS框架的方式创建Vue实例
- window.SS.dom.initializeFormApp({
- el: "#app",
- data() {
- return {
- pageParams: {},
- loading: false,
- tabList: [], // tabTag接口返回的Tab列表
- baseParams: {}, // 基础参数(传递给子页面)
- };
- },
- mounted() {
- // 获取URL参数
- this.pageParams = this.getUrlParams();
- console.log("🔗 mp_objInfo页面接收到参数:", this.pageParams);
- const infoService =
- this.pageParams.service || this.pageParams.ssServ || "";
- const infoDest =
- this.pageParams.dest || this.pageParams.ssDest || "";
- const infoParam = this.pageParams.param || "";
- // 设置基础参数(会传递给所有子页面)
- this.baseParams = {
- ssObjName:
- this.pageParams.ssObjName || this.pageParams.ssobjname || "",
- ssObjId: this.pageParams.ssObjId || this.pageParams.ssobjid || "",
- sqid: this.pageParams.sqid || "",
- shid: this.pageParams.shid || "",
- shyjm: this.pageParams.shyjm || "",
- bdlbm: this.pageParams.bdlbm || "",
- dataType:
- this.pageParams.dataType ||
- this.pageParams.datatype ||
- "bdplay",
- encode_shid: this.pageParams.encode_shid || "",
- jdmc: this.pageParams.jdmc || "",
- ssToken: this.pageParams.ssToken || "",
- service: infoService,
- dest: infoDest,
- param: infoParam,
- ssServ: infoService,
- ssDest: infoDest,
- };
- console.log("📦 mp_objInfo透传基础参数:", this.baseParams);
- // 联调模式:不校验入参,始终尝试调用tabTag
- this.loadTag();
- },
- methods: {
- // 获取URL参数
- getUrlParams() {
- const params = {};
- const urlSearchParams = new URLSearchParams(
- window.location.search
- );
- for (const [key, value] of urlSearchParams) {
- params[key] = decodeURIComponent(value);
- }
- return params;
- },
- // 加载Tab列表
- async loadTag() {
- this.loading = true;
- try {
- console.log("📋 调用tabTag服务获取Tab列表...");
- const { ssObjName, ssObjId, sqid, shid, service, dest, param } =
- this.baseParams;
- const tagQuery = new URLSearchParams({
- ssServ: "tabTag",
- ssDest: "data",
- name: "baseInfo,child",
- ssObjName: ssObjName || "",
- ssObjId: ssObjId || "",
- sqid: sqid || "",
- shid: shid || "",
- service: service || "",
- dest: dest || "",
- param: param || "",
- });
- const tagUrl = `/service?${tagQuery.toString()}`;
- console.log("📋 tabTag请求URL:", tagUrl);
- const tagResponse = await request.post(
- tagUrl,
- {},
- { loading: false, formData: true }
- );
- console.log("📋 tabTag响应:", tagResponse);
- // 保存Tab列表
- if (
- tagResponse &&
- tagResponse.data &&
- tagResponse.data.tabList
- ) {
- this.tabList = tagResponse.data.tabList;
- console.log("✅ 获取到Tab列表:", this.tabList);
- } else {
- console.warn("⚠️ tabTag响应中没有tabList字段", {
- service,
- dest,
- param,
- tagResponse,
- });
- }
- } catch (error) {
- console.error("❌ 加载Tab数据失败:", error);
- } finally {
- this.loading = false;
- }
- },
- // Tab切换事件处理
- handleTabChange({ index, tab }) {
- console.log("📑 切换到Tab:", index, tab.desc || tab.title);
- },
- },
- });
- });
- </script>
- </body>
- </html>
|