Commit 79f72084 authored by 刘文虎's avatar 刘文虎

行程/日常记账接口调试

parent bd51154d
import request from "@/utils/request.js"
export function getList(data) {
return request({
url: `/rest/bookRecord`,
method: 'GET',
data
})
}
export function getBillTypes(data) {
return request({
url: `/rest/user/bookClassification`,
method: 'GET',
data
})
}
export function get(data) {
return request({
url: `/rest/bookRecord/detail`,
method: 'GET',
data
})
}
export function add(data) {
return request({
url: `/rest/bookRecord`,
method: 'POST',
data
})
}
export function deleteByIds(data) {
return request({
url: `/rest/bookRecord/delete`,
method: 'POST',
data
})
}
\ No newline at end of file
import request from "@/utils/request.js"
export function getShopInfo() {
return request({
url: `/rest/user/shop`,
method: 'GET',
})
}
export function updateShopInfo(data) {
return request({
url: `/rest/user/shop`,
method: 'POST',
data
})
}
\ No newline at end of file
import request from "@/utils/request.js"
export function getList(data) {
return request({
url: `/rest/trip/day`,
method: 'GET',
data
})
}
export function get(data) {
return request({
url: `/rest/trip/detail`,
method: 'GET',
data
})
}
export function add(data) {
return request({
url: `/rest/trip`,
method: 'POST',
data
})
}
export function deleteByIds(data) {
return request({
url: `/rest/trip/delete`,
method: 'POST',
data
})
}
\ No newline at end of file
......@@ -3,27 +3,27 @@
<view class="content">
<view class="billing">
<view class="billing-head">
<view class="billing-head-location ">
<view class="billing-head-location" @click="$u.throttle(chooseLocation, 500)">
<u-icon name="map" class="billing-head-location-icon"></u-icon>
<view class="billing-head-location-address ellipsis">{{ form.location }}</view>
<view class="billing-head-location-address ellipsis">{{ form.address }}</view>
</view>
<view class="billing-head-close" @click="close"><u-icon name="close"></u-icon></view>
</view>
<view class="billing-type">
<checkbox-groups :checked="form.type" :custom-style="customStyle" :options="billingTypeOptions" @handleClick="billingTypeChange"></checkbox-groups>
<view class="billing-type-date" @click="openCalendarPopup">
<text>{{ form.date }}</text>
<text>{{ form.happenTime }}</text>
<u-icon name="arrow-down-fill" class="billing-type-date-icon"></u-icon>
</view>
</view>
<view class="billing-money ellipsis">
<text>¥</text>
<text>{{ form.money }}</text>
<text>{{ form.amount }}</text>
</view>
<view class="billing-category"><billing-category :checked="form.category" @handleClick="billingCategoryChange"></billing-category></view>
<view class="billing-category"><billing-category :list="billingCategoryList" :checked="form.classificationId" @handleClick="billingCategoryChange"></billing-category></view>
<view class="billing-remark">
<view class="billing-remark-upload" @click="handleClickChangeImage">
<image :src="takePhotoSuccessIcon" mode="" v-if="form.photos"></image>
<image :src="takePhotoSuccessIcon" mode="" v-if="form.attach"></image>
<image :src="takePhotoIcon" mode="" v-else></image>
</view>
<view class="billing-remark-input">
......@@ -42,7 +42,7 @@
<!-- 计算器 -->
<view class="billing-calculator"><ab-calculator @change="calculatorChange" @sure="calculatorSure"></ab-calculator></view>
<!-- 日历 -->
<calendar-popup :date="form.date" ref="calendar-popup" @confirm="calendarChange"></calendar-popup>
<calendar-popup :date="form.happenTime" ref="calendar-popup" @confirm="calendarChange"></calendar-popup>
</view>
</u-popup>
</template>
......@@ -55,8 +55,9 @@ import BillingCategory from './components/billing-category.vue';
import { billingTypeOptions } from '@/utils/options/index';
import { indexBaseUrl } from '@/utils/config.js';
import upload from '@/utils/upload';
import { getBillTypes, add } from '@/api/bill/daily.js';
export default {
name: 'billing-details',
name: 'billing-daily',
components: {
AbCalculator,
CheckboxGroups,
......@@ -66,8 +67,8 @@ export default {
data() {
return {
billingTypeOptions,
takePhotoIcon:indexBaseUrl+'shangchuanbeizhu@3x.png',
takePhotoSuccessIcon:indexBaseUrl+'shangchuanbeizhuchenggong@3x.png',
takePhotoIcon: indexBaseUrl + 'shangchuanbeizhu@3x.png',
takePhotoSuccessIcon: indexBaseUrl + 'shangchuanbeizhuchenggong@3x.png',
show: false,
customStyle: {
width: '104rpx',
......@@ -75,31 +76,70 @@ export default {
fontSize: '24rpx'
},
form: {
type: '1',
location: '庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威',
date: '2022-07-13',
money: '56465464646456544444444444444444444444444444444444',
category: '2',
photos:'1'
type: 'INCOME',
address: '庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威庭威',
happenTime: '2022-07-13',
amount: '0.00',
classificationId: '2',
attach: '1',
latitude: '',
longitude: ''
},
upload: {
uploading: false,
fileList: [],
qiniuToken: ''
}
},
limit:6,
billingCategoryList:[]
};
},
mounted() {
this.getBillTypeOptions();
},
methods: {
async getBillTypeOptions() {
try {
let { data } = await getBillTypes({ type: this.form.type });
let list=[]
let resData=[...data]
data.forEach((item,index)=>{
if(index % this.limit ===0){
console.log(index,index % this.limit)
list.push(resData.slice(index,index+this.limit))
console.log(resData.slice(index,index+this.limit))
}
})
console.log("billingCategoryList",list)
} catch (e) {
//TODO handle the exception
console.log(e)
}
},
open() {
this.show = true;
},
close() {
this.show = false;
},
chooseLocation() {
uni.chooseLocation({
success: res => {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
let { name, address, latitude, longitude } = res;
this.form.address = name;
this.form.latitude = latitude;
this.form.longitude = longitude;
}
});
},
// 点击=
calculatorChange(e) {
console.log('calculatorChange', e);
this.form.money = e;
this.form.amount = e;
},
// 点击确认
calculatorSure(e) {
......@@ -108,7 +148,7 @@ export default {
// 日历
calendarChange(e) {
console.log('calendarChange', e);
this.form.date = e;
this.form.happenTime = e;
},
billingTypeChange(e) {
console.log(e);
......@@ -118,7 +158,7 @@ export default {
this.$refs['calendar-popup'].open();
},
billingCategoryChange(item) {
this.form.category = item.value;
this.form.classificationId = item.value;
},
// 上传组件
handleListChange(lists) {
......
<template>
<view class="billing-category">
<uni-swiper-dot :info="swiperList" :current="current" field="content" :mode="mode" :dotsStyles="dotsStyles">
<uni-swiper-dot :info="list" :current="current" field="content" :mode="mode" :dotsStyles="dotsStyles">
<swiper class="swiper" :indicator-dots="false" indicator-color="#8d8d8d" indicator-active-color="#02A074" :autoplay="false" :duration="duration" @change="change">
<swiper-item v-for="(swiper, swiperIndex) in swiperList" :key="swiperIndex">
<swiper-item v-for="(swiper, swiperIndex) in list" :key="swiperIndex">
<view class="swiper-item">
<view class="billing-category-item" :class="{ active: item.value === checked }" v-for="(item, index) in list" :key="index" @click="handleCheck(item)">
<view class="billing-category-item" :class="{ active: item.value === checked }" v-for="(item, index) in swiper" :key="index" @click="handleCheck(item)">
<view class="billing-category-item-icon">
<image :src="billBaseUrl + item.icon" mode="" v-if="item.value !== checked"></image>
<image :src="billBaseUrl + item.selectedIcon" mode="" v-else></image>
......@@ -31,13 +31,16 @@ export default {
checked: {
type: Number | String,
default: ''
},
list:{
type:Array,
default: ()=>[]
}
},
data() {
return {
billBaseUrl,
list: billingCategoryOptions,
swiperList: [1, 2],
// list: billingCategoryOptions,
duration: 500,
current:0,
mode:'round',
......
......@@ -33,10 +33,11 @@ export default {
data() {
return {
show: false,
defaultDate: ''
defaultDate: parseTime(new Date(), '{y}-{m}-{d}')
};
},
mounted() {
// this.defaultDate=this.date
this.$refs['lunc-calendar'].init(this.date);
},
methods: {
......
......@@ -21,6 +21,11 @@ export default {
customStyle:{
type: Object,
default: () => {}
},
// 是否允许空值 默认false
allowsNull:{
type: Boolean,
default:false
}
},
data() {
......@@ -28,7 +33,13 @@ export default {
},
methods: {
handleCheck(item) {
this.$emit('handleClick', item);
let detail={
...item
}
if(this.allowsNull&&item.value===this.checked){
detail.value=''
}
this.$emit('handleClick', detail);
}
}
};
......
......@@ -13,12 +13,12 @@
<!-- <view class="close"><view class="close-button" @click="close">X</view></view> -->
</view>
</u-popup>
<billing-details ref="billing-details" :type="type"></billing-details>
<billing-daily ref="billing-daily" :type="type"></billing-daily>
</view>
</template>
<script>
import BillingDetails from '@/components/billing-details/billing-details.vue';
import BillingDetails from '@/components/billing-daily/billing-daily.vue';
import { minPopupOptions } from '@/utils/options/index/index.js';
export default {
name: 'mid-popup',
......@@ -43,7 +43,7 @@ export default {
this.type = item.type;
this.close();
if (this.type === '3') {
this.$refs['billing-details'].open();
this.$refs['billing-daily'].open();
} else {
if (item.path) {
uni.navigateTo({
......
......@@ -12,8 +12,10 @@ Vue.use(router)
import uView from "uview-ui";
Vue.use(uView);
import {parseTime,showToast} from "@/utils/common.js"
import {parseTime,showToast,deepClone} from "@/utils/common.js"
Vue.prototype.parseTime=parseTime
Vue.prototype.showToast=showToast
Vue.prototype.deepClone=deepClone
import {platform, channel} from './utils/platform'
Vue.prototype.$u.platform = platform
Vue.prototype.$u.channel = channel
......
......@@ -62,7 +62,12 @@
"urlCheck" : false,
"minified" : true
},
"usingComponents" : true
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "用于获取当前位置信息"
}
}
},
"mp-alipay" : {
"usingComponents" : true
......
......@@ -85,7 +85,8 @@
"path": "create-schedule/create-schedule",
"style": {
"navigationBarTitleText": "添加行程",
"enablePullDownRefresh": false
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
......
......@@ -29,14 +29,14 @@
</view>
</view>
<PopInput title="删除提醒" type="text" sureText="确定" content="确认删除该账单?" :visible.sync="showConfirm" @click="handleConfirm" />
<billing-details ref="billing-details" :type="type"></billing-details>
<billing-daily ref="billing-daily" :type="type"></billing-daily>
</view>
</template>
<script>
import AbButton from '@/components/common/ab-button.vue';
import PopInput from '@/components/pop-input-view';
import BillingDetails from '@/components/billing-details/billing-details.vue';
import BillingDetails from '@/components/billing-daily/billing-daily.vue';
export default {
components: {
AbButton,
......@@ -86,7 +86,7 @@ export default {
this.showConfirm=true
},
toEdit() {
this.$refs["billing-details"].open()
this.$refs["billing-daily"].open()
},
handleConfirm(){
uni.showToast({
......
......@@ -15,15 +15,20 @@
</view>
</view>
</view>
<PopInput title="提醒" type="text" sureText="退出" content="确定要退出登录吗?" :visible.sync="showConfirm" @click="handleConfirm" />
</view>
</template>
<script>
import PopInput from '@/components/pop-input-view';
import { packageOptions } from '@/utils/options/mine/index.js';
import { version } from '@/utils/config.js';
import {getToken} from "@/utils/common.js"
export default {
components:{
PopInput
},
props: {
messageNum: {
type: Number
......@@ -32,16 +37,31 @@ export default {
data() {
return {
packageOptions,
version
version,
showConfirm:false
}
},
methods:{
itemClick(item) {
if (item.path) {
if(item.title==='退出登录'){
if(getToken()){
this.showConfirm=true
}
}else if (item.path) {
uni.navigateTo({
url: item.path
});
}
},
handleConfirm(path){
this.$store.dispatch("LogOut")
this.showToast("已退出登录",true)
setTimeout(()=>{
uni.switchTab({
url: "/pages/index/index"
});
},1500)
}
}
};
......
......@@ -4,7 +4,7 @@
<image :src="userInfo.avatar_l" mode="" v-if="userInfo.avatar_l"></image>
<image :src="avatar" v-else></image>
</view>
<view class="user-info">
<view class="user-info" @click="toLogin">
<view class="user-nickname">
<text v-if="userInfo.id">{{ userInfo.nickname }}</text>
<text v-else>立即登录</text>
......@@ -54,7 +54,15 @@ export default {
return this.baseUrl+'bushihuiyuan@3x.png'
},
},
methods:{
toLogin(){
if(!this.userInfo.id){
uni.navigateTo({
url:"/pages/login/login"
})
}
}
}
};
</script>
......
<template>
<view class="ali">
<!-- ======="state": 0 ,1 ,2====== -->
<!-- ======="status": 0 ,1 ====== -->
<view class="ali_state">
<block v-for="(item, i) in datas" :key="i">
<block v-for="(item, i) in list" :key="i">
<view class="State_Four">
<view class="FourBox">
<text class="line" :class="{ noline: i == 0, 'closed-border': i >= firstClosed }"></text>
<text class="ali_top_icon" style="margin: 0 0;" :class="{ closed: item.status === '0' }">{{ item.time }}</text>
<text class="ali_top_dot" style="margin: 0 0;" :class="{ 'closed-background': i >= firstClosed }" v-if="i !== datas.length - 1"></text>
<text class="line" :class="{ noline: i == datas.length - 1, 'closed-border': i >= firstClosed - 1 }"></text>
<text class="ali_top_icon" style="margin: 0 0;" :class="{ closed: item.status === '0' }">{{ resetTime(item.startTime) }}</text>
<text class="ali_top_dot" style="margin: 0 0;" :class="{ 'closed-background': i >= firstClosed }" v-if="i !== list.length - 1"></text>
<text class="line" :class="{ noline: i == list.length - 1, 'closed-border': i >= firstClosed - 1 }"></text>
</view>
<view class="remark" @click.stop="handleClick(item)">
<view class="remark-content" :class="{ closed: item.status === '0' }">{{ item.remark }}</view>
<view class="remark-content" :class="{ closed: item.status === '0' }">{{ item.name }}</view>
<view class="status" :class="{ closed: item.status === '0' }" @click.stop="handleRemind(item)">{{ item.status === '1' ? '提醒' : '已结束' }}</view>
</view>
</view>
......@@ -22,18 +22,21 @@
<script>
export default {
props: ['datas', 'state', 'ways'],
props: ['list'],
data() {
return {};
},
computed: {
firstClosed() {
let index = this.datas.findIndex(item => item.status === '0');
let index = this.list.findIndex(item => item.status === '0');
console.log(index);
return index;
}
},
methods: {
resetTime(time){
return this.parseTime(time,'{h}:{i}')
},
handleRemind(item){
this.$emit("handleRemind",item)
},
......
......@@ -5,7 +5,7 @@
<ab-button content="添加计划" :customStyle="customStyle" left-icon="plus" @click="toAdd"></ab-button>
</view>
<view class="time-line">
<block v-if="list.length"><plan-step :datas="list" @handleClick="handleClick" @handleRemind="handleRemind"></plan-step></block>
<block v-if="list.length"><plan-step :list="list" @handleClick="handleClick" @handleRemind="handleRemind"></plan-step></block>
<block v-else-if="afterGetList"><no-data :imageName="imageName" text="当前暂无待办计划"></no-data></block>
</view>
</view>
......@@ -16,6 +16,8 @@ import AbButton from '@/components/common/ab-button.vue';
import EmptyPage from '@/components/common/empty-page.vue';
import NoData from '@/components/no-data';
import PlanStep from './plan-step.vue';
import { getTime } from '@/utils/common.js';
import { getList } from '@/api/schedule/index.js';
export default {
name: 'plan-view',
......@@ -33,49 +35,38 @@ export default {
height: '64rpx'
},
list: [
// {
// time: '10:30',
// status: '1',
// remark: '[杭州市]快件派送至【丰巢智能快递柜】'
// },
// {
// time: '14:00',
// status: '1',
// remark: '[杭州市]快件交给黄平,正在派送途中(联系电话:15157162459)'
// },
// {
// time: '08:30',
// status: '0',
// remark: '[杭州市]正在派送途中'
// },
// {
// time: '14:00',
// status: '0',
// remark: '[杭州市]快件交给黄平,正在派送途中(联系电话:15157162459)'
// },
// {
// time: '08:30',
// status: '0',
// remark: '[杭州市]正在派送途中'
// }, {
// time: '14:00',
// status: '0',
// remark: '[杭州市]快件交给黄平,正在派送途中(联系电话:15157162459)'
// },
// {
// time: '08:30',
// status: '0',
// remark: '[杭州市]正在派送途中'
// },
],
afterGetList: false
};
},
created() {},
methods: {
async getList(date) {
// let res=await getList()
let time = this.parseTime(date, '{y}-{m}-{d}');
console.log(time);
try {
let res = await getList({
day: date
});
let validList=[]
let disabledList=[]
res.data.sort((a, b) => {
return getTime(a.startTime)-getTime(b.startTime);
});
let time = getTime(new Date());
res.data.forEach(item => {
if (getTime(item.startTime) > time) {
item.status = '1';
validList.push(item)
} else {
item.status = '0';
disabledList.push(item)
}
});
this.list = [...validList,...disabledList];
} catch (e) {
//TODO handle the exception
}
this.afterGetList = true;
},
toAdd() {
......
......@@ -14,9 +14,7 @@
@chooseMonth="chooseMonth"
></lunc-calendar>
</view>
<view class="">
<plan-view ref="plan-view"></plan-view>
</view>
<view class=""><plan-view ref="plan-view" :day="date"></plan-view></view>
<mid-popup ref="midPopup"></mid-popup>
<u-tabbar :list="tabbar" :mid-button="true" :mid-button-size="80" :before-switch="beforeSwitch"></u-tabbar>
</view>
......@@ -25,7 +23,7 @@
<script>
import MidPopup from '@/components/mid-popup/mid-popup.vue';
import NavbarNormal from '@/components/navbar-normal';
import PlanView from "./components/plan-view.vue"
import PlanView from './components/plan-view.vue';
import { tabbar } from '@/utils/settings.js';
export default {
components: {
......@@ -48,15 +46,22 @@ export default {
info: '八月初四张三生日'
},
{
date: '2022-07-12',
date: '2022-07-12'
// title: '朋友聚会'
}
],
date:new Date()
date: '',
firstEnter: true
};
},
onReady() {
this.getList()
this.date = this.parseTime(new Date(), '{y}-{m}-{d}');
this.getList();
},
onShow() {
if (!this.firstEnter) {
this.getList();
}
},
methods: {
beforeSwitch(index) {
......@@ -71,17 +76,18 @@ export default {
},
dayChange(e) {
console.log('dayChange', e);
this.date=e.date
this.getList()
this.date = e.date;
this.getList();
},
monthChange(e) {
console.log('monthChange', e);
},
chooseMonth(selDate){
chooseMonth(selDate) {
console.log('selDate', selDate);
},
getList(){
this.$refs["plan-view"].getList(this.date)
getList() {
this.$refs['plan-view'].getList(this.date);
this.firstEnter = false;
}
}
};
......
......@@ -177,8 +177,9 @@ export default {
return false
}
let notification = `input-sure-${this.type}`;
let str= this.value.replace(/[\r\n]/g,"")
uni.$emit(notification, {
content: this.value
content: str
});
}
......
<template>
<view class="content">
<view class="package">
<view class="package-item" v-for="(item, index) in shopSettingOptions" :key="index" @click="itemClick(item)">
<!-- <view class="package-item" v-for="(item, index) in shopSettingOptions" :key="index" @click="itemClick(item)">
<view class="package-item-title">{{ item.label +":"}}</view>
<view class="package-item-right ellipsis">
<text class="" v-if="detail[item.value]">{{ detail[item.value] }}</text>
<text class="ellipsis" v-if="detail[item.value]">{{ detail[item.value] }}</text>
<text class="package-item-right-text" v-else>去填写</text>
<u-icon name="arrow-right" class="package-item-right-icon"></u-icon>
</view>
</view>
</view> -->
<u-cell-group>
<u-cell-item
title-width="160"
:title-style="titleStyle"
:value-style="valueStyle(detail[item.value])"
:title="item.label + ':'"
:value="detail[item.value] || '去填写'"
v-for="(item, index) in shopSettingOptions"
:key="index"
@click="itemClick(item)"
></u-cell-item>
</u-cell-group>
</view>
</view>
</template>
......@@ -24,10 +36,25 @@ export default {
},
data() {
return {
shopSettingOptions
shopSettingOptions,
titleStyle: {
fontSize: '28rpx',
color: '#8D8D8D',
},
};
},
methods: {
valueStyle(value){
let valueStyle= {
fontSize: '28rpx',
color: '#8D8D8D',
}
if(value){
valueStyle.color="#333333"
}
return valueStyle
},
itemClick(item) {
if (item.path) {
this.$u.route({
......@@ -38,16 +65,14 @@ export default {
}
});
uni.$once(`input-sure-${item.value}`, res => {
this.$emit("update",{
value:item.value,
content:res.content
})
this.$emit('update', {
value: item.value,
content: res.content
});
});
}
},
updateCamp(param){
}
updateCamp(param) {}
}
};
</script>
......@@ -56,7 +81,8 @@ export default {
.package {
background: #ffffff;
border-radius: 16upx;
padding: 0 24upx;
// padding: 0 24upx;
overflow: hidden;
width: 100%;
.package-item {
height: 110upx;
......@@ -71,14 +97,19 @@ export default {
}
.package-item-title {
font-size: 28upx;
line-height: 28upx;
color: #8d8d8d;
margin-right: 30upx;
}
.package-item-right {
vertical-align: middle;
height: 28rpx;
flex: 1;
text-align: right;
font-weight: bold;
line-height: 28rpx;
color: #3d3f4d;
width: 400rpx;
&-text {
font-weight: normal;
color: #8d8d8d;
......
<template>
<view class="content">
<setting-card :detail="detail" @update="updateDetail"></setting-card>
<setting-card :detail="stopInfo" @update="updateDetail"></setting-card>
<view class="switch">
<view class="label">维修记账自动统计为收入</view>
<u-switch slot="right-icon" v-model="detail.memberOpen" active-color="#02A074" inactive-color="#8D8D8D" :loading="switchLoading" @change="switchChange"></u-switch>
<u-switch slot="right-icon" v-model="stopInfo.intoBookRecord" active-color="#02A074" inactive-color="#8D8D8D" :loading="switchLoading" @change="switchChange"></u-switch>
</view>
</view>
</template>
<script>
import settingCard from './components/setting-card.vue';
import {getShopInfo,updateShopInfo} from "@/api/mine/shop.js"
export default {
components: {
settingCard
},
data() {
return {
detail: {
stopInfo: {
name: '',
address: '',
phone: ''
phone: '',
intoBookRecord:false
},
switchLoading: false
};
},
onLoad() {
this.getShop()
},
methods: {
async getShop(){
try{
let res=await getShopInfo()
this.stopInfo=res.data
}catch(e){
//TODO handle the exception
console.log(e)
}
},
updateDetail(params) {
let { value, content } = params;
this.detail[value] = content;
this.updateCamp({})
this.stopInfo[value] = content;
this.updateShop(this.stopInfo)
},
switchChange(val) {
this.switchLoading = true;
this.updateCamp({
// memberOpen: this.info.memberOpen,
// id: this.camp_id
});
this.updateShop(this.stopInfo);
},
updateCamp(param) {
// this.$u.api
// .updateCamp(param)
// .then(res => {
// this.switchLoading = false;
// console.log('menu:', res);
// })
// .catch(err => {
// console.log(err);
// });
async updateShop(param) {
try{
let res=await updateShopInfo(param)
this.stopInfo=res.data
}catch(e){
//TODO handle the exception
console.log(e)
}
this.switchLoading = false;
}
}
......
<template>
<view class="create-schedule">
<NavbarRight :backText="title" :text="deleteText" :background="{'background-color': '#f6f7fa'}" :image="deleteImage" @click="handlClickDelete" />
<u-form :model="form" ref="uForm" label-position="top" :error-type="errorType" label-width="180">
<view class="schedule-card">
<u-form-item label="计划类型:" prop="type">
<u-form-item label="计划类型:" prop="type" required>
<view class="input-view"><checkbox-groups :checked="form.type" :options="scheduleTypeOptions" @handleClick="scheduleTypeChange"></checkbox-groups></view>
</u-form-item>
<u-form-item label="计划时间:" :prop="form.createdTime ? 'time' : 'createdTime'" label-position="left">
<u-form-item label="计划时间:" :prop="form.createdTime ? 'time' : 'createdTime'" label-position="left" required>
<view class="created-time">
<view class="created-time-item" @click="openCalendarPopup">
<view class="created-time-item-inner">
......@@ -23,52 +24,59 @@
</view>
</view>
</u-form-item>
<u-form-item label="提醒设置:" prop="setting" :border-bottom="false">
<checkbox-groups :checked="form.setting" :options="scheduleSettingOptions" @handleClick="scheduleSettingChange"></checkbox-groups>
<u-form-item label="提醒设置:" prop="remindMinute" :border-bottom="false">
<checkbox-groups :checked="form.remindMinute" :allowsNull="true" :options="scheduleSettingOptions" @handleClick="scheduleSettingChange"></checkbox-groups>
</u-form-item>
</view>
<view class="schedule-card">
<u-form-item label="计划标题:" prop="title" label-position="left">
<u-input type="text" v-model="form.title" placeholder="请输入计划标题" :clearable="false" input-align="right" maxlength="100" class="form-input" />
<u-form-item label="计划标题:" prop="name" label-position="left" required>
<u-input type="text" v-model="form.name" placeholder="请输入计划标题" :clearable="false" input-align="right" maxlength="100" class="form-input" />
</u-form-item>
<u-form-item label="计划纪要:" prop="desc" :border-bottom="false">
<u-input v-model="form.desc" type="textarea" :border="true" :height="240" :auto-height="false" :clearable="false" />
<u-form-item label="计划纪要:" prop="content" :border-bottom="false">
<u-input v-model="form.content" type="textarea" :border="true" :height="240" :auto-height="false" :clearable="false" />
</u-form-item>
<u-form-item prop="sound" :border-bottom="false">
<sound-player ref="sound-player" :path="form.sound" @clear="clearSound" v-if="form.sound"></sound-player>
<u-form-item prop="attach" :border-bottom="false">
<sound-player ref="sound-player" :path="form.attach" @clear="clearSound" v-if="form.attach"></sound-player>
<view class="sound-button" hover-class="u-hover-class" @click="startRecording" v-else><u-icon name="mic"></u-icon></view>
</u-form-item>
</view>
</u-form>
<view class="submit"><ab-button :disabled="disabled" :customStyle="customStyle" @click="submit"></ab-button></view>
<view class="submit" v-loading="loading"><ab-button :disabled="disabled" :customStyle="customStyle" @click="submit"></ab-button></view>
<u-popup v-model="soundShow" mode="bottom" border-radius="14" safe-area-inset-bottom>
<sound-recording ref="sound-recording" @cancel="soundCancel" @confirm="soundConfirm"></sound-recording>
</u-popup>
<calendar-popup :date="form.createdTime" ref="calendar-popup" @confirm="calculatorChange"></calendar-popup>
<u-picker v-model="timeShow" mode="time" :default-time="defaultTime" :params="timeParams" @confirm="timePickerConfirm"></u-picker>
<PopInput title="提醒" type="text" sureText="删除" content="确定删除此行程吗?" :visible.sync="showConfirm" @click="handleConfirm" />
</view>
</template>
<script>
import NavbarRight from '@/components/navbar-right';
import PopInput from '@/components/pop-input-view';
import SoundRecording from '@/components/sound-recording/sound-recording.vue';
import AbButton from '@/components/common/ab-button.vue';
import CheckboxGroups from '@/components/checkbox-groups/checkbox-groups.vue';
import CalendarPopup from '@/components/calendar-popup/calendar-popup.vue';
import SoundPlayer from './components/sound-player.vue';
import { authorize, openSetting, showModal } from '@/utils/auth.js';
import { baseUrl } from '@/utils/config.js';
import { scheduleTypeOptions, scheduleSettingOptions } from '@/utils/options/schedule';
import { get, add, deleteById } from '@/api/schedule/index.js';
export default {
components: { SoundRecording, CheckboxGroups, CalendarPopup, SoundPlayer, AbButton },
components: { NavbarRight, PopInput, SoundRecording, CheckboxGroups, CalendarPopup, SoundPlayer, AbButton },
data() {
return {
customStyle:{
fontSize:"32rpx"
customStyle: {
fontSize: '32rpx'
},
scheduleTypeOptions,
scheduleSettingOptions,
loading:false,
soundShow: false, // 录音弹框
showConfirm: false, // 删除弹框
timeShow: false, // 时间Picker
defaultTime: '',
timeParams: {
......@@ -81,72 +89,84 @@ export default {
},
id: '',
form: {
type: '1',
createdTime: '',
time: '',
setting: '',
title: '',
sound: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3'
type: 'WORK',
startTime: '', // 开始时间
createdTime: '', //开始日期
time: '', // 开始时间 时-分
remindMinute: '',
name: '', // 标题
content: '',
attach: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3'
},
errorType: ['toast', 'border-bottom'],
rules: {
type: [{ required: true, message: '请选择计划类型', trigger: ['change', 'blur'] }],
createdTime: [{ required: true, message: '请选择计划日期', trigger: ['change', 'blur'] }],
time: [{ required: true, message: '请选择计划时间', trigger: ['change', 'blur'] }],
title: [{ required: true, message: '请输入计划标题', trigger: ['blur'] }]
name: [{ required: true, message: '请输入计划标题', trigger: ['blur'] }]
}
};
},
computed: {
disabled() {
let flag = !this.form.createdTime || !this.form.time || !this.form.title;
let flag = !this.form.createdTime || !this.form.time || !this.form.name;
return flag;
},
title() {
return this.id ? '修改行程' : '新增行程';
},
deleteText() {
return this.id ? '删除' : '';
},
deleteImage() {
return this.id ? baseUrl + 'shanchuzhangdanxiangqing@3x.png' : '';
}
},
onLoad(options) {
this.form.createdTime=this.parseTime(new Date(), '{y}-{m}-{d}')
this.form.time=this.parseTime(new Date(), '{h}:{i}')
if (options && options.id) {
this.id = options.id;
// this.geDetail()
this.geDetail();
}
},
onReady() {
this.$refs.uForm.setRules(this.rules);
uni.setNavigationBarTitle({
title: this.id ? '修改行程' : '新增行程'
});
},
methods: {
async geDetail() {
let res = await addBind(this.form);
let { code, data, msg } = res;
if (code === 200) {
this.form = data;
try {
let { code, data, msg } = await get({id:this.id});
this.form = { ...this.form, ...data };
} catch (e) {
//TODO handle the exception
}
},
submit() {
this.loading = true;
this.$refs.uForm.validate(valid => {
if (valid) {
this.create();
let { createdTime, time } = this.form;
this.form.startTime = createdTime + ' ' + time + ':00';
this.save();
} else {
this.loading = false;
console.log('验证失败');
}
});
},
async create() {
// let res = await addBind(this.form);
let res = {
code: 200
};
let { code, data, msg } = res;
if (code === 200) {
uni.showToast({
title: '创建成功',
mask: true
});
async save() {
let title=this.form.id?"修改":"新增"
try {
await add(this.form);
this.showToast(title+'成功', true);
setTimeout(() => {
this.navigateTo();
}, 1500);
} catch (error) {
this.showToast(title+'失败');
}
this.loading = false;
},
navigateTo() {
uni.switchTab({
......@@ -187,16 +207,16 @@ export default {
soundConfirm(e) {
console.log(e);
this.soundShow = false;
this.form.sound = e;
this.form.attach = e;
},
scheduleTypeChange(item) {
this.form.type = item.value;
},
scheduleSettingChange(item) {
if (this.form.setting === item.value) {
this.form.setting = '';
if (this.form.remindMinute === item.value) {
this.form.remindMinute = '';
} else {
this.form.setting = item.value;
this.form.remindMinute = item.value;
}
},
openCalendarPopup() {
......@@ -218,7 +238,27 @@ export default {
this.form.time = `${e.hour}:${e.minute}`;
},
clearSound() {
this.form.sound = '';
this.form.attach = '';
},
handlClickDelete() {
this.showConfirm = true;
},
async handleConfirm() {
if (!this.form.id) {
this.showToast('行程不存在');
return false;
}
try {
await deleteById({
id:this.form.id
});
this.showToast('删除成功', true);
setTimeout(() => {
this.navigateTo();
}, 1500);
} catch (e) {
//TODO handle the exception
}
}
}
};
......
<template>
<view class="schedule-detail">
<view class="schedule-detail-head">
<view class="schedule-detail-head-status" :class="{ closed: detail.status === '0' }">{{ detail.status === '1' ? '待提醒' : '已结束' }}</view>
<view class="schedule-detail-head-edit" v-if="detail.status === '1'" @click="toEdit">
<view class="schedule-detail-head-edit-icon"><u-icon name="edit-pen"></u-icon></view>
<text class="">编辑</text>
<view class="schedule-detail-head-status" :class="{ closed: status === '0' }">{{ status === '1' ? '待提醒' : '已结束' }}</view>
<view class="schedule-detail-head-right">
<view class="schedule-detail-head-edit" v-if="status === '1'" @click="toEdit">
<view class="schedule-detail-head-edit-icon"><u-icon name="edit-pen"></u-icon></view>
<text class="">编辑</text>
</view>
<view class="schedule-detail-head-edit schedule-detail-head-delete" @click="handlClickDelete">
<view class="schedule-detail-head-edit-icon"><u-icon name="trash"></u-icon></view>
<text class="">删除</text>
</view>
</view>
</view>
<view class="schedule-card">
......@@ -13,8 +19,11 @@
<view class="item" v-for="(item, index) in list" :key="index">
<view class="item-label">{{ item.label }}</view>
<view class="item-value">
<text v-if="item.value === 'createdTime'">
<text v-if="detail.createdTime && detail.time">{{ detail.createdTime + ' ' + detail.time }}</text>
<text v-if="item.value === 'type'">
<text>{{ detail.type.desc }}</text>
</text>
<text v-else-if="item.value === 'remindMinute'">
<text>{{ myFilter(detail[item.value] + '', scheduleSettingOptions) }}</text>
</text>
<text v-else>{{ detail[item.value] }}</text>
</view>
......@@ -27,30 +36,37 @@
<view class="schedule-card-body" slot="body">
<view class="item desc">
<view class="item-label">计划纪要:</view>
<view class="item-value">{{ detail.desc }}</view>
<sound-player ref="sound-player" :path="detail.sound" :showClose="false" v-if="detail.sound"></sound-player>
<view class="item-value">{{ detail.content }}</view>
<sound-player ref="sound-player" :path="detail.attach" :showClose="false" v-if="detail.attach"></sound-player>
</view>
</view>
</u-card>
</view>
<PopInput title="提醒" type="text" sureText="删除" content="确定删除此行程吗?" :visible.sync="showConfirm" @click="handleConfirm" />
</view>
</template>
<script>
import PopInput from '@/components/pop-input-view';
import SoundPlayer from '@/pages/schedule/create-schedule/components/sound-player.vue';
import { get, deleteById } from '@/api/schedule/index.js';
import { myFilter, getTime } from '@/utils/common.js';
import { scheduleSettingOptions } from '@/utils/options/schedule';
export default {
components: { SoundPlayer },
components: { SoundPlayer,PopInput },
data() {
return {
scheduleSettingOptions,
myFilter,
id: '',
detail: {
title: '计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题计划标题',
type: '0',
createdTime: '2022-07-19',
time: '19:00',
status: '1',
desc: '描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述',
sound: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3'
name: '',
type: '',
startTime: '',
status: '',
content: '',
attach: ''
},
list: [
{
......@@ -59,34 +75,66 @@ export default {
},
{
label: '计划时间:',
value: 'createdTime'
value: 'startTime'
},
{
label: '提醒时间:',
value: 'time'
value: 'remindMinute'
}
]
};
},
computed: {
status() {
let time = getTime(new Date());
if (getTime(this.detail.startTime) > time) {
return '1';
} else {
return '0';
}
}
},
onLoad(options) {
if (options && options.id) {
this.id = options.id;
// this.geDetail()
this.geDetail();
}
},
methods: {
async geDetail() {
let res = await addBind(this.form);
let { code, data, msg } = res;
if (code === 200) {
try {
let res = await get({ id: this.id });
let { code, data, msg } = res;
this.detail = data;
} catch (e) {
//TODO handle the exception
}
},
toEdit() {
uni.navigateTo({
url: `/pages/schedule/create-schedule/create-schedule?id=${this.id}`
});
},
handlClickDelete() {
this.showConfirm = true;
},
async handleConfirm() {
if (!this.form.id) {
this.showToast('行程不存在');
return false;
}
try {
await deleteById({
id:this.form.id
});
this.showToast('删除成功', true);
setTimeout(() => {
this.navigateTo();
}, 1500);
} catch (e) {
//TODO handle the exception
}
}
}
};
......@@ -108,6 +156,10 @@ export default {
.closed {
color: #8d8d8d;
}
&-right{
display: flex;
align-items: center;
}
&-edit {
font-size: 28upx;
line-height: 28upx;
......@@ -118,6 +170,10 @@ export default {
margin-right: 6upx;
}
}
&-delete {
margin-left: 16rpx;
color: #fc524d;
}
}
.schedule-card {
margin-top: 24upx;
......
......@@ -29,56 +29,49 @@ const router = createRouter({
console.log(to)
let {path}=to
let index=whiteList.findIndex(item=>item===path)
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
// 鉴权
console.log("需要鉴权")
if(checkToken()){
next()
}else{
// 鉴权
console.log("需要鉴权")
if(checkToken()){
next()
}else {
// next()
if(store.getters.platform==='4'){
}else {
// next()
if(store.getters.platform==='4'){
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
next()
}else{
showToast('登录已过期,请重新登录')
setTimeout(()=>{
next({
path:'/pages/login/login'
})
},1500)
}else{
store.dispatch('Auto_login').then(()=>{
}
}else{
store.dispatch('Auto_login').then(()=>{
next()
}).catch(()=>{
if(index!==-1){
// 白名单内直接跳转
console.log("白名单内直接跳转")
next()
// if(!store.getters.userInfo||!store.getters.userInfo.id){
// console.log("未获取到用户信息")
// store.dispatch('Get_UserInfo').then(()=>{
// next()
// }).catch(()=>{
// showToast('获取用户信息失败');
// setTimeout(()=>{
// next({
// path:'/pages/login/login'
// })
// },1500)
// })
// }else{
// next()
// }
}).catch(()=>{
}else{
showToast('自动登录失败');
setTimeout(()=>{
next({
path:'/pages/login/login'
})
},1500)
})
}
}
})
}
}
},
routerAfterEach: (to, from) => {
console.log('--------routerAfterEach----')
......
import {
getLocation
} from "@/utils/auth.js"
const state = {
location: null,
}
const mutations = {
SAVE_LOCATION: (state, data) => {
state.location = data
},
}
const actions = {
Get_location: ({
state,
commit
}) => {
return new Promise((resolve, reject) => {
let time = new Date().getTime()
if (state.timetamp && (time - state.timetamp) <= 60 * 1000) {
resolve(state.location)
} else {
getLocation().then(res => {
state.timetamp = time
commit("SAVE_LOCATION", res)
resolve(state.location)
}).catch(err => {
reject(err)
})
}
})
},
Save_location:({
state,
commit
},res) => {
commit("SAVE_LOCATION", res)
},
}
export default {
state,
mutations,
actions
}
......@@ -112,10 +112,26 @@ export function checkToken() {
}
}
export function checkVip() {
let userinfo = getUserinfo()
if (userinfo) {
if (userinfo.remainDay > 0 && userinfo.vip) {
return true;
}
}
return false;
}
export function checkAdminToken() {
let time = new Date().getTime()
let {check,expireTime,headName,token}=getPasswordCheck()
if (check&&token) {
let {
check,
expireTime,
headName,
token
} = getPasswordCheck()
if (check && token) {
if (expireTime && time < expireTime) {
return true;
} else {
......@@ -160,11 +176,11 @@ export function myFilter(value, options) {
}
// 自定义弹框消息
export function showToast(message) {
export function showToast(message, mask = false) {
uni.showToast({
title: message,
icon: 'none',
// mask: true
mask
})
}
......@@ -314,3 +330,43 @@ export const getTime = function(time) {
}
return t;
}
// 初始化查询参数
export const initQueryParams = (params) => {
const defParams = {
size: 10,
current: 1,
sort: "createTime",
order: "descending",
model: {},
extra: {},
timeRange: null,
};
return params ? {
...defParams,
...params
} : defParams;
};
/**
* This is just a simple version of deep copy
* Has a lot of edge cases bug
* If you want to use a perfect deep copy, use lodash's _.cloneDeep
* @param {Object} source
* @returns {Object}
*/
export function deepClone(source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'deepClone')
}
const targetObj = source.constructor === Array ? [] : {}
Object.keys(source).forEach(keys => {
if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = deepClone(source[keys])
} else {
targetObj[keys] = source[keys]
}
})
return targetObj
}
......@@ -22,11 +22,11 @@ export const minPopupOptions = [{
]
export const billingTypeOptions = [{
value: "1",
value: "INCOME",
label: "收入"
},
{
value: "2",
value: "EXPENSE",
label: "支出"
},
]
......
......@@ -45,7 +45,7 @@ export const packageOptions = [{
id: 3,
title: '退出登录',
icon: 'bookmark',
path: "/pages/mine/logout/logout"
path: ""
}
]
......
export const scheduleTypeOptions = [{
value: "1",
value: "WORK",
label: "工作"
},
{
value: "2",
value: "LIfE",
label: "生活"
},
]
export const scheduleSettingOptions = [{
value: "1",
value: "30",
label: "30分钟前"
},
{
value: "2",
value: "60",
label: "1小时前"
},
{
value: "3",
value: "120",
label: "2小时前"
},
]
......@@ -92,10 +92,8 @@ function request({
}
},
fail: error => {
// 重置时间戳
setTimetamp()
uni.hideLoading()
showToast("request error")
showToast("REQUEST ERROR")
console.log(error)
reject(error)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment