diff --git a/App.vue b/App.vue index 04cd5e5..d30aebc 100644 --- a/App.vue +++ b/App.vue @@ -4,7 +4,7 @@ projectname:'', // 项目名称 lat:'', // 公司地址维度 lng:'' ,// 公司地址经度 - hostapi:'https://laonon.scdxtc.cn' // 域名配置 + hostapi:'https://idle.scdxtc.cn' // 域名配置 }, }; @@ -22,7 +22,8 @@ @import url("./commons/loading.css"); /* 加载中样式 end */ - /* 设置背景颜色 */ + /* 设置背景颜色 start */ page{ background-color: #f5f5f5;} + /* 设置背景颜色 end */ diff --git a/components/goods-list/goods-list.vue b/components/goods-list/goods-list.vue index 8bd1c0e..aa0726d 100644 --- a/components/goods-list/goods-list.vue +++ b/components/goods-list/goods-list.vue @@ -39,9 +39,15 @@ methods:{ // 跳转详情 goDetail(id){ - uni.navigateTo({ - url:`/pages/goods/detail?id=${id}`, - }) + if(this.isOperate){ + uni.navigateTo({ + url:`/pages/goods/detail?id=${id}&type=release`, + }) + }else{ + uni.navigateTo({ + url:`/pages/goods/detail?id=${id}`, + }) + } }, // 更改显示状态 @@ -67,7 +73,7 @@ } .goods-list .cover{ width: 100%; - height: 350rpx; + height: 320rpx; overflow: hidden; margin-bottom: 10rpx; position: relative; diff --git a/components/status-nav/status-nav.vue b/components/status-nav/status-nav.vue index 725e1d4..73b893e 100644 --- a/components/status-nav/status-nav.vue +++ b/components/status-nav/status-nav.vue @@ -14,7 +14,8 @@ - {{navBarTitle}} + {{navBarTitle}} + {{navBarTitle}} {{netText}}刷新 @@ -81,6 +82,11 @@ type: String, default: '0' }, + // 是否可选择小区 + estate:{ + type: Number, + default: 0 + } }, data() { return { @@ -128,6 +134,12 @@ }) } }) + }, + // 小区选择 + choiceEstate(estate){ + uni.navigateTo({ + url: `/pages/estate/estate?estate=${estate}` + }) } } } diff --git a/components/tabbar/tabbar.vue b/components/tabbar/tabbar.vue index 3db891f..fbc667d 100644 --- a/components/tabbar/tabbar.vue +++ b/components/tabbar/tabbar.vue @@ -24,37 +24,17 @@ }, data() { return { - footBarList:[], //底部列表 + footBarList:[ + {iconPath:'/static/icon-idle.png',title:'闲置'}, + {iconPath:'/static/icon-my.png',title:'我的'} + ], //底部列表 }; }, mounted() { // 获取当前页面路径 this.$toolAll.tools.obtainPagePath(); - // 获取底部信息 - this.getTabbarList(); }, methods:{ - // 获取底部信息 - getTabbarList(){ - this.footBarList = [ - {iconPath:'/static/icon-idle.png',title:'闲置'}, - {iconPath:'/static/icon-my.png',title:'我的'} - ] - // this.$requst.get('/api/index/mini-program-setting').then(res=>{ - // if(res.code == 0){ - // console.log(res,'底部信息') - // let tabbarArr = []; - // res.data.footBar.forEach(item=>{ - // let obj = { - // iconPath:this.$hostHttp+item.icon, - // title:item.name, - // } - // tabbarArr.push(obj) - // }) - // this.footBarList = tabbarArr; - // } - // }) - }, // 跳转tabbar chooseFootTab(index){ switch (index){ @@ -75,9 +55,11 @@ // 发布商品 goRelease(){ - uni.navigateTo({ - url:'/pages/idle/release', - }) + if(this.$toolAll.tools.judgeAuth()) { + uni.navigateTo({ + url:'/pages/idle/release', + }) + } }, } } diff --git a/jsFile/requst.js b/jsFile/requst.js index 41553f8..114e317 100644 --- a/jsFile/requst.js +++ b/jsFile/requst.js @@ -6,6 +6,7 @@ const goLogin = () => { }) } let flag = true; + // 刷新token并跳转到当前页面 var authTimer = null; const refreshTokenPage = () => { @@ -24,10 +25,9 @@ const refreshTokenPage = () => { uni.login({ success: (res) => { uni.request({ - url:'https://laonon.scdxtc.cn/api/user/login', + url:`${getApp().globalData.hostapi}/api/v1/user/login`, data:{ code:res.code, - invite_code:uni.getStorageSync('inviteCode')?uni.getStorageSync('inviteCode'):'', }, success: (result) => { if(result.data.code == 0) { @@ -37,7 +37,6 @@ const refreshTokenPage = () => { uni.setStorageSync('expire',result.data.data.expire);//缓存失效时间(时间戳格式) uni.setStorageSync('phone_active',result.data.data.phone_active);//是否授权手机号 uni.setStorageSync('is_active',result.data.data.is_active);//是否授权头像和昵称 - uni.setStorageSync('invite_code',result.data.data.invite_code);//缓存邀请码 // 重新进入当前页面 uni.reLaunch({ url:localRoute @@ -50,6 +49,7 @@ const refreshTokenPage = () => { } flag = true; } + // 请求错误处理 const checkError = (e) => { console.log('500接口错误'); @@ -153,6 +153,7 @@ const request = (method, url, options) => { }) }) } + // 上传文件 封装请求 const uploadFile = (url, options) => { let tempData = options || {} @@ -179,7 +180,6 @@ const uploadFile = (url, options) => { }) } - export default { get: (url, options) => { return request('get', url, options) diff --git a/jsFile/tools.js b/jsFile/tools.js index 63ceec6..0c87f54 100644 --- a/jsFile/tools.js +++ b/jsFile/tools.js @@ -272,7 +272,7 @@ const tools = { }) .replace(']*src=['"]([^'"]+)[^>]*>/gi, (match, p1) => { - return ` -1 ? p1 : 'https://laonon.scdxtc.cn' + p1}' />` + return ` -1 ? p1 : 'https://idle.scdxtc.cn' + p1}' />` }) }, /** diff --git a/main.js b/main.js index e9c82df..6753642 100644 --- a/main.js +++ b/main.js @@ -19,7 +19,7 @@ import requst from '@/jsFile/requst.js'; Vue.prototype.$requst = requst; //公共域名 -Vue.prototype.$hostHttp = 'https://laonon.scdxtc.cn'; +Vue.prototype.$hostHttp = 'https://idle.scdxtc.cn'; //不显示console.log if (uni.getSystemInfoSync().platform !== "devtools") { diff --git a/manifest.json b/manifest.json index e5fc110..74c5b50 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "老农极鲜土货", + "name" : "小区闲置", "appid" : "__UNI__768F35C", "description" : "这是一款基于uniapp开发的app和微信小程序的模板框架", "versionName" : "1.0.0", @@ -69,7 +69,7 @@ /* 快应用特有相关 */ "mp-weixin" : { /* 小程序特有相关 */ - "appid" : "wx19c92fb80708ae46", + "appid" : "wxf6f7c457ee92d2ac", "setting" : { "urlCheck" : true, "es6" : true, @@ -81,9 +81,7 @@ "desc" : "您的位置信息,将用于附近小区查询!" } }, - "requiredPrivateInfos": [ - "getLocation" - ] + "requiredPrivateInfos" : [ "getLocation" ] }, "mp-baidu" : { "appid" : "24346353" diff --git a/pages/estate/estate.vue b/pages/estate/estate.vue index 6b9e6bf..10b24a4 100644 --- a/pages/estate/estate.vue +++ b/pages/estate/estate.vue @@ -4,7 +4,7 @@ - {{item.name}} + {{item.name}} @@ -24,15 +24,18 @@ return { statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度 estateList:[], //商品列表 + keyword:'', //关键词 page:1, //页数 size:10, //条数 total:0, //总数 isLoading:false, //是否加载完成 + estate:0, //0:闲置进入,1:车位进入,2:房屋进入 } }, - onLoad() { - // 获取定位 - this.getLocation(); + onLoad(op) { + if(op.estate) this.estate = op.estate; + // 查询小区列表 + this.getEstateList(); }, onReachBottom(e) { if(this.estateList.length { console.log('位置信息',res) - // 查询小区列表 - this.getEstateList(); }, fail: (err)=> { uni.showToast({ @@ -60,55 +61,54 @@ } }); }, - // 查询商品列表 + + // 查询小区列表 getEstateList(){ - this.estateList = [ - {id:1,name:'奥园广场一期',state:0}, - {id:2,name:'奥园广场二期',state:0}, - {id:3,name:'奥园广场三期',state:0}, - {id:4,name:'万圣家园A区',state:0}, - {id:5,name:'万圣家园B区',state:0}, - {id:6,name:'万圣家园C区',state:0} - ] - this.isLoading = true; - // uni.showLoading({ - // title:'加载中' - // }) - // let params = { - // page:this.page, - // size:this.size, - // addr_id:id - // } - // this.$requst.get('/api/spu/list',params).then(res=>{ - // if(res.code == 0){ - // console.log(res,'商品列表') - // this.total = res.data.total; - // let goodsArr = []; - // res.data.list.forEach(item=>{ - // let obj = { - // id:item.id, - // cover:item.cover, - // name:item.name, - // price:item.price - // } - // goodsArr.push(obj) - // }) - // this.goodsList = this.goodsList.concat(goodsArr); - // } - // uni.hideLoading(); - // this.isLoading = true; - // }) + uni.showLoading({ + title:'加载中' + }) + let params = { + page:this.page, + size:this.size + } + if(this.page==1) this.estateList = []; + this.$requst.get('/api/v1/goods/area',params).then(res=>{ + if(res.code == 0){ + console.log(res,'小区列表') + this.total = res.data.total; + let estateArr = []; + res.data.list.forEach(item=>{ + let obj = { + id:item.id, + name:item.title, + } + estateArr.push(obj) + }) + this.estateList = this.estateList.concat(estateArr); + } + uni.hideLoading(); + this.isLoading = true; + }) }, // 选择小区 - choiseEstate(id){ - uni.reLaunch({ - url:`/pages/idle/idle` - }) + choiseEstate(id,name){ + // 缓存小区信息 + uni.setStorageSync('area_id',id); + uni.setStorageSync('area_name',name); + if(this.estate == 1){ + uni.reLaunch({ + url:`/pages/idle/idle` + }) + } }, // 返回闲置 backIdle(){ + if(!uni.getStorageSync('area_id')||!uni.getStorageSync('area_name')){ + uni.setStorageSync('area_id',this.estateList[0].id); + uni.setStorageSync('area_name',this.estateList[0].name); + } uni.reLaunch({ url:`/pages/idle/idle` }) diff --git a/pages/goods/detail.vue b/pages/goods/detail.vue index 199b708..ded6bf1 100644 --- a/pages/goods/detail.vue +++ b/pages/goods/detail.vue @@ -1,5 +1,5 @@