wangyx 1 month ago
parent
commit
4593b52703
  1. 17
      App.vue
  2. 4
      pages.json
  3. 114
      pages/login/login.vue
  4. 8
      pages/tabBar/work/index.vue
  5. 7
      pages/tabBar/xjPage/xj.vue
  6. 23
      pagesA/checkout/detail/detail.vue
  7. 2
      pagesA/checkout/list/list.vue
  8. 42
      pagesA/force/index/index.vue
  9. 37
      pagesA/release/detail/detail.vue
  10. 6
      pagesA/release/list/list.vue

17
App.vue

@ -2,22 +2,7 @@
export default { export default {
onLaunch: function() { onLaunch: function() {
console.log('App Launch'); console.log('App Launch');
// uni.logincode
uni.login({
provider:'weixin',
success: function(loginRes) {
// code
console.log('获取的用户code是:' + loginRes.code);
uni.request({
url:'',
method:'POST'
})
},
fail: function(error) {
//
console.error('登录失败:', error);
}
});
}, },
onShow: function() { onShow: function() {
console.log('App Show') console.log('App Show')

4
pages.json

@ -62,14 +62,14 @@
{ {
"path": "pages/tabBar/sdPage/sfReport", "path": "pages/tabBar/sdPage/sfReport",
"style": { "style": {
"navigationBarTitleText": "水上报", "navigationBarTitleText": "水上报",
"disableScroll": true "disableScroll": true
} }
}, },
{ {
"path": "pages/tabBar/sdPage/dfReport", "path": "pages/tabBar/sdPage/dfReport",
"style": { "style": {
"navigationBarTitleText": "电上报", "navigationBarTitleText": "电上报",
"disableScroll": true "disableScroll": true
} }
} }

114
pages/login/login.vue

@ -1,11 +1,7 @@
<template> <template>
<view class="login-bg"> <view class="login-bg">
<view class="login-welcome"> <view class="login-welcome">
<image <image class="login-bg-img" src="../../static/img/login-top.png" mode="aspectFill"></image>
class="login-bg-img"
src="../../static/img/login-top.png"
mode="aspectFill"
></image>
<view class="login-welcome-content"> <view class="login-welcome-content">
<text class="login-title">您好</text> <text class="login-title">您好</text>
<text class="login-title">欢迎使用</text> <text class="login-title">欢迎使用</text>
@ -14,61 +10,39 @@
<view class="login-form-box"> <view class="login-form-box">
<view class="login-form-item"> <view class="login-form-item">
<text class="login-label">用户名</text> <text class="login-label">用户名</text>
<u-input <u-input v-model="form.username" placeholder="请输入用户名" type="text" border="none" shape="circle"
v-model="form.username" custom-style="background:#f6f6f6;padding:16rpx 0;padding-left:16px;" />
placeholder="请输入用户名"
type="text"
border="none"
shape="circle"
custom-style="background:#f6f6f6;padding:16rpx 0;padding-left:16px;"
/>
</view> </view>
<view class="login-form-item"> <view class="login-form-item">
<text class="login-label">密码</text> <text class="login-label">密码</text>
<u-input <u-input v-model="form.password" placeholder="请输入密码" type="password" border="none" shape="circle"
v-model="form.password" custom-style="background:#f6f6f6;padding:16rpx 0;padding-left:16px;" />
placeholder="请输入密码"
type="password"
border="none"
shape="circle"
custom-style="background:#f6f6f6;padding:16rpx 0;padding-left:16px;"
/>
</view> </view>
<view class="login-form-item captcha-row"> <view class="login-form-item captcha-row">
<text class="login-label">验证码</text> <text class="login-label">验证码</text>
<view class="captcha-flex"> <view class="captcha-flex">
<u-input <u-input v-model="form.code" placeholder="验证码" border="none" shape="circle"
v-model="form.code" custom-style="background:#f6f6f6;padding:16rpx 0;padding-left:16px;" />
placeholder="验证码" <image :src="codeUrl" class="captcha-img" mode="aspectFit" @click="getCaptcha" />
border="none"
shape="circle"
custom-style="background:#f6f6f6;padding:16rpx 0;padding-left:16px;"
/>
<image
:src="codeUrl"
class="captcha-img"
mode="aspectFit"
@click="getCaptcha"
/>
</view> </view>
</view> </view>
</view> </view>
<view class="login-btn-box"> <view class="login-btn-box">
<u-button <u-button :hairline="false" shape="circle" :custom-style="btnStyle" @click="handleLogin"
:hairline="false" color="#fff">登录</u-button>
shape="circle"
:custom-style="btnStyle"
@click="handleLogin"
color="#fff"
>登录</u-button
>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { login, getCodeImg } from "../api"; import {
import { encrypt, decrypt } from "../../utils/jsencrypt"; login,
getCodeImg
} from "../api";
import {
encrypt,
decrypt
} from "../../utils/jsencrypt";
export default { export default {
data() { data() {
return { return {
@ -104,6 +78,24 @@ export default {
} }
}, },
async handleLogin() { async handleLogin() {
// uni.logincode
uni.login({
provider: 'weixin',
success: function(loginRes) {
// code
console.log('获取的用户code是:' + loginRes.code);
// uni.request({
// url: '',
// method: 'POST'
// }).then(res => {
// console.log(res, 'res')
// })
},
fail: function(error) {
//
console.error('登录失败:', error);
}
});
const username = String(this.form.username); // const username = String(this.form.username); //
// 1. // 1.
const lockInfo = JSON.parse( const lockInfo = JSON.parse(
@ -126,7 +118,10 @@ export default {
} }
// 2. // 2.
if (!this.form.username || !this.form.password || !this.form.code) { if (!this.form.username || !this.form.password || !this.form.code) {
uni.showToast({ title: "请填写完整信息", icon: "none" }); uni.showToast({
title: "请填写完整信息",
icon: "none"
});
return; return;
} }
this.loading = true; this.loading = true;
@ -153,9 +148,14 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.loginFailCounts[username] = 0; this.loginFailCounts[username] = 0;
uni.setStorageSync("token", res.token); uni.setStorageSync("token", res.token);
uni.switchTab({ url: "/pages/tabBar/work/index" }); uni.switchTab({
url: "/pages/tabBar/work/index"
});
} else { } else {
uni.showToast({ title: res.msg, icon: "none" }); uni.showToast({
title: res.msg,
icon: "none"
});
// //
this.loginFailCounts[username] = this.loginFailCounts[username] =
(this.loginFailCounts[username] || 0) + 1; (this.loginFailCounts[username] || 0) + 1;
@ -164,14 +164,20 @@ export default {
this.accountLockTimes[username] = lockEndTime; this.accountLockTimes[username] = lockEndTime;
uni.setStorageSync( uni.setStorageSync(
`lock_${username}`, `lock_${username}`,
JSON.stringify({ lockEndTime, username }) JSON.stringify({
lockEndTime,
username
})
); );
uni.showToast({ uni.showToast({
title: "账号登录失败次数过多,已锁定10分钟", title: "账号登录失败次数过多,已锁定10分钟",
icon: "none", icon: "none",
}); });
} else { } else {
uni.showToast({ title: res[1].data.msg || "登录失败", icon: "none" }); uni.showToast({
title: res[1].data.msg || "登录失败",
icon: "none"
});
} }
this.getCaptcha(); this.getCaptcha();
} }
@ -191,12 +197,14 @@ export default {
background: #f7fafd; background: #f7fafd;
height: 100vh; height: 100vh;
} }
.login-welcome { .login-welcome {
position: relative; position: relative;
width: 100vw; width: 100vw;
padding-top: 244rpx; padding-top: 244rpx;
overflow: hidden; overflow: hidden;
} }
.login-bg-img { .login-bg-img {
position: absolute; position: absolute;
left: 0; left: 0;
@ -205,6 +213,7 @@ export default {
height: 526px; height: 526px;
z-index: 1; z-index: 1;
} }
.login-welcome-content { .login-welcome-content {
position: relative; position: relative;
z-index: 2; z-index: 2;
@ -216,6 +225,7 @@ export default {
padding-left: 60rpx; padding-left: 60rpx;
margin-bottom: 70rpx; margin-bottom: 70rpx;
} }
.login-title { .login-title {
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
@ -231,9 +241,11 @@ export default {
padding: 40rpx 30rpx 30rpx 30rpx; padding: 40rpx 30rpx 30rpx 30rpx;
margin-bottom: -46rpx; margin-bottom: -46rpx;
} }
.login-form-item { .login-form-item {
margin-bottom: 36rpx; margin-bottom: 36rpx;
} }
.login-label { .login-label {
font-size: 28rpx; font-size: 28rpx;
font-weight: bold; font-weight: bold;
@ -241,19 +253,23 @@ export default {
margin-bottom: 12rpx; margin-bottom: 12rpx;
display: block; display: block;
} }
.login-btn-box { .login-btn-box {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.captcha-row { .captcha-row {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.captcha-flex { .captcha-flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.captcha-img { .captcha-img {
width: 160rpx; width: 160rpx;
height: 60rpx; height: 60rpx;

8
pages/tabBar/work/index.vue

@ -71,8 +71,8 @@ export default {
{ image: '/static/img/记录.png', text: '巡检记录' }, { image: '/static/img/记录.png', text: '巡检记录' },
], ],
sdList: [ sdList: [
{ image: '/static/img/水费.png', text: '水上报' }, { image: '/static/img/水费.png', text: '水上报' },
{ image: '/static/img/电费.png', text: '电上报' }, { image: '/static/img/电费.png', text: '电上报' },
], ],
bxList: [ bxList: [
{ image: '/static/img/上报.png', text: '上报' }, { image: '/static/img/上报.png', text: '上报' },
@ -130,11 +130,11 @@ export default {
} }
}, },
handelSdClick (item) { handelSdClick (item) {
if(item.text === '水上报'){ if(item.text === '水上报'){
uni.navigateTo({ uni.navigateTo({
url: '/pages/tabBar/sdPage/sfReport' url: '/pages/tabBar/sdPage/sfReport'
}) })
} else if(item.text === '电上报'){ } else if(item.text === '电上报'){
uni.navigateTo({ uni.navigateTo({
url: '/pages/tabBar/sdPage/dfReport' url: '/pages/tabBar/sdPage/dfReport'
}) })

7
pages/tabBar/xjPage/xj.vue

@ -38,6 +38,8 @@
accept="all" accept="all"
@afterRead="afterRead" @afterRead="afterRead"
@delete="onDelete" @delete="onDelete"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
> >
<view class="custom-upload-btn"> <view class="custom-upload-btn">
<view class="icon-box"> <view class="icon-box">
@ -158,6 +160,11 @@ export default {
}); });
}); });
this.form.imageList = arry this.form.imageList = arry
},
//
oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
}, },
getDictType(){ getDictType(){
getDicts('inspection_question_type').then((res) => { getDicts('inspection_question_type').then((res) => {

23
pagesA/checkout/detail/detail.vue

@ -100,6 +100,8 @@ import { detail } from '@/api/mz/contract';
:maxCount="10" :maxCount="10"
uploadIconColor="#12c3c3" uploadIconColor="#12c3c3"
:previewImage="true" :previewImage="true"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
> >
<view class="custom-upload-btn"> <view class="custom-upload-btn">
<view class="icon-box"> <view class="icon-box">
@ -197,6 +199,11 @@ export default {
beforeRead(event) { beforeRead(event) {
console.log("event", event); console.log("event", event);
}, },
//
oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
},
// //
async afterRead(event) { async afterRead(event) {
@ -210,9 +217,9 @@ export default {
}); });
}); });
for (let i = 0; i < lists.length; i++) { for (let i = 0; i < lists.length; i++) {
try {
const result = await uploadImage(lists[i].url); const result = await uploadImage(lists[i].url);
let item = this[`fileList${event.name}`][fileListLen]; let item = this[`fileList${event.name}`][fileListLen];
this[`fileList${event.name}`].splice( this[`fileList${event.name}`].splice(
fileListLen, fileListLen,
1, 1,
@ -223,6 +230,20 @@ export default {
}) })
); );
fileListLen++; fileListLen++;
} catch (err) {
//
let msg = (err && err.msg) || (err && err.message) || "上传失败";
console.log('344',err);
uni.showToast({
title: msg,
icon: "none",
duration: 3000
});
//
this[`fileList${event.name}`].splice(fileListLen, 1);
return; //
}
} }
var arry = []; var arry = [];
this.fileList.filter((v, i) => { this.fileList.filter((v, i) => {

2
pagesA/checkout/list/list.vue

@ -32,7 +32,7 @@
</view> </view>
<view style="text-align: center;" v-if="isLoading">加载中...</view> <view style="text-align: center;" v-if="isLoading">加载中...</view>
<view v-else-if="listData.length <= 0" class="no-data"> 暂无数据~ </view> <view v-else-if="listData.length <= 0" class="no-data"> 暂无数据~ </view>
<view v-else-if="noMore && listData.length > 0" style="text-align: center;">没有更多了~</view> <!-- <view v-else-if="noMore && listData.length > 0" style="text-align: center;">没有更多了~</view> -->
</scroll-view> </scroll-view>
</view> </view>
</template> </template>

42
pagesA/force/index/index.vue

@ -12,6 +12,7 @@
:showAction="false" :showAction="false"
@search="handleQuery" @search="handleQuery"
@clear="handleClear" @clear="handleClear"
@clickIcon="handleQuery"
></u-search> ></u-search>
</u-form-item> </u-form-item>
</view> </view>
@ -53,13 +54,13 @@
/> --> /> -->
</u-form-item> </u-form-item>
<view style="border-bottom: 2rpx solid #e5e5e5; margin: 0"></view> <view style="border-bottom: 2rpx solid #e5e5e5; margin: 0"></view>
<u-form-item <!-- <u-form-item
label="退房日期" label="退房日期"
prop="leaveDate" prop="leaveDate"
required required
@click="showDate = false" @click="showDate = false"
> >
<text style="text-align: right">{{ baseInfo.checkOutTime }}</text> <text style="text-align: right">{{ baseInfo.checkOutTime }}</text> -->
<!-- <u--input <!-- <u--input
v-model="baseInfo.checkOutTime" v-model="baseInfo.checkOutTime"
placeholder="请选择退房日期" placeholder="请选择退房日期"
@ -67,7 +68,7 @@
readonly readonly
input-align="right" input-align="right"
></u--input> --> ></u--input> -->
</u-form-item> <!-- </u-form-item> -->
<!-- <u-form-item <!-- <u-form-item
label="问题类型" label="问题类型"
prop="problemType" prop="problemType"
@ -104,6 +105,8 @@
:maxCount="10" :maxCount="10"
uploadIconColor="#12c3c3" uploadIconColor="#12c3c3"
:previewImage="true" :previewImage="true"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
> >
<view class="custom-upload-btn"> <view class="custom-upload-btn">
<view class="icon-box"> <view class="icon-box">
@ -218,17 +221,19 @@ export default {
}); });
}, },
handleClear() { handleClear() {
this.form = { (this.baseInfo.graduateName = ""),
room: "", (this.baseInfo.telephone = ""),
name: "", (this.baseInfo.idCard = ""),
idCard: "", (this.baseInfo.checkOutTime = ""),
phone: "", (this.baseInfo.apartmentName = ""),
leaveDate: "", (this.baseInfo.buildingName = ""),
desc: "", (this.baseInfo.unitName = ""),
imageUrl: "", (this.baseInfo.roomTypeName = "");
pickerValue: "", },
problemType: "", //
}; oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
}, },
// //
beforeRead(event) { beforeRead(event) {
@ -315,13 +320,22 @@ export default {
}, },
handleTempSave(params) { handleTempSave(params) {
forceRelease(params).then((res) => { forceRelease(params).then((res) => {
if (res.code === 200) {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "success", icon: "success",
}); });
setTimeout(() => {
uni.switchTab({ uni.switchTab({
url: "/pages/tabBar/work/index", url: "/pages/tabBar/work/index",
}); });
}, 1500);
} else {
uni.showToast({
title: res.msg,
icon: "error",
});
}
}); });
}, },
}, },

