slj 4 years ago
parent
commit
48f496a0d1
  1. 3
      models/topic.js
  2. 96
      pages/home/index.js
  3. 2
      pages/topics/lease/index.js
  4. 10
      pages/topics/lease/index.wxml
  5. 9
      pages/topics/lease/index.wxss
  6. 2
      pages/topics/loan/index.wxml
  7. 2
      pages/topics/reportDemand/index.js

3
models/topic.js

@ -200,8 +200,7 @@ class TopicModel extends HTTP {
typeCode: datas.typeCode, typeCode: datas.typeCode,
id: datas.id, id: datas.id,
questionType: datas.questionType, questionType: datas.questionType,
company: datas.company workplace: datas.workplace
}, },
success: success success: success
} }

96
pages/home/index.js

@ -2,7 +2,9 @@
import dayjs from '../../utils/dayjs/index.js' import dayjs from '../../utils/dayjs/index.js'
import relativeTime from '../../utils/dayjs/relativeTime.js' import relativeTime from '../../utils/dayjs/relativeTime.js'
dayjs.extend(relativeTime); dayjs.extend(relativeTime);
import { HomeModel } from '../../models/home.js' import {
HomeModel
} from '../../models/home.js'
let homeModel = new HomeModel() let homeModel = new HomeModel()
Page({ Page({
data: { data: {
@ -11,9 +13,9 @@ Page({
banners: [], banners: [],
hots: [], hots: [],
list: [], list: [],
show:false, show: false,
// url:"../../images/ad.jpg", // url:"../../images/ad.jpg",
web:'https://wx.vzan.com/live/TpForm?zbid=860533452&oId=213742&type=0&v=1623841891714' web: 'https://wx.vzan.com/live/TpForm?zbid=860533452&oId=213742&type=0&v=1623841891714'
// web:'http://www.rencaibeichu.cn' // web:'http://www.rencaibeichu.cn'
}, },
onLoad: function () { onLoad: function () {
@ -35,8 +37,8 @@ Page({
}) })
}, },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {
this.setData({ this.setData({
currPage: 1, currPage: 1,
@ -46,7 +48,7 @@ Page({
this.fetchHomeBanner() this.fetchHomeBanner()
this.fetchHomeHot() this.fetchHomeHot()
wx.vibrateShort({ wx.vibrateShort({
success () { success() {
//console.log('震动') //console.log('震动')
} }
}) })
@ -66,7 +68,7 @@ Page({
// 获取首页列表 // 获取首页列表
fetchHomeList () { fetchHomeList() {
let page = this.data.currPage let page = this.data.currPage
homeModel.getHomeList(page, res => { homeModel.getHomeList(page, res => {
this.setData({ this.setData({
@ -82,7 +84,7 @@ Page({
image: item.titlePic, image: item.titlePic,
showTop: item.isTop == 1 ? true : false, showTop: item.isTop == 1 ? true : false,
time: dayjs(item.createTime).toNow(), time: dayjs(item.createTime).toNow(),
type:item.type, type: item.type,
readed: item.isRead == 0 ? false : true readed: item.isRead == 0 ? false : true
}) })
}) })
@ -113,7 +115,7 @@ Page({
}, },
fetchHomeBanner () { fetchHomeBanner() {
this.setData({ this.setData({
banners: [] banners: []
}) })
@ -126,7 +128,8 @@ Page({
tempBanners.push({ tempBanners.push({
id: item.id, id: item.id,
image: item.titlePic, image: item.titlePic,
title: item.title title: item.title,
type: item.type
}) })
}) })
this.setData({ this.setData({
@ -134,7 +137,7 @@ Page({
}) })
}) })
}, },
fetchHomeHot () { fetchHomeHot() {
this.setData({ this.setData({
hots: [] hots: []
}) })
@ -146,7 +149,8 @@ Page({
datas.forEach(item => { datas.forEach(item => {
tempHots.push({ tempHots.push({
id: item.id, id: item.id,
title: item.title title: item.title,
type: item.type
}) })
}) })
this.setData({ this.setData({
@ -155,57 +159,81 @@ Page({
}) })
}, },
// Banner/Hot/List事件 // Banner/Hot/List事件
tapSwiperItem (e) { tapSwiperItem(e) {
//console.log(e.detail) console.log(e)
if(e.detail.id == '987a8433d925f36d3690fab91fe9e137'){ const {
id,
type
} = e.detail
if (e.detail.id == '987a8433d925f36d3690fab91fe9e137') {
this.jump() this.jump()
}else{ } else {
this.gotoArticePage(e.detail.id) // this.gotoArticePage(e.detail.id)
if (type == 0) {
this.gotoArticePage(id)
} else {
this.gotoActivityPage(id)
}
} }
}, },
tapFocusItem (e) { tapFocusItem(e) {
// console.log(e)
const {
id,
title,
type
} = e.detail
//console.log(e.detail) //console.log(e.detail)
this.gotoArticePage(e.detail.id) // this.gotoArticePage(e.detail.id)
//type 文章/活动标识0-文章,1-活动
if (type == 0) {
this.gotoArticePage(id)
} else {
this.gotoActivityPage(id)
}
}, },
//点击列表cell获取id,进入页面 //点击列表cell获取id,进入页面
clickListItem (e) { clickListItem(e) {
//console.log(e.detail) //console.log(e.detail)
console.log('点击---',e) console.log('点击---', e)
const {id, index,type} = e.detail const {
id,
index,
type
} = e.detail
this.setData({ this.setData({
[`list[${index}].readed`]: true [`list[${index}].readed`]: true
}) })
//type 文章/活动标识0-文章,1-活动 //type 文章/活动标识0-文章,1-活动
if(type==0){ if (type == 0) {
this.gotoArticePage(id) this.gotoArticePage(id)
} } else {
else{ this.gotoActivityPage(id)
this.gotoActivityPage(id) }
}
}, },
//文章 0 //文章 0
gotoArticePage (id) { gotoArticePage(id) {
wx.navigateTo({ wx.navigateTo({
url: `/pages/article/index?id=${id}`, url: `/pages/article/index?id=${id}`,
}) })
}, },
//活动 1 //活动 1
gotoActivityPage (id) { gotoActivityPage(id) {
wx.navigateTo({ wx.navigateTo({
url: `/pages/topics/activity/activityDetail/index?activityId=${id}`, url: `/pages/topics/activity/activityDetail/index?activityId=${id}`,
}) })
}, },
onClose(){ onClose() {
this.setData({ this.setData({
show:false show: false
}) })
}, },
jump:function(){ jump: function () {
this.setData({ this.setData({
show:false show: false
}) })
wx.navigateTo({ wx.navigateTo({
url: '/pages/resource/navigate/index?url=' + encodeURIComponent(this.data.web) url: '/pages/resource/navigate/index?url=' + encodeURIComponent(this.data.web)

2
pages/topics/lease/index.js

@ -43,5 +43,7 @@ Component({
this.setData({ this.setData({
height:app.globalData.windowHeight - 44 height:app.globalData.windowHeight - 44
}) })
console.log('windowHeight--->',app.globalData.windowHeight)
console.log('height--->',this.data.height)
}, },
}) })

10
pages/topics/lease/index.wxml

@ -1,8 +1,14 @@
<!--pages/topics/rentHouse/index.wxml--> <!--pages/topics/rentHouse/index.wxml-->
<!--pages/topics/loan/index.wxml--> <!-- <view class="con"
<view class="con"
style="background: url({{imgUrl}}) no-repeat; background-size:cover;background-position-y:bottom;height:{{height}}px"> style="background: url({{imgUrl}}) no-repeat; background-size:cover;background-position-y:bottom;height:{{height}}px">
<view class="btnView"> <view class="btnView">
<e-ibutton title="查看详情" bind:onTap="check" /> <e-ibutton title="查看详情" bind:onTap="check" />
</view> </view>
</view> -->
<view class="con" style="height:{{height}}px">
<image src="{{imgUrl}}" class="bg-image" style="height:{{height}}px"></image>
<view class="btnView">
<e-ibutton title="查看详情" bind:onTap="check" />
</view>
</view> </view>

9
pages/topics/lease/index.wxss

@ -1,11 +1,16 @@
/* pages/topics/rentHouse/index.wxss */ /* pages/topics/rentHouse/index.wxss */
.bg-image{
display: block;
width: 100%;
height: 100%;
/* background-color: rgba(0,0,0,.2); */
}
.con{ .con{
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
background-size: 100% 100%; /* background-size: 100% 100%; */
} }
.img{ .img{
width: 200px; width: 200px;

2
pages/topics/loan/index.wxml

@ -1,5 +1,5 @@
<!--pages/topics/loan/index.wxml--> <!--pages/topics/loan/index.wxml-->
<view class="con" style="background: url({{imgUrl}}) no-repeat; background-size:cover;background-position-y:bottom;height:{{height}}px"> <view class="con" style="overflow:hidden;background: url({{imgUrl}}) no-repeat; background-size:cover;background-position-y:bottom;height:{{height}}px">
<!-- <view class="img"> <!-- <view class="img">
<image src="{{detail.titlePic}}"></image> <image src="{{detail.titlePic}}"></image>
</view> </view>

2
pages/topics/reportDemand/index.js

@ -313,7 +313,7 @@ Page({
workplace: this.data.company, workplace: this.data.company,
name: this.data.username name: this.data.username
} }
console.log('报需求-->',data)
topicModel.addTalents(data, res => { topicModel.addTalents(data, res => {
const id = res.result; const id = res.result;
if (res.code === 200) { if (res.code === 200) {

Loading…
Cancel
Save