Skip to content

Commit

Permalink
抽离组件优化
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhou123 committed Aug 23, 2018
1 parent 9d9e932 commit 55680aa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .wepycache
@@ -1 +1 @@
{"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\wepy.js":499162500000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy-async-function\\index.js":1517302333000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy-com-toast\\toast.wpy":1488432898000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\app.js":499162500000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\page.js":499162500000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\component.js":499162500000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\event.js":499162500000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\base.js":499162500000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\util.js":499162500000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\mixin.js":499162500000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy-async-function\\global.js":1517302333000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\promise-polyfill\\promise.js":1511627065000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\regenerator-runtime\\runtime.js":1493390741000,"D:\\wxxcx\\recode\\wxxcx\\node_modules\\wepy\\lib\\native.js":499162500000}
{"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\wepy.js":499162500000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy-async-function\\index.js":1517302333000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy-com-toast\\toast.wpy":1488432898000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\app.js":499162500000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\page.js":499162500000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\component.js":499162500000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\event.js":499162500000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\base.js":499162500000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\util.js":499162500000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\mixin.js":499162500000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy-async-function\\global.js":1517302333000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\promise-polyfill\\promise.js":1511627065000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\regenerator-runtime\\runtime.js":1493390741000,"D:\\order\\wxxcx\\wxrecode\\node_modules\\wepy\\lib\\native.js":499162500000}
30 changes: 16 additions & 14 deletions src/components/express/index.wpy
Expand Up @@ -10,7 +10,7 @@
<view catchtap='scanExpressCode' class="icon iconfont icon-saoma"></view>
</view>
<!--历史记录-->
<view class="history {{ index === chosseIndex ? 'del' : '' }}" data-number="{{ item.nubmer }}" catchtap='goToExpress' wx:for='{{ history }}' wx:key="unique">
<view class="history {{ index === chosseIndex ? 'del' : '' }}" data-number="{{ item.nubmer }}" wx:for='{{ history }}' wx:key="unique" @tap="selectCate({{item}})">
<view class='info-wrap'>
<view class="company">{{ item.company }}</view>
<view class="number">{{ item.nubmer }}</view>
Expand All @@ -32,7 +32,14 @@ import { formatTime } from '@/utils/util';
export default class ForexpressItem extends wepy.page {
config = {
navigationBarTitleText: '快递查询'
};
}

props = {
history: {
type: Array,
default: []
}
}

data = {
baseUrl: 'https://qf-restapi.mdscj.com/xp_express',
Expand All @@ -47,7 +54,6 @@ export default class ForexpressItem extends wepy.page {
expressValue: '',
delStatus: false,
chosseIndex: -1,
history: [],
animationData: {},
winHeight: '', //窗口高度
currentTab: 0, //预设当前项的值
Expand Down Expand Up @@ -144,11 +150,10 @@ export default class ForexpressItem extends wepy.page {
* 查询详细内容
* @param e
*/
goToExpress(e) {
console.log(e);
let number = e.currentTarget.dataset.number;
this.$navigate({
url: './expressJump/expressJump?number=' + number
selectCate(item) {
console.log(item.nubmer);
this.$parent.$navigate({
url: './expressJump/expressJump?number=' + item.nubmer
});
},
/**
Expand All @@ -159,9 +164,9 @@ export default class ForexpressItem extends wepy.page {
if (this.delStatus) return;
this.delStatus = true;
let index = e.currentTarget.dataset.index;
let history = this.data.history;
let history = this.history;
this.chosseIndex = index;

setTimeout(function() {
history.splice(index, 1);
wx.setStorageSync('saveList', history);
Expand Down Expand Up @@ -205,10 +210,7 @@ export default class ForexpressItem extends wepy.page {
}
}

onShow() {
this.history = wx.getStorageSync('saveList');
this.$apply();
}
onShow() {}
}
</script>

Expand Down
10 changes: 7 additions & 3 deletions src/pages/forexpress.wpy
Expand Up @@ -18,7 +18,7 @@
<!-- 快递查询 -->
<swiper-item wx:for="{{[0,1,2,3,4]}}" wx:key="*this">
<scroll-view scroll-y="true" class="scoll-h" wx:if="{{index==0}}">
<ForexpressItem></ForexpressItem>
<ForexpressItem :history.sync = 'history'></ForexpressItem>
</scroll-view>
<scroll-view scroll-y="true" class="scoll-h" wx:elif="{{index==1}}">
<PeoPleCard></PeoPleCard>
Expand Down Expand Up @@ -56,15 +56,16 @@ export default class Forexpress extends wepy.page {
IdCard,
Figure,
MobileHome,
PeoPleCard
PeoPleCard
}

data = {
showMark: false,
winHeight: '', //窗口高度
currentTab: 0, //预设当前项的值
scrollLeft: 0, //tab标题的滚动条位置,
searchArr:['快递','身份证','银行卡号','手机号码','身材']
searchArr:['快递','身份证','银行卡号','手机号码','身材'],
history:[]
};

methods = {
Expand Down Expand Up @@ -161,6 +162,9 @@ export default class Forexpress extends wepy.page {
} catch (e) {
this.showMark = true;
}
//快递历史
this.history = wx.getStorageSync('saveList');
this.$apply();
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/testYun/index.wpy
Expand Up @@ -32,7 +32,7 @@ export default class TestYun extends wepy.page {
};

data = {
array: ['水瓶座','摩羯座','双鱼座','白羊座','金牛座','处女座','天枰座','天蝎座','巨蟹座','射手座','双子座','狮子座'],
array: ['水瓶座','摩羯座','双鱼座','白羊座','金牛座','处女座','天秤座','天蝎座','巨蟹座','射手座','双子座','狮子座'],
index:0
};

Expand Down

0 comments on commit 55680aa

Please sign in to comment.