删除wap下多余样式

This commit is contained in:
sugar1569 2018-09-30 12:24:11 +08:00
parent df1d3ae2b5
commit aba36446a1
14 changed files with 0 additions and 3547 deletions

View File

@ -1,104 +0,0 @@
function Base64() {
// private property
_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// public method for encoding
this.encode = function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = _utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
}
// public method for decoding
this.decode = function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = _utf8_decode(output);
return output;
}
// private method for UTF-8 encoding
_utf8_encode = function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
}
// private method for UTF-8 decoding
_utf8_decode = function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}

View File

@ -1,127 +0,0 @@
requirejs(['vue','store','helper'],function(Vue,storeApi,$h){
new Vue({
el:"#store-cart",
data:{
validCartList:[],
invalidCartList:[],
totalPrice:0,
checkedAll:true,
changeStatus:false,
loading:false
},
watch:{
validCartList:{
handler:function(){
this.getTotalPrice();
},
deep:true
}
},
methods:{
cartNumTotal:function(){
return this.validCartList.reduce(function(total,cart){
return total+=cart.cart_num;
},0);
},
getStoreUrl:function (cart) {
return $h.U({
c:'store',
a:'detail',
p:{id:cart.productInfo.id}
});
},
cartCount:function(){
return this.getCheckedCart().reduce(function(total,cart){
return total+=cart.cart_num;
},0);
},
checkedAllCart:function(){
var that = this;
var validCartList = this.validCartList.map(function(cart){
if(cart.is_del !== true) cart.checked = that.checkedAll;
});
},
checkedCart:function(cart){
this.checkedAllStatus();
},
checkedAllStatus:function(){
this.checkedAll = this.validCartList.length > 0 && this.getCheckedCart().length == this.validCartList.length;
},
getCheckedCart:function(){
return this.validCartList.filter(function(cart){
return cart.is_del != true && cart.checked == true;
});
},
getTotalPrice:function(){
this.totalPrice = this.getCheckedCart().reduce(function(total,cart){
return $h.Add(total,$h.Mul(cart.cart_num,cart.truePrice));
},0);
},
getCartList:function(){
var that = this;
storeApi.getCartList(function(cartGroup){
cartGroup.valid.map(function(cart){
cart.checked = true;
cart.is_del = false;
});
that.checkedAll = cartGroup.valid.length > 0;
that.validCartList = cartGroup.valid;
that.invalidCartList = cartGroup.invalid;
that.loading = true;
});
},
getAttrValues:function (cart) {
return cart.productInfo.attrInfo == undefined ? '' : '属性:'+cart.productInfo.attrInfo.suk;
},
changeCartNum:function(cart,index,changeNum){
var num = +cart.cart_num + changeNum;
if(num <= 0) num = 1;
if(num > cart.trueStock){
$h.pushMsgOnce('该商品库存不足'+num);
num = cart.trueStock;
}
if(cart.cart_num != num){
storeApi.changeCartNum(cart.id,num);
cart.cart_num = num;
this.$set(this.validCartList,index,cart);
}
},
removeCart:function(){
var ids = [],validCartList = [];
this.validCartList.map(function(cart){
if(cart.checked){
cart.is_del = true;
ids.push(cart.id);
}else{
validCartList.push(cart);
}
});
if(ids.length) storeApi.removeCart(ids);
this.$set(this,'validCartList',validCartList);
this.$nextTick(function(){
this.checkedAllStatus();
this.changeStatus = false;
});
},
submitCart:function(){
var ids = this.getCheckedCart().map(function(cart){
return cart.id;
});
if(!ids.length) return false;
location.href = $h.U({
c:'store',
a:'confirm_order',
p:{cartId:ids}
});
},
removeInvalidCart:function(cart,index){
storeApi.removeCart([cart.id]);
this.invalidCartList.splice(index,1);
}
},
mounted:function(){
this.getCartList();
}
})
});

View File

@ -1,54 +0,0 @@
(function(global,factory){
typeof define == 'function' && define([],factory);
})(this,function() {
return {
style:'.tmp-wrapper .tmp-container{z-index:99;position:fixed;left:0;bottom:0;width:100%;background-color:#fff;-webkit-transform:translate3d(0,110%,0);transform:translate3d(0,110%,0);-webkit-transition:all .5s ease;transition:all .5s ease}.tmp-wrapper .tmp-container .title{height: 1.06rem;line-height: 1.06rem;color:#1d1d1d;font-size:.26rem;text-align:center;border-bottom:1px solid #eee}.tmp-wrapper .tmp-container .title span{color: #666;font-size: .2rem;}.tmp-wrapper .tmp-container .tmp-main .item{position:relative;padding:0 .2rem;height:.75rem;border-bottom:1px solid #eee;-webkit-box-pack:justify;-o-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-o-box-align:center;-ms-flex-align:center;align-items:center}.tmp-wrapper .tmp-container .tmp-main .item .input-box{width:4.2rem}.tmp-wrapper .tmp-container .tmp-main .item .input-box input::-webkit-input-placeholder{color:#ccc}.tmp-wrapper .tmp-container .tmp-main .item .address-icon{position:absolute;right:.2rem;top:50%;display:inline-block;width:.25rem;height:.35rem;margin-top:-.175rem;background-image:url(../images/add-icon.png);background-size:100% 100%}.tmp-wrapper .tmp-container .tmp-main .item .selected{position:relative;height:100%}.tmp-wrapper .tmp-container .tmp-main .item .selected input{display:none}.tmp-wrapper .tmp-container .tmp-main .item .selected .icon{position:absolute;left:-.16rem;top:50%;margin:-.18rem 0 0 -.18rem;display:inline-block;width:18px;height:18px;border:1px solid #cdcdcd;border-radius:50%}.tmp-wrapper .tmp-container .submit-btn{width:100%;height:.77rem;margin-top:.3rem}.tmp-wrapper .tmp-container .submit-btn button{display:block;width:100%;height:100%;color:#fff;background-color:#e3383e}.tmp-wrapper .tmp-container.up{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.tmp-container .tmp-main .item.on{background-image: url(/public/wap/crmeb/images/enter01.png);color: #e52800;background-size: .22rem auto;background-repeat: no-repeat;background-position: 95% center;}.tmp-wrapper .close{position: absolute;right: .2rem;top: .2rem;background-image: url(/public/wap/sx/images/mtw-close.png);width: .3rem;height: .3rem;background-size: 100% 100%;}',
template:'<div class="refund-reason tmp-wrapper" v-cloak=""><div class="model-bg" :class="{on:show == true}" @click="show = false" @touchmove.prevent></div><div class="tmp-container" :class="{up:show == true}" @touchmove.prevent><div class="title"><p>请选择退款原因</p></div><div class="tmp-main"><div class="item flex" :class="{on:selectIndex == index}" v-for="(msg,index) in reason" @click="selectIndex = index"><span>{{msg}}</span></div></div><div class="submit-btn"><button type="submit" @click="select">提交</button></div><div class="close" @click="show = false"></div></div></div>',
install:function (Vue) {
this.factory(Vue);
},
factory:function (Vue) {
var that = this;
$f = Vue.extend({
template:this.template,
data:function () {
return {
show:false,
reason:[
'收货地址填错了',
'大小尺寸与描述不符',
'颜色、款式、图案描述不符合',
'尺寸拍错不喜欢、效果不好',
'收到商品破损',
'未按约定时间发货',
'商品质量问题'
],
selectIndex:-1,
selectFn:function(){}
};
},
watch:{
show:function (n) {
if(!n)this.selectIndex = -1;
}
},
methods:{
select:function () {
if(this.selectIndex < 0) return false;
this.selectFn && this.selectFn(this.reason[this.selectIndex]);
this.show = false;
}
}
});
$vm = new $f().$mount();
document.body.appendChild($vm.$el);
var styleDom = document.createElement('style');
styleDom.innerHTML = that.style;
document.head.appendChild(styleDom);
Vue.prototype.$orderRefundReason = function (opt) {
$vm.show = true;
if(opt !== undefined) $vm.selectFn = opt;
}
}
}
});

