Commit 23b8f1eb authored by 刘殿昕's avatar 刘殿昕

portal

parent bc44e4e3
......@@ -354,8 +354,8 @@
</div>
</block-radius>
</div>
<div>
<iframe src="https://apaasgis.wodcloud.com/portal/apaasplat/viewer/autologin.html" style="width: 1000px;height: 400px"></iframe>
<div style="display: none">
<iframe src="https://apaasgis.wodcloud.com/portal/apaasplat/viewer/autologin.html"></iframe>
</div>
</div>
</template>
......@@ -365,6 +365,7 @@ import BlockRadius from "@/components/general/block-radius";
import CesTable from "@/components/table/table-um";
import Codes from "@/components/general/codes";
import uploadFile from "@/components/general/upload_file";
import helper from "@/services/helper";
export default {
components: {
BlockRadius,
......@@ -569,6 +570,8 @@ export default {
T009: "28",
T010: "29",
},
portal_status: true,
portal_data_service_type_2: "",
};
},
computed: {},
......@@ -746,6 +749,19 @@ export default {
} else if (this.responseRules != 0) {
this.$message.error("请完善返回参数信息中的字段名称");
}
} else if (this.activeBtn == 1) {
if (this.portal_status) {
let value = helper.getQueryString("id", this.serviceUrl);
if (value != "") {
this.getItemInfo(value);
} else {
this.addPortalItem();
}
}
this.request_fields = [];
this.response_fields = [];
this.jcxxtx = true;
this.getOrganization();
} else {
this.request_fields = [];
this.response_fields = [];
......@@ -817,6 +833,8 @@ export default {
? 12
: this.activeBtn == 1
? this.skfwQqt
: this.activeBtn == 2
? portal_data_service_type_2
: this.activeBtn == 4
? this.zhyyVal
: 0,
......@@ -914,10 +932,11 @@ export default {
this.$router.push(path);
},
addPortalItem() {
console.log("添加portal");
//添加服务到portal
var url =
"https://apaasgis.wodcloud.com/portal/sharing/rest/content/users/" +
portalUser.username +
this.portalUser.username +
"/addItem";
$.ajax({
url: url,
......@@ -926,19 +945,19 @@ export default {
//data: json,
data: {
f: "json",
tags: industryTree_apaas_Config["1"],
tags: this.industryTree_apaas_Config["1"],
title: "测试添加服务5",
url:
"https://apaasgis.wodcloud.com/server/rest/services/GZ_FJXQZTT/FeatureServer",
type: dataTree_apaas_config["19"],
token: portalUser.token,
type: this.dataTree_apaas_config["19"],
token: this.portalUser.token,
},
dataType: "json", //dataType不能少
success: function (result) {
if (result.error != null) {
alert("添加专题图到Portal中失败," + result.error.message);
} else {
shareItem(result.id);
this.shareItem(result.id);
}
},
error: function (xhr, status, err) {
......@@ -947,9 +966,10 @@ export default {
});
},
shareItem(itemid) {
console.log(`共享portal${itemid}`);
var searchUrl =
"https://apaasgis.wodcloud.com/portal/sharing/rest/content/users/" +
portalUser.username +
this.portalUser.username +
"/shareItems";
$.ajax({
url: searchUrl,
......@@ -958,7 +978,7 @@ export default {
data: {
items: itemid,
everyone: true,
token: portalUser.token,
token: this.portalUser.token,
f: "json",
groups: null,
},
......@@ -969,10 +989,10 @@ export default {
});
},
getItemInfo(itemid) {
console.log("ssss")
console.log(`获取portal参数${itemid}`);
var searchUrl =
"https://apaasgis.wodcloud.com/portal/sharing/rest/content/users/" +
portalUser.username +
this.portalUser.username +
"/items/" +
itemid;
$.ajax({
......@@ -980,33 +1000,37 @@ export default {
dataType: "json",
method: "POST",
data: {
token: portalUser.token,
token: this.portalUser.token,
f: "json",
},
success: function (data) {
var sectors = "";
$(data.item.tags).each(function (i, tag) {
if (!!industryTree_apaas_Config[tag]) {
sectors = industryTree_apaas_Config[tag];
if (!!this.industryTree_apaas_Config[tag]) {
sectors = this.industryTree_apaas_Config[tag];
return;
}
});
var item = {
url: data.item.url,
itemid: data.item.id,
this.form = {
name: data.item.title,
descript: data.item.description,
cover:
"https://apaasgis.wodcloud.com/portal/sharing/rest/content/items/" +
data.item.id +
"/info/" +
data.item.thumbnail +
"?token=" +
portalUser.token,
sectors: sectors,
data_service_type2: dataTree_apaas_config[data.item.type],
desc: data.item.description,
area: sectors,
origin: "",
code: "自动生成",
resource: 1,
};
this.cover =
"https://apaasgis.wodcloud.com/portal/sharing/rest/content/items/" +
data.item.id +
"/info/" +
data.item.thumbnail +
"?token=" +
this.portalUser.token;
this.iportal_id = data.item.id;
this.serviceUrl = data.item.url;
this.portal_data_service_type_2 = this.dataTree_apaas_config[
data.item.type
];
console.log(item);
},
error: function (err) {
......@@ -1016,20 +1040,20 @@ export default {
},
},
mounted() {
this.judgeMap();
this.getServiceType1();
this.getArea();
window.addEventListener(
"message",
function (event) {
console.log(event);
if (event.data && event.data.cmd == "getPortalUser") {
portalUser = event.data.params;
getItemInfo("86fd0d2e89854cb293d287efd2142acd");
//addPortalItem();
this.portalUser = event.data.params;
this.portal_status = true;
}
},
false
);
this.judgeMap();
this.getServiceType1();
this.getArea();
},
};
</script>
......
......@@ -84,4 +84,19 @@ module.exports.CreationDateDesc = function (timestamp) {
return date.toLocaleDateString("zh-CN", {
timeZone: "Asia/Shanghai"
});
}
module.exports.getQueryString = function (name, url) {
let search = url.substr(url.indexOf("?"));
console.log(search)
let theRequest = new Object();
if (search.indexOf("?") != -1) {
let str = search.substr(1);
strs = str.split("&");
console.log(strs)
for (let i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest[name];
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment