123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- window.onload = function (ev) {
- init();
- }
- init = function () {
- getAttributeInfo();
- }
- getAttributeInfo = function () {
- var parameter = urlEncode(["SelectcountDown"]);
- $.ajax({
- type: "post",
- url: "/new/php/index.php",
- data: {mode: parameter},
- dataType: "json",
- success: function (data) {
- if (data[0].length == 0 || data == -1) {
- var th = '<th colspan="9" scope="col" class="text-c f-20" style="padding: 50px 0;">暂无数据</th>';
- $("#warp").html(th);
- return;
- }
- printAttributeInfo(data);
- console.log(data);
- }
- });
- }
- printAttributeInfo = function (data) {
- var warp = $("#warp"),
- tr,
- href,
- title = "'查看商品信息'";
- warp.html("");
- for (var i = 0; i < data.length; i++) {
- href = "'product-add.html?pid=" + data[i].ProductId + "'";
- tr = $('<tr class="text-c">' +
- '<td>' + data[i].ProductId + '</td>' +
- '<td>' + data[i].ProductRemarks + '</td>' +
- '<td>' + data[i].ProductName + '</td>' +
- '<td>' + data[i].CountDown + '</td>' +
- '<td>' +
- '<a class="btn btn-primary radius td-button" href="/new/goods.html?pid=' + data[i].ProductId + '">查看H5页面</>' +
- '<a class="btn btn-primary radius td-button" onclick="product_add(' + title + ',' + href + ')">查看产品信息</a>' +
- '</td></tr>');
- warp.append(tr);
- }
- $("#loading").css({"display": "none"});
- $("#warp").css({"display": "table-row-group"});
- }
- product_add = function (title, url) {
- var index = layer.open({
- type: 2,
- title: title,
- content: url
- });
- layer.full(index);
- }
- urlEncode = function (arr) {
- var i; //循环初始化
- for (i = 0; i < arr.length; i++) {
- arr[i] = encodeURIComponent(encodeURIComponent(arr[i]));
- }
- return arr.join();
- }
|