View File

@ -1,477 +0,0 @@
(function(global,factory){
typeof define == 'function' && define('store',['axios','helper'],factory);
})(this,function(axios,$h){
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
return {
baseGet:function(url,successCallback,errorCallback){
axios.get(url).then(function(res){
if(res.status == 200 && res.data.code == 200){
successCallback && successCallback(res);
}else{
var err = res.data.msg || '请求失败!';
errorCallback && errorCallback(err);
$h.pushMsgOnce(err)
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsgOnce(err)
});
},
basePost:function(url,data,successCallback,errorCallback){
axios.post(url,data).then(function(res){
if(res.status == 200 && res.data.code == 200){
successCallback && successCallback(res);
}else{
var err = res.data.msg || '请求失败!';
errorCallback && errorCallback(err);
$h.pushMsgOnce(err)
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsgOnce(err)
});
},
setCart:function(opt,successCallback,errorCallback){
axios.get($h.U({
c:"auth_api",
a:"set_cart",
p:opt
})).then(function(res){
if(res.status == 200 && res.data.code == 200)
successCallback && successCallback();
else{
var error = res.data.msg || '加入购物车失败!';
errorCallback && errorCallback(error);
$h.pushMsg(error);
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsg(err);
});
},
goBuy:function(opt,successCallback,errorCallback){
axios.get($h.U({
c:"auth_api",
a:"now_buy",
p:opt
})).then(function(res){
if(res.status == 200 && res.data.code == 200)
successCallback && successCallback(res.data.data.cartId);
else{
var error = res.data.msg || '订单生成失败!';
errorCallback && errorCallback(error);
$h.pushMsg(error);
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsg(err);
});
},
addBargainShare:function(opt,successCallback,errorCallback){
axios.get($h.U({
c:"auth_api",
a:"add_bargain_share",
p:opt
})).then(function(res){
}).catch(function(err){
});
},
likeProduct:function(productId,category,successCallback,errorCallback) {
axios.get($h.U({
c:"auth_api",
a:"like_product",
p:{productId:productId,category:category}
})).then(function(res){
if(res.status == 200 && res.data.code == 200){
successCallback && successCallback(res.data);
}else{
var error = res.data.msg || '点赞失败!';
errorCallback && errorCallback(error);
$h.pushMsg(error);
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsg(err)
});
},
bargainFriends:function(bargain,successCallback,errorCallback){
this.basePost($h.U({
c:'auth_api',
a:'set_bargain_help'
}),bargain,successCallback,errorCallback)
},
unlikeProduct:function(productId,category,successCallback,errorCallback) {
axios.get($h.U({
c:"auth_api",
a:"unlike_product",
p:{productId:productId,category:category}
})).then(function(res){
if(res.status == 200 && res.data.code == 200){
successCallback && successCallback(res.data);
}else{
var error = res.data.msg || '取消点赞失败!';
errorCallback && errorCallback(error);
$h.pushMsg(error);
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsg(err)
});
},
collectProduct(productId,category,successCallback,errorCallback){
axios.get($h.U({
c:'auth_api',
a:'collect_product',
p:{productId:productId,category:category}
})).then(function(res){
if(res.status == 200 && res.data.code == 200){
successCallback && successCallback(res.data);
}else{
var error = res.data.msg || '收藏失败!';
errorCallback && errorCallback(error);
$h.pushMsg(error);
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsg(err)
});
},
unCollectProduct(productId,category,successCallback,errorCallback){
axios.get($h.U({
c:'auth_api',
a:'uncollect_product',
p:{productId:productId,category:category}
})).then(function(res){
if(res.status == 200 && res.data.code == 200){
successCallback && successCallback(res.data);
}else{
var error = res.data.msg || '取消收藏失败!';
errorCallback && errorCallback(error);
$h.pushMsg(error);
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsg(err)
});
},
getCartNum:function(callback){
axios.get($h.U({
c:'auth_api',
a:'get_cart_num'
})).then(function(res){
if(res.status == 200 && res.data.code == 200){
callback && callback(res.data.data);
}else{
callback && callback(0);
}
}).catch(function(){
callback && callback(0);
});
},
changeCartNum:function(cartId,cartNum,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'change_cart_num',
p:{cartId:cartId,cartNum:cartNum}
}),successCallback,errorCallback);
},
getCartList:function(successCallback,errorCallback){
axios.get($h.U({
c:'auth_api',
a:'get_cart_list'
})).then(function(res){
if(res.status == 200 && res.data.code == 200){
successCallback && successCallback(res.data.data,res.data);
}else{
var error = res.data.msg || '获取购物车数据失败!';
errorCallback && errorCallback(error);
$h.pushMsg(error);
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsg(err)
});
},
removeCart:function(cartId,successCallback,errorCallback){
axios.get($h.U({
c:'auth_api',
a:'remove_cart',
p:{ids:cartId}
})).then(function(res){
if(res.status == 200 && res.data.code == 200){
successCallback && successCallback(res.data.data,res.data);
}else{
var error = res.data.msg || '删除失败!';
errorCallback && errorCallback(error);
$h.pushMsg(error);
}
}).catch(function(err){
errorCallback && errorCallback(err);
$h.pushMsg(err)
});
},
getUseCoupon:function(successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'get_use_coupon'
}),successCallback,errorCallback);
},
getArticleList:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'public_api',
a:'get_cid_article',
p:p
}),successCallback,errorCallback)
},
getVideoList:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'public_api',
a:'get_video_list',
p:p
}),successCallback,errorCallback)
},
getCollectProduct:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'get_user_collect_product',
p:p
}),successCallback,errorCallback)
},
removeCollectProduct:function(productId,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'remove_user_collect_product',
p:{productId:productId}
}),successCallback,errorCallback)
},
editUserAddress:function(addressInfo,successCallback,errorCallback){
this.basePost($h.U({
c:'auth_api',
a:'edit_user_address'
}),addressInfo,successCallback,errorCallback)
},
getUserDefaultAddress:function(successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'user_default_address'
}),successCallback,errorCallback)
},
setUserDefaultAddress:function(addressId,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'set_user_default_address',
p:{addressId:addressId}
}),successCallback,errorCallback)
},
removeUserAddress:function(addressId,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'remove_user_address',
p:{addressId:addressId}
}),successCallback,errorCallback)
},
submitOrder:function(key,order,successCallback,errorCallback){
this.basePost($h.U({
c:'auth_api',
a:'create_order',
p:{key:key}
}),order,successCallback,errorCallback)
},
getUserOrderList:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'get_user_order_list',
p:p
}),successCallback,errorCallback);
},
removeUserOrder:function(uni,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'user_remove_order',
p:{uni:uni}
}),successCallback,errorCallback);
},
payOrder:function(uni,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'pay_order',
p:{uni:uni}
}),successCallback,errorCallback);
},
orderApplyRefund:function(uni,text,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'apply_order_refund',
p:{uni:uni,text:text}
}),successCallback,errorCallback);
},
orderDetails:function(uni,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'order_details',
p:{uni:uni}
}),successCallback,errorCallback);
},
userTakeOrder:function(uni,successCallback,errorCallback) {
this.baseGet($h.U({
c:'auth_api',
a:'user_take_order',
p:{uni:uni}
}),successCallback,errorCallback);
},
getProductCategory:function(successCallback,errorCallback) {
this.baseGet($h.U({
c:'auth_api',
a:'get_product_category'
}),successCallback,errorCallback);
},
userCommentProduct:function(unique,data,successCallback,errorCallback){
this.basePost($h.U({
c:'auth_api',
a:'user_comment_product',
p:{unique:unique}
}),data,successCallback,errorCallback)
},
getSpreadList:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'get_spread_list',
p:p
}),successCallback,errorCallback);
},
getProductList:function(search,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'get_product_list',
p:search
}),successCallback,errorCallback);
},
getUserBalanceList:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'user_balance_list',
p:p
}),successCallback,errorCallback);
},
getUserIntegralList:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'user_integral_list',
p:p
}),successCallback,errorCallback);
},
getProductReply:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'product_reply_list',
p:p
}),successCallback,errorCallback);
},
getUserAddress:function(successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'user_address_list'
}),successCallback,errorCallback);
},
getProductAttr:function(productId,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'product_attr_detail',
p:{productId:productId}
}),successCallback,errorCallback);
},
userWechatRecharge:function(price,successCallback,errorCallback) {
this.baseGet($h.U({
c:'auth_api',
a:'user_wechat_recharge',
p:{price:price}
}),successCallback,errorCallback);
},
getNoticeList:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'get_notice_list',
p:p
}),successCallback,errorCallback);
},
seeNotice: function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'see_notice',
p:p
}),successCallback,errorCallback);
},
getIssueCouponList:function(limit,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'get_issue_coupon_list',
p:{limit:limit}
}),successCallback,errorCallback);
},
getCategoryProductList:function(limit,successCallback,errorCallback){
this.baseGet($h.U({
c:'public_api',
a:'get_category_product_list',
p:{limit:limit}
}),successCallback,errorCallback);
},
getBestProductList:function(p,successCallback,errorCallback){
this.baseGet($h.U({
c:'public_api',
a:'get_best_product_list',
p:p
}),successCallback,errorCallback);
},
userGetCoupon:function(couponId,successCallback,errorCallback){
this.baseGet($h.U({
c:'auth_api',
a:'user_get_coupon',
p:{couponId:couponId}
}),successCallback,errorCallback);
},
isLogin:function(){
return $h.getCookie('is_login') == 1;
},
goLogin:function(){
if(!this.isLogin()){
$h.pushMsg('未登录,立即登陆',function(){
location.href = $h.U({
c:'login',
a:'index',
p:{ref:window.btoa(unescape(encodeURIComponent( location.href )))}
});
});
return false;
}
return true;
},
wechatUploadImg:function(wxApi,count,successCallback,errorCallback){
wxApi.chooseImage({count:count,sizeType:['compressed']},function(localIds){
$h.prompt('图片上传中...');
wxApi.uploadImage(localIds,function(serverIds){
axios.get($h.U({
c:"public_api",
a:"wechat_media_id_by_image",
p:{mediaIds:serverIds}
})).then(function(result){
$h.promptClear();
if(result.status == 200 && result.data.code == 200)
return Promise.resolve(result.data.data);
else
return Promise.reject('上传失败!');
}).then(function(picList){
if(!picList) return Promise.reject('请选择上传图片!');
successCallback && successCallback(picList);
}).catch(function(err){
$h.promptClear();
$h.pushMsgOnce(err);
errorCallback && errorCallback(err);
});
})
});
}
}
});

