暂存我的页面修改

This commit is contained in:
2024-11-28 17:33:29 +08:00
parent 7bbe58a0d0
commit 520f44a25f
25 changed files with 469 additions and 26 deletions

View File

@@ -1,3 +1,9 @@
import { getAidList } from "../../service/system";
import { alertInfo, alertSuccess } from "../../utils/index";
import request from '../../utils/request'
const { OK } = request;
// components/aid/index.js
Component({
@@ -5,20 +11,68 @@ Component({
* 组件的属性列表
*/
properties: {
type: Number,
bannerType: Number,
},
lifetimes: {
attached() {
this.init();
}
},
/**
* 组件的初始数据
*/
data: {
park: {},
list: [],
total: 0,
page: 1,
size: 20,
},
lifetimes: {
attached() {
this.init()
}
},
/**
* 组件的方法列表
*/
methods: {
async init() {
const { type, page, size } = this.data;
const { code, message, data = [], total } = await getAidList(page, size, type);
console.log('data', data)
if (code !== OK) {
alertInfo(message)
return
}
this.setData({
list: data,
total
}, () => {
console.log("this.data", this.data)
})
},
onRefresh() {
const that = this;
this.setData({
page: 1,
}, () => {
that.init();
})
},
jumpToDetail(e) {
const { id = "" } = e.currentTarget.dataset;
const { type } = this.data;
wx.navigateTo({
url: `/pages/aid/detail/index?id=${id}&type=${type}`,
})
},
consult() {
wx.navigateTo({
url: `/pages/aid/consult/index?id=${this.data.type}`,
})
}
}
})

View File

@@ -1,4 +1,9 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"Banner": "/components/banner/index",
"van-image": "@vant/weapp/image/index",
"empty": "/components/empty/index",
"van-icon": "@vant/weapp/icon/index"
}
}

View File

@@ -1,2 +1,29 @@
<!--components/aid/index.wxml-->
<text>components/aid/index.wxml</text>
<Banner park="{{park.id}}" type="{{bannerType}}" />
<div class="title">行业精英</div>
<view wx:if="{{list.length}}">
<view wx:for="{{list}}" wx:key="id" >
<view class="userInfoItem" mut-bind:tap="jumpToDetail" data-id="{{item.id}}">
<view class="content">
<van-image
width="200rpx"
height="200rpx"
lazy-load
src="{{item.avatar}}"
/>
<view class="userInfo">
<view style="display: flex;font-size: 30rpx;">
<view class="userName"> {{ item.name }} </view>
<view class="userLevel"> {{ item.level }} </view>
</view>
<view class="synopsis"> {{item.synopsis}}{{item.synopsis}} {{item.synopsis}} </view>
<view class="connect" bind:tap="consult">
<van-icon name="service-o" />
<view style="margin-left: 10rpx;"> 在线咨询 </view>
</view>
</view>
</view>
</view>
</view>
</view>
<empty wx:else bind:refresh="onRefresh" />

View File

@@ -1 +1,44 @@
/* components/aid/index.wxss */
/* components/aid/index.wxss */
.title {
padding-top: 30rpx;
padding-left: 30rpx;
display: flex;
}
.userInfoItem {
padding: 30rpx;
}
.userInfoItem .content {
display: flex;
align-items: center;
border-bottom: 1rpx solid #ccc;
}
.userInfo {
height: 200rpx;
margin-left: 30rpx;
flex: 1;
}
.userLevel {
margin-left: 30rpx;
font-weight: 600;
}
.synopsis {
height: 80rpx;
overflow: hidden;
margin-top: 20rpx;
margin-bottom: 10rpx;
font-size: 32rpx;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.connect {
display: flex;
justify-content: flex-end;
}