绑定 , 再也不怕忘记账号密码 已成功绑定 我的历史 我的消息 意见反馈 关于我们
退出

亲爱的,真的要离我而去吗~

确定 取消

MIP.util.platform.start() if(window.location.origin != 'https://m.happymh.com'){ MIP.setData({sys:{isHost:false}}); } MIP.setData({"sys":{"linkType":"html"}}) var storage = MIP.util.customStorage(0); var user = storage.get("_u"); var uBookcase = storage.get("_bc"); var uHistory = storage.get("_ht"); var bc_time = storage.get("_bc_time"); if(user !== null){ user = JSON.parse(user) uBookcase = JSON.parse(uBookcase) uHistory = JSON.parse(uHistory) MIP.setData({"user":{"detail":user,"uHistory":uHistory ? uHistory : [],"uBookcase": uBookcase ? uBookcase : [],"bc_time":bc_time}}); } MIP.watch('user.changeTime', function (newVal, oldVal) { if(newVal !== 0){ var user = MIP.getData("user"); var detail = user.detail; var bookcase = user.uBookcase; var history = user.uHistory; storage.set("_u",JSON.stringify(detail)); storage.set("_bc",JSON.stringify(bookcase)); storage.set("_ht",JSON.stringify(history)); storage.set("_bc_time",user.bc_time); } }) MIP.watch('user.action', function (newVal, oldVal) { if(newVal === 'exit'){ var expireOld = new Date((new Date()).getTime() - 24 * 3600000 * 365); var host = location.host; var mainHost = host.replace('m.', ''); document.cookie = "sf_token=; expires=" + expireOld+"; Path=/ ; domain="+mainHost; document.cookie = "sf_token=; expires=" + expireOld+"; Path=/"; storage.clear(); } }) MIP.watch('sys.toastMsg.visible', function (newVal, oldVal) { var toastConfig = MIP.getData("sys.toastMsg"); if(newVal === true){ setTimeout(function(){ MIP.setData({sys:{toastMsg:{visible:false}}}) },toastConfig.timeout) } }) var user = MIP.getData("user"); if(Object.keys(user.detail).length == 0 || user.detail.type == 0){ MIP.setData({"hasLogin":false}); }else{ MIP.setData({"hasLogin":true,"cover": user.detail.cover}); if(user.detail.social_site !== 'facebook'){ MIP.setData({"showBind": true}) }else{ MIP.setData({"showHasBind": true}) } } if(Object.keys(user.detail).length > 0){ var formData = new FormData(); fetch('https://m.happymh.com/apis/u/noticeCount', { 'method':'post' }).then(function(res){ return res.json(); }).then(function(response){ if(response.data.num > 0){ MIP.setData({hasNew: true}); } }).catch(function(error){ MIP.setData({sys:{toastMsg:{content:error.message,visible:true}}}); }) } MIP.watch('cover', function (newVal, oldVal) { var user = MIP.getData('user'); if(newVal !== user.detail.cover){ var formData = new FormData(); formData.append('token',user.detail.token); formData.append('cover',newVal); fetch('https://m.happymh.com/apis/u/uCover', { 'method':'post', 'body':formData }).then(function(res){ return res.json(); }).then(function(data){ if(data.status){ MIP.setData({sys:{toastMsg:{content:data.msg,visible:true}}}); }else{ MIP.setData({user:{changeTime:11,detail:{cover:newVal}}}); MIP.setData({sys:{toastMsg:{content:'头像变更成功',visible:true}}}); } }).catch(function(error){ MIP.setData({sys:{toastMsg:{content:error.message,visible:true}}}); }) } })