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

portal

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