|
|
|
// pages/index/index.js
|
|
|
|
const app = getApp()
|
|
|
|
import {
|
|
|
|
login,
|
|
|
|
getUserInfo
|
|
|
|
} from "../../api/user"
|
|
|
|
import {
|
|
|
|
getPolicyList,
|
|
|
|
message
|
|
|
|
} from "../../api/index"
|
|
|
|
Page({
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
indicatorDots: true,
|
|
|
|
autoplay: true,
|
|
|
|
interval: 3000,
|
|
|
|
duration: 1000,
|
|
|
|
navList: [
|
|
|
|
// {
|
|
|
|
// name: "政策资讯",
|
|
|
|
// url:"/subpages/index/policy/index/index"
|
|
|
|
// },
|
|
|
|
{
|
|
|
|
name: "入住办理",
|
|
|
|
url: '/subpages/OCRCard/pages/index/index',
|
|
|
|
image:'../../images/icon/ruzhu.png'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "退房确认",
|
|
|
|
url: "/subpages/index/checkOutConfirm/index/index",
|
|
|
|
image:'../../images/icon/tuifang.png'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "延租申请",
|
|
|
|
url: "/subpages/index/renewalApplication/renewalApplication",
|
|
|
|
image:'../../images/icon/yanzu.png'
|
|
|
|
},
|
|
|
|
|
|
|
|
// {
|
|
|
|
// name: "报修",
|
|
|
|
// url: "/subpages/eventAdd/add/add",
|
|
|
|
// image:'../../images/icon/baoxiu.png'
|
|
|
|
// },
|
|
|
|
// {
|
|
|
|
// name: "报事",
|
|
|
|
// url: "/subpages/bsPage/bsPage/bsPage",
|
|
|
|
// image:'../../images/icon/baoshi.png'
|
|
|
|
// },
|
|
|
|
// {
|
|
|
|
// name: "生活圈",
|
|
|
|
// },
|
|
|
|
{
|
|
|
|
name: "更多",
|
|
|
|
url:'/pages/serve/serve',
|
|
|
|
image:'../../images/icon/gengduo.png'
|
|
|
|
},
|
|
|
|
],
|
|
|
|
searchValue: "",
|
|
|
|
policyList:[],//政策列表
|
|
|
|
getUserInfo:{},
|
|
|
|
bindPhone:false
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
statusHeight: app.globalData.deviceInfo.statusHeight,
|
|
|
|
navigationHeight: app.globalData.deviceInfo.navigationHeight,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
init(){
|
|
|
|
this.login()
|
|
|
|
},
|
|
|
|
login() {
|
|
|
|
wx.showLoading({
|
|
|
|
title:'加载中...'
|
|
|
|
})
|
|
|
|
const that = this
|
|
|
|
wx.removeStorageSync('token')
|
|
|
|
wx.login({
|
|
|
|
success: (res) => {
|
|
|
|
login({
|
|
|
|
code: res.code,
|
|
|
|
miniAppId:'wx00dbd91a119d3b91'
|
|
|
|
}).then(res => {
|
|
|
|
wx.setStorageSync('token',res.data.token)
|
|
|
|
that.getUserInfo()
|
|
|
|
that.setData({
|
|
|
|
bindPhone:res.data.bindPhone
|
|
|
|
})
|
|
|
|
this.getPolicyList()
|
|
|
|
this.getMessage()
|
|
|
|
wx.hideLoading()
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err);
|
|
|
|
wx.hideLoading()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
|
|
|
getPolicyList() {
|
|
|
|
let query = {
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 3
|
|
|
|
}
|
|
|
|
getPolicyList(query).then(res => {
|
|
|
|
let policyList = [
|
|
|
|
{
|
|
|
|
coverImg:"https://hrss.qingdao.gov.cn/mzjwj/1751954217605_75881750735046145_8829微信图片_20250624111724.jpg"
|
|
|
|
|
|
|
|
},{coverImg:"https://hrss.qingdao.gov.cn/mzjwj/1751954194729_86821750650507376_5134微信图片_20250623114826.png"
|
|
|
|
},
|
|
|
|
]
|
|
|
|
this.setData({
|
|
|
|
policyList
|
|
|
|
})
|
|
|
|
}).catch(err => {
|
|
|
|
console.log(err);
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toPolicyDetail(e){
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
getMessage(){
|
|
|
|
message({pageNum:1,pageSize:1}).then(res=>{
|
|
|
|
if(res.code === 200){
|
|
|
|
console.log(res);
|
|
|
|
this.setData({
|
|
|
|
messageList:res.data.records
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toMessage(){
|
|
|
|
wx.switchTab({
|
|
|
|
url: '/pages/message/message',
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
|
*/
|
|
|
|
onReady() {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
|
|
*/
|
|
|
|
onShow() {
|
|
|
|
this.init()
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide() {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
|
*/
|
|
|
|
onUnload() {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
*/
|
|
|
|
onPullDownRefresh() {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom() {},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 用户点击右上角分享
|
|
|
|
*/
|
|
|
|
onShareAppMessage() {},
|
|
|
|
getUserInfo(){
|
|
|
|
getUserInfo().then(res=>{
|
|
|
|
// 有身份证号直接去信息确认没有的话就去识别身份证信息
|
|
|
|
app.globalData.userInfo = res.data;
|
|
|
|
this.setData({
|
|
|
|
userInfo:res.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
navigateTo(e){
|
|
|
|
if(wx.getStorageSync('token')){
|
|
|
|
if(e.currentTarget.dataset.url && e.currentTarget.dataset.url != '/subpages/OCRCard/pages/index/index'){
|
|
|
|
if(e.currentTarget.dataset.url === '/pages/serve/serve'){
|
|
|
|
wx.switchTab({
|
|
|
|
url: '/pages/serve/serve',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
wx.navigateTo({
|
|
|
|
url: e.currentTarget.dataset.url,
|
|
|
|
})
|
|
|
|
}else if(e.currentTarget.dataset.url){
|
|
|
|
if(!this.data.bindPhone){
|
|
|
|
if(this.data.userInfo.idCard){
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/index/checkInUser/checkInUser?idCard=${this.data.userInfo.idCard}&name=${this.data.userInfo.name}&phone=${this.data.userInfo.phone}`,
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/subpages/OCRCard/pages/index/index`,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/register/register',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|