View File

@ -1,15 +0,0 @@
(function(global,factory){
typeof define == 'function' && define(['better-scroll'],factory)
})(this,function(BScroll){
return {
install:function(Vue){
Vue.prototype.$scrollLoad = function(dom,loadFn){
var scroll = new BScroll(dom,{click:true,probeType:1,cancelable:false,deceleration:0.005,snapThreshold:0.01});
scroll.on('pullingUp',function(){
loadFn && loadFn(scroll.finishPullUp,scroll.refresh);
});
return scroll;
};
}
}
});

View File

@ -1,187 +0,0 @@
(function (global,factory) {
typeof define && define.amd && define(['vue'],factory);
})(this,function(Vue){
var template = '<div class=shop-card>' +
'<div class=model-bg :class="{on:show == true}" @click=close @touchmove.prevent>' +
'</div>' +
'<div class=card-model :class="{up:show == true}">' +
'<div class=cm-header @touchmove.prevent>' +
'<div class=header-product>' +
'<img :src=product.image>' +
'</div>' +
'<div class=header-info>' +
'<p class=money>' +
'¥<i v-text=product.price></i>' +
'</p>' +
'<span class=stock>' +
'库存<i v-text=product.stock></i>' +
'件</span>' +
'</div>' +
'</div>' +
'<div class="amount clearfix" @touchmove.prevent>' +
'<div class="text fl">购买数量</div>' +
'<div class="count fr">' +
'<div @click=descCartNum>-</div>' +
'<input type=number v-model=cartNum readonly disabled style="-webkit-text-fill-color: #666;-webkit-opacity:1; opacity: 1;">' +
'<div @click=incCartNum>+</div>' +
'</div>' +
'</div>' +
'<div class=model-footer @touchmove.prevent>' +
'<a class=footer-buy href="javascript:void(0);" v-if="buy == true" v-show="product.stock > 0" @click=goBuy>' +
'立即秒杀' +
'</a>' +
'<a class="footer-buy no" href="javascript:void(0);" v-show="!product.stock || product.stock <= 0">' +
'无货' +
'</a>' +
'</div>' +
'<div class=model-close @click=close>' +
'</div>' +
'</div>' +
'</div>';
var shopCard = Vue.extend({
template:template,
props:{
onShow:Function,
onClose:Function,
onChange:Function,
onBuy:Function,
onCart:Function,
cart:{
type:Boolean,
default:true
},
buy:{
type:Boolean,
default:true
},
product:{
type:Object,
default:function(){
return {
image:'',
price:'',
stock:0
}
}
},
attrList:{
type:Array,
default:function (){
return [];
}
},
show:Boolean
},
data:function(){
return {
cartNum:1
}
},
watch:{
cartNum:function(v){
if(this.product.stock <= 0) this.cartNum = 0;
else if(v > this.product.stock) this.cartNum = this.product.stock;
else if(v < 1) this.cartNum = 1;
},
attrList:{
handler:function (v) {
this.$nextTick(function(){
this.onChange && this.onChange(this.getCheckedValue());
})
},
deep:true
},
product:function(){
this.cartNum = 1;
}
},
methods:{
changeProduct:function(product){
this.product = product;
},
getCheckedValue:function(){
return this.attrList.map(function(attr){
return attr.checked;
});
},
close:function(){
this.show = false;
this.onClose && this.onClose();
},
active:function(){
this.show = true;
this.onShow && this.onShow();
},
incCartNum:function(){
if(this.product.num <= this.cartNum){
$h.pushMsg('每次购买数量不能超过'+this.product.num+'个')
this.cartNum = this.product.num;
}else{
this.cartNum+=1;
}
},
descCartNum:function(){
this.cartNum-=1;
},
changeChecked:function(value,attr,index){
attr.checked = value;
this.$set(this.attrList,index,attr);
},
goCart:function(){
if(this.cartNum > this.product.stock || this.cartNum <= 0) return false;
this.onCart && this.onCart(this.getCheckedValue(),this.cartNum,this.product) == true && this.init();
},
goBuy:function(){
if(this.cartNum > this.product.stock || this.cartNum <= 0) return false;
this.onBuy && this.onBuy(this.getCheckedValue(),this.cartNum,this.product) == true && this.init();
},
init:function(){
var that = this;
this.attrList.map(function(attr,index){
attr.checked = attr.attr_values[0];
that.$set(that.attrList,index,attr);
});
this.cartNum = this.product.stock >=1 ? 1 : 0;
},
_setData:function(opt){
this.product = opt.product;
this.attrList = opt.attrList == undefined ? [] : opt.attrList;
this.onChange = opt.onChange;
this.onClose = opt.onClose;
this.onCart = opt.onCart;
this.onBuy = opt.onBuy;
this.cart = opt.cart == undefined ? true : opt.cart;
this.buy = opt.buy == undefined ? true : opt.buy;
this.init();
}
},
mounted:function(){
var that = this;
this.init();
this.$el.reload = function(){
that.init();
};
}
});
shopCard.install = function(Vue){
Vue.prototype.$shopCard = function(opt){
var $vm = new shopCard().$mount(),$el = $vm.$el;
document.body.appendChild($el);
$vm._setData(opt);
$vm.remove = function(){
document.body.removeChild($el);
};
this.$nextTick(function(){
setTimeout(function(){
opt.show == true && $vm.active();
},0);
});
return $vm;
};
};
return shopCard;
});

