From 1755fb4bbfd010e3e20f2462d7363e796e65f0f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E5=A8=81=E5=A8=81?= <1834256911@qq.com> Date: Tue, 3 Jun 2025 19:20:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/css/public.scss | 3 + common/wskj_function.js | 39 ++++--- components/upload-image.vue | 16 +-- pages.json | 6 + pages/login/wechatlogin.vue | 63 ++++++----- pages/my/feedback.vue | 151 ++++++++++++------------- pages/wy-home.vue | 109 +++++++++++++++++- pages/wy-mine.vue | 28 +++-- pagesMain/pages/bxbs.vue | 7 +- pagesMain/pages/bxbs_lsgd.vue | 61 +++++++++-- pagesMain/pages/bxbs_submit.vue | 95 +++++++--------- pagesMain/pages/cydh.vue | 41 +++++-- pagesMain/pages/fkdj.vue | 189 +++++++++++++++++++++----------- pagesMain/pages/fwgz.vue | 56 ++-------- pagesMain/pages/tsby.vue | 2 +- pagesMine/pages/jtcy.vue | 125 ++++++++++++++++++--- pagesMine/pages/wdfw.vue | 52 ++++++--- static/icon_gd.png | Bin 0 -> 1491 bytes 18 files changed, 683 insertions(+), 360 deletions(-) create mode 100644 static/icon_gd.png diff --git a/common/css/public.scss b/common/css/public.scss index b75f0df..3c90106 100644 --- a/common/css/public.scss +++ b/common/css/public.scss @@ -81,6 +81,9 @@ .v-center { align-items:center; } + .text-left { + text-align:left; + } .vh-center { justify-content: center; align-items:center; diff --git a/common/wskj_function.js b/common/wskj_function.js index c35d302..0b179e4 100644 --- a/common/wskj_function.js +++ b/common/wskj_function.js @@ -38,7 +38,7 @@ import checkUpdateApp from "@/utils/updateapp.js" /** * 上传图片 - * @author 万世科技 + * @author 小威 * @param {String} imgurl 图片地址 */ function uploadImg(imgurl) { @@ -46,17 +46,15 @@ function uploadImg(imgurl) { const token = uni.getStorageSync('token') try { uni.uploadFile({ - url: config.domain + '/api/common/upload', + url: config.domain + '/api/oss/upload', header: { - token + "Authorization": token }, filePath: imgurl, name: 'file', success: res => { - // console.log(res) const data = JSON.parse(res.data) - // console.log(data) - if (data.code === 1) { + if (data.code === 200) { resolve(data.data) } else { reject(data) @@ -64,7 +62,6 @@ function uploadImg(imgurl) { }, fail: err => { reject(err) - // console.log(err) } }) } catch (err) { @@ -77,7 +74,7 @@ function uploadImg(imgurl) { /** * 打开高德地图APP - * @author 万世科技 + * @author 小威 * @param {String} current_latitude 当前纬度 * @param {String} current_longitude 当前经度 * @param {String} current_address 当前所在地名称 @@ -138,7 +135,7 @@ function openGaoDeMap(current_latitude, current_longitude, current_address, shop /** * 打开百度地图APP - * @author 万世科技 + * @author 小威 * @param {String} current_latitude 当前纬度 * @param {String} current_longitude 当前经度 * @param {String} current_address 当前所在地名称 @@ -389,7 +386,7 @@ const isVideo = (url) => { /** * 检测是否是邮箱 - * @author 万世科技 + * @author 小威 * @param {String} email 邮箱号 */ function testEmail(email) { @@ -399,7 +396,7 @@ function testEmail(email) { /** * 检测是否是手机号 - * @author 万世科技 + * @author 小威 * @param {String} mobile 手机号 */ function testMobile(mobile) { @@ -409,7 +406,7 @@ function testMobile(mobile) { /** * 检测是否是Url - * @author 万世科技 + * @author 小威 * @param {String} url url地址 */ function testUrl(url) { @@ -530,8 +527,13 @@ function toast(text) { uni.$u.toast(text) } +function isNull(text) { + return text == null || text == '' ? true : false +} - +function isNullStr(text) { + return text == null || text == '' ? '' : text +} /** * 微信小程序支付或APP微信支付或APP支付宝支付 * @param {Object} orderInfo 支付信息对象 @@ -623,6 +625,12 @@ function wxBrowserPay(params) { ); } +function splitList(data) { + if (data == null) { + return [] + } + return data.split(',') +} const wskj_function = { @@ -661,7 +669,10 @@ const wskj_function = { toast, pay, onSaveImageAlbum, - wxBrowserPay + wxBrowserPay, + isNullStr, + isNull, + splitList, } diff --git a/components/upload-image.vue b/components/upload-image.vue index 072d1a2..3465f30 100644 --- a/components/upload-image.vue +++ b/components/upload-image.vue @@ -43,18 +43,15 @@ images: { immediate: true, handler(newVal, oldVal) { - // console.log(newVal) - // console.log(this.fileList) this.fileList = [] if (newVal) { const urlList = newVal.split(",") + console.log(urlList) urlList.forEach(item => { - // 防止直接传递全路径 - let url = this.removeUrl(item, this.$config.domain) this.fileList.push({ status: 'success', message: '', - fullurl: this.$config.domain + url, + fullurl: url, url: url }) }) @@ -66,15 +63,12 @@ // 删除图片 deletePic(event, type) { this.fileList.splice(event.index, 1) - this.uploadParseData() }, // 新增图片 async afterRead(event, type) { - // console.log(event) let lists = [].concat(event.file) let fileListLen = this.fileList.length - lists.map((item) => { this.fileList.push({ ...item, @@ -84,13 +78,13 @@ }) for (let i = 0; i < lists.length; i++) { const result = await this.$wskj.uploadImg(lists[i].url) - // console.log(result) + console.log(result) let item = this[[type]][fileListLen] this.fileList.splice(fileListLen, 1, Object.assign(item, { status: 'success', message: '', url: result.url, - fullurl: result.fullurl + fullurl: result.url })) fileListLen++ } @@ -98,6 +92,8 @@ }, uploadParseData() { const images = this.fileList.map(item => item[this.type]).join(",") + console.log(this.fileList) + console.log(images) this.$emit('upload', images) }, removeUrl(str, urlToRemove) { diff --git a/pages.json b/pages.json index 1bc0455..8003ffd 100644 --- a/pages.json +++ b/pages.json @@ -12,6 +12,12 @@ "navigationBarTitleText": "协议" } }, + { + "path": "pages/my/feedback", + "style": { + "navigationBarTitleText": "协议" + } + }, { "path": "pages/wy-home", "style": { diff --git a/pages/login/wechatlogin.vue b/pages/login/wechatlogin.vue index a925ed7..8c2581d 100644 --- a/pages/login/wechatlogin.vue +++ b/pages/login/wechatlogin.vue @@ -33,45 +33,58 @@ return { agreement: false, code: '', - userId: '' }; }, onLoad(options) { - this.userId = options.userId || '' const token = uni.getStorageSync('token') - if (!token) { + if (token) { this.$wskj.switchTab('/pages/wy-home'); } + + }, + onShow() { + }, methods: { onGetphonenumber(e) { + // 获取微信授权code + const than = this uni.login({ provider: 'weixin', success: (loginRes) => { - this.code = loginRes.code - console.log("微信授权信息", loginRes) - console.log("手机号授权信息", e) - if (e.detail.iv && e.detail.encryptedData) { - const params = { - url: '/api/login/mobile', - loadingTip: '登录中...', - data: { - payCode: this.code, - loginCode: e.detail.code, - } - } - this.$request(params).then(res => { - console.log(res) - if (res.code === 200) { - uni.setStorageSync('token', res.data.token) - this.$wskj.switchTab('/pages/wy-home'); + than.code = loginRes.code + // 获取用户信息 + uni.getUserInfo({ + provider: 'weixin', + success: function(infoRes) { + console.log("微信授权信息", loginRes) + console.log("微信用户信息", infoRes); + console.log("手机号授权信息", e) + if (e.detail.iv && e.detail.encryptedData) { + const params = { + url: '/api/login/mobile', + loadingTip: '登录中...', + data: { + payCode: than.code, + loginCode: e.detail.code, + encryptedData: infoRes.encryptedData, + iv: infoRes.iv, + } + } + than.$request(params).then(res => { + console.log(res) + if (res.code === 200) { + uni.setStorageSync('token', res.data.token) + than.$wskj.switchTab('/pages/wy-home'); + } else { + than.$u.toast(res.msg || '登录失败') + } + }) } else { - this.$u.toast(res.msg || '登录失败') + than.$u.toast('手机号授权失败') } - }) - } else { - this.$u.toast('手机号授权失败') - } + } + }); } }); diff --git a/pages/my/feedback.vue b/pages/my/feedback.vue index 6d60a0e..a70d89a 100644 --- a/pages/my/feedback.vue +++ b/pages/my/feedback.vue @@ -1,33 +1,28 @@ + \ No newline at end of file diff --git a/pages/wy-home.vue b/pages/wy-home.vue index 70a3cc1..fd6ad3c 100644 --- a/pages/wy-home.vue +++ b/pages/wy-home.vue @@ -44,6 +44,35 @@ + + + 楼栋号/单元号/户号 + + + + {{item.room}} + + + + + 完成 + + + + @@ -51,10 +80,17 @@ export default { data() { return { + //选择小区用到的字段 address: '请选择', show: false, - selectIndex: 0, + selectIndex: -1, listXq: [], + communityId: '', //小区ID + //选择小区户号用到的字段 + showHh: false, + selectHhIndex: -1, + listHh: [], + proprietorId: '', //户号id list1: [ "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2023%2F0826%2F07b46817j00rzyq1h000kd000hs00alp.jpg&thumbnail=660x2147483647&quality=80&type=jpg", "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2023%2F0826%2F07b46817j00rzyq1h000kd000hs00alp.jpg&thumbnail=660x2147483647&quality=80&type=jpg", @@ -95,7 +131,11 @@ }; }, onShow() { - this.listAll() + this.userInfo() + this.getXqList() + //获取小区信息 + const addressItem = uni.getStorageSync("addressItem") + this.address = addressItem.communityName }, methods: { open() { @@ -103,7 +143,6 @@ }, close() { this.show = false - // console.log('close'); }, onSelect(index) { this.selectIndex = index @@ -111,11 +150,14 @@ onSubmit() { this.show = false this.address = this.listXq[this.selectIndex].communityName + this.communityId = this.listXq[this.selectIndex].communityId + uni.setStorageSync('addressItem', this.listXq[this.selectIndex]) + this.getHhList() }, - listAll() { + //获取小区数据 + getXqList() { const params = { url: '/api/community/listAll', - loadingTip: '', method: 'GET', data: {} } @@ -124,6 +166,57 @@ this.listXq = res.data }) }, + + openHh() { + this.showHh = true + }, + closeHh() { + this.showHh = false + }, + onSelectHh(index) { + this.selectHhIndex = index + + }, + onSubmitHh() { + this.showHh = false + this.proprietorId = this.listHh[this.selectHhIndex].proprietorId + this.upHh() + }, + //获取户号数据 + getHhList() { + const params = { + url: '/api/community/room/listAllByCommunityId/' + this.communityId, + method: 'GET', + data: {} + } + this.$request(params).then(res => { + console.log(res.data) + this.listHh = res.data + //打开户号选择的弹框 + this.openHh() + }) + }, + upHh() { + const params = { + url: '/api/community/cut/' + this.communityId + "/" + this.proprietorId, + data: {} + } + this.$request(params).then(res => { + this.$wskj.toast("设置成功") + }) + }, + userInfo() { + const params = { + url: '/api/login/userInfo', + method: 'GET', + data: {} + } + this.$request(params).then(res => { + uni.setStorageSync('userInfo', res.data) + }) + }, + + onClick(index) { if (index == 0) { this.$wskj.to("/pagesMain/pages/fkdj") @@ -143,6 +236,7 @@ } if (index == 4) { this.$wskj.toast("敬请期待") + this.$wskj.to("/pages/my/feedback") return } if (index == 5) { @@ -179,4 +273,9 @@ border-bottom: 1rpx solid #f5f5f5; border-right: 1rpx solid #f5f5f5; } + + .v-top-popup /deep/ .u-popup__content { + border-radius: 0 0 24rpx 24rpx; + margin-top: 20%; + } \ No newline at end of file diff --git a/pages/wy-mine.vue b/pages/wy-mine.vue index 4dcd8a5..25f1927 100644 --- a/pages/wy-mine.vue +++ b/pages/wy-mine.vue @@ -3,10 +3,10 @@ - + - 旅行的小七仔 - 177****1234 + {{userInfo.nickName}} + {{userInfo.mobile}} @@ -18,11 +18,11 @@ - 利达国宾中心 + {{userInfo.communityName}} - 1栋2单元205室 + {{userInfo.room}} @@ -58,14 +58,26 @@ export default { data() { return { - + userInfo: {}, }; }, - onLoad(options) { - + onShow() { + this.getUserInfo() }, methods: { + getUserInfo() { + const params = { + url: '/api/login/userInfo', + loadingTip: '', + method: 'GET', + data: {} + } + this.$request(params).then(res => { + this.userInfo = res.data + uni.setStorageSync('userInfo', res.data) + }) + }, onClick(index) { if (index == 3) { this.$wskj.to("/pagesMine/pages/zlbj") diff --git a/pagesMain/pages/bxbs.vue b/pagesMain/pages/bxbs.vue index 88fed47..762fd83 100644 --- a/pagesMain/pages/bxbs.vue +++ b/pagesMain/pages/bxbs.vue @@ -16,7 +16,6 @@ data() { return { - }; }, onLoad(options) { @@ -31,11 +30,11 @@ }, onClick(index) { if (index == 0) { - this.$wskj.to("/pagesMain/pages/bxbs_submit?type=0") + this.$wskj.to("/pagesMain/pages/bxbs_submit?type=1") return } if (index == 1) { - this.$wskj.to("/pagesMain/pages/bxbs_submit?type=1") + this.$wskj.to("/pagesMain/pages/bxbs_submit?type=2") return } if (index == 2) { @@ -43,7 +42,7 @@ return } if (index == 3) { - this.$wskj.to("/pagesMain/pages/fwgz") + this.$wskj.to("/pagesMain/pages/fwgz?type=1") return } } diff --git a/pagesMain/pages/bxbs_lsgd.vue b/pagesMain/pages/bxbs_lsgd.vue index 1cff89d..9f4db51 100644 --- a/pagesMain/pages/bxbs_lsgd.vue +++ b/pagesMain/pages/bxbs_lsgd.vue @@ -11,7 +11,7 @@ :style="{ color: index==0?'#FF682D':index==1?'#EEA616':index==2?'#1FCA7C':'#23BBEE'}" v-for="(item, index) in 4" :key="index"> 25 - 待处理 + {{index==0?'待处理':index==1?'待支付':index==2?'已完成':index==3?'已取消':''}} @@ -22,25 +22,29 @@ - + - + 居家报修 - 待处理 + {{item.state==1?'待处理':item.state==2?'待支付':item.state==3?'已完成':item.state==4?'已取消':''}} - 待处理 + {{item.repairsDescription}} - - + + - 2025-03-10 10:01:45 - 去支付 + {{item.repairsTime}} + 关闭报修 + 去支付 报修详情 @@ -57,14 +61,51 @@ return { type: 0, tabIndex: 0, + list: [], }; }, onLoad(e) { this.type = e.type + this.getList() }, methods: { onClick(index) { - this.$wskj.to("/pagesMain/pages/bxxq") + this.tabIndex = index; + this.getList() + }, + onCz(e, index) { + if (e == "详情") { + this.$wskj.to("/pagesMain/pages/bxxq") + return + } + if (e == "关闭报修") { + this.gb(this.list[index].repairsId); + return + } + if (e == "去支付") { + + return + } + }, + getList() { + const params = { + url: '/api/repairs/userListAll?state=' + (this.tabIndex + 1), + method: 'GET', + } + this.$request(params).then(res => { + this.list = res.data + + }) + }, + gb(id) { + const params = { + url: '/api/repairs/cancel/' + id, + method: 'PUT', + } + this.$request(params).then(res => { + this.getList() + + }) } }, }; diff --git a/pagesMain/pages/bxbs_submit.vue b/pagesMain/pages/bxbs_submit.vue index 035cfea..5cb8e7a 100644 --- a/pagesMain/pages/bxbs_submit.vue +++ b/pagesMain/pages/bxbs_submit.vue @@ -7,25 +7,25 @@ - - 利达国宾中心 + + {{userinfo.communityName}} - + 业主信息 业主姓名 - 张三 + {{$wskj.isNullStr(userinfo.name)}} 业主房间号 - 张三 + {{$wskj.isNullStr(userinfo.room)}} 业主手机号 - 张三 + {{userinfo.mobile}} @@ -37,7 +37,8 @@ - + @@ -45,16 +46,6 @@ 提交 - - - - - - 确认提交? - - - @@ -65,58 +56,48 @@ title: '居家报修', type: 0, reason: '', - submitShow: false, images: '', + userinfo: '', }; }, onLoad(e) { this.type = e.type - if (e.type == 0) { + if (e.type == 1) { this.title = "居家报修" } else { this.title = "公区报事" } + this.userinfo = uni.getStorageSync("userInfo") }, methods: { - onSubmit() { - this.$wskj.to("/pagesMain/pages/tjsq?type=" + this.type) - // if (!this.reason) { - // return this.$u.toast('请输入内容') - // } - // if (!this.images) { - // return this.$u.toast('请至少上传一张照片') - // } - // if (this.reason.length < 10) { - // return this.$u.toast('文字描述最低10个字') - // } - // this.submitShow = true + upload(e) { + this.images = e }, - // 提交 - onConfirmSubmit() { - // const params = { - // url: '/api/user/yijian', - // loadingTip: '', - // data: { - // content: this.reason, - // images: this.images - // } - // } - // // console.log(params); - // this.$request(params).then(res => { - // // console.log(res) - // this.submitShow = false - // if (res.code === 1) { - // this.$u.toast(res.msg || '提交成功') - - // this.reason = '' - // this.images = '' - // } else { - // this.$u.toast(res.msg || '提交失败') - // } - // }).catch(err => { - // this.submitShow = false - // this.$u.toast(err.msg || '提交失败') - // }) + onSubmit() { + console.log(this.images) + if (!this.reason) { + this.$wskj.toast('请输入报修信息'); + return + } + if (!this.images) { + this.$wskj.toast('请上传图片'); + return + } + const params = { + url: '/api/repairs/add', + loadingTip: '加载中...', + data: { + repairsDescription: this.reason, + repairsImg: this.images, + type: this.type + } + } + this.$request(params).then(res => { + this.$wskj.toast('提交成功') + setTimeout(() => { + this.$wskj.goBack(1) + }, 600) + }) } }, }; diff --git a/pagesMain/pages/cydh.vue b/pagesMain/pages/cydh.vue index 809184b..2aac6cb 100644 --- a/pagesMain/pages/cydh.vue +++ b/pagesMain/pages/cydh.vue @@ -5,21 +5,22 @@ :title-style="{color: '#FFF'}"> - + - + - 天气预报 + {{item.name}} - 12121 + {{item.phone}} @@ -28,7 +29,7 @@ {{index==0?"取消置顶":"置顶"}} - + 一键拨打 @@ -49,11 +50,15 @@ export default { data() { return { - + list: [], + searchKey: '', }; }, onLoad(e) { + }, + onShow() { + this.listAll() }, methods: { onZd(index) { @@ -64,6 +69,28 @@ } }, + search(event) { + this.searchKey = event.detail.value + console.log(this.filteredList(this.searchKey)) + }, + filteredList(e) { + return e == '' ? this.list : this.list.filter(item => { + // 筛选条件:名称包含关键词(忽略大小写) + return item.name.includes(e) + }) + }, + listAll() { + const params = { + url: '/api/commonPhone/listAll', + loadingTip: '', + method: 'GET', + data: {} + } + this.$request(params).then(res => { + console.log(res.data) + this.list = res.data + }) + }, onBd(phone) { this.$wskj.onCall(phone) } diff --git a/pagesMain/pages/fkdj.vue b/pagesMain/pages/fkdj.vue index 303b5f2..198b641 100644 --- a/pagesMain/pages/fkdj.vue +++ b/pagesMain/pages/fkdj.vue @@ -9,53 +9,59 @@ 访客登记 - + * 访客姓名 - - + + - - + + * 到访小区 - - 请选择小区 + + {{address==''?'请选择小区':address}} - + * 到访房间号 - - + + - - + + * - 到访时间 + 手机号 - - {{startTimeValue==""?"请选择到访时间":startTimeValue}} - + + - + * - 手机号 + 验证码 - - + + + + + + + {{tips}} @@ -64,35 +70,32 @@ 车牌号 - + - 提交 + 提交 选择小区 - + - 西城小区 + {{item.communityName}} - + 下一步 - - @@ -100,10 +103,19 @@ export default { data() { return { - showDate: false, - startTimeValue: "", - startTime: new Date().getTime(), + tips: '', show: false, + selectIndex: -1, + address: '', + data: { + guestName: "", //访客姓名 + guestPhone: "", //访客手机 + communityId: 0, //小区ID + guestRoom: "", //访客房间号 + plateNumber: "", //车牌号 + phoneCode: "" //手机验证码 + }, + listXq: [], list1: [ "https://zhongqian.xnszz.com/1-images/home/20250213002.png", ], @@ -131,43 +143,94 @@ }; }, onLoad(options) { - - }, - onReady() { - // 微信小程序需要用此写法 - this.$refs.datetimePicker.setFormatter(this.formatter) + this.listAll() }, methods: { - open() { - // console.log('open'); + //选择小区 + listAll() { + const params = { + url: '/api/community/listAll', + loadingTip: '', + method: 'GET', + data: {} + } + this.$request(params).then(res => { + console.log(res.data) + this.listXq = res.data + }) }, - close() { + onSelect(index) { + this.selectIndex = index + }, + onSubmit() { this.show = false - // console.log('close'); + this.data.communityId = this.listXq[this.selectIndex].communityId; + this.address = this.listXq[this.selectIndex].communityName; + uni.setStorageSync('addressItem', this.listXq[this.selectIndex]); }, - formatter(type, value) { - if (type === 'year') { - return `${value}年` - } - if (type === 'month') { - return `${value}月` + //获取验证码 + codeChange(text) { + this.tips = text; + }, + getCode() { + if (!this.data.guestPhone) { + this.$wskj.toast('请输入手机号'); + return } - if (type === 'day') { - return `${value}日` + if (this.$refs.uCode.canGetCode) { + const params = { + url: '/api/login/sendSmsCode', + loadingTip: '', + method: 'GET', + data: { + mobile: this.data.guestPhone + } + } + this.$request(params).then(res => { + this.$refs.uCode.start(); + }) + + } else { + this.$wskj.toast('倒计时结束后再发送'); } - return value - }, - onOpenStartTime() { - this.showDate = true }, - onCloseStartTime() { - this.showDate = false + //新增访客 + onAdd() { + if (!this.data.guestName) { + this.$wskj.toast('请输入姓名'); + return + } + if (!this.data.communityId) { + this.$wskj.toast('请选择小区'); + return + } + if (!this.data.guestRoom) { + this.$wskj.toast('请输入房间号'); + return + } + if (!this.data.guestPhone) { + this.$wskj.toast('请输入手机号'); + return + } + if (!this.data.phoneCode) { + this.$wskj.toast('请输入验证码'); + return + } + const params = { + url: '/api/guest/add', + loadingTip: '加载中...', + data: this.data + } + this.$request(params).then(res => { + + }) }, - onConfirmStartTime(e) { - this.onCloseStartTime() - this.startTimeValue = this.$wskj.timeFormat(e.value, 'yyyy-mm-dd') - this.$emit('onConfirmStartTime', this.startTimeValue) + open() { + this.show = true }, + close() { + this.show = false + } } }; diff --git a/pagesMain/pages/fwgz.vue b/pagesMain/pages/fwgz.vue index f5ce6a9..35bce9f 100644 --- a/pagesMain/pages/fwgz.vue +++ b/pagesMain/pages/fwgz.vue @@ -1,7 +1,7 @@