Commit 9efd7f9f authored by 刘殿昕's avatar 刘殿昕

portal

parent d8175be0
......@@ -570,7 +570,6 @@ export default {
T009: "28",
T010: "29",
},
portal_status: true,
portal_data_service_type_2: "",
};
},
......@@ -750,9 +749,9 @@ export default {
this.$message.error("请完善返回参数信息中的字段名称");
}
} else if (this.activeBtn == 1) {
if (this.portal_status) {
if (this.portalUser.username && this.portalUser.username != "") {
let value = helper.getQueryString("id", this.serviceUrl);
if (value != "") {
if (value && value != "") {
this.getItemInfo(value);
} else {
this.addPortalItem();
......@@ -933,27 +932,28 @@ export default {
},
addPortalItem() {
console.log("添加portal");
let self = this;
//添加服务到portal
let url =
"https://apaasgis.wodcloud.com/portal//portal/sharing/rest/content/users/" +
this.portalUser.username +
self.portalUser.username +
"/addItem";
let data = {
f: "json",
tags: this.industryTree_apaas_Config["1"],
tags: self.industryTree_apaas_Config["1"],
title: "测试添加服务5",
url:
"https://apaasgis.wodcloud.com/server/rest/services/GZ_FJXQZTT/FeatureServer",
type: this.dataTree_apaas_config["19"],
token: this.portalUser.token,
type: self.dataTree_apaas_config["19"],
token: self.portalUser.token,
};
this.$http
.post(url, data)
self.$http
.post(url, data, {emulateJSON: true})
.then((response) => {
if (response.data.success == 1) {
this.shareItem(response.data.id);
self.shareItem(response.data.id);
} else {
this.$message({
self.$message({
message: `删除失败`,
type: "warning",
});
......@@ -961,7 +961,7 @@ export default {
})
.catch((error) => {
console.log(error);
this.$message({
self.$message({
message: `添加专题图到Portal中失败,${error}`,
type: "warning",
});
......@@ -969,19 +969,20 @@ export default {
},
shareItem(itemid) {
console.log(`共享portal${itemid}`);
let self = this;
let searchUrl =
"https://apaasgis.wodcloud.com/portal//portal/sharing/rest/content/users/" +
this.portalUser.username +
self.portalUser.username +
"/shareItems";
let data = {
items: itemid,
everyone: true,
token: this.portalUser.token,
token: self.portalUser.token,
f: "json",
groups: null,
};
this.$http
.post(searchUrl, data)
self.$http
.post(searchUrl, data, {emulateJSON: true})
.then((response) => {
console.log(response);
})
......@@ -991,28 +992,30 @@ export default {
},
getItemInfo(itemid) {
console.log(`获取portal参数${itemid}`);
let self = this;
console.log(self.portalUser)
let searchUrl =
"https://apaasgis.wodcloud.com/portal//portal/sharing/rest/content/users/" +
this.portalUser.username +
self.portalUser.username +
"/items/" +
itemid;
let data = {
token: this.portalUser.token,
token: self.portalUser.token,
f: "json",
};
this.$http
.post(searchUrl, data)
self.$http
.post(searchUrl, data, {emulateJSON: true})
.then((response) => {
console.log(response);
if (response.data.success == 1) {
var sectors = "";
$(data.item.tags).each(function (i, tag) {
if (!!this.industryTree_apaas_Config[tag]) {
sectors = this.industryTree_apaas_Config[tag];
if (!!self.industryTree_apaas_Config[tag]) {
sectors = self.industryTree_apaas_Config[tag];
return;
}
});
this.form = {
self.form = {
name: data.item.title,
desc: data.item.description,
area: sectors,
......@@ -1020,16 +1023,16 @@ export default {
code: "自动生成",
resource: 1,
};
this.cover =
self.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[
self.portalUser.token;
self.iportal_id = data.item.id;
self.serviceUrl = data.item.url;
self.portal_data_service_type_2 = self.dataTree_apaas_config[
data.item.type
];
}
......@@ -1047,7 +1050,6 @@ export default {
if (event.data && event.data.cmd == "getPortalUser") {
this.portalUser = event.data.params;
console.log(this.portalUser);
this.portal_status = true;
}
},
false
......
......@@ -88,12 +88,10 @@ module.exports.CreationDateDesc = function (timestamp) {
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]);
}
......
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