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

portal

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