Authored by lore-w

意见反馈

framework @ 119c247f
1 -Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2 1 +Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
@@ -6,28 +6,22 @@ @@ -6,28 +6,22 @@
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 Hammer = require('yoho.hammer'), 8 Hammer = require('yoho.hammer'),
9 - lazyLoad = require('yoho.lazyload'),  
10 Swiper = require('yoho.iswiper'); 9 Swiper = require('yoho.iswiper');
11 10
12 -//导航  
13 var $navLi = $('#fav-tab > li'), 11 var $navLi = $('#fav-tab > li'),
14 - $favContainer = $('.fav-content');  
15 -  
16 -var $curContainer = $favContainer.children('.fav-type').first();//保存当前显示的$favContainer  
17 -  
18 -var favTabHammer;  
19 -  
20 -//轮播图  
21 -var $swiperList = $('.swiper-container'),  
22 - swiperArray = [],  
23 - swiperObj = {};  
24 -  
25 -//lazyLoad(); 12 + $favContainer = $('.fav-content'),
  13 + $curContainer = $favContainer.children('.fav-type').first(),
  14 + $swiperList = $('.swiper-container'),
  15 + swiperObj = {},
  16 + favTabHammer,
  17 + favContentHammer;
26 18
27 favTabHammer = new Hammer(document.getElementById('fav-tab')); 19 favTabHammer = new Hammer(document.getElementById('fav-tab'));
28 favTabHammer.on('tap', function(e) { 20 favTabHammer.on('tap', function(e) {
29 var $cur = $(e.target).closest('li'), 21 var $cur = $(e.target).closest('li'),
30 - index; 22 + index,
  23 + id,
  24 + i;
31 25
32 if ($cur.length === 0 || $cur.hasClass('active')) { 26 if ($cur.length === 0 || $cur.hasClass('active')) {
33 return; 27 return;
@@ -42,9 +36,10 @@ favTabHammer.on('tap', function(e) { @@ -42,9 +36,10 @@ favTabHammer.on('tap', function(e) {
42 $curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide'); 36 $curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide');
43 37
44 if (index === 1) { 38 if (index === 1) {
  39 +
45 //导航 40 //导航
46 - for (var i = 0; i < $swiperList.length; i++) {  
47 - var id = $swiperList.eq(i).attr('data-id'); 41 + for (i = 0; i < $swiperList.length; i++) {
  42 + id = $swiperList.eq(i).attr('data-id');
48 swiperObj[id] = new Swiper('#swiper-container-' + id, { 43 swiperObj[id] = new Swiper('#swiper-container-' + id, {
49 slidesPerView: 'auto', 44 slidesPerView: 'auto',
50 grabCursor: true, 45 grabCursor: true,
@@ -57,3 +52,31 @@ favTabHammer.on('tap', function(e) { @@ -57,3 +52,31 @@ favTabHammer.on('tap', function(e) {
57 52
58 } 53 }
59 }); 54 });
  55 +
  56 +//删除收藏的商品
  57 +favContentHammer = new Hammer(document.getElementById('fav-content'));
  58 +
  59 +favContentHammer.on('tap', function (e) {
  60 + var id = '';
  61 +
  62 +
  63 + if ($(e.target).hasClass('del-fav')) {
  64 + id = $(e.target).closest('li').attr('data-id');
  65 + $.ajax({
  66 + method: 'post',
  67 + url: '/home/favoriteDel',
  68 + data: {
  69 + id: id
  70 + }
  71 + }).then(function (data) {
  72 +
  73 +
  74 + if (data.code === 200) {
  75 + $(e.target).closest('li').remove();
  76 + }
  77 + }).fail(function () {
  78 +
  79 + //TODO
  80 + });
  81 + }
  82 +});
@@ -7,21 +7,59 @@ @@ -7,21 +7,59 @@
7 7
8 var $ = require('jquery'), 8 var $ = require('jquery'),
9 Hammer = require('yoho.hammer'), 9 Hammer = require('yoho.hammer'),
10 - lazyLoad = require('yoho.lazyload'); 10 + Handlebars = require('yoho.handlebars');
  11 +
  12 +var $uploadImgList = $('.upload-img-list'),
  13 + headerNavHammer,
  14 + imgTpl,
  15 + template;
11 16
12 require('./jquery.uploadifive'); 17 require('./jquery.uploadifive');
13 18
14 $('#upload-img').uploadifive({ 19 $('#upload-img').uploadifive({
15 auto: true, 20 auto: true,
16 - buttonClass: 'nav-btn',  
17 - fileType: 'image/*', 21 + fileType: 'image*/*',
18 uploadScript: '/home/suggestimgUpload', 22 uploadScript: '/home/suggestimgUpload',
19 fileObjName: 'fileData', 23 fileObjName: 'fileData',
20 fileSizeLimit: 1024, 24 fileSizeLimit: 1024,
21 - onAddQueueItem: function (file) {  
22 - console.log(file); 25 + height: '100%',
  26 + width: '100%',
  27 + onAddQueueItem: function (files) {
  28 +
  29 + //TODO
23 }, 30 },
24 - onQueueComplete: function (file) {  
25 - console.log(file); 31 + onUploadComplete: function (file, data) {
  32 + $uploadImgList.html(template(data));
  33 + }
  34 +});
  35 +
  36 +
  37 +imgTpl = '{{# imgList}}' +
  38 + '<li><img src="{{imgUrl}}" /></li>' +
  39 + '{{/ imgList}}';
  40 +
  41 +template = Handlebars.compile(imgTpl);
  42 +
  43 +headerNavHammer = new Hammer(document.getElementById('yoho-header'));
  44 +
  45 +headerNavHammer.on('tap', function (e) {
  46 + var suggestText = $('#suggest-textarea').val();
  47 +
  48 +
  49 + if ($(e.target).hasClass('nav-btn')) {
  50 +
  51 + $.ajax({
  52 + method: 'post',
  53 + url: '/home/savesuggest',
  54 + data: {
  55 + content: suggestText
  56 + }
  57 + }).then(function (data) {
  58 +
  59 + //TODO
  60 + }).fail(function () {
  61 +
  62 + //TODO
  63 + });
26 } 64 }
27 }); 65 });
@@ -156,12 +156,34 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px); @@ -156,12 +156,34 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
156 .img-form { 156 .img-form {
157 padding: 0 pxToRem(30px); 157 padding: 0 pxToRem(30px);
158 158
  159 + .upload-img-list {
  160 + float: left;
  161 +
  162 + > li {
  163 + display: block;
  164 + width: pxToRem(130px);
  165 + height: pxToRem(130px);
  166 + overflow: hidden;
  167 + float: left;
  168 + margin-right: pxToRem(30px);
  169 +
  170 + > img {
  171 + display: block;
  172 + width: 100%;
  173 + height: 100%;
  174 + overflow: hidden;
  175 + }
  176 + }
  177 + }
  178 +
159 .img-add { 179 .img-add {
160 display: block; 180 display: block;
161 width: pxToRem(130px); 181 width: pxToRem(130px);
162 height: pxToRem(130px); 182 height: pxToRem(130px);
163 border: 1px dashed #e0e0e0; 183 border: 1px dashed #e0e0e0;
164 position: relative; 184 position: relative;
  185 + text-indent: -1000px;
  186 + float: left;
165 187
166 &:after { 188 &:after {
167 $width: pxToRem(image_width(sprite-file($suggest, suggest-add))); 189 $width: pxToRem(image_width(sprite-file($suggest, suggest-add)));
@@ -180,7 +202,7 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px); @@ -180,7 +202,7 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
180 margin-left: -$width / 2; 202 margin-left: -$width / 2;
181 } 203 }
182 204
183 - > input[type="file"] { 205 + input[type="file"], {
184 position: absolute; 206 position: absolute;
185 //@include stretch(); 207 //@include stretch();
186 @include opacity(0.2); 208 @include opacity(0.2);
@@ -5,11 +5,11 @@ @@ -5,11 +5,11 @@
5 <li class="active">收藏的商品</li> 5 <li class="active">收藏的商品</li>
6 <li>收藏的品牌</li> 6 <li>收藏的品牌</li>
7 </ul> 7 </ul>
8 - <div class="fav-content"> 8 + <div class="fav-content" id="fav-content">
9 <div class="fav-type"> 9 <div class="fav-type">
10 <ul class="fav-product-list"> 10 <ul class="fav-product-list">
11 {{# hasFavProduct}} 11 {{# hasFavProduct}}
12 - <li> 12 + <li data-id="{{fav_id}}">
13 <div class="fav-img-box"> 13 <div class="fav-img-box">
14 <img src="{{imgUrl}}" alt=""/> 14 <img src="{{imgUrl}}" alt=""/>
15 </div> 15 </div>
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="yoho-suggest-sub-page yoho-page"> 2 <div class="yoho-suggest-sub-page yoho-page">
3 {{# suggestSub}} 3 {{# suggestSub}}
4 - <div class="suggest-sub-form"  
5 - data-version="{{param.app_version}}"  
6 - data-type="{{param.client_type}}"  
7 - data-os-version="{{param.os_version}}"  
8 - data-screen-size="{{param.screen_size}}"  
9 - data-v="{{param.v}}"  
10 - data-project="{{param.project}}"  
11 - data-client-secret="{{param.client_secret}}"> 4 + <div class="suggest-sub-form">
12 <textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea> 5 <textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea>
13 <div class="img-form"> 6 <div class="img-form">
  7 + <ul class="upload-img-list"></ul>
14 <span class="img-add"> 8 <span class="img-add">
15 - <input id="upload-img" type="file" name="fileselect[]" multiple /> 9 + <input id="upload-img" type="file" multiple />
16 </span> 10 </span>
17 </div> 11 </div>
18 </div> 12 </div>
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 <script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script> 16 <script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script>
17 {{/if}} 17 {{/if}}
18 {{#if devEnv}} 18 {{#if devEnv}}
19 -<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>  
20 -<script>seajs.config({base: 'http://localhost:8000/'});</script> 19 +<script src="http://172.16.6.204:8000/static/js/sea.js?nowrap"></script>
  20 +<script>seajs.config({base: 'http://172.16.6.204:8000/'});</script>
21 {{/if}} 21 {{/if}}
22 <script type="text/javascript"> 22 <script type="text/javascript">
23 (function(w,d,s,j,f){ 23 (function(w,d,s,j,f){
1 {{#pageHeader}} 1 {{#pageHeader}}
2 -<header class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}"> 2 +<header id="yoho-header" class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}">
3 {{#if navBack}} 3 {{#if navBack}}
4 <a href="javascript:history.go(-1);" class="iconfont nav-back">&#xe610;</a> 4 <a href="javascript:history.go(-1);" class="iconfont nav-back">&#xe610;</a>
5 {{/if}} 5 {{/if}}
@@ -75,18 +75,19 @@ class HomeController extends AbstractAction @@ -75,18 +75,19 @@ class HomeController extends AbstractAction
75 75
76 $favProducts = \Index\UserModel::getFavProductData($uid); 76 $favProducts = \Index\UserModel::getFavProductData($uid);
77 $favBrands = \Index\UserModel::getFavBrandData($uid, $gender); 77 $favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
78 - $data = array(  
79 - 'favPage' => true, //加载js  
80 - 'pageFooter' => true,  
81 - 'favorite' => true,  
82 - 'hasFavProduct' => $favProducts,  
83 - 'hasFavBrand' => $favBrands  
84 - );  
85 - // 判断时候为品牌页  
86 - if ($tab === 'brand')  
87 - {  
88 - $data['brandTab'] = true;  
89 - } 78 +
  79 + //print_r($favProducts);
  80 + $data = array(
  81 + 'favPage' => true, //加载js
  82 + 'pageFooter' => true,
  83 + 'favorite' => true,
  84 + 'hasFavProduct' => $favProducts,
  85 + 'hasFavBrand' => $favBrands
  86 + );
  87 + // 判断是否为品牌收藏页
  88 + if ($tab === 'brand') {
  89 + $data['brandTab'] = true;
  90 + }
90 91
91 $this->_view->display('favorite', $data); 92 $this->_view->display('favorite', $data);
92 } 93 }
@@ -406,8 +407,8 @@ class HomeController extends AbstractAction @@ -406,8 +407,8 @@ class HomeController extends AbstractAction
406 */ 407 */
407 public function suggestimgUploadAction() 408 public function suggestimgUploadAction()
408 { 409 {
409 - $filename = $this->post('filename', '');  
410 - $result = \Index\UserModel::saveSuggestImg($filename); 410 + //$filename = $this->post('filename', '');
  411 + $result = \Index\UserModel::saveSuggestImg('fileData');
411 412
412 $this->echoJson($result); 413 $this->echoJson($result);
413 } 414 }
@@ -421,7 +422,7 @@ class HomeController extends AbstractAction @@ -421,7 +422,7 @@ class HomeController extends AbstractAction
421 { 422 {
422 $uid = $this->getUid(); 423 $uid = $this->getUid();
423 $content = $this->post('content', ''); 424 $content = $this->post('content', '');
424 - $suggest_type = $this->get('suggest_type', 2); 425 + $suggest_type = $this->post('suggest_type', 2);
425 $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type); 426 $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);
426 427
427 $this->echoJson($result); 428 $this->echoJson($result);