Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: + 首页展示信息重构 #71 #74

Merged
merged 1 commit into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"useIsolateContext": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"disableUseStrict": false,
"minifyWXML": true,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"minifyWXML": true
"useCompilerPlugins": false
},
"compileType": "miniprogram",
"condition": {}
Expand Down
9 changes: 5 additions & 4 deletions src/components/ContentItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ function jumpToDetail() {
.article_list_item {
box-sizing: border-box;
background: #fff;
// margin-bottom: 20rpx;
margin: 20rpx 0rpx;
border-radius: 20rpx;
border:1px solid #3333332e;
.article_detail {
box-sizing: border-box;
display: flex;
width: 100%;
justify-content: space-between;
justify-content: space-around;
align-items: center;
border-bottom: 1px solid #f5f6f6;
padding: 20rpx 40rpx;
padding:20rpx;
.artclie_text_msg {
flex: 1;
}
Expand Down
33 changes: 18 additions & 15 deletions src/components/NavBar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<view class="self_tabs">
<view class="tab_header">
<button
<view
v-for="item in tabList"
:key="item.key"
:class="item.key === activeKey ? 'item_active' : 'item'"
Expand All @@ -14,7 +14,7 @@
:src="item.key === activeKey ? item.activeIcon : item.icon"
style="height: 30rpx; width: 30rpx"
/>
</button>
</view>
</view>
</view>
</template>
Expand All @@ -25,46 +25,49 @@ import { computed, defineComponent, PropType, toRefs } from "vue";
export default defineComponent({
name: "NavBar",
data() {
/**
* [{"id":5,"name":"流浪乞讨"},
* {"id":4,"name":"其他寻人"},
* {"id":3,"name":"海外寻亲"},
* {"id":2,"name":"宝贝寻家"},
* {"id":1,"name":"家寻宝贝"}]
*/
return {
tabList: [
{
label: "家寻",
key: "newest",
// icon: "http://static.gocoder.top/unfold.png",
// activeIcon: "http://static.gocoder.top/unfold_active.png",
key: 1,
},
{ label: "寻家", key: "column" },
{ label: "其他", key: "pay" },
{ label: "寻家", key: 2 },
{ label: "其他", key: 4 },
],
activeKey: "newest"
activeKey: 1
};
},
methods: {
tabChang(activeKey) {
this.activeKey = activeKey;
this.$emit("change", activeKey);
},
}
},
});
</script>

<style lang="less">
.self_tabs {
position: sticky;
top: 0;
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-around;
.tab_header {
display: flex;
align-items: center;
height: 88rpx;
align-items: center;
color: #999;
border-bottom: 1rpx solid #f6f5f8;
box-sizing: border-box;
background: #fff;
justify-content: space-around;

width: 100%;
padding:16rpx 0px;
.item {
font-size: 32rpx;
text-align: center;
Expand Down
57 changes: 39 additions & 18 deletions src/pages/index/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,36 @@

<!--Contact for phone calls-->
<Contact></Contact>
<!-- nut-searchbar @search事件失效.. -->
<nut-searchbar
v-model="query.keyword"
placeholder="姓名 | 编号 | 城市"
@blur="refreshList"
></nut-searchbar>

<NavBar @change="onNavBarChange"></NavBar>

<!--List of lost info-->
<view class="content">
<content-item
v-for="item in list"
:key="item.id"
:item="item"
/>

<view class="lost-list-container">
<!-- nut-searchbar @search事件失效.. -->
<nut-searchbar
v-model="query.keyword"
placeholder="搜索"
@clear="onQueryClear"
@blur="refreshList">
<template v-slot:leftin>
<nut-icon size="14" name="search2"></nut-icon>
</template>
</nut-searchbar>



<!--List of lost info-->
<view class="content">
<content-item
v-for="item in list"
:key="item.id"
:item="item"
/>
</view>
</view>
</template>

<script>
import { stopPullDownRefresh } from "@tarojs/taro";
import Taro, { stopPullDownRefresh } from "@tarojs/taro";
import { ref } from "vue";
import { useList } from "../../composables/index";
import { API_LIST } from "../../utils/api";
Expand All @@ -53,7 +62,7 @@ export default {
this.loadList()
},
setup() {
const { query, list, loadList, refreshList } = useList({ url: API_LIST.lost,queryDefault:{type:'newest'} })
const { query, list, loadList, refreshList } = useList({ url: API_LIST.lost,queryDefault:{category:1} })
const background = [
"https://wechat-1251018873.file.myqcloud.com/images/banner.png",
"https://wechat-1251018873.file.myqcloud.com/images/banner.png",
Expand All @@ -65,7 +74,7 @@ export default {
list,
loadList,
refreshList,
background,
background
};
},
methods: {
Expand All @@ -75,7 +84,11 @@ export default {
};
},
onNavBarChange(activeBar){
this.query.type = activeBar
this.query.category = activeBar
this.refreshList()
},
onQueryClear(){
this.query = ''
this.refreshList()
}

Expand All @@ -84,6 +97,14 @@ export default {
</script>

<style lang="less">
.lost-list-container {
flex:1;
background-color: #97939726;
padding:24rpx;
>.nut-searchbar {
background-color: unset;
}
}
.miniprogram-root {
.for-web {
display: none;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function listLost(pageNo) {
* @description 文章列表
* @param {number} pageNo
* @param {number} pageSize
* @param {string} ??type
* @param {string} ??category
* @param {string} ??keywords
*/
// return get('/articles', { page_no })
Expand Down