37
pagesA/release/detail/detail.vue

@ -1,7 +1,11 @@
<template> <template>
<view class="checkout-detail-bg"> <view class="checkout-detail-bg">
<!-- 房间图片 --> <!-- 房间图片 -->
<image class="room-img" :src="userInfo.houseTypeCoverImg" mode="aspectFill"></image> <image
class="room-img"
:src="userInfo.houseTypeCoverImg"
mode="aspectFill"
></image>
<!-- 基本信息卡片 --> <!-- 基本信息卡片 -->
<view class="info-card"> <view class="info-card">
<view class="info-header"> <view class="info-header">
@ -78,7 +82,9 @@
uploadIconColor="#12c3c3" uploadIconColor="#12c3c3"
uploadText="点击上传" uploadText="点击上传"
:previewImage="true" :previewImage="true"
accept="media" accept="all"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
> >
</u-upload> </u-upload>
<!-- #endif --> <!-- #endif -->
@ -92,6 +98,8 @@
uploadIconColor="#12c3c3" uploadIconColor="#12c3c3"
:previewImage="true" :previewImage="true"
accept="image/*,video/*" accept="image/*,video/*"
:maxSize="10 * 1024 * 1024"
@oversize="oversize"
> >
<view class="custom-upload-btn"> <view class="custom-upload-btn">
<view class="icon-box"> <view class="icon-box">
@ -186,6 +194,11 @@ export default {
}); });
this.fileList = arry; this.fileList = arry;
}, },
//
oversize(e) {
this.$u.toast("请传10MB以内大小的图片/视频!");
return false;
},
// //
async afterRead(event) { async afterRead(event) {
let lists = [].concat(event.file); let lists = [].concat(event.file);
@ -284,14 +297,17 @@ export default {
} }
// //
if (!this.roomDetail.facilitiesCheckResults || this.roomDetail.facilitiesCheckResults.length === 0) { if (
!this.roomDetail.facilitiesCheckResults ||
this.roomDetail.facilitiesCheckResults.length === 0
) {
uni.showToast({ title: "请完成设备检查", icon: "none" }); uni.showToast({ title: "请完成设备检查", icon: "none" });
return; return;
} }
// //
const unfinishedDevices = this.roomDetail.facilitiesCheckResults.filter(item => const unfinishedDevices = this.roomDetail.facilitiesCheckResults.filter(
item.checkResult === undefined || item.checkResult === null (item) => item.checkResult === undefined || item.checkResult === null
); );
if (unfinishedDevices.length > 0) { if (unfinishedDevices.length > 0) {
uni.showToast({ title: "请完成所有设备检查", icon: "none" }); uni.showToast({ title: "请完成所有设备检查", icon: "none" });
@ -299,11 +315,14 @@ export default {
} }
// 0 // 0
const nonIntactDevices = this.roomDetail.facilitiesCheckResults.filter(item => const nonIntactDevices = this.roomDetail.facilitiesCheckResults.filter(
item.checkResult !== 0 (item) => item.checkResult !== 0
); );
if (nonIntactDevices.length > 0) { if (nonIntactDevices.length > 0) {
uni.showToast({ title: "所有设备必须都是完好状态才能提交", icon: "none" }); uni.showToast({
title: "所有设备必须都是完好状态才能提交",
icon: "none",
});
return; return;
} }
@ -313,7 +332,7 @@ export default {
cleaned: this.cleaned, cleaned: this.cleaned,
facilitiesCheckDesc: this.value, facilitiesCheckDesc: this.value,
facilitiesCheckImages: this.fileList, facilitiesCheckImages: this.fileList,
imageList:this.fileList imageList: this.fileList,
}; };
const res = await releaseRoom(parm); const res = await releaseRoom(parm);

6
pagesA/release/list/list.vue

@ -9,7 +9,7 @@
@scrolltolower="loadMore" @scrolltolower="loadMore"
style="height: 100vh;" style="height: 100vh;"
> >
<view v-for="item in listData" :key="item.id"> <view v-for="(item,index) in listData" :key="item.roomId">
<view class="checkout-card" @click="goDetail(item)"> <view class="checkout-card" @click="goDetail(item)">
<image :src="item.houseTypeCoverImg" class="room-img" mode="aspectFill"></image> <image :src="item.houseTypeCoverImg" class="room-img" mode="aspectFill"></image>
<view class="room-info"> <view class="room-info">
@ -23,7 +23,7 @@
</view> </view>
<view style="text-align: center;" v-if="isLoading">加载中...</view> <view style="text-align: center;" v-if="isLoading">加载中...</view>
<view v-else-if="listData.length <= 0" class="no-data"> 暂无数据~ </view> <view v-else-if="listData.length <= 0" class="no-data"> 暂无数据~ </view>
<view v-else-if="noMore && listData.length > 0" style="text-align: center;">没有更多了~</view> <!-- <view v-else-if="noMore " style="text-align: center;">没有更多了~</view> -->
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
@ -102,6 +102,8 @@ export default {
} }
}, },
goDetail(item) { goDetail(item) {
console.log(item,'item');
uni.navigateTo({ uni.navigateTo({
url: `/pagesA/release/detail/detail?roomId=${item.roomId}&userInfo=${JSON.stringify(item)}` url: `/pagesA/release/detail/detail?roomId=${item.roomId}&userInfo=${JSON.stringify(item)}`
}); });

Loading…
Cancel
Save