View File

@ -1,144 +0,0 @@
(function (global,factory) {
typeof define && define.amd && define(['vue'],factory);
})(this,function(Vue){
var template = '<div class=shop-card><div class=model-bg :class="{on:show == true}" @click=close @touchmove.prevent></div><div class=card-model :class="{up:show == true}"><div class=cm-header @touchmove.prevent><div class=header-product><img :src=product.image></div><div class=header-info><p class=money>¥<i v-text=product.price></i></p><span class=stock>库存<i v-text=product.stock></i>件</span><p class=tips v-show="attrList.length > 0">请选择属性</p></div></div><div id=selects-wrapper class=selects-info v-show="attrList && attrList.length > 0"><div class=scroll><div class=cm-selects v-for="(attr,index) in attrList"><h1>{{attr.attr_name}}</h1><div class="options option-color"><span v-for="value in attr.attr_values" :class="{on:attr.checked == value}" @click="changeChecked(value,attr,index)">{{value}}</span></div></div></div></div><div class="amount clearfix" @touchmove.prevent><div class="text fl">购买数量</div><div class="count fr"><div @click=descCartNum>-</div><input type=number v-model=cartNum readonly><div @click=incCartNum>+</div></div></div><div class=model-footer @touchmove.prevent><a class=footer-car href="javascript:void(0);" v-if="cart == true" v-show="product.stock > 0" @click=goCart>加入购物车</a><a class=footer-buy href="javascript:void(0);" v-if="buy == true" v-show="product.stock > 0" @click=goBuy>立即购买</a><a class="footer-buy no" href="javascript:void(0);" v-show="!product.stock || product.stock <= 0">无货</a></div><div class=model-close @click=close></div></div></div>';
var shopCard = Vue.extend({
template:template,
props:{
onShow:Function,
onClose:Function,
onChange:Function,
onBuy:Function,
onCart:Function,
cart:{
type:Boolean,
default:true
},
buy:{
type:Boolean,
default:true
},
product:{
type:Object,
default:function(){
return {
image:'',
price:'',
stock:0
}
}
},
attrList:{
type:Array,
default:function (){
return [];
}
},
show:Boolean
},
data:function(){
return {
cartNum:1
}
},
watch:{
cartNum:function(v){
if(this.product.stock <= 0) this.cartNum = 0;
else if(v > this.product.stock) this.cartNum = this.product.stock;
else if(v < 1) this.cartNum = 1;
},
attrList:{
handler:function (v) {
this.$nextTick(function(){
this.onChange && this.onChange(this.getCheckedValue());
})
},
deep:true
},
product:function(){
this.cartNum = 1;
}
},
methods:{
changeProduct:function(product){
this.product = product;
},
getCheckedValue:function(){
return this.attrList.map(function(attr){
return attr.checked;
});
},
close:function(){
this.show = false;
this.onClose && this.onClose();
},
active:function(){
this.show = true;
this.onShow && this.onShow();
},
incCartNum:function(){
this.cartNum+=1;
},
descCartNum:function(){
this.cartNum-=1;
},
changeChecked:function(value,attr,index){
attr.checked = value;
this.$set(this.attrList,index,attr);
},
goCart:function(){
if(this.cartNum > this.product.stock || this.cartNum <= 0) return false;
this.onCart && this.onCart(this.getCheckedValue(),this.cartNum,this.product) == true && this.init();
},
goBuy:function(){
if(this.cartNum > this.product.stock || this.cartNum <= 0) return false;
this.onBuy && this.onBuy(this.getCheckedValue(),this.cartNum,this.product) == true && this.init();
},
init:function(){
var that = this;
this.attrList.map(function(attr,index){
attr.checked = attr.attr_values[0];
that.$set(that.attrList,index,attr);
});
this.cartNum = this.product.stock >=1 ? 1 : 0;
},
_setData:function(opt){
this.product = opt.product;
this.attrList = opt.attrList == undefined ? [] : opt.attrList;
this.onChange = opt.onChange;
this.onClose = opt.onClose;
this.onCart = opt.onCart;
this.onBuy = opt.onBuy;
this.cart = opt.cart == undefined ? true : opt.cart;
this.buy = opt.buy == undefined ? true : opt.buy;
this.init();
}
},
mounted:function(){
var that = this;
this.init();
this.$el.reload = function(){
that.init();
};
}
});
shopCard.install = function(Vue){
Vue.prototype.$shopCard = function(opt){
var $vm = new shopCard().$mount(),$el = $vm.$el;
document.body.appendChild($el);
$vm._setData(opt);
$vm.remove = function(){
document.body.removeChild($el);
};
setTimeout(function(){
opt.show == true && $vm.active();
},300);
return $vm;
};
};
return shopCard;
});

