shuchang hai 3 meses
pai
achega
86ec32d044

+ 10 - 4
common/config/api.js

@@ -2,12 +2,18 @@ const {
 	http
 } = uni.$u
 
+// 获取用户信息
+export const getUserInfoUrl = (data) => http.get('/dev-api/api/wechat/getInfo', data);
+// 登录
+export const loginUrl = (data) => http.get('/dev-api/api/wechat/login', data);
+// 绑定信息
+export const bindInfoUrl = (data) => http.get('/dev-api/api/wechat/bindPhone', data);
+// 提交
+export const applyUrl = (params, config = {}) => http.post('/dev-api/care/applications', params, config);
+
 // 注册
 export const registerUrl = (params, config = {}) => http.post('/xc-order/api//order/user/register', params, config);
-// 登录
-export const loginUrl = (params, config = {}) => http.post('/xc-order/api/order/user/login', params, config);
-// 获取用户信息
-export const getUserInfoUrl = (data) => http.get('/xc-order/api/order/user/getUser', data);
+
 // 获取未读消息数
 export const getMsgCountUrl = (data) => http.get('/xc-order/api/order/message/getNotReadNum', data);
 // 修改消息

+ 14 - 0
pages.json

@@ -80,6 +80,20 @@
 					"navigationStyle": "custom",
 					"navigationBarTitleText": "选择护理公司/人员"
 				}
+			},
+			{
+				"path": "pages/apply/apply",
+				"style": {
+					"navigationStyle": "custom",
+					"navigationBarTextStyle": "black"
+				}
+			},
+			{
+				"path": "pages/choose-people/choose-people",
+				"style": {
+					"navigationStyle": "custom",
+					"navigationBarTextStyle": "black"
+				}
 			}
 		]
 	}],

+ 139 - 0
pages/subpack/pages/apply/apply.vue

