2022-9-29 xy

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

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

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

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

@ -50,7 +50,7 @@
<view>{{detail.customer.phone}}</view>
</view>
</view>
<view class="re-location">
<view class="re-location" @click="$u.throttle(refreshLoaction,1000)">
<view class="text">更新定位</view>
<u-image src="/static/detail/distance.png" height="34" width="34"></u-image>
</view>
@ -66,10 +66,9 @@
<view class="content">
<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"></u-checkbox>
<view>{{item.sku_info.name}}</view>
</view>
<u-checkbox v-model="form[index].isSelect" shape="circle" :name="item.sku_info.name">
{{item.sku_info.name}}
</u-checkbox>
<view class="input">
<u-input v-model="form[index].time" :custom-style="inputStyle" placeholder="请输入"
placeholder-style="color:#A7AFBC;" input-align="center" :clearable="false" type="number"
@ -83,11 +82,19 @@
<!-- 打卡 -->
<view class="clock">
<view class="btn" :class="{'btn-active':isClick && type === 1}" @click="punch">
<view class="btn">
<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 class="btn" :class="{'btn-active':isClick && type === 2}" @click="locate">
<view class="btn">
<view class="text1">更新定位</view>
<view class="text2">{{$u.timeFormat(time,'hh:MM:ss')}}</view>
</view>
@ -102,12 +109,14 @@
</template>
<script>
import {
ROOTPATH
} from '@/common/config.js'
import QQMapWX from '@/libs/qqmap-wx-jssdk.js'
export default {
data() {
return {
isClick: false,
type: '',
qqmapsdk: null,
inputStyle: {
@ -122,15 +131,27 @@
borderRadius: '100%',
background: 'blue'
},
form: [],
detail: {},
time: new Date(),
location: {
lng: '',
lat: '',
time: '',
address: ''
}
},
form: {
schedule_list_id: '',
lat: '',
lng: '',
address: '',
type: '',
upload_list: [],
},
subForm: {
id: '',
sku_time_list: []
},
detail: {},
time: new Date(),
}
},
methods: {
@ -145,7 +166,7 @@
id
})
this.detail = res
this.form = res.sku.map(item => {
this.subForm.schedule_list_id = res.sku.map(item => {
return {
isSelect: false,
sku_id: item.id,
@ -154,75 +175,165 @@
})
},
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)
//
getLoaction() {
return new Promise((resolve, reject) => {
uni.getLocation().then(res => {
this.location.lat = res[1]?.latitude
this.location.lng = res[1]?.longitude
this.location.time = this.time
if (res[1]) {
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)
success: (res) => {
this.location.address = res.result.address
resolve(res)
},
fail: (err) => {
reject(err)
}
})
}).then(res => {
this.location.address = res.result.address
} else {
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: {
ageComputed() {
@ -243,6 +354,8 @@
this.getDeatil(option.id)
this.getLoaction()
setInterval(() => {
this.time = new Date()
}, 1000)
@ -251,10 +364,6 @@
</script>
<style scoped lang="scss">
/deep/.u-checkbox {
display: inline !important;
}
.user-info {
width: 710rpx;
background: #FFFFFF;
@ -442,21 +551,7 @@
justify-content: space-between;
align-items: center;
.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;
}
}
.checkbox {}
.input {
display: flex;
@ -523,33 +618,6 @@
.text2 {
@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="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 class="name">

@ -47,7 +47,8 @@
<view class="center">
<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 class="user-info">
<view class="name">{{item.customer.name}}</view>
@ -55,13 +56,13 @@
<view>
<u-icon name="phone" size="28" color="#1479FF"></u-icon>
</view>
<view class="text">{{item.customer.phone}}</view>
<view class="text">{{item.customer.phone || '无'}}</view>
</view>
<view class="address">
<view>
<u-icon name="map" size="28" color="#1479FF"></u-icon>
</view>
<view class="text">{{item.customer.address}}</view>
<view class="text">{{item.customer_address.address || '无'}}</view>
</view>
</view>
<view class="sex">
@ -390,6 +391,7 @@
}
.user-info {
flex: 1;
padding-left: 24rpx;

@ -82,7 +82,8 @@
<view v-if="selectUserList && selectUserList.length > 0">
<view v-for="(item,index) in selectUserList" :key="index" class="user-item">
<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 class="center">
<view class="top">{{item.customer.name}}</view>

@ -12,7 +12,9 @@
<view class="text">头像</view>
<view style="display: flex">
<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>
</view>
<view class="arrow" @click="chooseAvatar">
@ -114,7 +116,7 @@
},
filePath: path,
name: 'file',
complete: (res) => {
success: (res) => {
this.$u.api.save({
avatar: JSON.parse(res.data).id
@ -127,6 +129,12 @@
this.$store.dispatch('me')
})
},
fail: (err) => {
uni.showToast({
icon: "none",
title: '更换头像失败'
})
}
});
})

@ -29,7 +29,8 @@
<view class="center">
<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 class="user-info">
<view class="name">{{item.customer.name}}</view>
@ -37,13 +38,13 @@
<view>
<u-icon name="phone" size="28" color="#1479FF"></u-icon>
</view>
<view class="text">{{item.customer.phone}}</view>
<view class="text">{{item.customer.phone|| '无'}}</view>
</view>
<view class="address">
<view>
<u-icon name="map" size="28" color="#1479FF"></u-icon>
</view>
<view class="text">{{item.customer.address}}</view>
<view class="text">{{item.customer_address.address || '无'}}</view>
</view>
</view>
<view class="sex">
@ -240,7 +241,7 @@
}
.user-info {
flex: 1;
padding-left: 24rpx;
.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_token: lifeData.vuex_token || '',
vuex_version: '1.0',
vuex_male_img: '/static/male.png',
vuex_female_img: '/static/female.png'
},
mutations: {
$uStore(state, payload) {

Loading…
Cancel
Save