| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- Namespace.register("Couple");//注册命名空间
- Couple.Bind=function () {
- var userName=$(".userName")[0]//获取用户名
- var ul = $(".asideMenu ul")[0];//获取项目列表ul
- var asideMenu = $(".asideMenu")[0];
- var informationtInfo = $(".informationtInfo")[0];//获取反馈信息
- var informationtTime = $(".informationtTime")[0];//获取反馈时间
- userName.innerText = document.URL.split('?')[1].split("=")[1];
- U.A.Request("http://cd.1473.cn/net",["db.1473.cn", "UseStudio_FeedBack", "GetProductByUserId",U.UF.Cookie.get("usestudiosso","userid")[0]],function (r){//获取项目列表
- for(var i=0;i<r.value.length;i++){
- var li=$$("li", {
- "className": "asideItem","productId":r.value[i].FeedbackId
- }, ul);
- var a=$$("a", {}, li);
- var icon=$$("span", {
- "className": "icon icon-times icon-2x",
- }, a);
- var span=$$("span", {
- "className": "asideItemText","innerText":r.value[i].ProductName
- }, a);
- ul.onclick = function(ev) {//点击项目列表
- ev = ev || event;
- var target = ev.target || ev.srcElement;
- var productId = target.parentNode.parentElement.productId;
- if(informationtTime.firstChild==null){
- Couple.createInfo(productId)
- }else{
- informationtInfo.removeChild(informationtInfo.firstChild);
- informationtTime.removeChild(informationtTime.firstChild);
- Couple.createInfo(productId)
- }
- Couple.OnclickTime=function(id,time){//点击时间对应获取信息
- U.A.Request("http://cd.1473.cn/net",["db.1473.cn","UseStudio_FeedBack","GetCouple",id,time],function (r){//获取产品的反馈信息
- if(informationtInfo.firstChild==null){}else{
- informationtInfo.removeChild(informationtInfo.firstChild);
- informationtTime.removeChild(informationtTime.firstChild);
- Couple.createInfo(productId)
- }
- var tbody = $$("tbody", {//创建表格
- "className": "tbMain",
- }, informationtInfo);
- var tr = $$("tr", {}, tbody);
- var td = $$("td", {
- "className":"infoTitle","innerText":"排序"
- }, tr);
- var td = $$("td", {
- "className":"infoTitle trTitle","innerText":"标题"
- }, tr);
- var td = $$("td", {
- "className":"infoTitle trContent","innerText":"内容",
- }, tr);
- var td = $$("td", {
- "className":"infoTitle trCoupleTime","innerText":"反馈时间"
- }, tr);
- var td = $$("td", {}, tr);
- for(var i=0;i<r.value.length;i++){
- var trow = Couple.getDataRow(r.value[i],i+1);
- tbody.appendChild(trow);
- }
-
- })
- }
- };
- }
- })
- }
- Couple.createInfo=function(productId){
- var informationtTime = $(".informationtTime")[0]//获取反馈时间
- Date.prototype.Format = function (fmt) {//时间处理对Date的扩展
- var o = {
- "M+": this.getMonth() + 1, // 月份
- "d+": this.getDate(), // 日
- "h+": this.getHours(), // 小时
- "m+": this.getMinutes(), // 分
- "s+": this.getSeconds(), // 秒
- "q+": Math.floor((this.getMonth() + 3) / 3), // 季度
- "S": this.getMilliseconds() // 毫秒
- };
- if (/(y+)/.test(fmt))
- fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- }
- var time = (new Date()).Format("yyyy-MM-dd hh:mm:ss");//获取时间
- var timeSequence=$$("div", {
- "className": "timeSequence"
- }, informationtTime);
- var oneDay=$$("button", {
- "className": "timeItem","innerText":"今天","onclick":"Couple.OnclickTime('"+productId+"','today')"
- }, timeSequence);
- var threeDay=$$("button", {
- "className": "timeItem","innerText":"最近三天","onclick":"Couple.OnclickTime('"+productId+"','3days')"
- }, timeSequence);
- var oneWeek=$$("button", {
- "className": "timeItem","innerText":"最近一周","onclick":"Couple.OnclickTime('"+productId+"','7days')"
- }, timeSequence)
- var oneMonth=$$("button", {
- "className": "timeItem","innerText":"最近一月","onclick":"Couple.OnclickTime('"+productId+"','30days')"
- }, timeSequence)
- }
- Couple.logout=function(){//退出
- U.UF.CD.loadAjaxCrossDomain(function(){
- U.A.Request(US.AUTH, ["UserOffline", U.UF.Cookie.get("usestudiosso","userid")[0]],function(r){
- window.location.href="http://couple.1473.cn/login.html";
- });
- });
- }
- Couple.getDataRow = function(h,i){//创建表格下的行放数据库循环数据
- var row = document.createElement('tr');
- var sortCell = document.createElement('td');
- sortCell.innerText = i;
- row.appendChild(sortCell);
- var trTitle = document.createElement('td');
- trTitle.setAttribute('class','trTitle');
- trTitle.innerText = h.FeedbackName;
- row.appendChild(trTitle);
- var trContent = document.createElement('td');
- trContent.setAttribute('class','trContent');
- trContent.innerText = h.FeedbackContent;
- row.appendChild(trContent);
- var trCoupleTime = document.createElement('td');
- trCoupleTime.setAttribute('class','trCoupleTime');
- trCoupleTime.innerText = U.UF.D.getYearMonthDay(h.FeedbackTime)
- row.appendChild(trCoupleTime);
- //每行末尾添加删除按钮
- var delCell = document.createElement('td');
- delCell.setAttribute('class','trDel');
- row.appendChild(delCell);
- var btnDel = document.createElement('input');
- btnDel.setAttribute('type','button');
- btnDel.setAttribute('value','删除');
- btnDel.setAttribute('class','delectInfo');
- btnDel.onclick=function(){ //删除操作
- if(confirm("确定删除这一行嘛?")){
- this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
- }
- U.A.Request("http://cd.1473.cn/net",["db.1473.cn", "UseStudio_FeedBack", "DeleteCouple",h.FeedbackId],function (r){})
- }
- delCell.appendChild(btnDel);
- return row;
- }
- Couple.Init=function () {
- var asideMenu = $(".asideMenu")[0];
- Couple.Bind();
- window.onscroll = function(){
- var scrollTop = document.documentElement.scrollTop;
- if(scrollTop>=1){
- asideMenu.style.top = "0";
- }else{
- asideMenu.style.top = "70px";
- }
- }
- }();
|