2022-9-29 xy

master
271556543@qq.com 4 years ago
parent b074e234b7
commit bddf3f3711

@ -1,4 +1,4 @@
const mode = process.env.NODE_ENV; const mode = 'development';
let ROOTPATH = ''; //域名 let ROOTPATH = ''; //域名
switch (mode) { switch (mode) {
case 'development': case 'development':

@ -1,51 +1,54 @@
//api集合 //api集合
let apiAuth = { let apiAuth = {
login: "/api/nurse/auth/login", login: "/api/nurse/auth/login",
me: "/api/nurse/auth/me", me: "/api/nurse/auth/me",
logout: "/api/nurse/auth/logout", logout: "/api/nurse/auth/logout",
save: "/api/nurse/auth/save", save: "/api/nurse/auth/save",
}; };
let apiTask = { let apiTask = {
nurseList: "/api/nurse/nurse-list", nurseList: "/api/nurse/nurse-list",
nurseDetail: "/api/nurse/nurse-detail", nurseDetail: "/api/nurse/nurse-detail",
nurseSave: "/api/nurse/nurse-save", nurseSave: "/api/nurse/nurse-save",
nurseCalendar: "/api/nurse/nurse-calendar", processSave: "/api/nurse/process-save",
noticeList: "/api/nurse/notice-list", nurseCalendar: "/api/nurse/nurse-calendar",
noticeDetail: "/api/nurse/notice-detail", noticeList: "/api/nurse/notice-list",
statistic: "/api/nurse/statistic", noticeDetail: "/api/nurse/notice-detail",
statistic: "/api/nurse/statistic",
}; };
// 此处第二个参数vm就是我们在页面使用的this你可以通过vm获取vuex等操作 // 此处第二个参数vm就是我们在页面使用的this你可以通过vm获取vuex等操作
const install = (Vue, vm) => { const install = (Vue, vm) => {
//api方法 //api方法
let login = (data = {}) => vm.$u.post(apiAuth.login, data); let login = (data = {}) => vm.$u.post(apiAuth.login, data);
let me = (data = {}) => vm.$u.post(apiAuth.me, data); let me = (data = {}) => vm.$u.post(apiAuth.me, data);
let logout = (data = {}) => vm.$u.post(apiAuth.logout, data); let logout = (data = {}) => vm.$u.post(apiAuth.logout, data);
let save = (data = {}) => vm.$u.post(apiAuth.save, data); let save = (data = {}) => vm.$u.post(apiAuth.save, data);
let nurseList = (params = {}) => vm.$u.get(apiTask.nurseList, params); let nurseList = (params = {}) => vm.$u.get(apiTask.nurseList, params);
let nurseDetail = (params = {}) => vm.$u.get(apiTask.nurseDetail, params); let nurseDetail = (params = {}) => vm.$u.get(apiTask.nurseDetail, params);
let nurseSave = (data = {}) => vm.$u.post(apiTask.nurseSave, data); let nurseSave = (data = {}) => vm.$u.post(apiTask.nurseSave, data);
let nurseCalendar = (params = {}) => vm.$u.get(apiTask.nurseCalendar, params); let processSave = (data = {}) => vm.$u.post(apiTask.processSave, data);
let noticeList = (params = {}) => vm.$u.get(apiTask.noticeList, params); let nurseCalendar = (params = {}) => vm.$u.get(apiTask.nurseCalendar, params);
let noticeDetail = (params = {}) => vm.$u.get(apiTask.noticeDetail, params); let noticeList = (params = {}) => vm.$u.get(apiTask.noticeList, params);
let statistic = (params = {}) => vm.$u.get(apiTask.statistic, params); let noticeDetail = (params = {}) => vm.$u.get(apiTask.noticeDetail, params);
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下 let statistic = (params = {}) => vm.$u.get(apiTask.statistic, params);
vm.$u.api = { // 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
login, vm.$u.api = {
me, login,
logout, me,
save, logout,
save,
nurseList, nurseList,
nurseDetail, nurseDetail,
nurseSave, nurseSave,
processSave,
nurseCalendar, nurseCalendar,
noticeList, noticeList,
noticeDetail, noticeDetail,
statistic statistic
}; };
}; };
export default { export default {
install, install,
}; };

@ -59,6 +59,10 @@
"scope.userLocation" : { "scope.userLocation" : {
"desc" : "获取位置" "desc" : "获取位置"
} }
},
"requiredPrivateInfos" : [ "getLocation" ],
"optimization" : {
"subPackages" : true
} }
}, },
"mp-alipay" : { "mp-alipay" : {

@ -50,7 +50,7 @@
<view>{{detail.customer.phone}}</view> <view>{{detail.customer.phone}}</view>
</view> </view>
</view> </view>
<view class="re-location"> <view class="re-location" @click="$u.throttle(refreshLoaction,1000)">
<view class="text">更新定位</view> <view class="text">更新定位</view>
<u-image src="/static/detail/distance.png" height="34" width="34"></u-image> <u-image src="/static/detail/distance.png" height="34" width="34"></u-image>
</view> </view>
@ -66,10 +66,9 @@
<view class="content"> <view class="content">
<view class="content-item" v-for="(item,index) in detail.sku" :key='item.id'> <view class="content-item" v-for="(item,index) in detail.sku" :key='item.id'>
<view class="checkbox"> <u-checkbox v-model="form[index].isSelect" shape="circle" :name="item.sku_info.name">
<u-checkbox v-model="form[index].isSelect" shape="circle"></u-checkbox> {{item.sku_info.name}}
<view>{{item.sku_info.name}}</view> </u-checkbox>
</view>
<view class="input"> <view class="input">
<u-input v-model="form[index].time" :custom-style="inputStyle" placeholder="请输入" <u-input v-model="form[index].time" :custom-style="inputStyle" placeholder="请输入"
placeholder-style="color:#A7AFBC;" input-align="center" :clearable="false" type="number" placeholder-style="color:#A7AFBC;" input-align="center" :clearable="false" type="number"
@ -83,11 +82,19 @@
<!-- 打卡 --> <!-- 打卡 -->
<view class="clock"> <view class="clock">
<view class="btn" :class="{'btn-active':isClick && type === 1}" @click="punch"> <view class="btn">
<view class="text1">过程打卡</view> <view class="text1">过程打卡</view>
<view class="text2">1</view> <view class="text2">3</view>
</view>
<view class="btn" @click="$u.throttle(sign)">
<view class="text1">签到</view>
<view class="text2">{{$u.timeFormat(time,'hh:MM:ss')}}</view>
</view>
<view class="btn">
<view class="text1">签退</view>
<view class="text2">{{$u.timeFormat(time,'hh:MM:ss')}}</view>
</view> </view>
<view class="btn" :class="{'btn-active':isClick && type === 2}" @click="locate"> <view class="btn">
<view class="text1">更新定位</view> <view class="text1">更新定位</view>
<view class="text2">{{$u.timeFormat(time,'hh:MM:ss')}}</view> <view class="text2">{{$u.timeFormat(time,'hh:MM:ss')}}</view>
</view> </view>
@ -102,12 +109,14 @@
</template> </template>
<script> <script>
import {
ROOTPATH
} from '@/common/config.js'
import QQMapWX from '@/libs/qqmap-wx-jssdk.js' import QQMapWX from '@/libs/qqmap-wx-jssdk.js'
export default { export default {
data() { data() {
return { return {
isClick: false,
type: '', type: '',
qqmapsdk: null, qqmapsdk: null,
inputStyle: { inputStyle: {
@ -122,15 +131,27 @@
borderRadius: '100%', borderRadius: '100%',
background: 'blue' background: 'blue'
}, },
form: [],
detail: {},
time: new Date(),
location: { location: {
lng: '', lng: '',
lat: '', lat: '',
time: '', time: '',
address: '' address: ''
} },
form: {
schedule_list_id: '',
lat: '',
lng: '',
address: '',
type: '',
upload_list: [],
},
subForm: {
id: '',
sku_time_list: []
},
detail: {},
time: new Date(),
} }
}, },
methods: { methods: {
@ -145,7 +166,7 @@
id id
}) })
this.detail = res this.detail = res
this.form = res.sku.map(item => { this.subForm.schedule_list_id = res.sku.map(item => {
return { return {
isSelect: false, isSelect: false,
sku_id: item.id, sku_id: item.id,
@ -154,75 +175,165 @@
}) })
}, },
save(type) { //
this.$u.api.nurseSave({ getLoaction() {
id: this.detail.id, return new Promise((resolve, reject) => {
sku_time_list: this.form.filter(item => {
return item.isSelect
}),
logs: [{
lat: this.location.lat,
lng: this.location.lng,
address: this.location.address,
type
}]
}).then(res => {
if (type === 1) {
uni.showToast({
icon: 'success',
title: '打卡成功'
})
}
if (type === 2) {
uni.showToast({
icon: 'success',
title: '更新定位成功'
})
}
})
},
punch() {
this.$u.throttle(() => {
this.type = 1
this.isClick = true
this.save(1)
setTimeout(() => {
this.isClick = false
}, 10000)
}, 10000)
},
//
locate() {
this.$u.throttle(() => {
this.type = 2
this.isClick = true
setTimeout(() => {
this.isClick = false
}, 10000)
uni.getLocation().then(res => { uni.getLocation().then(res => {
this.location.lat = res[1]?.latitude if (res[1]) {
this.location.lng = res[1]?.longitude this.location.lat = res[1]?.latitude
this.location.time = this.time this.location.lng = res[1]?.longitude
this.location.time = this.time
new Promise((reject, resolve) => {
this.qqmapsdk.reverseGeocoder({ this.qqmapsdk.reverseGeocoder({
location: { location: {
latitude: this.location.lat, latitude: this.location.lat,
longitude: this.location.lng longitude: this.location.lng
}, },
success: (r) => { success: (res) => {
reject(r) this.location.address = res.result.address
resolve(res)
},
fail: (err) => {
reject(err)
} }
}) })
}).then(res => { } else {
this.location.address = res.result.address uni.showToast({
icon: 'none',
title: '操作频繁,请稍后再试'
})
reject(res)
}
this.save(2) })
})
},
//
refreshLoaction() {
this.getLoaction().then(res => {
uni.showToast({
icon: 'none',
title: '更新定位成功'
})
})
},
//
async uploadImgs() {
let res = await uni.chooseImage()
if (res[1]) {
let promiseAll = res[1].tempFilePaths.map(item => {
console.log(`${ROOTPATH}/api/nurse/upload-file`);
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${ROOTPATH}/api/nurse/upload-file`,
header: {
Authorization: `Bearer ${this.vuex_token}`
},
filePath: item,
name: 'file',
success: (res1) => {
resolve(res1)
},
fail: (err) => {
reject(err)
}
})
}) })
}) })
}, 10000)
return Promise.all(promiseAll)
} else {
uni.showToast({
icon: 'none',
title: '上传失败'
})
}
},
//
sign() {
this.uploadImgs().then(res => {
this.form.upload_list = res.map(item => {
return {
upload_id: JSON.parse(item.data).id
}
})
console.log(this.form);
})
}, },
// save(type) {
// this.$u.api.nurseSave({
// id: this.detail.id,
// sku_time_list: this.form.filter(item => {
// return item.isSelect
// }),
// logs: [{
// lat: this.location.lat,
// lng: this.location.lng,
// address: this.location.address,
// type
// }]
// }).then(res => {
// if (type === 1) {
// uni.showToast({
// icon: 'success',
// title: ''
// })
// }
// if (type === 2) {
// uni.showToast({
// icon: 'success',
// title: ''
// })
// }
// })
// },
// punch() {
// this.$u.throttle(() => {
// this.type = 1
// this.isClick = true
// this.save(1)
// setTimeout(() => {
// this.isClick = false
// }, 10000)
// }, 10000)
// },
//
// locate() {
// this.$u.throttle(() => {
// this.type = 2
// this.isClick = true
// setTimeout(() => {
// this.isClick = false
// }, 10000)
// uni.getLocation().then(res => {
// this.location.lat = res[1]?.latitude
// this.location.lng = res[1]?.longitude
// this.location.time = this.time
// new Promise((reject, resolve) => {
// this.qqmapsdk.reverseGeocoder({
// location: {
// latitude: this.location.lat,
// longitude: this.location.lng
// },
// success: (r) => {
// reject(r)
// }
// })
// }).then(res => {
// this.location.address = res.result.address
// this.save(2)
// })
// })
// }, 10000)
// },
}, },
computed: { computed: {
ageComputed() { ageComputed() {
@ -243,6 +354,8 @@
this.getDeatil(option.id) this.getDeatil(option.id)
this.getLoaction()
setInterval(() => { setInterval(() => {
this.time = new Date() this.time = new Date()
}, 1000) }, 1000)
@ -251,10 +364,6 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/deep/.u-checkbox {
display: inline !important;
}
.user-info { .user-info {
width: 710rpx; width: 710rpx;
background: #FFFFFF; background: #FFFFFF;
@ -442,21 +551,7 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.checkbox { .checkbox {}
display: flex;
align-items: center;
&>view {
height: 40rpx;
font-size: 28rpx;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #36596A;
line-height: 40rpx;
padding-left: 16rpx;
}
}
.input { .input {
display: flex; display: flex;
@ -523,33 +618,6 @@
.text2 { .text2 {
@extend .text-class; @extend .text-class;
} }
&-active {
&::after {
content: '';
width: 80rpx;
height: 80rpx;
background: rgba(180, 180, 180, 0.5);
border-radius: 100%;
animation: ripper 270ms linear forwards;
position: absolute;
top: calc(50% - 40rpx);
left: calc(50% - 40rpx);
}
@keyframes ripper {
from {
opacity: 0.8;
}
to {
opacity: 0.1;
transform: scale(2.6, 2.6);
}
}
}
} }
} }

@ -3,7 +3,8 @@
<!-- 用户信息 --> <!-- 用户信息 -->
<view class="user-info" @click="toSetting"> <view class="user-info" @click="toSetting">
<view class="head-img"> <view class="head-img">
<u-avatar :src="vuex_user.upload.url || '/static/logo.png'" size="104"></u-avatar> <u-avatar :src="vuex_user.upload.url || (vuex_user.sex === '男' ? vuex_male_img : vuex_female_img)"
size="104"></u-avatar>
</view> </view>
<view class="name"> <view class="name">

@ -47,7 +47,8 @@
<view class="center"> <view class="center">
<view class="avatar"> <view class="avatar">
<u-image src="/static/logo.png" height="104" width="104" shape="circle"></u-image> <u-image :src="item.customer.sex === '男' ? vuex_male_img : vuex_female_img" height="104"
width="104" shape="circle"></u-image>
</view> </view>
<view class="user-info"> <view class="user-info">
<view class="name">{{item.customer.name}}</view> <view class="name">{{item.customer.name}}</view>
@ -55,13 +56,13 @@
<view> <view>
<u-icon name="phone" size="28" color="#1479FF"></u-icon> <u-icon name="phone" size="28" color="#1479FF"></u-icon>
</view> </view>
<view class="text">{{item.customer.phone}}</view> <view class="text">{{item.customer.phone || '无'}}</view>
</view> </view>
<view class="address"> <view class="address">
<view> <view>
<u-icon name="map" size="28" color="#1479FF"></u-icon> <u-icon name="map" size="28" color="#1479FF"></u-icon>
</view> </view>
<view class="text">{{item.customer.address}}</view> <view class="text">{{item.customer_address.address || '无'}}</view>
</view> </view>
</view> </view>
<view class="sex"> <view class="sex">
@ -390,6 +391,7 @@
} }
.user-info { .user-info {
flex: 1;
padding-left: 24rpx; padding-left: 24rpx;

@ -82,7 +82,8 @@
<view v-if="selectUserList && selectUserList.length > 0"> <view v-if="selectUserList && selectUserList.length > 0">
<view v-for="(item,index) in selectUserList" :key="index" class="user-item"> <view v-for="(item,index) in selectUserList" :key="index" class="user-item">
<view class="left"> <view class="left">
<u-image src="/static/logo.png" height="104" width="104" shape="circle"></u-image> <u-image :src="item.customer.sex === '男' ? vuex_male_img : vuex_female_img" height="104"
width="104" shape="circle"></u-image>
</view> </view>
<view class="center"> <view class="center">
<view class="top">{{item.customer.name}}</view> <view class="top">{{item.customer.name}}</view>

@ -12,7 +12,9 @@
<view class="text">头像</view> <view class="text">头像</view>
<view style="display: flex"> <view style="display: flex">
<view class="avatar"> <view class="avatar">
<u-avatar :src="vuex_user.upload.url || '/static/logo.png'" :size="104" mode="circle"> <u-avatar
:src="vuex_user.upload.url || (vuex_user.sex === '男' ? vuex_male_img : vuex_female_img)"
:size="104" mode="circle">
</u-avatar> </u-avatar>
</view> </view>
<view class="arrow" @click="chooseAvatar"> <view class="arrow" @click="chooseAvatar">
@ -114,7 +116,7 @@
}, },
filePath: path, filePath: path,
name: 'file', name: 'file',
complete: (res) => { success: (res) => {
this.$u.api.save({ this.$u.api.save({
avatar: JSON.parse(res.data).id avatar: JSON.parse(res.data).id
@ -127,6 +129,12 @@
this.$store.dispatch('me') this.$store.dispatch('me')
}) })
},
fail: (err) => {
uni.showToast({
icon: "none",
title: '更换头像失败'
})
} }
}); });
}) })

@ -29,7 +29,8 @@
<view class="center"> <view class="center">
<view class="avatar"> <view class="avatar">
<u-image src="/static/logo.png" height="104" width="104" shape="circle"></u-image> <u-image :src="item.customer.sex === '男' ? vuex_male_img : vuex_female_img" height="104"
width="104" shape="circle"></u-image>
</view> </view>
<view class="user-info"> <view class="user-info">
<view class="name">{{item.customer.name}}</view> <view class="name">{{item.customer.name}}</view>
@ -37,13 +38,13 @@
<view> <view>
<u-icon name="phone" size="28" color="#1479FF"></u-icon> <u-icon name="phone" size="28" color="#1479FF"></u-icon>
</view> </view>
<view class="text">{{item.customer.phone}}</view> <view class="text">{{item.customer.phone|| '无'}}</view>
</view> </view>
<view class="address"> <view class="address">
<view> <view>
<u-icon name="map" size="28" color="#1479FF"></u-icon> <u-icon name="map" size="28" color="#1479FF"></u-icon>
</view> </view>
<view class="text">{{item.customer.address}}</view> <view class="text">{{item.customer_address.address || '无'}}</view>
</view> </view>
</view> </view>
<view class="sex"> <view class="sex">
@ -240,7 +241,7 @@
} }
.user-info { .user-info {
flex: 1;
padding-left: 24rpx; padding-left: 24rpx;
.name { .name {

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

@ -35,6 +35,8 @@ const store = new Vuex.Store({
vuex_user: lifeData.vuex_user || null, vuex_user: lifeData.vuex_user || null,
vuex_token: lifeData.vuex_token || '', vuex_token: lifeData.vuex_token || '',
vuex_version: '1.0', vuex_version: '1.0',
vuex_male_img: '/static/male.png',
vuex_female_img: '/static/female.png'
}, },
mutations: { mutations: {
$uStore(state, payload) { $uStore(state, payload) {

Loading…
Cancel
Save