Authored by lore-w

意见反馈

framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -6,28 +6,22 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload'),
Swiper = require('yoho.iswiper');
//导航
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content');
var $curContainer = $favContainer.children('.fav-type').first();//保存当前显示的$favContainer
var favTabHammer;
//轮播图
var $swiperList = $('.swiper-container'),
swiperArray = [],
swiperObj = {};
//lazyLoad();
$favContainer = $('.fav-content'),
$curContainer = $favContainer.children('.fav-type').first(),
$swiperList = $('.swiper-container'),
swiperObj = {},
favTabHammer,
favContentHammer;
favTabHammer = new Hammer(document.getElementById('fav-tab'));
favTabHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
index;
index,
id,
i;
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
... ... @@ -42,9 +36,10 @@ favTabHammer.on('tap', function(e) {
$curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide');
if (index === 1) {
//导航
for (var i = 0; i < $swiperList.length; i++) {
var id = $swiperList.eq(i).attr('data-id');
for (i = 0; i < $swiperList.length; i++) {
id = $swiperList.eq(i).attr('data-id');
swiperObj[id] = new Swiper('#swiper-container-' + id, {
slidesPerView: 'auto',
grabCursor: true,
... ... @@ -57,3 +52,31 @@ favTabHammer.on('tap', function(e) {
}
});
//删除收藏的商品
favContentHammer = new Hammer(document.getElementById('fav-content'));
favContentHammer.on('tap', function (e) {
var id = '';
if ($(e.target).hasClass('del-fav')) {
id = $(e.target).closest('li').attr('data-id');
$.ajax({
method: 'post',
url: '/home/favoriteDel',
data: {
id: id
}
}).then(function (data) {
if (data.code === 200) {
$(e.target).closest('li').remove();
}
}).fail(function () {
//TODO
});
}
});
\ No newline at end of file
... ...
... ... @@ -7,21 +7,59 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
Handlebars = require('yoho.handlebars');
var $uploadImgList = $('.upload-img-list'),
headerNavHammer,
imgTpl,
template;
require('./jquery.uploadifive');
$('#upload-img').uploadifive({
auto: true,
buttonClass: 'nav-btn',
fileType: 'image/*',
fileType: 'image*/*',
uploadScript: '/home/suggestimgUpload',
fileObjName: 'fileData',
fileSizeLimit: 1024,
onAddQueueItem: function (file) {
console.log(file);
height: '100%',
width: '100%',
onAddQueueItem: function (files) {
//TODO
},
onQueueComplete: function (file) {
console.log(file);
onUploadComplete: function (file, data) {
$uploadImgList.html(template(data));
}
});
imgTpl = '{{# imgList}}' +
'<li><img src="{{imgUrl}}" /></li>' +
'{{/ imgList}}';
template = Handlebars.compile(imgTpl);
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
headerNavHammer.on('tap', function (e) {
var suggestText = $('#suggest-textarea').val();
if ($(e.target).hasClass('nav-btn')) {
$.ajax({
method: 'post',
url: '/home/savesuggest',
data: {
content: suggestText
}
}).then(function (data) {
//TODO
}).fail(function () {
//TODO
});
}
});
\ No newline at end of file
... ...
... ... @@ -156,12 +156,34 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
.img-form {
padding: 0 pxToRem(30px);
.upload-img-list {
float: left;
> li {
display: block;
width: pxToRem(130px);
height: pxToRem(130px);
overflow: hidden;
float: left;
margin-right: pxToRem(30px);
> img {
display: block;
width: 100%;
height: 100%;
overflow: hidden;
}
}
}
.img-add {
display: block;
width: pxToRem(130px);
height: pxToRem(130px);
border: 1px dashed #e0e0e0;
position: relative;
text-indent: -1000px;
float: left;
&:after {
$width: pxToRem(image_width(sprite-file($suggest, suggest-add)));
... ... @@ -180,7 +202,7 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
margin-left: -$width / 2;
}
> input[type="file"] {
input[type="file"], {
position: absolute;
//@include stretch();
@include opacity(0.2);
... ...
... ... @@ -5,11 +5,11 @@
<li class="active">收藏的商品</li>
<li>收藏的品牌</li>
</ul>
<div class="fav-content">
<div class="fav-content" id="fav-content">
<div class="fav-type">
<ul class="fav-product-list">
{{# hasFavProduct}}
<li>
<li data-id="{{fav_id}}">
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
... ...
{{> layout/header}}
<div class="yoho-suggest-sub-page yoho-page">
{{# suggestSub}}
<div class="suggest-sub-form"
data-version="{{param.app_version}}"
data-type="{{param.client_type}}"
data-os-version="{{param.os_version}}"
data-screen-size="{{param.screen_size}}"
data-v="{{param.v}}"
data-project="{{param.project}}"
data-client-secret="{{param.client_secret}}">
<div class="suggest-sub-form">
<textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea>
<div class="img-form">
<ul class="upload-img-list"></ul>
<span class="img-add">
<input id="upload-img" type="file" name="fileselect[]" multiple />
<input id="upload-img" type="file" multiple />
</span>
</div>
</div>
... ...
... ... @@ -16,8 +16,8 @@
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script>
{{/if}}
{{#if devEnv}}
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://localhost:8000/'});</script>
<script src="http://172.16.6.204:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://172.16.6.204:8000/'});</script>
{{/if}}
<script type="text/javascript">
(function(w,d,s,j,f){
... ...
{{#pageHeader}}
<header class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}">
<header id="yoho-header" class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}">
{{#if navBack}}
<a href="javascript:history.go(-1);" class="iconfont nav-back">&#xe610;</a>
{{/if}}
... ...
... ... @@ -75,18 +75,19 @@ class HomeController extends AbstractAction
$favProducts = \Index\UserModel::getFavProductData($uid);
$favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
$data = array(
'favPage' => true, //加载js
'pageFooter' => true,
'favorite' => true,
'hasFavProduct' => $favProducts,
'hasFavBrand' => $favBrands
);
// 判断时候为品牌页
if ($tab === 'brand')
{
$data['brandTab'] = true;
}
//print_r($favProducts);
$data = array(
'favPage' => true, //加载js
'pageFooter' => true,
'favorite' => true,
'hasFavProduct' => $favProducts,
'hasFavBrand' => $favBrands
);
// 判断是否为品牌收藏页
if ($tab === 'brand') {
$data['brandTab'] = true;
}
$this->_view->display('favorite', $data);
}
... ... @@ -406,8 +407,8 @@ class HomeController extends AbstractAction
*/
public function suggestimgUploadAction()
{
$filename = $this->post('filename', '');
$result = \Index\UserModel::saveSuggestImg($filename);
//$filename = $this->post('filename', '');
$result = \Index\UserModel::saveSuggestImg('fileData');
$this->echoJson($result);
}
... ... @@ -421,7 +422,7 @@ class HomeController extends AbstractAction
{
$uid = $this->getUid();
$content = $this->post('content', '');
$suggest_type = $this->get('suggest_type', 2);
$suggest_type = $this->post('suggest_type', 2);
$result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);
$this->echoJson($result);
... ...