暂存我的页面修改
This commit is contained in:
@@ -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}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
@@ -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"
|
||||
}
|
||||
}
|
@@ -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" />
|
@@ -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;
|
||||
}
|
72
components/banner/index.js
Normal file
72
components/banner/index.js
Normal file
@@ -0,0 +1,72 @@
|
||||
import { getBannerList } from "../../service/system"
|
||||
import { alertInfo } from "../../utils/index";
|
||||
import request from '../../utils/request'
|
||||
|
||||
const { OK } = request;
|
||||
|
||||
// pages/home/components/home-swiper/index.js
|
||||
Component({
|
||||
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
park: String,
|
||||
type: Number,
|
||||
},
|
||||
observers: {
|
||||
'park,type': function(newPark, newType) {
|
||||
if ((!newPark && newType === 0) || (!newType && newType !== 0)) {
|
||||
return
|
||||
}
|
||||
this.init(newPark, newType)
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {
|
||||
indicatorDots: true,
|
||||
vertical: false,
|
||||
autoplay: false,
|
||||
interval: 2000,
|
||||
duration: 500,
|
||||
list: [],
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
async init(park, type) {
|
||||
const { code, message, data = [] } = await getBannerList(park, type);
|
||||
if (code !== OK) {
|
||||
alertInfo(message);
|
||||
this.setData({ list: [], park, type })
|
||||
return
|
||||
}
|
||||
this.setData({ list: data })
|
||||
},
|
||||
handleJump(e) {
|
||||
const { data = {} } = e.currentTarget.dataset;
|
||||
switch(data.jumpType) {
|
||||
case 1:
|
||||
wx.navigateToMiniProgram({
|
||||
appId: data.appid,
|
||||
path: data.wxPath,
|
||||
envVersion: "trial"
|
||||
})
|
||||
break;
|
||||
case 2:
|
||||
wx.navigateTo({
|
||||
url: data.value,
|
||||
})
|
||||
break;
|
||||
case 3:
|
||||
wx.navigateTo({
|
||||
url: '/pages/webPage/index?path=' + data.value,
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
6
components/banner/index.json
Normal file
6
components/banner/index.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-image": "@vant/weapp/image/index"
|
||||
}
|
||||
}
|
22
components/banner/index.wxml
Normal file
22
components/banner/index.wxml
Normal file
@@ -0,0 +1,22 @@
|
||||
<!--pages/home/components/home-swiper/index.wxml-->
|
||||
<swiper
|
||||
indicator-dots="{{indicatorDots}}"
|
||||
autoplay="{{autoplay}}"
|
||||
interval="{{interval}}"
|
||||
duration="{{duration}}"
|
||||
wx:if="{{list.length}}"
|
||||
style="height: 288rpx"
|
||||
>
|
||||
<block wx:for="{{list}}" wx:key="id" wx:item="item">
|
||||
<swiper-item>
|
||||
<van-image
|
||||
width="100%"
|
||||
height="100%"
|
||||
lazy-load
|
||||
src="{{item.url}}"
|
||||
data-data="{{item}}"
|
||||
bind:click="handleJump"
|
||||
/>
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
1
components/banner/index.wxss
Normal file
1
components/banner/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
/* pages/home/components/home-swiper/index.wxss */
|
Reference in New Issue
Block a user