|
@@ -45,252 +45,269 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import {
|
|
|
- ref,
|
|
|
- onMounted,
|
|
|
- watch,
|
|
|
- computed
|
|
|
- } from 'vue';
|
|
|
- // import {
|
|
|
- // typeOptionSelect
|
|
|
- // } from "@/api/volunteerDetailsApi/details.js"
|
|
|
- import {
|
|
|
- workDate,
|
|
|
- getDataTime
|
|
|
- } from '@/api/volunteer.js'
|
|
|
- import Calendar from '../../components/uni-calendar/components/uni-calendar/uni-calendar.vue'
|
|
|
-
|
|
|
-
|
|
|
- // Toast 控制宫格
|
|
|
- const uToastRef = ref(null);
|
|
|
- const userType = uni.getStorageSync('userType') //读取本地存储
|
|
|
- // 用户/志愿者 识别标识
|
|
|
- const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
|
|
|
-
|
|
|
- const calendar = ref(null)
|
|
|
- const info = ref({
|
|
|
- lunar: true,
|
|
|
- range: true,
|
|
|
- insert: false,
|
|
|
- })
|
|
|
- const selected = ref([])
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 普通用户
|
|
|
- const serviceList1 = ref([{
|
|
|
- icon: '/static/img/统一知识平台-营运@1x.png',
|
|
|
- name: '家庭辅导',
|
|
|
- key:1,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/编组.png',
|
|
|
- name: '陪伴陪聊',
|
|
|
- key:2,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/清空.png',
|
|
|
- name: '家庭助理',
|
|
|
- key:3,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/构建.png',
|
|
|
- name: '健康管理',
|
|
|
- key:4,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/报事报修@6x.png',
|
|
|
- name: '家庭清洁',
|
|
|
- key:5,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/报事报修@6x.png',
|
|
|
- name: '家务帮手',
|
|
|
- key:6,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/报事报修@6x.png',
|
|
|
- name: '资讯与服务',
|
|
|
- key:7,
|
|
|
- },
|
|
|
- ]);
|
|
|
- //志愿者
|
|
|
- const serviceList2 = ref([{
|
|
|
- icon: '/static/img/统一知识平台-营运@1x.png',
|
|
|
- name: '家庭辅导注册',
|
|
|
- key: 2,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/编组.png',
|
|
|
- name: '陪伴陪聊注册',
|
|
|
- key: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/清空.png',
|
|
|
- name: '家庭助理注册',
|
|
|
- key: 3,
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/构建.png',
|
|
|
- name: '健康管理注册',
|
|
|
- key: 4
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/报事报修@6x.png',
|
|
|
- name: '家庭清洁注册',
|
|
|
- key: 5
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/报事报修@6x.png',
|
|
|
- name: '家务帮手注册',
|
|
|
- key: 6
|
|
|
- },
|
|
|
- {
|
|
|
- icon: '/static/img/清空.png',
|
|
|
- name: '排班管理',
|
|
|
- key: 7
|
|
|
- },
|
|
|
- ]);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 宫格点击事件
|
|
|
- const handleGridClick = async (index) => {
|
|
|
- const service = serviceList1.value[index]; // 获取点击的服务条目
|
|
|
- // 用户
|
|
|
- if (userType == 1) {
|
|
|
- // 只有第一条和第二条可以跳转
|
|
|
- if (index === 0 || index === 1) {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages_home/pages/client/details?name=${encodeURIComponent(service.name)}`
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 其他条目提示“敬请期待”
|
|
|
- uni.showToast({
|
|
|
- title: '敬请期待',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- // 志愿者
|
|
|
- if (userType == 2 && uToastRef.value) {
|
|
|
- const data = serviceList2.value[index]
|
|
|
- if (data.key !== 7) {
|
|
|
- data.key === 1 || data.key === 2 ? uni.navigateTo({
|
|
|
- url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(data))}`
|
|
|
- }) : uni.showToast({
|
|
|
- title: '敬请期待',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- return;
|
|
|
- }
|
|
|
- init();
|
|
|
- calendar.value.open();
|
|
|
+import {
|
|
|
+ ref,
|
|
|
+ onMounted,
|
|
|
+ watch,
|
|
|
+ computed
|
|
|
+} from 'vue';
|
|
|
+// import {
|
|
|
+// typeOptionSelect
|
|
|
+// } from "@/api/volunteerDetailsApi/details.js"
|
|
|
+import {
|
|
|
+ workDate,
|
|
|
+ getDataTime
|
|
|
+} from '@/api/volunteer.js'
|
|
|
+import Calendar from '../../components/uni-calendar/components/uni-calendar/uni-calendar.vue'
|
|
|
+
|
|
|
+
|
|
|
+// Toast 控制宫格
|
|
|
+const uToastRef = ref(null);
|
|
|
+const userType = uni.getStorageSync('userType') //读取本地存储
|
|
|
+// 用户/志愿者 识别标识
|
|
|
+const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
|
|
|
+
|
|
|
+const calendar = ref(null)
|
|
|
+const info = ref({
|
|
|
+ lunar: true,
|
|
|
+ range: true,
|
|
|
+ insert: false,
|
|
|
+})
|
|
|
+const selected = ref([])
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// 普通用户
|
|
|
+const serviceList1 = ref([{
|
|
|
+ icon: '/static/img/统一知识平台-营运@1x.png',
|
|
|
+ name: '家庭辅导',
|
|
|
+ key: 1,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/编组.png',
|
|
|
+ name: '陪伴陪聊',
|
|
|
+ key: 2,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/清空.png',
|
|
|
+ name: '家庭助理',
|
|
|
+ key: 3,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/构建.png',
|
|
|
+ name: '健康管理',
|
|
|
+ key: 4,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/报事报修@6x.png',
|
|
|
+ name: '家庭清洁',
|
|
|
+ key: 5,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/报事报修@6x.png',
|
|
|
+ name: '家务帮手',
|
|
|
+ key: 6,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/报事报修@6x.png',
|
|
|
+ name: '资讯与服务',
|
|
|
+ key: 7,
|
|
|
+},
|
|
|
+]);
|
|
|
+//志愿者
|
|
|
+const serviceList2 = ref([{
|
|
|
+ icon: '/static/img/统一知识平台-营运@1x.png',
|
|
|
+ name: '家庭辅导注册',
|
|
|
+ key: 2,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/编组.png',
|
|
|
+ name: '陪伴陪聊注册',
|
|
|
+ key: 1,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/清空.png',
|
|
|
+ name: '家庭助理注册',
|
|
|
+ key: 3,
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/构建.png',
|
|
|
+ name: '健康管理注册',
|
|
|
+ key: 4
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/报事报修@6x.png',
|
|
|
+ name: '家庭清洁注册',
|
|
|
+ key: 5
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/报事报修@6x.png',
|
|
|
+ name: '家务帮手注册',
|
|
|
+ key: 6
|
|
|
+},
|
|
|
+{
|
|
|
+ icon: '/static/img/清空.png',
|
|
|
+ name: '排班管理',
|
|
|
+ key: 7
|
|
|
+},
|
|
|
+]);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// 宫格点击事件
|
|
|
+const handleGridClick = async (index) => {
|
|
|
+ const service = serviceList1.value[index]; // 获取点击的服务条目
|
|
|
+ // 用户
|
|
|
+ if (userType == 1) {
|
|
|
+ // 只有第一条和第二条可以跳转
|
|
|
+ if (index === 0 || index === 1) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages_home/pages/client/details?name=${encodeURIComponent(service.name)}`
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 其他条目提示“敬请期待”
|
|
|
+ uni.showToast({
|
|
|
+ title: '敬请期待',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
}
|
|
|
- };
|
|
|
-
|
|
|
-
|
|
|
- const change = (e) => {
|
|
|
- console.log('change', e);
|
|
|
- let dates = [{
|
|
|
- date: e.fulldate,
|
|
|
- info: `${e.time.startTime}~${e.time.endTime}`,
|
|
|
- time: e.time
|
|
|
- }]
|
|
|
- if (e.range.before && e.range.after) {
|
|
|
- dates = e.range.data.map(item => {
|
|
|
- return {
|
|
|
- date: item,
|
|
|
- info: `${e.time.startTime}~${e.time.endTime}`,
|
|
|
- time: e.time
|
|
|
- }
|
|
|
+ }
|
|
|
+ // 志愿者
|
|
|
+ if (userType == 2 && uToastRef.value) {
|
|
|
+ const data = serviceList2.value[index]
|
|
|
+ if (data.key !== 7) {
|
|
|
+ data.key === 1 || data.key === 2 ? uni.navigateTo({
|
|
|
+ url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(data))}`
|
|
|
+ }) : uni.showToast({
|
|
|
+ title: '敬请期待',
|
|
|
+ icon: 'none'
|
|
|
})
|
|
|
+ return;
|
|
|
}
|
|
|
- selected.value = [...selected.value, ...dates]
|
|
|
+ init();
|
|
|
+ calendar.value.open();
|
|
|
}
|
|
|
+};
|
|
|
|
|
|
- const onDelete = (e) => {
|
|
|
- selected.value = selected.value.filter(item => {
|
|
|
- console.log('item.fulldate !== e.date', item.date, e.fulldate);
|
|
|
|
|
|
- return item.date !== e.fulldate
|
|
|
- })
|
|
|
- console.log(e, selected.value);
|
|
|
- }
|
|
|
- const confirm = (e) => {
|
|
|
- const parmas = selected.value.map(item => {
|
|
|
+const change = (e) => {
|
|
|
+ console.log('change', e);
|
|
|
+ let dates = [{
|
|
|
+ date: e.fulldate,
|
|
|
+ info: `${e.time.startTime}~${e.time.endTime}`,
|
|
|
+ time: e.time
|
|
|
+ }]
|
|
|
+ if (e.range.before && e.range.after) {
|
|
|
+ dates = e.range.data.map(item => {
|
|
|
return {
|
|
|
- workDate: item.date,
|
|
|
- workStartTime: item.time.startTime,
|
|
|
- workEndTime: item.time.endTime
|
|
|
+ date: item,
|
|
|
+ info: `${e.time.startTime}~${e.time.endTime}`,
|
|
|
+ time: e.time
|
|
|
}
|
|
|
})
|
|
|
- console.log('确定', parmas);
|
|
|
- workDate(parmas).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- uni.showToast({
|
|
|
- title: '修改成功',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- close();
|
|
|
- return;
|
|
|
- }
|
|
|
- uni.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- })
|
|
|
- };
|
|
|
- const close = () => {
|
|
|
- calendar.value.close();
|
|
|
}
|
|
|
+ selected.value = [...selected.value, ...dates]
|
|
|
+}
|
|
|
+
|
|
|
+const onDelete = (e) => {
|
|
|
+ selected.value = selected.value.filter(item => {
|
|
|
+ console.log('item.fulldate !== e.date', item.date, e.fulldate);
|
|
|
+
|
|
|
+ return item.date !== e.fulldate
|
|
|
+ })
|
|
|
+ console.log(e, selected.value);
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
- const init = () => {
|
|
|
- if(userType === "2"){
|
|
|
- getDataTime().then(res => {
|
|
|
- console.log('res', res);
|
|
|
- selected.value = res.data.map(item => {
|
|
|
- return {
|
|
|
- date: item.workDate,
|
|
|
- info: `${item.workStartTime}~${item.workEndTime}`,
|
|
|
- time: {
|
|
|
- startTime: item.workStartTime,
|
|
|
- endTime: item.workEndTime
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
+//排班时间去重处理
|
|
|
+const handleDates = computed(() => {
|
|
|
+ const parmas = selected.value.map(item => {
|
|
|
+ return {
|
|
|
+ workDate: item.date,
|
|
|
+ workStartTime: item.time.startTime,
|
|
|
+ workEndTime: item.time.endTime
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return parmas.reduce((acc, current) => {
|
|
|
+ const existing = acc.find(item => item.workDate === current.workDate);
|
|
|
+ if (existing) {
|
|
|
+ Object.assign(existing, current);
|
|
|
+ } else {
|
|
|
+ acc.push(current);
|
|
|
+ }
|
|
|
+ return acc;
|
|
|
+ }, []);
|
|
|
+});
|
|
|
+const confirm = (e) => {
|
|
|
+ const parmas = handleDates.value;
|
|
|
+ console.log('确定', parmas);
|
|
|
+ workDate(parmas).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '修改成功',
|
|
|
+ icon: 'success',
|
|
|
+ success: () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ close();
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
})
|
|
|
- return
|
|
|
+
|
|
|
+ return;
|
|
|
}
|
|
|
- }
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ })
|
|
|
+};
|
|
|
+const close = () => {
|
|
|
+ calendar.value.close();
|
|
|
+}
|
|
|
+
|
|
|
+const init = () => {
|
|
|
+ getDataTime().then(res => {
|
|
|
+ console.log('res', res);
|
|
|
+ selected.value = res.data.map(item => {
|
|
|
+ return {
|
|
|
+ date: item.workDate,
|
|
|
+ info: `${item.workStartTime}~${item.workEndTime}`,
|
|
|
+ time: {
|
|
|
+ startTime: item.workStartTime,
|
|
|
+ endTime: item.workEndTime
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
|
- onMounted(() => {
|
|
|
- // init();
|
|
|
- });
|
|
|
+onMounted(() => {
|
|
|
+ // init();
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
- .Wrapper-grid {
|
|
|
- margin-top: 170rpx;
|
|
|
- }
|
|
|
+.Wrapper-grid {
|
|
|
+ margin-top: 170rpx;
|
|
|
+}
|
|
|
|
|
|
- /* 图标样式 */
|
|
|
- .service-img {
|
|
|
- width: 80rpx;
|
|
|
- height: 80rpx;
|
|
|
- margin-bottom: 15rpx;
|
|
|
- }
|
|
|
+/* 图标样式 */
|
|
|
+.service-img {
|
|
|
+ width: 80rpx;
|
|
|
+ height: 80rpx;
|
|
|
+ margin-bottom: 15rpx;
|
|
|
+}
|
|
|
|
|
|
- /* 文本样式 */
|
|
|
- .grid-text {
|
|
|
- font-size: 24rpx;
|
|
|
- color: #333;
|
|
|
- text-align: center;
|
|
|
- margin-top: 10rpx;
|
|
|
- }
|
|
|
+/* 文本样式 */
|
|
|
+.grid-text {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #333;
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 10rpx;
|
|
|
+}
|
|
|
</style>
|