View File

@ -1,96 +0,0 @@
(function(global,factory){
typeof define == 'function' && define(['store','helper'],factory);
})(this,function(storeApi,$h){
var template = '<div><div><div class="model-bg":class="{on:show == true}" @touchmove.prevent @click="close"></div><div class="card-model addres-select":class="{up:show == true}"><div class="cm-header">收货地址</div><div class="empty" v-show="addressList.length == 0" @touchmove.prevent> <img src="/public/wap/crmeb/images/empty_address.png"><p>&nbsp;</p></div><div id="selects-wrapper"class="selects-info"><ul><li class="flex"v-for="item in addressList":class="{on:checkedAddressId == item.id}"@click="selectAddress(item)"><div class="select-icon"></div><div class="user-info"><p><span class="name"v-text="item.real_name"> </span> <span class="tel"v-text="item.phone"></span></p><p class="address-info"v-text="addressText(item)"></p></div><a class="edit"@click="goEdit(item.id)"href="javascript:void(0);"></a></li></ul></div><div class="model-footer"><a class="footer-buy"href="javascript:void(0);" @click="goAdd">添加新地址</a></div></div></div></div>';
return {
factory:function(Vue){
return Vue.extend({
template:template,
props:{
checkedAddressId:{
type:Number,
default:function(){return 0;}
},
onSelect:{
type:Function
},
onClose:{
type:Function
},
onShow:{
type:Function
},
show:Boolean
},
data:function(){
return {
addressList:[]
}
},
methods:{
goEdit:function(addressId){
location.href = $h.U({
c:'my',
a:'edit_address',
p:{addressId:addressId}
});
},
goAdd:function(){
location.href = $h.U({
c:'my',
a:'edit_address'
});
},
getUserAddress:function(){
var that = this;
storeApi.getUserAddress(function(res){
that.addressList = res.data.data;
});
},
addressText:function(address){
return address.province+address.city+address.district+address.detail
},
close:function(){
this.show = false;
this.onClose && this.onClose();
},
remove:function(){
var that = this;
setTimeout(function(){
that.$el.remove();
},600);
},
active:function(){
this.show = true;
this.onShow && this.onShow();
},
selectAddress:function(address){
this.close();
this.onSelect && this.onSelect(address.id,address);
},
init:function(opt){
if(!opt) opt = {};
if(typeof opt.onClose == 'function') this.onClose = opt.onClose;
if(typeof opt.onSelect == 'function') this.onSelect = opt.onSelect;
if(typeof opt.onShow == 'function') this.onShow = opt.onShow;
if(opt.checked != undefined) this.checkedAddressId = opt.checked;
}
},
mounted:function(){
vm = this;
this.getUserAddress();
}
});
},
install:function(Vue){
var useAddress = this.factory(Vue);
var $vm = new useAddress().$mount(),$el = $vm.$el;
document.body.appendChild($el);
Vue.prototype.$useAddress = function(opt){
$vm.init(opt);
$vm.active();
};
}
}
});

View File

