Browse Source

小程序新增页面

master
xuxu 5 years ago
parent
commit
1112e38d07
  1. 58
      pages/resource/list/index.js
  2. 4
      pages/resource/list/index.json
  3. 28
      pages/resource/list/index.wxml
  4. 76
      pages/resource/list/index.wxss
  5. 69
      pages/resource/navigate/index.js
  6. 3
      pages/resource/navigate/index.json
  7. 2
      pages/resource/navigate/index.wxml
  8. 1
      pages/resource/navigate/index.wxss
  9. 31
      pages/topics/loan/index.js
  10. 6
      pages/topics/loan/index.json
  11. 18
      pages/topics/loan/index.wxml
  12. 27
      pages/topics/loan/index.wxss
  13. 105
      pages/topics/rent/detail/index.js
  14. 3
      pages/topics/rent/detail/index.json
  15. 18
      pages/topics/rent/detail/index.wxml
  16. 60
      pages/topics/rent/detail/index.wxss
  17. 33
      pages/topics/rent/index.js
  18. 6
      pages/topics/rent/index.json
  19. 15
      pages/topics/rent/index.wxml
  20. 58
      pages/topics/rent/index.wxss
  21. 104
      pages/topics/rent/room/index.js
  22. 6
      pages/topics/rent/room/index.json
  23. 2
      pages/topics/rent/room/index.wxml
  24. 1
      pages/topics/rent/room/index.wxss

58
pages/resource/list/index.js

@ -0,0 +1,58 @@
// pages/resource/list/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
list:{
type:Array,
value:[],
},
tp:{
type:String,
value:'1'
}
},
/**
* 组件的初始数据
*/
data: {
titlePic:"/images/temp_1.jpg"
},
/**
* 组件的方法列表
*/
methods: {
detail:function(e){
if (!e.currentTarget.dataset.id){
return;
}
if(this.properties.tp == '1'){
if(e.currentTarget.dataset.url){
wx.navigateTo({
url: '/pages/resource/navigate/index?url=' + encodeURIComponent(e.currentTarget.dataset.url)
})
return;
}else{
wx.navigateTo({
url: '/pages/resource/detail/index?id=' + e.currentTarget.dataset.id
})
return;
}
}else if(this.properties.tp == '2'){
wx.navigateTo({
url: '/pages/topics/rent/detail/index?id=' + e.currentTarget.dataset.id
})
return;
}
}
}
})

4
pages/resource/list/index.json

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

28
pages/resource/list/index.wxml

@ -0,0 +1,28 @@
<!--pages/resource/list/index.wxml-->
<view class="container">
<view class="column" wx:for="{{ list }}" bindtap="detail" data-id="{{item.id}}" data-url="{{item.url}}">
<view class="left">
<block wx:if="{{tp == '1'}}">
<view class="articleImg">
<image src="{{item.titlePic ? item.titlePic : titlePic}}" mode="widthFix" style="width:100%;"></image>
</view>
</block>
<block wx:if="{{tp == '2'}}">
<view class="roomImg">
<image src="{{item.titlePic ? item.titlePic : titlePic}}" mode="widthFix" style="width:100%;"></image>
</view>
</block>
<view class="content">
<view class="title">{{item.title}}</view>
<block wx:if="{{tp == '1'}}">
<view class="r_type">{{item.typeName}}</view>
</block>
<block wx:if="{{tp == '2'}}">
<view class="r_type"><text style="color:#f25959">{{item.price}}</text>元/月</view>
</block>
</view>
</view>
<view class="right"><text class="fa fa-angle-right fa-lg"></text></view>
</view>
</view>

76
pages/resource/list/index.wxss

