Authored by shijian

app联调

@@ -219,6 +219,19 @@ const matchHeader = (path, qs, titleMap) => { @@ -219,6 +219,19 @@ const matchHeader = (path, qs, titleMap) => {
219 return header; 219 return header;
220 } 220 }
221 221
  222 + if (/\/me\/records/.test(path)) {
  223 + header = titleMap[3];
  224 + header.title.des = '浏览记录';
  225 + header.right = {
  226 + des: '清空',
  227 + action: 'clearRecords'
  228 + };
  229 + if (qs.type === '0') {
  230 + header.right.des = '';
  231 + }
  232 + return header;
  233 + }
  234 +
222 return header; 235 return header;
223 }; 236 };
224 237
@@ -5,7 +5,7 @@ const VueTouch = require('vue-touch'); @@ -5,7 +5,7 @@ const VueTouch = require('vue-touch');
5 5
6 Vue.use(VueTouch); 6 Vue.use(VueTouch);
7 VueTouch.config.swipe = { 7 VueTouch.config.swipe = {
8 - threshold: 50 8 + threshold: 10
9 }; 9 };
10 10
11 yoho.ready(() => { 11 yoho.ready(() => {
1 <template> 1 <template>
2 <div class="items" v-for="item in list" v-if="item.show" v-touch:swipeleft="showbutton($index)" 2 <div class="items" v-for="item in list" v-if="item.show" v-touch:swipeleft="showbutton($index)"
3 - v-touch:swiperight="hidebutton($index)" :class="{showbtn:item.isshowbtn,xiajia:!item.status,shouwan:!item.storage}"> 3 + v-touch:swiperight="hidebutton($index)" :class="{showbtn:item.isshowbtn,xiajia:!item.status,shouwan:!item.storage}" v-touch-options:swipe="{ direction: 'horizontal', threshold: 10}">
4 <div class="wrap"> 4 <div class="wrap">
5 <a :href="item.goodsUrl"> 5 <a :href="item.goodsUrl">
6 <img :src='item.image'> 6 <img :src='item.image'>
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 收藏的品牌 53 收藏的品牌
54 <span class="num">{{data.brand_favorite_total}} <span class="icon icon-right"></span></span> 54 <span class="num">{{data.brand_favorite_total}} <span class="icon icon-right"></span></span>
55 </a> 55 </a>
56 - <a class="glist-item" href="/me/records"> 56 + <a class="glist-item auth" href="/me/records?type={{recordNum}}">
57 浏览记录 57 浏览记录
58 <span class="num">{{recordNum}}<span class="icon icon-right"></span></span> 58 <span class="num">{{recordNum}}<span class="icon icon-right"></span></span>
59 </a> 59 </a>
@@ -116,7 +116,7 @@ @@ -116,7 +116,7 @@
116 $('.auth').off('click', this.authClick); 116 $('.auth').off('click', this.authClick);
117 $('.auth').removeClass('no-intercept'); 117 $('.auth').removeClass('no-intercept');
118 118
119 - if (!yoho.isLogin()) { 119 + if (yoho.isLogin()) {
120 $.ajax({ 120 $.ajax({
121 url: '/me/userdata' 121 url: '/me/userdata'
122 }).then(result => { 122 }).then(result => {
@@ -11,21 +11,22 @@ @@ -11,21 +11,22 @@
11 :deleteSkn="deleteskn"></swiper-list> 11 :deleteSkn="deleteskn"></swiper-list>
12 </div> 12 </div>
13 <div v-if="nodata"> 13 <div v-if="nodata">
14 - <div class='title-wrap'>浏览记录</div> 14 + <!--<div class='title-wrap'>浏览记录</div>-->
15 <div class="nodata"> 15 <div class="nodata">
16 <i></i> 16 <i></i>
17 <div class="tip1">暂无浏览记录</div> 17 <div class="tip1">暂无浏览记录</div>
18 <div class="tip2">You have no recently viewed items</div> 18 <div class="tip2">You have no recently viewed items</div>
19 - <a class="go" href="//m.yohoblk.com">随便逛逛</a> 19 + <a class="go" href="/product/new">随便逛逛</a>
20 </div> 20 </div>
21 </div> 21 </div>
22 </template> 22 </template>
23 23
24 <script> 24 <script>
25 - const yoho = require('yoho'); 25 +const yoho = require('yoho');
26 const $ = require('jquery'); 26 const $ = require('jquery');
27 const swiperList = require('component/me/swiperList.vue'); 27 const swiperList = require('component/me/swiperList.vue');
28 const modal = require('common/modal'); 28 const modal = require('common/modal');
  29 +const interceptClick = require('common/intercept-click');
29 let originList, originCategory, categoryLen; 30 let originList, originCategory, categoryLen;
30 31
31 module.exports = { 32 module.exports = {
@@ -46,7 +47,7 @@ module.exports = { @@ -46,7 +47,7 @@ module.exports = {
46 this.headIco = 'data:image/png;base64,R0lGODlhFAAUAIAAAP///wAAACH5BAEAAAAALAAAAAAUABQAAAIRhI+py+0Po5y02ouz3rz7rxUAOw=='; 47 this.headIco = 'data:image/png;base64,R0lGODlhFAAUAIAAAP///wAAACH5BAEAAAAALAAAAAAUABQAAAIRhI+py+0Po5y02ouz3rz7rxUAOw==';
47 }, 48 },
48 reload() { 49 reload() {
49 - if (!yoho.isLogin()) { 50 + if (yoho.isLogin()) {
50 $.ajax({ 51 $.ajax({
51 url: '/me/recordDataNew' 52 url: '/me/recordDataNew'
52 }).then(result => { 53 }).then(result => {
@@ -76,6 +77,9 @@ module.exports = { @@ -76,6 +77,9 @@ module.exports = {
76 77
77 this.hasdata = 1; 78 this.hasdata = 1;
78 this.nodata = 0; 79 this.nodata = 0;
  80 +
  81 + // 绑定清空事件
  82 + yoho.addNativeMethod('clearRecords', this.clearAllRecords);
79 } else { 83 } else {
80 this.nodata = 1; 84 this.nodata = 1;
81 this.hasdata = 0; 85 this.hasdata = 0;
@@ -105,6 +109,7 @@ module.exports = { @@ -105,6 +109,7 @@ module.exports = {
105 if (!originList.length) { 109 if (!originList.length) {
106 this.nodata = 1; 110 this.nodata = 1;
107 this.hasdata = 0; 111 this.hasdata = 0;
  112 + this.updateNavBar();
108 } else { 113 } else {
109 let deleteId = true; 114 let deleteId = true;
110 115
@@ -138,7 +143,7 @@ module.exports = { @@ -138,7 +143,7 @@ module.exports = {
138 let that = this; 143 let that = this;
139 let name, id, index; 144 let name, id, index;
140 145
141 - //寻找类别 146 + // 寻找类别
142 for (let i = 0; i < categoryLen; i++) { 147 for (let i = 0; i < categoryLen; i++) {
143 if (this.category[i].focus === true) { 148 if (this.category[i].focus === true) {
144 name = this.category[i].category_name; 149 name = this.category[i].category_name;
@@ -175,6 +180,7 @@ module.exports = { @@ -175,6 +180,7 @@ module.exports = {
175 if (!index || !originList.length) { 180 if (!index || !originList.length) {
176 that.nodata = 1; 181 that.nodata = 1;
177 that.hasdata = 0; 182 that.hasdata = 0;
  183 + that.updateNavBar();
178 } else { 184 } else {
179 185
180 // 更新页面 186 // 更新页面
@@ -186,8 +192,8 @@ module.exports = { @@ -186,8 +192,8 @@ module.exports = {
186 data: { 192 data: {
187 skn: skn 193 skn: skn
188 } 194 }
189 - }).then(result => {  
190 - if (result.code === 200) {} 195 + }).then(() => {
  196 +
191 }); 197 });
192 this.hide(); 198 this.hide();
193 return false; 199 return false;
@@ -195,15 +201,15 @@ module.exports = { @@ -195,15 +201,15 @@ module.exports = {
195 }, 201 },
196 focusCate(id, index, event) { 202 focusCate(id, index, event) {
197 if (event) { 203 if (event) {
  204 + let el = event.target;
  205 +
198 event.preventDefault(); 206 event.preventDefault();
199 - }  
200 207
201 // 标签移动 208 // 标签移动
202 - let el = event.target;  
203 -  
204 if (el.getBoundingClientRect().right > window.innerWidth) { 209 if (el.getBoundingClientRect().right > window.innerWidth) {
205 el.parentNode.scrollLeft += el.getBoundingClientRect().right - window.innerWidth + 10; 210 el.parentNode.scrollLeft += el.getBoundingClientRect().right - window.innerWidth + 10;
206 } 211 }
  212 + }
207 let list = Object.assign([], originList); 213 let list = Object.assign([], originList);
208 let newList; 214 let newList;
209 215
@@ -224,6 +230,14 @@ module.exports = { @@ -224,6 +230,14 @@ module.exports = {
224 refreshRecords() { 230 refreshRecords() {
225 this.list = originList; 231 this.list = originList;
226 this.focusCate(0, 0); 232 this.focusCate(0, 0);
  233 + },
  234 + updateNavBar() {
  235 + const header = Object.assign({}, interceptClick.defaultTitleMap[3]);
  236 +
  237 + header.right.des = '';
  238 + yoho.updateNavigationBar({
  239 + header: header
  240 + });
227 } 241 }
228 }, 242 },
229 ready() { 243 ready() {