@ -1,77 +0,0 @@
(function(global,factory){
typeof define == 'function' && define(['store'],factory);
})(this,function(storeApi){
var template = '<div><div class="model-bg" @touchmove.prevent :class="{on:isShow == true}" @click="close"></div><div class="card-model" :class="{up:isShow == true}" style="height: 72%;"><div style="position: absolute;left: 0px;top: -2px;width: 100%;height: 0.7rem;background-color: rgb(255, 255, 255);z-index: 99;padding-left: .3rem;line-height: .7rem;">请选择优惠劵<div style="top: 50%;margin-top: -.2rem;" class="model-close" @click="close"></div></div><div class="empty" v-show="couponList.length == 0" @touchmove.prevent> <img src="/public/wap/crmeb/images/empty_coupon.png"><p>暂无可用优惠劵</p></div><div v-show="couponList.length > 0" id="selects-wrapper" class="discount-list" style="height: 100%; overflow-y: scroll;padding-top: .7rem;padding-bottom: .2rem;-webkit-overflow-scrolling : touch; " @touchmove.stop><div style="margin-top: 0" class="list-box"><ul><li class="new" :class="{use:coupon._type == 0 || minPrice < coupon.use_min_price}" v-for="coupon in couponList" @click="select(coupon)"><div class="txt-info"><div class="con-cell"><p>满{{coupon.use_min_price}}元可用现金券</p><span>{{coupon._add_time}}至{{coupon._end_time}}使用</span></div></div><div class="price"><span>¥</span>{{coupon.coupon_price}}<p><a href="javascript:void(0);" v-if="coupon._type == 0">{{coupon._msg}}</a><a href="javascript:void(0);" v-if="coupon._type != 0">{{minPrice< coupon.use_min_price ? "无法使用" : "立即使用"}}</a></p></div><span class="text-icon" v-show="coupon._type == 2"></span></li></ul></div></div></div></div>';
return {
factory:function(Vue){
return Vue.extend({
name:'use-coupon',
template:template,
props:{
onClose:Function,
onSelect:Function,
onShow:Function,
},
data:function(){
return {
couponList:[],
isShow:false,
minPrice:0
};
},
methods:{
getCouponList:function(){
var that = this;
storeApi.getUseCoupon(function(res){
that.couponList = res.data.data;
});
},
select:function(coupon){
if(this.minPrice < coupon.use_min_price) return ;
this.onSelect && this.onSelect(coupon);
this.close();
},
active:function(){
this.isShow = true;
this.onShow && this.onShow();
},
close:function(){
this.isShow = false;
this.onClose && this.onClose();
},
init:function(minPrice,opt){
if(!opt) opt = {};
if(!minPrice) minPrice = 0;
if(typeof opt.onClose == 'function') this.onClose = opt.onClose;
if(typeof opt.onSelect == 'function') this.onSelect = opt.onSelect;
if(typeof opt.onShow == 'function') this.onShow = opt.onShow;
this.minPrice = minPrice;
}
},
mounted:function(){
this.getCouponList();
}
});
},
install:function(Vue){
var that = this;
Vue.prototype.$useCoupon = function(minPrice,opt){
var useCoupon = that.factory(Vue);
var $vm = new useCoupon().$mount(),$el = $vm.$el;
document.body.appendChild($el);
$vm.init(minPrice,opt);
$vm.remove = function(){
setTimeout(function(){
document.body.removeChild($el);
},600);
};
return {
remove:$vm.remove,
active:$vm.active,
close:$vm.close
};
};
}
}
});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,531 +0,0 @@
var page=1; //分页
var moban_time=0; //全局时间戳
var bq_h=".png"; //表情格式后缀
var load_over = false; //是否加载完聊天记录
/******************全局方法*********************/
//提示框弹出
function ts(html){
//获取垂直居中的px
$(".prompt p").html(html)
$(".prompt").fadeIn();
}
//提示框关闭
function ts_no(){
$(".prompt").fadeOut();
}
//ajax获取当前指定页聊天记录
function ajax_get_list(page){
ts("正在拉取<b>"+to_unickname+"</b>的记录");
var query = new Object();
query.uid = uid;
query.to_uid = to_uid;
query.page = page;
query.mer_id = mer_id;
$.ajax({
type:"post",
url:"/wap/auth_api/get_msn",
data:query,
dataType:"json",
async:true,
success: function(data){
if(data.code == 200 && data.data.length > 0){
//取原高度
jili=$(".kj").height();
html = moban_msn(data.data);
$(".duihua").prepend(html);
//更新滚动距离
conter(jili);
}else{
load_over = true;
}
//关闭提示框
ts_no();
}
});
}
//发送添加消息
function add_msn(msn,type){
var query = new Object();
query.uid = uid;
query.to_uid = to_uid;
query.msn = msn;
query.type = type;
query.mer_id = mer_id;
$.ajax({
type:"post",
url:"/wap/auth_api/add_msn",
data:query,
dataType:"json",
async:true,
success: function(data){
//合成我的消息
if(type == "html")
json_msn(msn);
else
json_msn($('<div>').text(msn).html());
}
});
}
//页面刷新消息显示
function refresh_msn(){
var query = new Object();
query.uid = uid;
query.to_uid = to_uid;
query.mer_id = mer_id;
$.ajax({
type:"post",
url:"/wap/auth_api/refresh_msn",
data:query,
dataType:"json",
async:true,
success: function(data){
if(data.code == 200 && data.data.length > 0){
html = moban_msn(data.data);
$(".duihua").append(html);
bottom();
}
}
});
}
//聊天显示时间处理
function timedate(sdate,type){
//取今天0点时间戳
today = new Date();
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
today.setMilliseconds(0);
today=Date.parse(today);
//时间戳计算
var oneday = 1000 * 60 * 60 * 24;
//取昨天0点
tooday=today-oneday;
//取前天0点
toooday=today-oneday*2;
//取7天0点
tooooday=today-oneday*7;
//js的时间戳和php的时间戳少4位
sdate=parseInt(sdate)*1000;
d=new Date(sdate);
if(sdate > today){//判断是否在今天内
res = moment(d).format('ah:mm');
}
if(sdate < today){//判断是否是昨天
res = moment(d).format('昨天 ah:mm');
if(type == 1)
res="昨天";
}
if(sdate < tooday){//判断是否昨天前 显示前天
res = moment(d).format('前天 ah:mm');
if(type == 1)
res="前天";
}
if(sdate < toooday){//判断是否前天前 显示星期
res = moment(d).format('dddd ah:mm');
if(type == 1)
res=moment(d).format('dddd');
}
if(sdate < tooooday){//判断是否7天前
res = moment(d).format('YYYY年M月D日 ah:mm');
if(type == 1)
res=moment(d).format('YY/M/D');
}
res =res.replace("am", "上午");
res =res.replace("pm", "下午");
res =res.replace("Sunday", "星期天");
res =res.replace("Saturday", "星期六");
res =res.replace("Monday", "星期一");
res =res.replace("Tuesday", "星期二");
res =res.replace("Wednesday", "星期三");
res =res.replace("Thursday", "星期四");
res =res.replace("Friday", "星期五");
return res;
}
/******************全局方法*********************/
//点击发送消息
function msn_add(){
if($("#msn").val() != ""){
//取消息
msn=$("#msn").val();
//编辑框清空
$("#msn").val("");
//添加信息
add_msn(msn,"auto");
}
}
//合成我的消息json
function json_msn(msn){
msn=msn.replace(/(^\s*)|(\s*$)/g,"");
if(msn !== ""){
var obj = new Object();
obj.my = "my";
obj.msn = msn;
obj.add_time = moment().format('X');
data = "["+JSON.stringify(obj)+"]";
// data='[{"my":"my","msn":"'+msn+'","add_time":"'+moment().format('X')+'"}]';
html = moban_msn(JSON.parse(data));
$(".duihua").append(html);
bottom();
}
}
//表情替换模版
function moban_bq(name){
jc=0;
var moj = new Array();
moj['阿'] = 1;
moj['唉'] = 2;
moj['拜拜'] = 3;
moj['板砖拍你'] = 4;
moj['暴走'] = 5;
moj['悲伤'] = 6;
moj['鼻出血'] = 7;
moj['别逼我'] = 8;
moj['不高兴'] = 9;
moj['崇拜'] = 10;
moj['出发'] = 11;
moj['打你'] = 12;
moj['打肿'] = 13 ;
moj['大哭'] = 14 ;
moj['大喷血'] = 15;
moj['大笑'] =16 ;
moj['发呆'] =17 ;
moj['愤怒'] = 18;
moj['感觉真好'] = 19;
moj['哈哈'] = 20;
moj['害羞'] = 21;
moj['好困'] = 22;
moj['好冷'] = 23;
moj['好美'] =24 ;
moj['好色'] = 25;
moj['黑客'] =26 ;
moj['怀疑'] =27 ;
moj['坏淫'] =28 ;
moj['惊讶'] = 29;
moj['可爱'] = 30;
moj['可怜'] =31 ;
moj['老大'] =32 ;
moj['流口水'] = 33;
moj['妈呀'] =34 ;
moj['你懂得'] =35 ;
moj['牛B'] = 36;
moj['亲亲'] =37 ;
moj['确定'] = 38;
moj['塞饭'] = 39;
moj['神阿'] = 40;
moj['生气'] =41 ;
moj['受伤'] = 42;
moj['说唱'] = 43;
moj['偷看'] =44 ;
moj['投降'] =45 ;
moj['无奈'] = 46;
moj['咽气'] =47 ;
moj['郁闷'] =48 ;
moj['找炮轰'] = 49;
moj[ '真臭'] =50;
moj['蜘蛛侠'] = 51;
moj['自信'] = 52;
moj['做梦'] = 53;
while(jc==0){
shou=name.indexOf("[");
wei=name.indexOf("]");
if(shou > -1 && wei > -1){
temp=name.substring(shou,wei+1);
bq_name=temp.replace("[", "");
bq_name=bq_name.replace("]", "");
html='<img class="express" src="'+bq_m+moj[bq_name]+bq_h+'" title="'+bq_name+'" >';
name=name.replace(temp,html);
}else{
jc=1;
}
}
return name;
}
//对话窗口模版
function moban_duihua(){
if(mer_id > 0)
$(".kj").html('<div class="duihua" style="padding-top: 45px;"></div>');
else
$(".kj").html('<div class="duihua"></div>');
var html= '<div class="msn">'+
'<div class="msn_k">'+
'<i class="express_icon"></i>'+
'<i class="img_icon"></i>'+
'<b onclick="msn_add()">发送</b>'+
'<span>'+
'<input type="text" id="msn" placeholder="请输入要发送的消息">'+
'</span>'+
'</div>'+
'<div class="biaoqing">'+
'<ul>'+
'<li>'+
'<span>'+
'<div>'+moban_bq("[大笑]")+'</div>'+
'<div>'+moban_bq("[哈哈]")+'</div>'+
'<div>'+moban_bq("[感觉真好]")+'</div>'+
'<div>'+moban_bq("[拜拜]")+'</div>'+
'<div>'+moban_bq("[害羞]")+'</div>'+
'<div>'+moban_bq("[亲亲]")+'</div>'+
'<div>'+moban_bq("[可爱]")+'</div>'+
'<div>'+moban_bq("[阿]")+'</div>'+
'<div>'+moban_bq("[唉]")+'</div>'+
'<div>'+moban_bq("[悲伤]")+'</div>'+
'<div>'+moban_bq("[鼻出血]")+'</div>'+
'<div>'+moban_bq("[别逼我]")+'</div>'+
'<div>'+moban_bq("[不高兴]")+'</div>'+
'<div>'+moban_bq("[崇拜]")+'</div>'+
'<div>'+moban_bq("[出发]")+'</div>'+
'<div>'+moban_bq("[打你]")+'</div>'+
'<div>'+moban_bq("[打肿]")+'</div>'+
'<div>'+moban_bq("[大哭]")+'</div>'+
'<div>'+moban_bq("[大喷血]")+'</div>'+
'<div>'+moban_bq("[发呆]")+'</div>'+
'<div>'+moban_bq("[愤怒]")+'</div>'+
'</span>'+
'</li>'+
'<li>'+
'<span>'+
'<div>'+moban_bq("[好困]")+'</div>'+
'<div>'+moban_bq("[好冷]")+'</div>'+
'<div>'+moban_bq("[好美]")+'</div>'+
'<div>'+moban_bq("[好色]")+'</div>'+
'<div>'+moban_bq("[黑客]")+'</div>'+
'<div>'+moban_bq("[怀疑]")+'</div>'+
'<div>'+moban_bq("[坏淫]")+'</div>'+
'<div>'+moban_bq("[惊讶]")+'</div>'+
'<div>'+moban_bq("[可怜]")+'</div>'+
'<div>'+moban_bq("[老大]")+'</div>'+
'<div>'+moban_bq("[流口水]")+'</div>'+
'<div>'+moban_bq("[妈呀]")+'</div>'+
'<div>'+moban_bq("[你懂得]")+'</div>'+
'<div>'+moban_bq("[牛B]")+'</div>'+
'<div>'+moban_bq("[确定]")+'</div>'+
'<div>'+moban_bq("[塞饭]")+'</div>'+
'<div>'+moban_bq("[神阿]")+'</div>'+
'<div>'+moban_bq("[生气]")+'</div>'+
'<div>'+moban_bq("[受伤]")+'</div>'+
'<div>'+moban_bq("[投降]")+'</div>'+
'<div>'+moban_bq("[偷看]")+'</div>'+
'</span>'+
'</li>'+
'<li>'+
'<span>'+
'<div>'+moban_bq("[无奈]")+'</div>'+
'<div>'+moban_bq("[咽气]")+'</div>'+
'<div>'+moban_bq("[郁闷]")+'</div>'+
'<div>'+moban_bq("[找炮轰]")+'</div>'+
'<div>'+moban_bq("[真臭]")+'</div>'+
'<div>'+moban_bq("[做梦]")+'</div>'+
'<div>'+moban_bq("[自信]")+'</div>'+
'<div>'+moban_bq("[暴走]")+'</div>'+
'<div>'+moban_bq("[板砖拍你]")+'</div>'+
'<div>'+moban_bq("[说唱]")+'</div>'+
'<div>'+moban_bq("[蜘蛛侠]")+'</div>'+
'</span>'+
'</li>'+
'</ul>'+
'</div>'+
'</div>';
$(".kj").after(html);
if(mer_id > 0){
var html = '<div class="title">';
html += '<a href="javascript:history.back(-1);" class="title-back"></a>';
html += '<div class="title-text">'+mer_name+'</div>';
html += '<a class="title-go" href="/wap/merchant/index/mid/'+mer_id+'.html">进店</a>';
html += '</div>';
$(".kj").before(html);
}
}
//对话窗口所用的js
function moban_duihua_js(){
//当按下回车时,发送消息
$("#msn").keyup(function(){
if(event.keyCode == 13){
$(".msn_k b").trigger("click");
}
});
//打开表情窗口
$(".msn i.express_icon").click(function(){
$(".biaoqing").show();
$(".duihua").css("padding-bottom","190px");
bottom();
});
//当点击其它区域时 关闭表情窗口
$("#msn,.msn_k b,.duihua").click(function(){
$(".biaoqing").hide();
$(".duihua").css("padding-bottom","60px");
})
//表情轮播
var slidey=$('.biaoqing').unslider({
delay: false,
dots: true
});
sliden = slidey.data('unslider');
//表情滑动
$(".biaoqing ul").swipe({
swipeStatus:function(event, phase, direction, distance, duration,fingerCount) {
if(direction == "left")//手指按住向左 表情跟随
$(this).css({"margin-left":"-"+distance+"px"});
if(direction == "right")//手指按住向右 表情跟随
$(this).css({"margin-left":distance+"px"});
if(phase == "cancel" || phase == "end"){//停止时
if(distance > 50){//滑动像素大于 30
$(this).css({"margin-left":"0"});
if(direction == "left") //向左滑动
sliden.next();
if(direction == "right") //向右滑动
sliden.prev();
}
else{
$(this).animate({marginLeft:"0"},300);
}
}
},
});
//表情滑动
$(".biaoqing ul").swipe({
swipeStatus:function(event, phase, direction, distance, duration,fingerCount) {
if(direction == "left")//手指按住向左 表情跟随
$(this).css({"margin-left":"-"+distance+"px"});
if(direction == "right")//手指按住向右 表情跟随
$(this).css({"margin-left":distance+"px"});
if(phase == "cancel" || phase == "end"){//停止时
if(distance > 50){//滑动像素大于 30
$(this).css({"margin-left":"0"});
if(direction == "left") //向左滑动
sliden.next();
if(direction == "right") //向右滑动
sliden.prev();
}
else{
$(this).animate({marginLeft:"0"},300);
}
}
},
});
//表情滑动
$(".biaoqing ul").swipe({
swipeStatus:function(event, phase, direction, distance, duration,fingerCount) {
if(direction == "left")//手指按住向左 表情跟随
$(this).css({"margin-left":"-"+distance+"px"});
if(direction == "right")//手指按住向右 表情跟随
$(this).css({"margin-left":distance+"px"});
if(phase == "cancel" || phase == "end"){//停止时
if(distance > 50){//滑动像素大于 30
$(this).css({"margin-left":"0"});
if(direction == "left")//向左滑动
sliden.next();
if(direction == "right")//向右滑动
sliden.prev();
}
else{
$(this).animate({marginLeft:"0"},300);
}
}
},
});
//点击表情添加
$(".biaoqing ul li span div img").swipe({
click:function(){
title=$(this).attr("title");//取在title标签中的内容
$("#msn").val($("#msn").val()+"["+title+"]");
}
});
page=1; //初始化分页
ajax_get_list(page); //首次加载聊天记录
$(window).scroll(function() {
//console.log($(window).scrollTop());
if ($(window).scrollTop() <= 0 && !load_over) {
page++;//更新分页
ajax_get_list(page);//加载此分页聊天记录
}
});
// $(".duihua").bind('swipeone',function(){
// alert("zhixing!");
// if ($(window).scrollTop() <= 0) {
// page++;//更新分页
// ajax_get_list(page);//加载此分页聊天记录
// }
// });
}
//消息模版
function moban_msn(data){
var html = "";
for(var i=0;i<data.length;i++){
//根据主从取头像
if(data[i].my == "my")
tou = uavatar;
else
tou = to_uavatar;
//对比时间戳
temptime=data[i].add_time - moban_time;
//超过60秒的信息就显示时间
if(Math.abs(temptime) > 60){
html +='<div class="time"><p>'+timedate(data[i].add_time,0)+'</p></div>';
//更新全局时间戳
moban_time=data[i].add_time;
}
//模版开始
html +='<div class="'+data[i].my+'hua">'+
'<div class="tou">'+
'<img src="'+tou+'">'+
'</div>'+
'<i class="ci_ico"></i>'+
'<div class="ci">'+moban_bq(data[i].msn)+'</div>'+
'</div>';
}
return html;
}
//滚动到底部
function bottom(){
$('html,body').animate({scrollTop:$(".kj").height()}, 500);
}
//顶上有新记录时,要滚动到以前的顶部距离
function conter(jili){
//取没更新的距离 减更新过的距离,就是要滚动到的高度
$conter_jili=$(".kj").height()-jili
$(document).scrollTop($conter_jili);
}