@@ -0,0 +1,139 @@
+<template>
+	<view class="container">
+		<up-navbar class="u-navbar-box" title="护理申请" auto-back placeholder bgColor="transparent"
+			:title-style="{fontWeight:'bold'}">
+		</up-navbar>
+		<scroll-view scroll-y class="flex-column flex-1" style="overflow: hidden;background-color: #F6F8FD;">
+			<view class="p-32 flex-column" style="width: 686rpx;">
+				<view class="w-100p flex-column">
+					<view class="flex-row align-center">
+						<view style="width: 6rpx;height: 32rpx;background-color: #39A1FF;border-radius: 4rpx;"></view>
+						<text class="font-xmd text-black3" style="margin-left: 14rpx;">预约人信息</text>
+					</view>
+					<view class="flex-column py-4 px-24 mt-24"
+						style="background: linear-gradient( 180deg, #E8F4FF 0%, #FFFFFF 100%);border-radius: 16rpx;">
+						<view class="flex-row align-center justify-between">
+							<text class="font text-black2">姓名</text>
+							<view class="flex-row justify-end" style="width: 440rpx;">
+								<up-input placeholder="请输入申请人姓名" border="none" v-model.trim="formData.name" clearable
+									:maxlength="20" input-align="end"></up-input>
+								<!-- <text class="font text-black2">请选择申请人</text> -->
+							</view>
+						</view>
+						<view class="flex-row align-center justify-between mt-4">
+							<text class="font text-black2">护理需求</text>
+							<view style="width: 440rpx;">
+								<up-input placeholder="请输入护理需求" border="none" v-model.trim="formData.demand" clearable
+									:maxlength="50"></up-input>
+							</view>
+						</view>
+						<view class="flex-row align-center justify-between mt-4">
+							<text class="font text-black2">首选护理人员性别</text>
+							<view style="width: 440rpx;">
+								<u-input placeholder="请输入性别" border="none" type="number" v-model.trim="formData.sex"
+									clearable :maxlength="11"></u-input>
+							</view>
+						</view>
+						<view class="flex-row align-center justify-between mt-4">
+							<text class="font text-black2">所在医院</text>
+							<view style="width: 440rpx;">
+								<u-input placeholder="请输入所在医院" border="none" type="number"
+									v-model.trim="formData.hospital" clearable :maxlength="11"></u-input>
+							</view>
+						</view>
+						<view class="flex-row align-center justify-between mt-4">
+							<text class="font text-black2">详细地址</text>
+							<view style="width: 440rpx;">
+								<u-input placeholder="请输入详细地址" border="none" type="number"
+									v-model.trim="formData.address" clearable :maxlength="11"></u-input>
+							</view>
+						</view>
+						<view class="flex-row align-center justify-between mt-4">
+							<text class="font text-black2">预计天数</text>
+							<view style="width: 440rpx;">
+								<u-input placeholder="请输入预计天数" border="none" type="number"
+									v-model.trim="formData.dayCount" clearable :maxlength="11"></u-input>
+							</view>
+						</view>
+						<view class="flex-row align-center justify-between mt-4">
+							<text class="font text-black2">备注</text>
+							<view style="width: 440rpx;">
+								<u-input placeholder="请输入备注" border="none" type="number" v-model.trim="formData.remark"
+									clearable :maxlength="50"></u-input>
+							</view>
+						</view>
+					</view>
+				</view>
+
+				<view class="w-100p flex-row align-center justify-center mt-4"
+					style="background-color: #39A1FF;height: 88rpx;border-radius: 50rpx;" @click="handleSubmit">
+					<text class="font-md text-white">确认提交</text>
+				</view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import dayjs from 'dayjs'
+	import {
+		applyUrl
+	} from '@/common/config/api.js'
+	export default {
+		data() {
+			return {
+				formData: {
+					personId: '6',
+					name: '',
+					demand: '',
+					sex: '',
+					hospital: '',
+					address: '',
+					dayCount: '',
+					remark: ''
+				}
+			}
+		},
+		methods: {
+			handleSubmit() {
+				applyUrl({
+						address: this.formData.address,
+						applyDate: dayjs().format('YYYY-MM-DD'),
+						careDays: this.formData.dayCount,
+						careNeeds: this.formData.demand,
+						hospital: this.formData.hospital,
+						nurseGender: this.formData.sex,
+						personId: this.formData.personId,
+						personName: this.formData.name,
+						remark: this.formData.remark
+					})
+					.then(res => {
+						console.log('提交');
+					})
+					.catch(err => {
+						console.log(err);
+					})
+			},
+			goChoosePeople() {
+				uni.navigateTo({
+					url: '/pages/subpack/pages/choose-people/choose-people'
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.container {
+		height: 100vh;
+		// background-image: url('@/static/images/index-bg.png');
+		// background-size: cover;
+		// background-position: center;
+		display: flex;
+		flex-direction: column;
+	}
+
+	.u-navbar-box {
+		background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
+	}
+</style>

+ 59 - 10
pages/subpack/pages/bindInfo/bindInfo.vue

@@ -20,7 +20,7 @@
 				</image>
 			</button>
 
-			<view class="flex-row align-center border-top border-bottom px-2"
+			<!-- <view class="flex-row align-center border-top border-bottom px-2"
 				style="width: 710rpx; height: 88rpx;margin-top: 40rpx;">
 				<view style="width: 150rpx;">
 					<text class="font font-weight-bolder text-black2">昵称</text>
@@ -28,7 +28,7 @@
 				<view style="margin-left: 20rpx;">
 					<input v-model.trim="nickName" type="nickname" :maxlength="20"></input>
 				</view>
-			</view>
+			</view> -->
 
 			<view class="flex-row align-center border-top border-bottom px-2"
 				style="width: 710rpx; height: 88rpx;margin-top: 40rpx;">
@@ -51,37 +51,86 @@
 </template>
 
 <script>
+	import {
+		bindInfoUrl,
+		getUserInfoUrl
+	} from '@/common/config/api.js'
 	export default {
 		data() {
 			return {
+				openId: '',
 				phone: '',
-				nickName: '',
+				// nickName: '',
 				avatarImg: '/pages/subpack/static/images/avatar.png',
 			}
 		},
 		onLoad(options) {
 			console.log('options: ', options);
+			this.openId = options.openId;
 		},
 		methods: {
 			onChooseAvatar(e) {
 				console.log('头像选择', e);
 				this.avatarImg = e.detail.avatarUrl
 			},
-			handleLogin() {     
-				if (!this.nickName) {
-					return uni.$u.toast('请输入昵称')
-				}
+			getUserInfo() {
+				getUserInfoUrl({
+						custom: {
+							catch: true
+						}
+					})
+					.then(res => {
+						uni.hideLoading();
+						console.log('用户信息', res);
+						let user = {
+							avatar: this.avatarImg,
+							nickName: res.user.nickName,
+							phonenumber: res.user.phonenumber,
+							roles: res.roles
+						}
+						this.$u.vuex('vuex_user', user);
+						uni.switchTab({
+							url: '/pages/tabbar/application/application'
+						})
+					})
+					.catch(err => {
+						uni.hideLoading();
+						console.log(err);
+					})
+			},
+			handleLogin() {
+				// if (!this.nickName) {
+				// 	return uni.$u.toast('请输入昵称')
+				// }
 				if (!this.phone) {
 					return uni.$u.toast('请输入手机号码')
 				}
 				if (!uni.$u.test.mobile(this.phone)) {
 					return uni.$u.toast('请输入正确的手机号码')
 				}
+				uni.showLoading({
+					title: '用户认证中...'
+				})
+
+				bindInfoUrl({
+						params: {
+							openId: this.openId,
+							phone: this.phone
+						}
+					})
+					.then(res => {
+						console.log('绑定用户信息', res);
+						this.$u.vuex('vuex_token', res.token);
+						// 获取用户信息
+						this.getUserInfo();
+					})
+					.catch(err => {
+						uni.hideLoading();
+						console.log(err);
+					})
 
 				// 跳转
-				uni.switchTab({
-					url: '/pages/tabbar/application/application'
-				})
+
 			},
 		}
 	}

+ 81 - 0
pages/subpack/pages/choose-people/choose-people.vue

@@ -0,0 +1,81 @@
+<template>
+	<z-paging ref="listPaging" v-model="dataList" @query="queryList" loading-more-no-more-text="没有更多消息了">
+		<template v-slot:top>
+			<div class="flex-column">
+				<up-navbar class="u-navbar-box" title="申请人列表" bgColor="transparent" auto-back
+					:title-style="{fontWeight:'bold'}">
+				</up-navbar>
+				<!-- <u-search v-model="keyword" :maxlength="10" placeholder="请输入人员姓名"></u-search> -->
+				<text>123</text>
+			</div>
+		</template>
+		<!-- <ItemReservation v-for="(item,index) in dataList" :item="item" :index="index" @cancel="handleCancel">
+		</ItemReservation> -->
+	</z-paging>
+</template>
+
+<script>
+	import {
+		getReservationListUrl,
+		cancelReservationUrl
+	} from '@/common/config/api.js'
+	// import ItemReservation from '@/components/ItemReservation.vue'
+	export default {
+		components: {
+			// ItemReservation
+		},
+		data() {
+			return {
+				keyword: '',
+				dataList: []
+			}
+		},
+		computed: {
+			computeNavHeight() {
+				console.log(uni.$u.sys());
+				return uni.$u.sys().statusBarHeight + 44 + 'px'
+			}
+		},
+		methods: {
+			handleCancel(orderId) {
+				cancelReservationUrl(orderId)
+					.then(res => {
+						console.log('取消预约', res);
+						uni.$u.toast('取消成功')
+						this.$refs.listPaging.reload();
+					})
+					.catch(err => {
+						console.log(err);
+						uni.$u.toast('取消失败')
+					})
+			},
+			queryList(pageNo, pageSize) {
+				getReservationListUrl({
+						params: {
+							pageNum: pageNo,
+							pageSize: pageSize,
+							createUser: this.vuex_user.id
+						}
+					})
+					.then(res => {
+						console.log('消息列表: ', res);
+						this.$refs.listPaging.complete(res.records);
+					})
+					.catch(err => {
+						console.log('err: ', err);
+						this.$refs.listPaging.complete(false);
+					})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	page {
+		background-color: #F6F8FD;
+	}
+
+	.u-navbar-box {
+		background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
+	}
+</style>

+ 29 - 4
pages/subpack/pages/login/login.vue

@@ -21,18 +21,43 @@
 </template>
 
 <script>
+	import {
+		loginUrl
+	} from '@/common/config/api.js'
 	export default {
 		data() {
 			return {}
 		},
 		methods: {
 			// 利用code登录
-			loginByCode() {
+			loginByCode(code) {
+				// console.log('code', code);
+				loginUrl({
+						params: {
+							code
+						}
+					})
+					.then(res => {
+						console.log('微信登录', res);
+						if (res.token) {
+							this.$u.vuex('vuex_token', res.token);
+							return uni.switchTab({
+								url: '/pages/tabbar/application/application'
+							})
+						};
+						if (res.openId) {
+							// 没有注册过
+							return uni.$u.route('/pages/subpack/pages/bindInfo/bindInfo', {
+								openId: res.openId
+							});
+						}
+					})
+					.catch(err => {
+						console.log('err', err);
+					})
 				// 暂时登录成功
 				// 跳转去手机号码填写页面
-				uni.navigateTo({
-					url: '/pages/subpack/pages/bindInfo/bindInfo'
-				})
+
 			},
 			// 微信登录
 			loginByWechat() {

+ 44 - 11
pages/tabbar/application/application.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="container" :style="{height:computeHeight}">
-		<up-navbar title="首页" placeholder bgColor="transparent" leftIcon='' :title-style="{fontWeight:'bold'}">
+		<up-navbar class="u-navbar-box" title="首页" placeholder bgColor="transparent" leftIcon=''
+			:title-style="{fontWeight:'bold'}">
 		</up-navbar>
 		<!-- header -->
 		<view class="flex-row justify-between"
@@ -17,7 +18,7 @@
 			</view>
 		</view>
 		<!--入口  -->
-		<view class="px-32" style="margin-top: -60rpx;" @click="goReservation">
+		<view class="px-32" style="margin-top: -60rpx;" @click="handleEnterClick">
 			<view class="position-relative flex-row align-center justify-between"
 				style="width: 100%;height: 148rpx;border-radius: 20rpx;background-color: rgba(228, 240, 255, 0.8);">
 				<image style="width: 100%;height: 100%;" src="@/static/images/index-center-bg.png" mode="aspectFill">
@@ -28,10 +29,10 @@
 						<image style="width: 66rpx;height: 66rpx;" src="@/static/images/index-enter-logo.png"
 							mode="aspectFill"></image>
 						<view class="flex-column ml-24">
-							<text class="font-md" style="color: #4A90C6;">护理申请</text>
+							<text class="font-md" style="color: #4A90C6;">{{computeHandleDesc}}</text>
 							<view class="bg-white flex-row align-center justify-center"
 								style="width: 208rpx;height: 40rpx;border-radius: 20rpx;margin-top: 18rpx;">
-								<text style="color: #4A90C6;font-size: 22rpx;">一键快速申请</text>
+								<text style="color: #4A90C6;font-size: 22rpx;">一键快速处理</text>
 							</view>
 						</view>
 					</view>
@@ -45,6 +46,8 @@
 
 <script>
 	import {
+		getUserInfoUrl,
+
 		getMsgCountUrl
 	} from '@/common/config/api.js'
 	export default {
@@ -54,7 +57,8 @@
 			}
 		},
 		onLoad() {
-
+			// 获取用户信息
+			this.getUserInfo();
 		},
 		onShow() {
 			this.getMsgCount();
@@ -62,9 +66,31 @@
 		computed: {
 			computeHeight() {
 				return uni.$u.sys().windowHeight + 'px'
+			},
+			computeHandleDesc() {
+				// 民政所
+				if (this.vuex_user.roles.includes('village')) {
+					return '护理申请'
+				}
 			}
 		},
 		methods: {
+			getUserInfo() {
+				getUserInfoUrl()
+					.then(res => {
+						console.log('用户信息', res);
+						let user = {
+							avatar: this.avatarImg,
+							nickName: res.user.nickName,
+							phonenumber: res.user.phonenumber,
+							roles: res.roles
+						}
+						this.$u.vuex('vuex_user', user);
+					})
+					.catch(err => {
+						console.log('err', err);
+					})
+			},
 			// 获取未读消息数量
 			getMsgCount() {
 				console.log(this.vuex_user.id);
@@ -92,20 +118,27 @@
 					})
 			},
 			// 点击预约
-			goReservation() {
-				uni.navigateTo({
-					url: '/pages/subpack/pages/cat-choose/cat-choose'
-				})
+			handleEnterClick() {
+				if (this.vuex_user.roles.includes('village')) {
+					return uni.navigateTo({
+						url: '/pages/subpack/pages/apply/apply'
+					})
+				}
 			}
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
+	.u-navbar-box {
+		background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
+	}
+
+
 	.container {
 		// background-image: url('@/static/images/index-bg.png');
-		background-size: cover;
-		background-position: center;
+		// background-size: cover;
+		// background-position: center;
 
 		.index-tag {
 			width: 164rpx;

BIN=BIN
static/images/index-bg.png


+ 7 - 6
utils/request/index.js

@@ -10,13 +10,14 @@ import {
 //  初始化请求配置
 const initRequest = (vm) => {
 	http.setConfig((defaultConfig) => {
+		defaultConfig.baseURL = 'http://tkhtest.natapp1.cc' /* 根域名 */
 		/* defaultConfig 为默认全局配置 */
-		if (process.env.NODE_ENV === 'development') {
-			defaultConfig.baseURL = '/api' /* 根域名 */
-		}
-		if (process.env.NODE_ENV === 'production') {
-			defaultConfig.baseURL = '/api' /* 根域名 */
-		}
+		// if (process.env.NODE_ENV === 'development') {
+		// 	defaultConfig.baseURL = '/api' /* 根域名 */
+		// }
+		// if (process.env.NODE_ENV === 'production') {
+		// 	defaultConfig.baseURL = '/api' /* 根域名 */
+		// }
 		return defaultConfig
 	})
 	requestInterceptors()

+ 5 - 6
utils/request/interceptors.js

@@ -25,25 +25,24 @@ const responseInterceptors = (vm) => {
 	 * @param {Object} http 
 	 */
 	http.interceptors.response.use((response) => {
-		console.log('response: ', response);
-		// toast(JSON.stringify(response.data))
+		// console.log('response: ', response);
 		/* 对响应成功做点什么 可使用async await 做异步操作*/
 		const data = response.data
 		// console.log('http', data)
 		// 自定义参数
 		const custom = response.config?.custom
-		if (data.meta.code !== '1') { // 服务端返回的状态码不等于200,则reject()
+		if (data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
 			// 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示
 			if (custom.toast !== false) {
-				toast(data.meta.message)
+				toast(data.msg)
 			}
-			if (data.meta.code === 401) {
+			if (data.code === 401) {
 				uni.showToast({
 					icon: 'none',
 					title: '请先登录'
 				})
 				uni.redirectTo({
-					url: '/pages/login/login'
+					url: '/pages/subpack/pages/login/login'
 				})
 			}
 			// 如果需要catch返回,则进行reject