h5-cli
Version:
hello
81 lines (64 loc) • 2.79 kB
JavaScript
"use strict";
define(function (require, exports, module) {
var PageModule = require("component/PageModule");
var page = PageModule.render({
init: function init() {
this.unionId = this.query.unionId;
//\u9009\u62e9\u5730\u5740
this.selectView = this.query.selectView;
this.countPatient = 0;
var self = this;
// alert( document.cookie )
//\u68c0\u67e5\u767b\u5f55
if (!this.checkLogin()) {
return;
};
this.get("/user-web/restapi/video/getAllAddress", {
corpId: this.query.corpId || this.corpId
});
},
regEvent: function regEvent() {
var self = this;
$('#J_List .J_Item').click(function (e) {
e.preventDefault();
var addressid = $(this).attr("data-addressid");
var registerData = self.cache.getCacheModule("yuantu-address");
registerData.set("addressid", addressid);
// alert(2)
// if( self.util.isInYuantuApp() ){
// //\u5982\u679c\u662f \u8fdc\u56fe app \u5c31\u628a\u503c\u901a\u8fc7 jsbrige\u8fd4\u56de\u5230\u4e0a\u4e00\u4e2a\u754c\u9762
// self.util.brige("pushDataToParent",{
// autoBack:true,
// data:JSON.stringify({
// addressid:addressid
// })
// });
// }else{
self.util.goBack();
// }
});
},
onSuccess: function onSuccess(result) {
// console.log( result )
// alert( result.data.length )
$('#J_Page').removeClass("wait");
$('#J_List').html(this.render(result.data));
//\u5982\u679c\u662f\u4ece\u5f53\u524d\u754c\u9762\u9009\u62e9\u60a3\u8005 \u90a3\u4e48\u5bf9list item \u8fdb\u884ca\u6807\u7b7e\u70b9\u51fb\u62e6\u622a
if (this.selectView) {
this.regEvent();
}
},
render: function render(list) {
var _this = this;
if (list && list.length) {
return "<ul class=\"ui-list ui-list-text ui-list-link ui-border-tb\">\n " + list.map(function (item) {
return "<li class=\"ui-border-t\">\n <a href=\"add-address.html?" + _this.util.flat({ id: item.id, target: "_blank" }) + "\" data-addressid=\"" + item.id + "\" class=\"J_Item\">\n <h4>" + item.recipient + " " + item.phone + "</h4>\n <div class=\"ui-txt-info\">" + item.address + " " + (item.postcode || "") + "</div>\n </a>\n </li>";
}).join("") + "\n </ul>";
} else {
return "<section class=\"ui-notice\" >\n <i></i>\n <p>\u8FD8\u6CA1\u6709\u6536\u83B7\u5730\u5740</p>\n </section>";
}
}
});
page.init();
module.exports = page;
});