h5-cli
Version:
hello
88 lines (73 loc) • 2.65 kB
JavaScript
"use strict";
//define(function (require, exports, module) {
define(function (require, exports, module) {
var VModule = require("component/VModule");
var page = VModule.render({
init: function init() {
if (!this.query.corpId) {
this.util.alert("\u7f3a\u5c11corpId");
}
this.id = this.query.id || "";
this.corpSelected = this.query.selected;
this.state = {
loading: true
};
this.module = this.initModule(this.state, '#J_Page');
this.get("/user-web/restapi/common/corp/corpHome", {
corpId: this.corpId
});
},
onSuccess: function onSuccess(result) {
var data = result.data;
var corpId = this.corpId;
var headerImage = null;
var corpName = null;
var tag = null;
try {
headerImage = result.data.banners ? result.data.banners[0].img : "";
//"http://s.yuantutech.com/i4/8fb394296c4b1959665c3bf4c2be2370-480-296.png"
corpName = result.data.name;
tag = result.data.tags ? result.data.tags[0] : "";
} catch (e) {
console.log(e);
console.log("\u6570\u636e\u9519\u8bef");
}
this.setState({
loading: false,
success: true,
logo: data.logo,
corpId: data.corpId || this.corpId,
leafList: data.leafList,
headerImage: headerImage,
corpName: corpName,
tag: tag,
tags: data.tags,
address: data.address,
funcions: data.funcions,
noticeTitle: data.noticeTitle,
noticeId: data.noticeId,
corpInfo: data.corpInfo,
phone: data.corpPhone
});
},
render: function render(state) {
var corpName = state.corpName,
tags = state.tags,
address = state.address,
logo = state.logo,
corpId = state.corpId,
noticeTitle = state.noticeTitle,
noticeId = state.noticeId,
phone = state.phone,
corpInfo = state.corpInfo;
return "\n\t\t\t\t<div class=\"corp-info ui-border-tb\">\n\t\t <div class=\"logo\" style=\"background-image:url(" + logo + ")\"></div>\n\t\t <h1>" + corpName + "</h1>\n\t\t <div class=\"tags\">\n\t\t\t\t\t\t" + tags.map(function (tag) {
return "<span>" + tag + "</span>";
}).join("") + "\n\t\t\t\t\t</div>\n\t\t <div class=\"address\">" + address + "</div>\n\t\t </div>\n\t\t <div class=\"corp-des module ui-border-tb\">" + corpInfo + "</div>\n\t\t\t";
},
renderError: function renderError(state) {
return "\n\t\t\t\t<section class=\"ui-notice\">\n\t\t\t\t\t<i></i>\n\t\t\t\t\t<div class=\"ui-tips\">" + (state.msg || "\u65e0\u6cd5\u83b7\u53d6\u533b\u9662\u6570\u636e\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5") + "</div>\n\t\t\t\t</section>\n\t\t\t";
}
});
page.init();
module.exports = page;
});