@ -0,0 +1,76 @@
/* pages/resource/list/index.wxss */
@import '../../../style/font.wxss';
.container{
display: flex;
width: 100%;
flex-direction: column;
align-items: center;
background-color: white;
/* margin-top:10px; */
}
.column{
display: flex;
align-items: center;
justify-content: space-between;
width: 90%;
height: 90px;
border-bottom: 2px solid whitesmoke;
}
.left{
display: flex;
align-items: center;
flex: 1;
}
.right{
width: 15px;
text-align:right;
}
.articleImg{
width: 55px;
height: 55px;
display: flex;
align-items: center;
/* border-radius: 50%; */
}
.roomImg{
width: 70px;
height: 55px;
display: flex;
align-items: center;
}
.content{
margin-left: 15px;
margin-right: 20px;
flex: 1;
}
.title{
width: 100%;
display: -webkit-box;
-webkit-line-clamp: 1;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
word-break: break-all;
font-weight:1000;
}
.r_type{
font-size: 13px;
}
.tips{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.tips-con{
width: 90%;
height: 90;
}

69
pages/resource/navigate/index.js

@ -0,0 +1,69 @@
// pages/resource/navigate/index.js
Page({
/**
* 页面的初始数据
*/
data: {
url:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// console.log(decodeURIComponent(options.url));
this.setData({
url:decodeURIComponent(options.url)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

3
pages/resource/navigate/index.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

2
pages/resource/navigate/index.wxml

@ -0,0 +1,2 @@
<!--pages/resource/navigate/index.wxml-->
<web-view src="{{url}}"></web-view>

1
pages/resource/navigate/index.wxss

@ -0,0 +1 @@
/* pages/resource/navigate/index.wxss */

31
pages/topics/loan/index.js

@ -0,0 +1,31 @@
// pages/topics/loan/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
detail:{
type:Object,
value:{}
}
},
/**
* 组件的初始数据
*/
data: {
url:'https://m.qdjqt.com/#/enterpriseLoan?xihaian=&VNK=e92927fe'
},
/**
* 组件的方法列表
*/
methods: {
check:function(){
var url = this.data.url;
wx.navigateTo({
url: '/pages/resource/navigate/index?url=' + encodeURIComponent(url)
})
}
}
})

6
pages/topics/loan/index.json

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"e-ibutton": "/components/image-button/index"
}
}

18
pages/topics/loan/index.wxml

@ -0,0 +1,18 @@
<!--pages/topics/loan/index.wxml-->
<!-- <view class="con">
<view class="img">
<image src="{{detail.titlePic}}"></image>
</view>
<view class="title">{{detail.title}}</view>
<view class="text">
<rich-text nodes="{{detail.content}}"></rich-text>
</view>
</view>
<view class="btnView">
<e-ibutton title="查看详情" bind:onTap="check"/>
</view> -->
<web-view src="{{url}}"></web-view>

27
pages/topics/loan/index.wxss

@ -0,0 +1,27 @@
/* pages/topics/loan/index.wxss */
.con{
display: flex;
flex-direction: column;
align-items: center;
}
.img{
width: 200px;
height: 150px;
}
.title{
font-weight:1000;
}
.btnView{
position: fixed;
padding: 10px 20px 20px 20px;
bottom: 0;
left: 0;
right: 0;
background-color: white;
}
.text{
width: 90%;
margin-top: 20px;
margin-bottom: 100px;
}

105
pages/topics/rent/detail/index.js

@ -0,0 +1,105 @@
// pages/topics/rent/detail/index.js
import { TopicModel } from '../../../../models/topic.js'
let topicModel = new TopicModel()
Page({
/**
* 页面的初始数据
*/
data: {
titlePic:"/images/temp_1.png",
unStar: '/images/common/star.png',
star: '/images/common/star_light.png',
detail:{},
isCollect:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var id = options.id;
topicModel.getRoomDetail(id,res=>{
if(res.result.isCollection == 1){
this.setData({
isCollect:true,
})
}else{
this.setData({
isCollect:false,
})
}
this.setData({
detail:res.result,
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onClickCollect:function(){
this.setData({
isCollect: !this.data.isCollect
})
let id = this.data.detail.id
topicModel.roomCollect(id,res =>{
//console.log('收藏')
if(res.code === 200){
wx.showToast({
title: '收藏成功',
icon: 'none'
})
}
})
}
})

3
pages/topics/rent/detail/index.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

18
pages/topics/rent/detail/index.wxml

@ -0,0 +1,18 @@
<!--pages/topics/rent/detail/index.wxml-->
<view class="title">
<view class="left">
<view class="articleImg">
<image src="{{detail.titlePic ? detail.titlePic : titlePic}}" bindtap="previewImage" mode="widthFix" style="width:100%;"></image>
</view>
<view class="content">
<view class="tit">{{detail.title}}</view>
<view class="r_type"><text style="color:#f25959">{{detail.price}}</text>元/月</view>
</view>
</view>
<view class="right">
<image class="artice_collect" src="{{isCollect ? star : unStar}}" bindtap="onClickCollect"></image>
</view>
</view>
<view class="text">
<rich-text nodes="{{detail.content}}"></rich-text>
</view>

60
pages/topics/rent/detail/index.wxss

@ -0,0 +1,60 @@
/* pages/topics/rent/detail/index.wxss */
page{
width: 100%;
display: flex;
align-items: center;
flex-direction: column;
}
.title{
display: flex;
align-items: center;
justify-content: space-between;
width: 90%;
min-height: 90px;
border-bottom: 2px solid whitesmoke;
margin-top:5px;
}
.left{
display: flex;
align-items: center;
flex: 1;
}
.right{
width: 15px;
text-align:right;
}
.articleImg{
width: 55px;
height: 55px;
display: flex;
align-items: center;
/* border-radius: 50%; */
}
.content{
margin-left: 15px;
margin-right: 20px;
flex: 1;
}
.tit{
width: 100%;
font-weight:1000;
}
.r_type{
font-size: 13px;
}
.artice_collect {
width: 20px;
height: 20px;
}
.text{
width: 90%;
}

33
pages/topics/rent/index.js

@ -0,0 +1,33 @@
// pages/rent/index.js
import { TopicModel } from '../../../models/topic.js'
let topicModel = new TopicModel()
Component({
/**
* 组件的属性列表
*/
properties: {
list:{
type:Array,
value:[]
}
},
/**
* 组件的初始数据
*/
data: {
img:'../../../images/'
},
/**
* 组件的方法列表
*/
methods: {
check:function(e){
var id = e.currentTarget.id;
wx.navigateTo({
url: '/pages/topics/rent/room/index?id=' + id
})
}
}
})

6
pages/topics/rent/index.json

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-button": "/components/vant/button/index"
}
}

15
pages/topics/rent/index.wxml

@ -0,0 +1,15 @@
<!--pages/rent/index.wxml-->
<view class="main">
<block wx:for="{{list}}">
<view class="box">
<view class="image" style="background: url({{item.pic}}) center no-repeat;background-size: cover;background-position: center 0;">
<!-- <image src="{{img}}" mode="aspectFill"></image> -->
<view class="title">{{item.title}}</view>
</view>
<view class="content">
<view><text class="fa fa-map-marker fa-lg"></text> <text class="address">{{item.address}}</text></view>
<view><van-button type="danger" size="small" bind:click="check" id="{{item.id}}">查看</van-button></view>
</view>
</view>
</block>
</view>

58
pages/topics/rent/index.wxss

@ -0,0 +1,58 @@
/* pages/rent/index.wxss */
@import '../../../style/font.wxss';
.main{
display: flex;
flex-direction: column;
align-items: center;
padding-top: 30rpx;
}
.box{
width:90%;
height:450rpx;
background-color: White;
margin-bottom:30rpx;
display: flex;
align-items: center;
/* justify-content: center; */
flex-direction: column;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
box-shadow:0px 2px 4px 2px rgba(0, 0, 0, 0.05);
}
.image{
height:350rpx;
width: 100%;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
.title{
font-size: 50rpx;
color: white;
padding-left: 15px;
padding-top: 250rpx;
}
.content{
height:80rpx;
width:90%;
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10rpx;
/* font-family: SimHei; */
font-size: 29rpx;
font-weight: bold;
color:#979797;
}
.address{
margin-left: 8px;
font-size: 27rpx;
}

104
pages/topics/rent/room/index.js

@ -0,0 +1,104 @@
// pages/topics/rent/room/index.js
import { TopicModel } from '../../../../models/topic.js'
let topicModel = new TopicModel()
Page({
/**
* 页面的初始数据
*/
data: {
page:1,
list:[],
apartmentId:'',
next:true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var id = options.id;
this.setData({
apartmentId:id
})
var page = this.data.page;
topicModel.getRoomList(id,page,res=>{
this.setData({
list:res.result.records
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
var th = this;
var next = th.data.next;
var typeCode = th.data.typeCode;
if(!next){
return;
}
var page = th.data.page;
var nextPage = page + 1;
var list = th.data.list;
topicModel.getRoomList(typeCode,nextPage,res=>{
if(res.result.records.length > 0){
list = list.concat(res.result.records);
th.setData({
list: list,
page: nextPage
})
}else{
th.setData({
next: false
})
}
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

6
pages/topics/rent/room/index.json

@ -0,0 +1,6 @@
{
"usingComponents": {
"resource":"/pages/resource/list/index"
},
"onReachBottomDistance":50
}

2
pages/topics/rent/room/index.wxml

@ -0,0 +1,2 @@
<!--pages/topics/rent/room/index.wxml-->
<resource style="width:100%" list="{{list}}" tp="2"/>

1
pages/topics/rent/room/index.wxss

@ -0,0 +1 @@
/* pages/topics/rent/room/index.wxss */
Loading…
Cancel
Save