Commit d8ca5d89 by 宋毅

tj

parent a374b20e
...@@ -118,6 +118,10 @@ class tmqueryCtl extends CtlBase { ...@@ -118,6 +118,10 @@ class tmqueryCtl extends CtlBase {
var opJdPayPageInfoResult = await this.opJdPayPageInfo(pobj, result, req); var opJdPayPageInfoResult = await this.opJdPayPageInfo(pobj, result, req);
return opJdPayPageInfoResult; return opJdPayPageInfoResult;
} }
else if (["gsb"].indexOf(pobj.actionProcess) >= 0 && pobj.actionType == "subTmOrder") {
var opGsbPayPageInfoResult = await this.opGsbPayPageInfo(pobj, result, req);
return opGsbPayPageInfoResult;
}
return result; return result;
} catch (e) { } catch (e) {
console.log(e.stack, "操作error..................."); console.log(e.stack, "操作error...................");
...@@ -522,95 +526,46 @@ class tmqueryCtl extends CtlBase { ...@@ -522,95 +526,46 @@ class tmqueryCtl extends CtlBase {
if (!pobj.actionBody.itemCode) { if (!pobj.actionBody.itemCode) {
return system.getResult(null, "itemCode param is not empty"); return system.getResult(null, "itemCode param is not empty");
} }
return system.getResultSuccess();
}
async getGsbPayPageAddr(itemCode, itemCodeList, req) {//获取京东下单
try { try {
const { Signer, Context } = require('../jd-gateway-sdk'); var tokenInfo = await this.getToken(pobj.actionProcess);
let ctx = new Context('x3k0s704lfun.cn-north-1.jdcloud-api.net', '/market/order/api/submit', 'POST', null, 'empty'); if (tokenInfo.status != 0) {
ctx.regionId = 'cn-north-1' return tokenInfo;
ctx.headers.set('content-type', 'application/json');
let credentials = {
accessKeyId: 'C6D680733C19362B5DF478207D6A90A4', //替换自己的AK
secretAccessKey: 'EB9AFEE49CE41700CADD5F2EE3B2122C' //替换自己的SK--jd>>>>>>>
} }
//测试报文: var param = {
//ctx.body = "pin=jcloud_pRiHQTd&serviceId=580010&itemCode=FW_GOODS-580010-1&platform=6" actionProcess: pobj.actionProcess,
//POST actionType: "subGsbOrderInfo",
var qs = require('querystring'); actionBody: {
// var post_data = { pin: "syaify", serviceId: 580010, itemCode: "FW_GOODS-580010-1", platform: 6, orderNum: 1, articleType: 1 };//这是需要提交的数据 channelUserId: req.session.userPinInfo.channelUserId,
channelItemCode: pobj.actionBody.itemCode,
var post_data = { order_param: {
pin: req.session.userPinInfo.channelUserId, mobile_phone: pobj.actionBody.apply.mobile || "18888888888",//必填
serviceId: itemCodeList[1], goods_list: [{//必填
itemCode: itemCode, goods_name: pobj.actionBody.itemCode,
platform: 6, goods_quantity: 1,
orderNum: 1, }],
articleType: 1, order_price: 300,//必填
additions: '{ \"246\": 0 }' province_name: "",//省
};//这是需要提交的数据 city_name: "",//市
district_name: ""//区
// var tmpContent = '{"pin":"syaify","serviceId":"581976","itemCode":"FW_GOODS-581976","platform":6,"orderNum":1,"articleType":1,"additions":{"246":0}}';
var tmpContent = JSON.stringify(post_data);
var tmpContentLength = Buffer.byteLength(tmpContent);
ctx.body = tmpContent;
ctx.method = 'POST'
var signer = new Signer(ctx, credentials);
ctx.headers.set('Content-Length', tmpContentLength)
ctx.buildNonce()
var dd = new Date();
var auth = signer.sign(dd)
console.log("POST签名为:", auth)
ctx.headers.set('Authorization', auth)
////////////////////////////////////////////////////////////////////////////////////////////////////////////
var http = require('https');
var options = {
host: 'x3k0s704lfun.cn-north-1.jdcloud-api.net',
port: 443,
path: '/market/order/api/submit',
method: 'POST',
headers: {
} }
},
isUser: "yes"
}; };
var reqUrl = this.channelApiUrl + "/action/tmOrder/springBoard";
for (let [key, value] of ctx.headers) { console.log("req---->opGsbPayPageInfo---->params:" + JSON.stringify(param) + ",reqUrl:" + reqUrl);
options.headers[key] = value var result = await this.execClient.execPostTK(param, reqUrl, tokenInfo.data.token);
if (!result) {
console.log("req---->opGsbPayPageInfo---->error:" + JSON.stringify(result));
return system.getResult(null, "req error");
} }
return result;
this.logClient.info("jd", "req---->getJdPayPageAddr---->options:" + JSON.stringify(options)); } catch (error) {
this.logClient.info("jd", "req---->getJdPayPageAddr---->tmpContent:" + tmpContent); console.log("req---->opGsbPayPageInfo---->操作error:" + error.stack);
var reqResult = await new Promise(function (resolve, reject) { return system.getResultFail(-200, "操作error");
let req = http.request(options, function (res) {
// res.setEncoding(encoding);
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
var _data = '';
res.on('data', function (chunk) {
_data += chunk;
});
res.on('end', function () {
console.log("\n--req---成功->>\nresult:", _data)
resolve({ result: true, data: _data });
});
});
req.on('error', (e) => {
console.error(`请求遇到问题-------------: ${e.message}`);
resolve({ result: false, errmsg: e.message });
});
req.write(tmpContent);
req.end();
});
return reqResult;
} catch (errorMsg) {
this.logClient.error("jd", "req---->getJdPayPageAddr---->error:" + error.stack);
return { success: false, code: -200, msg: error.stack };
} }
return system.getResultSuccess();
} }
async pushGsbPayOrder(pushData, req) {//处理京东推送的订单信息 async pushGsbPayOrder(pushData, req) {//处理京东推送的订单信息
try { try {
......
...@@ -7,6 +7,11 @@ var logClient = system.getObject("util.logClient"); ...@@ -7,6 +7,11 @@ var logClient = system.getObject("util.logClient");
const jwt = require('jsonwebtoken'); const jwt = require('jsonwebtoken');
const secret = '3rZ3aNfGAyQAB4sE'; //自定义 const secret = '3rZ3aNfGAyQAB4sE'; //自定义
module.exports = function (app) { module.exports = function (app) {
app.get("/admin", async function (req, res) {
res.redirect("http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=OAjdlist&client_id=9841572588670903");
return;
});
app.get("/jdtm/getUser", async function (req, res) { app.get("/jdtm/getUser", async function (req, res) {
try { try {
var params = req.query; var params = req.query;
...@@ -48,47 +53,6 @@ module.exports = function (app) { ...@@ -48,47 +53,6 @@ module.exports = function (app) {
}); });
} }
}); });
// app.get("/login", async function (req, res) {
// try {
// var params = req.query;
// if (!params.state || !params.token_type || !params.access_token) {
// res.redirect("http://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=http://tm.plus.jdcloud.com/jdtm/getUser&state=jdindentlist&client_id=9841572588670903");
// return;
// }
// var getUserparams = {
// actionProcess: "jd",
// authUrl: "https://oauth2.jdcloud.com/userinfo",
// authToken: params.token_type + " " + params.access_token
// };
// var userItemResult = await tmqueryCtl.getJdUserInfo(getUserparams, req.query, req);
// logClient.info("jd", {
// optitle: "###获取京东用户结果...getJdUserInfo",
// op: "/jdtm/loginUser",
// content: "参数=" + JSON.stringify(getUserparams) + ",result=" + JSON.stringify(userItemResult),
// clientIp: ""
// });
// if (userItemResult.status != 0) {
// res.redirect("/#/jd/jdindentlist");
// return;
// }
// if (!userItemResult.data.encryptChannelUserId || userItemResult.data.encryptChannelUserId == "undefined") {
// userItemResult = await tmqueryCtl.getUserIdEncryptStr(getUserparams, req.query, req);
// if (userItemResult.status != 0) {
// res.redirect("/#/jd/jdindentlist");
// return;
// }
// }
// var skipUrl = "/#/jd/" + params.state + "?channelUserId=" + encodeURIComponent(userItemResult.data.encryptChannelUserId);
// res.redirect(skipUrl);
// } catch (error) {
// logClient.error("jd", {
// optitle: "###获取京东用户异常...getJdUserInfo",
// op: "/jdtm/loginUser",
// content: error.stack,
// clientIp: ""
// });
// }
// });
app.get("/jd/orderNotify", async function (req, res) { app.get("/jd/orderNotify", async function (req, res) {
logClient.payLog("jd", { logClient.payLog("jd", {
optitle: "###操作订单结果参数...orderNotify", optitle: "###操作订单结果参数...orderNotify",
...@@ -202,8 +166,13 @@ module.exports = function (app) { ...@@ -202,8 +166,13 @@ module.exports = function (app) {
res.redirect(skipUrl); res.redirect(skipUrl);
}); });
app.get("/gsb/selfRegister", async function (req, res) { app.get("/gsb", async function (req, res) {
var skipUrl = "/#/gsb/selftmreg?channelUserId="; var skipUrl = "/#/gsb/selftmreg?channelUserId=";
var params = req.query;
if (!params.state) {
res.redirect(skipUrl);
return;
}
var token = req.cookies.ic_token; var token = req.cookies.ic_token;
if (!token) { if (!token) {
res.redirect(skipUrl); res.redirect(skipUrl);
...@@ -230,9 +199,39 @@ module.exports = function (app) { ...@@ -230,9 +199,39 @@ module.exports = function (app) {
res.redirect(skipUrl); res.redirect(skipUrl);
return; return;
} }
skipUrl = skipUrl + encodeURIComponent(userItemResult.data.encryptChannelUserId); skipUrl = "/#/gsb/" + params.state + "?channelUserId=" + encodeURIComponent(userItemResult.data.encryptChannelUserId);
res.redirect(skipUrl); res.redirect(skipUrl);
}); });
app.get("/gsb/orderNotify", async function (req, res) {
logClient.payLog("jd", {
optitle: "###操作订单结果参数...orderNotify",
op: "/jd/orderNotify",
content: "req.query=" + JSON.stringify(req.query) + ",req.body=" + JSON.stringify(req.body),
clientIp: ""
});
req.query.actionProcess = "jd";
var result = await tmqueryCtl.pushJdPayOrder(req.query, req);
logClient.payLog("jd", {
optitle: "###操作订单结果...orderNotify",
op: "/jd/orderNotify",
content: "result=" + JSON.stringify(result),
clientIp: ""
});
if (result.status != 0) {
res.end(JSON.stringify(result));
return;
}
var params =
{
instanceId: req.query.orderBizId,
appInfo: {
authUrl: "https://tm.plus.jdcloud.com/jd/skipPage?channelUserId=" + req.query.jdPin,
adminUrl: "https://tm.plus.jdcloud.com"
}
};
res.end(JSON.stringify(params));
return;
});
app.get("/", async function (req, res) { app.get("/", async function (req, res) {
try { try {
var appinfo = await metaCtl.getAppInfo(req); var appinfo = await metaCtl.getAppInfo(req);
......
...@@ -106,12 +106,6 @@ basecomp.forEach(function (comp) { ...@@ -106,12 +106,6 @@ basecomp.forEach(function (comp) {
}else{ }else{
this.logins.push({"icon":"el-icon-arrow-right","title":"退出","type":"text",key:"exit","isOnGrid":true}); this.logins.push({"icon":"el-icon-arrow-right","title":"退出","type":"text",key:"exit","isOnGrid":true});
} }
this.checkLogin(()=>{
if(location.hash=="#/"){
this.$router.push("/index");
}
});
}, },
methods:{ methods:{
initWindowShow(){ initWindowShow(){
......
...@@ -209,7 +209,6 @@ axios.get("/web/common/metaCtl/getRouteConfig").then(d => { ...@@ -209,7 +209,6 @@ axios.get("/web/common/metaCtl/getRouteConfig").then(d => {
} else { } else {
this.logins.push({ "icon": "el-icon-arrow-right", "title": "退出", "type": "text", key: "exit", "isOnGrid": true }); this.logins.push({ "icon": "el-icon-arrow-right", "title": "退出", "type": "text", key: "exit", "isOnGrid": true });
} }
this.checkLogin();
}, },
methods: { methods: {
// 返回当前接入渠道标识 // 返回当前接入渠道标识
......
axios.get("/vue/comp/base").then(function (res) { // axios.get("/vue/comp/base").then(function (res) {
axios = window.axios; // axios = window.axios;
$.base64.utf8encode = true; // $.base64.utf8encode = true;
if (res.data) { // if (res.data) {
res.data.forEach(function (comp) { // res.data.forEach(function (comp) {
try { // try {
var objfunc = eval("(" + comp + ")"); // var objfunc = eval("(" + comp + ")");
var obj=objfunc(); // var obj=objfunc();
Vue.component(obj.vname, obj); // Vue.component(obj.vname, obj);
} catch (e) { // } catch (e) {
console.log(e); // console.log(e);
} // }
}); // });
} // }
console.log("load base component finished..."); // console.log("load base component finished...");
function buildPromise(compath) { // function buildPromise(compath) {
return Promise.resolve(new Promise(function (resolve, reject) { // return Promise.resolve(new Promise(function (resolve, reject) {
//异步加载组件 // //异步加载组件
axios.get(compath).then(function (res) { // axios.get(compath).then(function (res) {
console.log(compath); // console.log(compath);
var objfunc = eval("(" + res.data + ")"); // var objfunc = eval("(" + res.data + ")");
var obj=objfunc(); // var obj=objfunc();
console.log(obj); // console.log(obj);
resolve(obj); // resolve(obj);
})["catch"](function (reason) { // })["catch"](function (reason) {
console.log(reason); // console.log(reason);
}); // });
})); // }));
} // }
function componentFactory(comname) { // function componentFactory(comname) {
var compath = "/vue/comp/" + comname; // var compath = "/vue/comp/" + comname;
var tmpFunc = function tmpFunc() { // var tmpFunc = function tmpFunc() {
return buildPromise(compath); // return buildPromise(compath);
}; // };
return tmpFunc; // return tmpFunc;
} // }
window.componentFactory = componentFactory; // window.componentFactory = componentFactory;
Vue.mixin({ // Vue.mixin({
props: ["modelName"], // props: ["modelName"],
computed: Vuex.mapState({ // computed: Vuex.mapState({
currentUser: function currentUser(state) { // currentUser: function currentUser(state) {
return state.currentUser; // return state.currentUser;
}, // },
currentCompany: function currentCompany(state) { // currentCompany: function currentCompany(state) {
return state.currentCompany; // return state.currentCompany;
}, // },
pfooterinfo: function pfooterinfo(state) { // pfooterinfo: function pfooterinfo(state) {
return state.pfooterinfo; // return state.pfooterinfo;
}, // },
codePath: function codePath(state) { // codePath: function codePath(state) {
return state.currentCodePath; // return state.currentCodePath;
}, // },
ctlName: function ctlName() { // ctlName: function ctlName() {
return this.modelName + "Ctl"; // return this.modelName + "Ctl";
}, // },
header_height: function header_height(state) { // header_height: function header_height(state) {
return state.header_height; // return state.header_height;
}, // },
socketClient: function socketClient(state) { // socketClient: function socketClient(state) {
return state.socketClient; // return state.socketClient;
}, // },
istabclick: function istabclick(state) { // istabclick: function istabclick(state) {
return state.istabclick; // return state.istabclick;
} // }
}), // }),
methods: { // methods: {
getUrl: function getUrl(md) { // getUrl: function getUrl(md) {
return "web/" + this.ctlName + "/" + md; // return "web/" + this.ctlName + "/" + md;
} // }
} // }
}); // });
var routes = []; // var routes = [];
var codepaths = {}; // var codepaths = {};
var mapTile = {}; // var mapTile = {};
var mapRouterEntry = {}; // var mapRouterEntry = {};
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======================="); // console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=======================");
axios.get("/web/metaCtl/getRouteConfigWithoutProduct").then(function (d) { // axios.get("/web/metaCtl/getRouteConfigWithoutProduct").then(function (d) {
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx======================="); // console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=======================");
console.log(d.data.data.bizs); // console.log(d.data.data.bizs);
Object.keys(d.data.data.bizs).map(function (k) { // Object.keys(d.data.data.bizs).map(function (k) {
//path是路由,静态的路由 // //path是路由,静态的路由
var pathTmp = d.data.data.bizs[k].path; // var pathTmp = d.data.data.bizs[k].path;
var codepath = d.data.data.bizs[k].codepath; // var codepath = d.data.data.bizs[k].codepath;
if (!d.data.data.bizs[k].isDynamicRoute) { // if (!d.data.data.bizs[k].isDynamicRoute) {
//如果不忽略静态路由 // //如果不忽略静态路由
var tmp = { // var tmp = {
"path": pathTmp, // "path": pathTmp,
"components": {} // "components": {}
}; // };
var vname = d.data.data.bizs[k].comname; //设置要显示的rouer-view的名字 // var vname = d.data.data.bizs[k].comname; //设置要显示的rouer-view的名字
tmp.components[pathTmp] = componentFactory(d.data.data.bizs[k].comname); // tmp.components[pathTmp] = componentFactory(d.data.data.bizs[k].comname);
mapTile[pathTmp] = d.data.data.bizs[k].title; // var tmp={"path":pathTmp,"components":{ // mapTile[pathTmp] = d.data.data.bizs[k].title; // var tmp={"path":pathTmp,"components":{
// "default":componentFactory(d.data.data.bizs[k].comname) // // "default":componentFactory(d.data.data.bizs[k].comname)
// },}; // // },};
routes.push(tmp); // routes.push(tmp);
mapRouterEntry[pathTmp] = tmp; // mapRouterEntry[pathTmp] = tmp;
} // }
codepaths[pathTmp] = codepath; //暂存每个叶子节点对应的codepath // codepaths[pathTmp] = codepath; //暂存每个叶子节点对应的codepath
}); //元数据分析时会为每个叶子节点动态生成codepath,按照code生成从根开始的路径 // }); //元数据分析时会为每个叶子节点动态生成codepath,按照code生成从根开始的路径
console.log(JSON.stringify(codepaths)); // console.log(JSON.stringify(codepaths));
var router = new VueRouter({ // var router = new VueRouter({
routes: routes // routes: routes
}); // });
router.mapTile = mapTile; // router.mapTile = mapTile;
router.mapRouterEntry = mapRouterEntry; // router.mapRouterEntry = mapRouterEntry;
var store = new Vuex.Store({ // var store = new Vuex.Store({
state: { // state: {
count: 1, // count: 1,
products: d.data.data.ps, // products: d.data.data.ps,
currentCodePath: "", // currentCodePath: "",
istabclick: false, // istabclick: false,
currentUser: null, // currentUser: null,
currentCompany: null, // currentCompany: null,
curSelRow: {}, // curSelRow: {},
header_height: "200", // header_height: "200",
socketClient: null, // socketClient: null,
logoUrl: "", // logoUrl: "",
appimgUrl: "", // appimgUrl: "",
currentChatTo: "", // currentChatTo: "",
pfooterinfo: null // pfooterinfo: null
}, // },
mutations: { // mutations: {
increment: function increment(state) { // increment: function increment(state) {
state.count++; // state.count++;
} // }
} // }
}); // });
function headtransparent() { // function headtransparent() {
$("#header").addClass("headtransparent"); // $("#leftmenudiv").addClass("menutransparent"); // $("#header").addClass("headtransparent"); // $("#leftmenudiv").addClass("menutransparent");
$(".spechorizotal .nav_color").css("color", "white"); // $(".spechorizotal .nav_color").css("color", "white");
$("#header").css("background-color", "transparent"); // $("#header").css("background-color", "transparent");
$("#welcome").css("color", "white"); // $("#welcome").css("color", "white");
$("#exitbtn").css("color", "white"); // $("#exitbtn").css("color", "white");
$("#adminbtn").css("color", "white"); // $("#adminbtn").css("color", "white");
$("#adminbtn").css("display", "display"); // $("#adminbtn").css("display", "display");
$("#loginbtn").css("color", "white"); // $("#loginbtn").css("color", "white");
$("#appname").css("color", "white"); // $("#appname").css("color", "white");
} // }
function headnotransparent() { // function headnotransparent() {
setTimeout(function () { // setTimeout(function () {
$(".spechorizotal .nav_color").css("color", "black"); // $(".spechorizotal .nav_color").css("color", "black");
$(".spechorizotal .nav_color:hover").css("color", "#2692FF"); // $(".spechorizotal .nav_color:hover").css("color", "#2692FF");
$("#header").removeClass("headtransparent"); // $("#header").removeClass("headtransparent");
$("#header").css("background-color", "white"); // $("#header").css("background-color", "white");
$("#welcome").css("color", "#fff"); // $("#welcome").css("color", "#fff");
$("#exitbtn").css("color", "#fff"); // $("#exitbtn").css("color", "#fff");
$("#adminbtn").css("color", "#fff"); // $("#adminbtn").css("display", "none"); // $("#adminbtn").css("color", "#fff"); // $("#adminbtn").css("display", "none");
$("#loginbtn").css("color", "#2692FF"); // $("#loginbtn").css("color", "#2692FF");
$("#appname").css("color", "#2692FF"); // $("#appname").css("color", "#2692FF");
}, 1500); // }, 1500);
} // }
router.beforeEach(function (to, from, next) { // router.beforeEach(function (to, from, next) {
console.log("enter before..........................."); // console.log("enter before...........................");
console.log(to); //设置当前访问的叶子节点的codepath // console.log(to); //设置当前访问的叶子节点的codepath
//对于静态路由按照路由条目,获取codepath // //对于静态路由按照路由条目,获取codepath
//对于工具产品,按照去掉最后一个数字后的路径去获取codepath,要求 // //对于工具产品,按照去掉最后一个数字后的路径去获取codepath,要求
//配置工具类产品的path时,路径要按照products/code(组件名字来设置) // //配置工具类产品的path时,路径要按照products/code(组件名字来设置)
//--可以添加静态路由,再次映射到产品,比如实现平台功能 // //--可以添加静态路由,再次映射到产品,比如实现平台功能
var keyCodePath = to.path; // var keyCodePath = to.path;
console.log(keyCodePath); // console.log(keyCodePath);
if (keyCodePath == "/" || keyCodePath.indexOf("login") > 0 || keyCodePath.indexOf("more") > 0 || keyCodePath.indexOf("about") > 0) { // if (keyCodePath == "/" || keyCodePath.indexOf("login") > 0 || keyCodePath.indexOf("more") > 0 || keyCodePath.indexOf("about") > 0) {
headtransparent(); // headtransparent();
} else { // } else {
headnotransparent(); // headnotransparent();
} // }
if (keyCodePath == "" || keyCodePath == "/") { // if (keyCodePath == "" || keyCodePath == "/") {
keyCodePath = "/"; // keyCodePath = "/";
} else { // } else {
var indexTmp = keyCodePath.lastIndexOf("/"); // var indexTmp = keyCodePath.lastIndexOf("/");
var laststr = keyCodePath.substring(indexTmp + 1); // var laststr = keyCodePath.substring(indexTmp + 1);
console.log(laststr); // console.log(laststr);
if (!isNaN(laststr)) { // if (!isNaN(laststr)) {
keyCodePath = keyCodePath.substring(0, indexTmp); // keyCodePath = keyCodePath.substring(0, indexTmp);
} // }
} // }
store.state.currentCodePath = codepaths[keyCodePath]; // store.state.currentCodePath = codepaths[keyCodePath];
if (!codepaths[keyCodePath]) { // if (!codepaths[keyCodePath]) {
//解决静态:id路由配置的问题 // //解决静态:id路由配置的问题
keyCodePath = keyCodePath + "/:id"; // keyCodePath = keyCodePath + "/:id";
store.state.currentCodePath = codepaths[keyCodePath]; // store.state.currentCodePath = codepaths[keyCodePath];
} // }
next(); // next();
}); // });
Vue.use(window['vue-cropper']); // Vue.use(window['vue-cropper']);
var app = new Vue({ // var app = new Vue({
el: "#app", // el: "#app",
router: router, // router: router,
store: store, // store: store,
data: function data() { // data: function data() {
return { // return {
switchcompany: null, // switchcompany: null,
companys: [], // companys: [],
catas: [], // catas: [],
loading: false, // loading: false,
items: [], // items: [],
logins: [// {"icon":"fa fa-home","title":"首页","type":"text",key:"login","isOnGrid":true}, // logins: [// {"icon":"fa fa-home","title":"首页","type":"text",key:"login","isOnGrid":true},
{ // {
"icon": "el-icon-arrow-right", // "icon": "el-icon-arrow-right",
"title": "专利检索", // "title": "专利检索",
"type": "text", // "type": "text",
key: "login", // key: "login",
"isOnGrid": true // "isOnGrid": true
}, { // }, {
"icon": "el-icon-arrow-right", // "icon": "el-icon-arrow-right",
"title": "专利分析", // "title": "专利分析",
"type": "text", // "type": "text",
key: "login", // key: "login",
"isOnGrid": true // "isOnGrid": true
}, { // }, {
"icon": "el-icon-arrow-right", // "icon": "el-icon-arrow-right",
"title": "专利竞争分析", // "title": "专利竞争分析",
"type": "text", // "type": "text",
key: "login", // key: "login",
"isOnGrid": true // "isOnGrid": true
}], // }],
editableTabs2: [{ // editableTabs2: [{
title: '首页', // title: '首页',
name: '/' // name: '/'
}], // }],
editableTabsValue2: '/', // editableTabsValue2: '/',
isShowMenu: "true", // isShowMenu: "true",
currentCompany: null, // currentCompany: null,
bankAccount: null, // bankAccount: null,
footerInfo: null, // footerInfo: null,
pfooterinfo: null, // pfooterinfo: null,
serviceqq: null, // serviceqq: null,
servicetel: null, // servicetel: null,
homeobj: null, // homeobj: null,
isfront: true // isfront: true
}; // };
}, // },
created: function created() { // created: function created() {
var _this = this; // var _this = this;
this.refreshLoginState(function () { // this.refreshLoginState(function () {
_this.initIndexPage(); // _this.initIndexPage();
}); // });
}, // },
updated: function updated() {}, // updated: function updated() {},
mounted: function mounted() { // mounted: function mounted() {
var sself = this; //获取被授权的公司列表 // var sself = this; //获取被授权的公司列表
this.postReq("/web/companyCtl/refQuery", { // this.postReq("/web/companyCtl/refQuery", {
fields: ["id", "name"], // fields: ["id", "name"],
datapriv: true // datapriv: true
}).then(function (d) { // }).then(function (d) {
if (d && d.data) { // if (d && d.data) {
d.data.forEach(function (r) { // d.data.forEach(function (r) {
sself.companys.push({ // sself.companys.push({
label: r.name, // label: r.name,
value: r.id // value: r.id
}); // });
}); // });
} // }
}); // });
if (this.$refs.topmenu) { // if (this.$refs.topmenu) {
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxx====="); // console.log("xxxxxxxxxxxxxxxxxxxxxxxxxx=====");
this.$refs.topmenu.fetchMetaData(); // this.$refs.topmenu.fetchMetaData();
} // }
function initMainHeight() { // function initMainHeight() {
var appheight = $("#app").height(); // var appheight = $("#app").height();
var headheight = 60; // var headheight = 60;
var footerheight = 140; // var footerheight = 140;
var minMainHeight = appheight - headheight - footerheight; // var minMainHeight = appheight - headheight - footerheight;
console.log("minMainHeightxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // console.log("minMainHeightxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
console.log(minMainHeight); // console.log(minMainHeight);
$("#stage").css("min-height", minMainHeight + "px"); // $("#stage").css("min-height", minMainHeight + "px");
} // }
; // ;
$(window).resize(function () { // $(window).resize(function () {
initMainHeight(); // initMainHeight();
}); // });
initMainHeight(); // initMainHeight();
this.hidetabs(); // this.hidetabs();
localStorage.removeItem("afterLogin"); // localStorage.removeItem("afterLogin");
if (window.history && window.history.pushState) { // if (window.history && window.history.pushState) {
window.addEventListener('popstate', this.goBack, false); // window.addEventListener('popstate', this.goBack, false);
} // }
this.isShowMenu = false; // this.isShowMenu = false;
setTimeout(function () { // setTimeout(function () {
$("#app").css("visibility", "visible"); // $("#app").css("visibility", "visible");
$("#footer").css("visibility", "visible"); // $("#footer").css("visibility", "visible");
}, 1000); // }, 1000);
}, // },
methods: { // methods: {
initIndexPage: function initIndexPage() { // initIndexPage: function initIndexPage() {
var url = location.href; // var url = location.href;
console.log("00000000000000000000000000000000"); // console.log("00000000000000000000000000000000");
console.log(url); // console.log(url);
if (url.indexOf("bycdetailtm?sbzch") > 0) { // if (url.indexOf("bycdetailtm?sbzch") > 0) {
var obj1 = url.split("bycdetailtm?sbzch=")[1]; // var obj1 = url.split("bycdetailtm?sbzch=")[1];
var obj2 = obj1.split("&gjfl="); // var obj2 = obj1.split("&gjfl=");
this.pushx({ // this.pushx({
title: "", // title: "",
name: "/bycdetailtm", // name: "/bycdetailtm",
params: { // params: {
sbzch: obj2[0], // sbzch: obj2[0],
gjfl: obj2[1] // gjfl: obj2[1]
} // }
}); // });
headnotransparent(); // headnotransparent();
} else if (url.indexOf("bycquerytm?tmmonitzcr") > 0) { // } else if (url.indexOf("bycquerytm?tmmonitzcr") > 0) {
var obj1 = url.split("bycquerytm?tmmonitzcr=")[1]; // var obj1 = url.split("bycquerytm?tmmonitzcr=")[1];
var obj1 = decodeURI(obj1); // var obj1 = decodeURI(obj1);
this.pushx({ // this.pushx({
title: "", // title: "",
name: "/bycquerytm", // name: "/bycquerytm",
params: { // params: {
tmmonitzcr: obj1 // tmmonitzcr: obj1
} // }
}); // });
headnotransparent(); // headnotransparent();
} else if (url.indexOf("bycquerytm") > 0) { // } else if (url.indexOf("bycquerytm") > 0) {
this.pushx({ // this.pushx({
title: "", // title: "",
name: "/bycquerytm" // name: "/bycquerytm"
}); // });
headnotransparent(); // headnotransparent();
} else if (url.indexOf("bycnoticedetailtm?name") > 0) { // } else if (url.indexOf("bycnoticedetailtm?name") > 0) {
var obj1 = url.split("bycnoticedetailtm?name=")[1]; // var obj1 = url.split("bycnoticedetailtm?name=")[1];
var obj2 = obj1.split("&imgurl="); // var obj2 = obj1.split("&imgurl=");
var na = decodeURI(obj2[0]); // var na = decodeURI(obj2[0]);
var url = decodeURI(obj2[1]); // var url = decodeURI(obj2[1]);
console.log(url); // console.log(url);
this.pushx({ // this.pushx({
title: "", // title: "",
name: "/bycnoticedetailtm", // name: "/bycnoticedetailtm",
params: { // params: {
name: na, // name: na,
imgurl: url // imgurl: url
} // }
}); // });
headnotransparent(); // headnotransparent();
} else if (url.indexOf("bytmmonitlistdetails?code=") > 0) { // } else if (url.indexOf("bytmmonitlistdetails?code=") > 0) {
var obj1 = url.split("bytmmonitlistdetails?code=")[1]; // var obj1 = url.split("bytmmonitlistdetails?code=")[1];
this.pushx({ // this.pushx({
title: "", // title: "",
name: "/bytmmonitlistdetails", // name: "/bytmmonitlistdetails",
params: { // params: {
code: obj1 // code: obj1
} // }
}); // });
headnotransparent(); // headnotransparent();
} else if (url.indexOf("bytmmonitagency?agency_name=") > 0) { // } else if (url.indexOf("bytmmonitagency?agency_name=") > 0) {
var obj1 = url.split("bytmmonitagency?agency_name=")[1]; // var obj1 = url.split("bytmmonitagency?agency_name=")[1];
var obj1 = decodeURI(obj1); // var obj1 = decodeURI(obj1);
this.pushx({ // this.pushx({
title: "", // title: "",
name: "/bytmmonitagency", // name: "/bytmmonitagency",
params: { // params: {
agency_name: obj1 // agency_name: obj1
} // }
}); // });
} else if (url.indexOf("bycncldetail") > 0) { // } else if (url.indexOf("bycncldetail") > 0) {
this.pushx({ // this.pushx({
title: "商标尼斯查询", // title: "商标尼斯查询",
name: "/bycncldetail" // name: "/bycncldetail"
}); // });
} else if (url.indexOf("bycnoticetm") > 0) { // } else if (url.indexOf("bycnoticetm") > 0) {
this.pushx({ // this.pushx({
title: "商标公告查询", // title: "商标公告查询",
name: "/bycnoticetm" // name: "/bycnoticetm"
}); // });
} else if (url.indexOf("bycnoticeindex") > 0) { // } else if (url.indexOf("bycnoticeindex") > 0) {
var obj1 = url.split("bycnoticeindex?noticetype=")[1]; // var obj1 = url.split("bycnoticeindex?noticetype=")[1];
var obj2 = obj1.split("&noticenumber="); // var obj2 = obj1.split("&noticenumber=");
var noticetype = decodeURI(obj2[0]); // var noticetype = decodeURI(obj2[0]);
var noticenumber = decodeURI(obj2[1]); // var noticenumber = decodeURI(obj2[1]);
this.pushx({ // this.pushx({
title: "商标公告查询", // title: "商标公告查询",
name: "/bycnoticeindex", // name: "/bycnoticeindex",
params: { // params: {
noticetype: noticetype, // noticetype: noticetype,
noticenumber: noticenumber // noticenumber: noticenumber
} // }
}); // });
} else if (url.indexOf("selftmreg") > 0) { // } else if (url.indexOf("selftmreg") > 0) {
this.$root.pushx({ // this.$root.pushx({
title: "自主商标注册", // title: "自主商标注册",
name: "/selftmreg", // name: "/selftmreg",
params: { // params: {
itemCode: "zzsbzc" // itemCode: "zzsbzc"
} // }
}); // });
} else if (url.indexOf("bytmmonitlist") > 0) { // } else if (url.indexOf("bytmmonitlist") > 0) {
this.pushx({ // this.pushx({
title: "监控列表", // title: "监控列表",
name: "/bytmmonitlist" // name: "/bytmmonitlist"
}); // });
headnotransparent(); // headnotransparent();
} else if (url.indexOf("bytmmonitdynamics") > 0) { // } else if (url.indexOf("bytmmonitdynamics") > 0) {
this.pushx({ // this.pushx({
title: "", // title: "",
name: "/bytmmonitdynamics" // name: "/bytmmonitdynamics"
}); // });
headnotransparent(); // headnotransparent();
} else if (url.indexOf("bytmmonit") > 0) { // } else if (url.indexOf("bytmmonit") > 0) {
this.pushx({ // this.pushx({
title: "商标监控", // title: "商标监控",
name: "/bytmmonit" // name: "/bytmmonit"
}); // });
headnotransparent(); // headnotransparent();
} else { // } else {
//检查lastaccess // //检查lastaccess
var to = this.localdata("lastaccess"); // var to = this.localdata("lastaccess");
if (to && to.name.indexOf("roleview") >= 0) { // if (to && to.name.indexOf("roleview") >= 0) {
this.isfront = false; // this.isfront = false;
} // }
if (to && to.name.indexOf("login") < 0 && this.currentUser) { // if (to && to.name.indexOf("login") < 0 && this.currentUser) {
this.pushx(to); // this.pushx(to);
} else { // } else {
if (this.currentUser) { // if (this.currentUser) {
this.$root.pushx({ // this.$root.pushx({
"title": "每日概览", // "title": "每日概览",
"name": "/roleview" // "name": "/roleview"
}); // });
} else { // } else {
this.$router.push("/"); // this.$router.push("/");
} // }
} // }
} // }
}, // },
contextCompany: function contextCompany() { // contextCompany: function contextCompany() {
if (this.switchcompany) { // if (this.switchcompany) {
return this.switchcompany; // return this.switchcompany;
} else { // } else {
return this.currentCompany; // return this.currentCompany;
} // }
}, // },
channelchange: function channelchange(v) { // channelchange: function channelchange(v) {
var _this2 = this; // var _this2 = this;
/*获取当前公司信息,更新当前公司和当前银行*/ // /*获取当前公司信息,更新当前公司和当前银行*/
if (v) { // if (v) {
this.postReq("/web/companyCtl/getInitCompanyInfo", { // this.postReq("/web/companyCtl/getInitCompanyInfo", {
id: v // id: v
}).then(function (d) { // }).then(function (d) {
if (d && d.status == 0) { // if (d && d.status == 0) {
// this.currentCompany = d.data.company; // // this.currentCompany = d.data.company;
// this.$store.state.currentCompany = d.data.company; // // this.$store.state.currentCompany = d.data.company;
_this2.switchcompany = d.data.company; // _this2.switchcompany = d.data.company;
_this2.footerInfo = d.data.footerinfo; // _this2.footerInfo = d.data.footerinfo;
_this2.homeobj.initMounted(); // _this2.homeobj.initMounted();
_this2.homeobj.initCreated(); // _this2.homeobj.initCreated();
} // }
}); // });
} else { // } else {
this.switchcompany = null; // this.switchcompany = null;
this.footerInfo = this.pfooterinfo; // this.footerInfo = this.pfooterinfo;
this.homeobj.initMounted(); // this.homeobj.initMounted();
this.homeobj.initCreated(); // this.homeobj.initCreated();
} // }
if (this.$refs.topmenu) { // if (this.$refs.topmenu) {
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxx====="); // console.log("xxxxxxxxxxxxxxxxxxxxxxxxxx=====");
this.$refs.topmenu.fetchMetaData(); // this.$refs.topmenu.fetchMetaData();
} // }
}, // },
mnufunc: function mnufunc(item) { // mnufunc: function mnufunc(item) {
if (this.contextCompany() && this.contextCompany().id != 1) { // if (this.contextCompany() && this.contextCompany().id != 1) {
if (item.code == "siteapply") { // if (item.code == "siteapply") {
return false; // return false;
} else { // } else {
return true; // return true;
} // }
} // }
return true; // return true;
}, // },
goBack: function goBack() { // goBack: function goBack() {
this.pushx({ // this.pushx({
title: "首页", // title: "首页",
name: "/" // name: "/"
}); // });
}, // },
backhome: function backhome() { // backhome: function backhome() {
this.pushx({ // this.pushx({
title: "首页", // title: "首页",
name: "/" // name: "/"
}); // });
this.showtopmenu(); // this.showtopmenu();
}, // },
goadmin: function goadmin() { // goadmin: function goadmin() {
this.isfront = false; // this.isfront = false;
this.pushx({ // this.pushx({
title: "每日概览", // title: "每日概览",
name: "/roleview" // name: "/roleview"
}); // });
}, // },
aboutus: function aboutus() { // aboutus: function aboutus() {
console.log("---------------------------------------"); // console.log("---------------------------------------");
this.pushx({ // this.pushx({
title: "关于我们", // title: "关于我们",
name: "/aboutus" // name: "/aboutus"
}); // });
}, // },
showtabs: function showtabs() { // showtabs: function showtabs() {
$(".maintab .el-tabs__nav-scroll").show(); // $(".maintab .el-tabs__nav-scroll").show();
$(".maintab .el-tabs--border-card > .el-tabs__header").css("border-bottom", "solid 1px #eee"); // $(".maintab .el-tabs--border-card > .el-tabs__header").css("border-bottom", "solid 1px #eee");
}, // },
hidetabs: function hidetabs() { // hidetabs: function hidetabs() {
$(".el-tabs__nav-scroll").hide(); // $(".el-tabs__nav-scroll").hide();
$(".el-tabs--border-card > .el-tabs__header").css("border-bottom", "none"); // $(".el-tabs--border-card > .el-tabs__header").css("border-bottom", "none");
}, // },
localdata: function localdata(key, item) { // localdata: function localdata(key, item) {
if (item) { // if (item) {
localStorage.setItem(key, JSON.stringify(item)); // localStorage.setItem(key, JSON.stringify(item));
} else { // } else {
var strobj = localStorage.getItem(key); // var strobj = localStorage.getItem(key);
if (strobj) { // if (strobj) {
return JSON.parse(strobj); // return JSON.parse(strobj);
} else { // } else {
return null; // return null;
} // }
} // }
}, // },
pushx: function pushx(to) { // pushx: function pushx(to) {
var _this3 = this; // var _this3 = this;
var exittabs = this.editableTabs2.filter(function (tab) { // var exittabs = this.editableTabs2.filter(function (tab) {
return tab.name == to.name; // return tab.name == to.name;
}); //缓存记录最后一次的点击 // }); //缓存记录最后一次的点击
this.localdata("lastaccess", to); //记录当前to到内存,key是路由路径 // this.localdata("lastaccess", to); //记录当前to到内存,key是路由路径
this.localdata(to.name, to); // this.localdata(to.name, to);
if (exittabs.length > 0) { // if (exittabs.length > 0) {
this.editableTabsValue2 = to.name; // this.editableTabsValue2 = to.name;
this.$nextTick(function () { // this.$nextTick(function () {
// this.$router.push(to.name); // // this.$router.push(to.name);
if (to.params) { // if (to.params) {
_this3.$router.push({ // _this3.$router.push({
path: to.name, // path: to.name,
query: to.params // query: to.params
}); // });
} else { // } else {
_this3.$router.push({ // _this3.$router.push({
path: to.name // path: to.name
}); // });
} // }
}); // });
return; // return;
} // }
this.editableTabs2.push({ // this.editableTabs2.push({
title: to.title, // title: to.title,
name: to.name // name: to.name
}); // });
this.editableTabsValue2 = to.name; // this.editableTabsValue2 = to.name;
this.$nextTick(function () { // this.$nextTick(function () {
//this.$router.push(to.name); // //this.$router.push(to.name);
if (to.params) { // if (to.params) {
_this3.$router.push({ // _this3.$router.push({
path: to.name, // path: to.name,
query: to.params // query: to.params
}); // });
} else { // } else {
_this3.$router.push({ // _this3.$router.push({
path: to.name // path: to.name
}); // });
} // }
}); // });
}, // },
showtopmenu: function showtopmenu() { // showtopmenu: function showtopmenu() {
var _this4 = this; // var _this4 = this;
this.isfront = true; // this.isfront = true;
setTimeout(function () { // setTimeout(function () {
_this4.$refs.topmenu.fetchMetaData(); // _this4.$refs.topmenu.fetchMetaData();
}, 100); // }, 100);
}, // },
tabclick: function tabclick(tab) { // tabclick: function tabclick(tab) {
console.log(tab.name); // console.log(tab.name);
console.log(".................................................."); // console.log("..................................................");
console.log(this.currentCodePath); // console.log(this.currentCodePath);
this.editableTabsValue2 = tab.name; //点击页签时,先获取以前的缓存to // this.editableTabsValue2 = tab.name; //点击页签时,先获取以前的缓存to
var tovalue = this.localdata(tab.name); //点击页签时,设置一个全局的环境变量宣称当前的操作为点击页签 // var tovalue = this.localdata(tab.name); //点击页签时,设置一个全局的环境变量宣称当前的操作为点击页签
this.$store.state.istabclick = true; // this.$store.state.istabclick = true;
if (tab.name == "/") { // if (tab.name == "/") {
this.showtopmenu(); // this.showtopmenu();
} // }
if (tab.name == "home") { // if (tab.name == "home") {
this.$router.push("/"); // this.$router.push("/");
} else { // } else {
console.log("================mmmmmmmmmmmmmmmmmmmmmmmmmmmmm==============="); // console.log("================mmmmmmmmmmmmmmmmmmmmmmmmmmmmm===============");
console.log(JSON.stringify(this.editableTabs2)); // console.log(JSON.stringify(this.editableTabs2));
console.log(tab.name); // console.log(tab.name);
if (tovalue) { // if (tovalue) {
if (tovalue.params) { // if (tovalue.params) {
this.$router.push({ // this.$router.push({
path: tovalue.name, // path: tovalue.name,
query: tovalue.params // query: tovalue.params
}); // });
} else { // } else {
this.$router.push({ // this.$router.push({
path: tovalue.name // path: tovalue.name
}); // });
} // }
} else { // } else {
this.$router.push(tab.name); // this.$router.push(tab.name);
} // }
} // }
}, // },
// addTab(to){ // // addTab(to){
// this.editableTabs2.push({ // // this.editableTabs2.push({
// title: to.title, // // title: to.title,
// name: to.name, // // name: to.name,
// }); // // });
// this.editableTabsValue2 = to.name; // // this.editableTabsValue2 = to.name;
// }, // // },
removetab: function removetab(targetName) { // removetab: function removetab(targetName) {
console.log("removeTab"); // console.log("removeTab");
if (targetName != "/home" || targetName != "/") { // if (targetName != "/home" || targetName != "/") {
var tabs = this.editableTabs2; // var tabs = this.editableTabs2;
var activeName = this.editableTabsValue2; // var activeName = this.editableTabsValue2;
if (activeName === targetName) { // if (activeName === targetName) {
tabs.forEach(function (tab, index) { // tabs.forEach(function (tab, index) {
console.log(); // console.log();
if (tab.name === targetName) { // if (tab.name === targetName) {
var nextTab = tabs[index + 1] || tabs[index - 1]; // var nextTab = tabs[index + 1] || tabs[index - 1];
if (nextTab) { // if (nextTab) {
activeName = nextTab.name; // activeName = nextTab.name;
} // }
} // }
}); // });
} // }
this.editableTabsValue2 = activeName; // this.editableTabsValue2 = activeName;
this.editableTabs2 = tabs.filter(function (tab) { // this.editableTabs2 = tabs.filter(function (tab) {
return tab.name !== targetName; // return tab.name !== targetName;
}); // });
this.tabclick({ // this.tabclick({
name: activeName // name: activeName
}); // });
} else { // } else {
return false; // return false;
} // }
}, // },
showMask: function showMask() { // showMask: function showMask() {
var self = this; // var self = this;
setTimeout(function () { // setTimeout(function () {
self.loading = true; // self.loading = true;
}, 10); // }, 10);
}, // },
hideMask: function hideMask() { // hideMask: function hideMask() {
var self = this; // var self = this;
setTimeout(function () { // setTimeout(function () {
self.loading = false; // self.loading = false;
}, 10); // }, 10);
}, // },
refreshLoginState: function refreshLoginState(cbk) { // refreshLoginState: function refreshLoginState(cbk) {
var self = this; //检查登录状态 // var self = this; //检查登录状态
self.checkLogin(function () { // self.checkLogin(function () {
if (cbk) { // if (cbk) {
cbk(); // cbk();
} // }
$("#leftmenudiv").addClass("menutransparent"); //setTimeout(() => { // $("#leftmenudiv").addClass("menutransparent"); //setTimeout(() => {
//$("#leftmenudiv").addClass("menutransparent"); // //$("#leftmenudiv").addClass("menutransparent");
// if (self.$refs.leftmenu) { // // if (self.$refs.leftmenu) {
// self.$refs.leftmenu.fetchMetaData(); // // self.$refs.leftmenu.fetchMetaData();
// } // // }
// if (self.$refs.topmenu) { // // if (self.$refs.topmenu) {
// self.$refs.topmenu.fetchMetaData(); // // self.$refs.topmenu.fetchMetaData();
// } // // }
// }, 100); // // }, 100);
}); // });
}, // },
checkLogin: function checkLogin(cbk) { // checkLogin: function checkLogin(cbk) {
var self = this; // var self = this;
self.postReq("/web/userCtl/checkLogin", {}).then(function (d) { // self.postReq("/web/userCtl/checkLogin", {}).then(function (d) {
console.log("------checkLogin------"); // console.log("------checkLogin------");
console.log(d.data); // console.log(d.data);
if (d && d.status == 0 && d.data.status != -99) { // if (d && d.status == 0 && d.data.status != -99) {
//修改样式header // //修改样式header
self.$store.state.currentUser = d.data; // self.$store.state.currentUser = d.data;
self.currentUser = d.data; // self.currentUser = d.data;
if (d.data.company) { // if (d.data.company) {
self.currentCompany = d.data.company; // self.currentCompany = d.data.company;
self.$store.state.currentCompany = d.data.company; // self.$store.state.currentCompany = d.data.company;
self.bankAccount = d.data.bankAccount; // self.bankAccount = d.data.bankAccount;
self.footerInfo = d.data.footerinfo; // self.footerInfo = d.data.footerinfo;
self.pfooterinfo = d.data.footerinfo; // self.pfooterinfo = d.data.footerinfo;
; // ;
self.$store.state.pfooterinfo = self.footerInfo; // self.$store.state.pfooterinfo = self.footerInfo;
self.serviceqq = "http://wpa.qq.com/msgrd?v=3&uin=" + self.currentCompany.serviceqq + "&site=qq&menu=yes"; // self.serviceqq = "http://wpa.qq.com/msgrd?v=3&uin=" + self.currentCompany.serviceqq + "&site=qq&menu=yes";
if (self.footerInfo) { // if (self.footerInfo) {
self.servicetel = self.footerInfo.serviceTel; // self.servicetel = self.footerInfo.serviceTel;
} else { // } else {
self.servicetel = "请完善客服电话"; // self.servicetel = "请完善客服电话";
} // }
$("#idtitle").text(self.currentCompany.sitename); // $("#idtitle").text(self.currentCompany.sitename);
} // }
if (cbk) { // if (cbk) {
cbk(d.data); // cbk(d.data);
} // }
} else { // } else {
if (d && d.data && d.data.company) { // if (d && d.data && d.data.company) {
self.$store.state.currentUser = null; // self.$store.state.currentUser = null;
self.currentUser = null; // self.currentUser = null;
self.currentCompany = d.data.company; // self.currentCompany = d.data.company;
self.footerInfo = d.data.footerinfo; // self.footerInfo = d.data.footerinfo;
self.pfooterinfo = d.data.footerinfo; // self.pfooterinfo = d.data.footerinfo;
self.$store.state.pfooterinfo = d.data.footerinfo; // self.$store.state.pfooterinfo = d.data.footerinfo;
self.serviceqq = "http://wpa.qq.com/msgrd?v=3&uin=" + self.currentCompany.serviceqq + "&site=qq&menu=yes"; // self.serviceqq = "http://wpa.qq.com/msgrd?v=3&uin=" + self.currentCompany.serviceqq + "&site=qq&menu=yes";
if (self.footerInfo) { // if (self.footerInfo) {
self.servicetel = self.footerInfo.serviceTel; // self.servicetel = self.footerInfo.serviceTel;
} else { // } else {
self.servicetel = "请完善客服电话"; // self.servicetel = "请完善客服电话";
} // }
$("#idtitle").text(self.currentCompany.sitename); // $("#idtitle").text(self.currentCompany.sitename);
} // }
if (d.data.isJump == 1) { // if (d.data.isJump == 1) {
self.$message({ // self.$message({
type: 'error', // type: 'error',
message: '您访问的地址未申请站点或还在审核中,请申请站点或耐心等待.', // message: '您访问的地址未申请站点或还在审核中,请申请站点或耐心等待.',
delay: 5000 // delay: 5000
}); // });
} // }
if (cbk) { // if (cbk) {
cbk(null); // cbk(null);
} // }
} // }
}); // });
}, // },
showLogin: function showLogin() {}, // showLogin: function showLogin() {},
hideLogin: function hideLogin() {}, // hideLogin: function hideLogin() {},
onselect: function onselect(k) { // onselect: function onselect(k) {
console.log(k); // console.log(k);
var self = this; // var self = this;
if (k == "register") { // if (k == "register") {
this.pushx({ // this.pushx({
title: "注册", // title: "注册",
name: "/register" // name: "/register"
}); // });
} // }
if (k == "login") { // if (k == "login") {
this.pushx({ // this.pushx({
title: "登录", // title: "登录",
name: "/login" // name: "/login"
}); // });
} // }
if (k == "roleview") { // if (k == "roleview") {
this.pushx({ // this.pushx({
title: "概况", // title: "概况",
name: "/roleview" // name: "/roleview"
}); // });
} // }
if (k == "exit") { // if (k == "exit") {
this.getReq("/web/userCtl/exit", null).then(function (r) { // this.getReq("/web/userCtl/exit", null).then(function (r) {
self.$store.state.currentUser = null; // self.$store.state.currentUser = null;
self.$nextTick(function () { // self.$nextTick(function () {
window.location.reload(); // window.location.reload();
}); // });
}); // });
} // }
}, // },
onMenuSelect: function onMenuSelect(index) { // onMenuSelect: function onMenuSelect(index) {
var self = this; // var self = this;
console.log("main.........." + index); // console.log("main.........." + index);
console.log("dddddddddddddddddddxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // console.log("dddddddddddddddddddxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
if (index == "/") { // if (index == "/") {
if (this.homeobj && this.currentCompany.id == 1) { // if (this.homeobj && this.currentCompany.id == 1) {
this.homeobj.a = false; // this.homeobj.a = false;
} // }
if (this.homeobj && this.currentCompany.id != 1) { // if (this.homeobj && this.currentCompany.id != 1) {
this.homeobj.moreservice("ip"); // this.homeobj.moreservice("ip");
} // }
} // }
if (index == "home") { // if (index == "home") {
this.editableTabsValue2 = "/"; // this.editableTabsValue2 = "/";
this.$router.push("/"); //this.$router.push({path:"/",query:{"from":"1"}}); // this.$router.push("/"); //this.$router.push({path:"/",query:{"from":"1"}});
} else { // } else {
var title = this.$router.mapTile[index]; // var to=index.substring(1); // var title = this.$router.mapTile[index]; // var to=index.substring(1);
this.pushx({ // this.pushx({
title: title, // title: title,
name: index // name: index
}); // });
} // }
}, // },
formatItem: function formatItem(t, label) { // formatItem: function formatItem(t, label) {
if (t) { // if (t) {
if (!label && t.src) { // if (!label && t.src) {
//表示当前是image元素 // //表示当前是image元素
if (this.currentUser) { // if (this.currentUser) {
return this.currentUser.imgUrl; // return this.currentUser.imgUrl;
} // }
return t.src; // return t.src;
} else { // } else {
return label; // return label;
} // }
} // }
}, // },
getReq: function getReq(path, data) { // getReq: function getReq(path, data) {
var self = this; // var self = this;
return new Promise(function (resv, reject) { // return new Promise(function (resv, reject) {
axios.get(path, { // axios.get(path, {
params: data, // params: data,
"headers": { // "headers": {
"codepath": self.codePath, // "codepath": self.codePath,
"companyid": self.contextCompany() ? self.contextCompany().id : "" // "companyid": self.contextCompany() ? self.contextCompany().id : ""
} // }
}).then(function (r) { // }).then(function (r) {
if (r && r.data && r.data.status == -99) { // if (r && r.data && r.data.status == -99) {
self.$store.state.currentUser = null; // self.$store.state.currentUser = null;
self.hideMask(); // self.$message({ // self.hideMask(); // self.$message({
// type: 'error', // // type: 'error',
// message: '请检查权限.' // // message: '请检查权限.'
// }); // // });
resv(null); // resv(null);
} else { // } else {
if (r.data && r.data.bizmsg && r.data.bizmsg != "empty") { // if (r.data && r.data.bizmsg && r.data.bizmsg != "empty") {
self.$message({ // self.$message({
message: r.data.bizmsg, // message: r.data.bizmsg,
type: 'warning' // type: 'warning'
}); // });
} // }
if (r.data.status < 0) { // if (r.data.status < 0) {
self.$message({ // self.$message({
type: 'error', // type: 'error',
message: r.data.msg // message: r.data.msg
}); // });
} // }
resv(r.data ? r.data : null); // resv(r.data ? r.data : null);
} // }
})["catch"](function (e) { // })["catch"](function (e) {
reject(e); // reject(e);
}); // });
}); // });
}, // },
postReq: function postReq(path, data) { // postReq: function postReq(path, data) {
var self = this; // var self = this;
return axios.post(path, data, { // return axios.post(path, data, {
"headers": { // "headers": {
'codepath': self.codePath, // 'codepath': self.codePath,
"companyid": self.contextCompany() ? self.contextCompany().id : "" // "companyid": self.contextCompany() ? self.contextCompany().id : ""
} // }
}).then(function (r) { // }).then(function (r) {
if (r && r.data && r.data.status == -99) { // if (r && r.data && r.data.status == -99) {
self.$store.state.currentUser = null; // self.$store.state.currentUser = null;
self.hideMask(); // self.$message({ // self.hideMask(); // self.$message({
// type: 'error', // // type: 'error',
// message: '请检查权限.' // // message: '请检查权限.'
// }); // // });
return null; // return null;
} else { // } else {
if (r.data.status < 0) { // if (r.data.status < 0) {
self.$message({ // self.$message({
type: 'error', // type: 'error',
message: r.data.msg // message: r.data.msg
}); // });
} // }
return r.data ? r.data : null; // return r.data ? r.data : null;
} // }
}); // });
} // }
} // }
}); // });
}); // });
}); // });
\ No newline at end of file \ 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