View File

@ -1,195 +0,0 @@
/**
* Unslider by @idiot
*/
(function($, f) {
// If there's no jQuery, Unslider can't work, so kill the operation.
if(!$) return f;
var Unslider = function() {
// Set up our elements
this.el = f;
this.items = f;
// Dimensions
this.sizes = [];
this.max = [0,0];
// Current inded
this.current = 0;
// Start/stop timer
this.interval = f;
// Set some options
this.opts = {
speed: 500,
delay: 3000, // f for no autoplay
complete: f, // when a slide's finished
keys: !f, // keyboard shortcuts - disable if it breaks things
dots: f, // display ••••o• pagination
fluid: f // is it a percentage width?,
};
// Create a deep clone for methods where context changes
var _ = this;
this.init = function(el, opts) {
this.el = el;
this.ul = el.children('ul');
this.max = [el.outerWidth(), el.outerHeight()];
this.items = this.ul.children('li').each(this.calculate);
// Check whether we're passing any options in to Unslider
this.opts = $.extend(this.opts, opts);
// Set up the Unslider
this.setup();
return this;
};
// Get the width for an element
// Pass a jQuery element as the context with .call(), and the index as a parameter: Unslider.calculate.call($('li:first'), 0)
this.calculate = function(index) {
var me = $(this),
width = me.outerWidth(), height = me.outerHeight();
// Add it to the sizes list
_.sizes[index] = [width, height];
// Set the max values
if(width > _.max[0]) _.max[0] = width;
if(height > _.max[1]) _.max[1] = height;
};
// Work out what methods need calling
this.setup = function() {
// Set the main element
this.el.css({
overflow: 'hidden',
width: _.max[0],
height: this.items.first().outerHeight()
});
// Set the relative widths
this.ul.css({width: (this.items.length * 100) + '%', position: 'relative'});
this.items.css('width', (100 / this.items.length) + '%');
if(this.opts.delay !== f) {
this.start();
this.el.hover(this.stop, this.start);
}
// Custom keyboard support
this.opts.keys && $(document).keydown(this.keys);
// Dot pagination
this.opts.dots && this.dots();
// Little patch for fluid-width sliders. Screw those guys.
if(this.opts.fluid) {
var resize = function() {
_.el.css('width', Math.min(Math.round((_.el.outerWidth() / _.el.parent().outerWidth()) * 100), 100) + '%');
};
resize();
$(window).resize(resize);
}
if(this.opts.arrows) {
this.el.parent().append('<p class="arrows"><span class="prev">←</span><span class="next">→</span></p>')
.find('.arrows span').click(function() {
$.isFunction(_[this.className]) && _[this.className]();
});
};
// Swipe support
if($.event.swipe) {
this.el.on('swipeleft', _.prev).on('swiperight', _.next);
}
};
// Move Unslider to a slide index
this.move = function(index, cb) {
// If it's out of bounds, go to the first slide
if(!this.items.eq(index).length) index = 0;
if(index < 0) index = (this.items.length - 1);
var target = this.items.eq(index);
var obj = {height: target.outerHeight()};
var speed = cb ? 5 : this.opts.speed;
if(!this.ul.is(':animated')) {
// Handle those pesky dots
_.el.find('.dot:eq(' + index + ')').addClass('active').siblings().removeClass('active');
this.el.animate(obj, speed) && this.ul.animate($.extend({left: '-' + index + '00%'}, obj), speed, function(data) {
_.current = index;
$.isFunction(_.opts.complete) && !cb && _.opts.complete(_.el);
});
}
};
// Autoplay functionality
this.start = function() {
_.interval = setInterval(function() {
_.move(_.current + 1);
}, _.opts.delay);
};
// Stop autoplay
this.stop = function() {
_.interval = clearInterval(_.interval);
return _;
};
// Keypresses
this.keys = function(e) {
var key = e.which;
var map = {
// Prev/next
37: _.prev,
39: _.next,
// Esc
27: _.stop
};
if($.isFunction(map[key])) {
map[key]();
}
};
// Arrow navigation
this.next = function() { return _.stop().move(_.current + 1) };
this.prev = function() { return _.stop().move(_.current - 1) };
this.dots = function() {
// Create the HTML
var html = '<ol class="dots">';
$.each(this.items, function(index) { html += '<li class="dot' + (index < 1 ? ' active' : '') + '">' + (index + 1) + '</li>'; });
html += '</ol>';
// Add it to the Unslider
this.el.addClass('has-dots').append(html).find('.dot').click(function() {
_.move($(this).index());
});
};
};
// Create a jQuery plugin
$.fn.unslider = function(o) {
var len = this.length;
// Enable multiple-slider support
return this.each(function(index) {
// Cache a copy of $(this), so it
var me = $(this);
var instance = (new Unslider).init(me, o);
// Invoke an Unslider instance
me.data('unslider' + (len > 1 ? '-' + (index + 1) : ''), instance);
});
};
})(window.jQuery, false);