Browse Source

1.健康打卡时间轴 2.获取个人信息

remotes/origin/HEAD
songsong428 5 years ago
parent
commit
4c340d1913
  1. 5
      App.vue
  2. 5
      main.js
  3. 12
      pages/add-stroke/add-stroke.vue
  4. 70
      pages/add-stroke/components/date-selector.vue
  5. 12
      pages/apply-code/apply-code.vue
  6. 2
      pages/basic-info/basic-info.vue
  7. 33
      pages/index/components/mine.vue
  8. 31
      pages/my-code/my-code.vue
  9. 103
      pages/my-trips/my-trips.vue
  10. BIN
      static/head-portrait.jpg

5
App.vue

@ -1,6 +1,7 @@
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import { GET_USER_INFO, HEALTH_TYPE_STATUS } from 'api/api';
import { showLoading, hideLoading, showToast, showModal } from 'utils/ui';
export default {
async onLaunch() {
@ -31,6 +32,7 @@ export default {
*/
async getUserInfo() {
try {
showLoading();
const { token } = this;
const params = {
param: {
@ -57,7 +59,9 @@ export default {
icon: 'none'
});
}
hideLoading();
} catch (error) {
hideLoading();
console.log('error: ', error);
if (error.msg) {
uni.showToast({
@ -81,6 +85,7 @@ export default {
data
} = res.data;
if (success && code === 200) {
this.success = true;
this.setStatus(data)
} else {

5
main.js

@ -10,6 +10,11 @@ Vue.prototype.$moment = moment;
moment.locale('zh-cn');
// 定义一个全局过滤器实现日期格式化
Vue.filter('datefmt', function (input, fmtstring) {
return moment.unix(input).format(fmtstring)
})
Vue.prototype.goHome = () => {
uni.reLaunch({
url: '/pages/index/index',

12
pages/add-stroke/add-stroke.vue

@ -44,12 +44,7 @@
<input placeholder="请输入同行人" name="input" type="text" v-model="together" />
</view>
</form>
<view class="margin flex flex-wrap">
<view @click="agree = !agree" class="iconfont agree-box" :class="[agree ? 'text-blue icon-check-square': 'text-gray icon-border']"></view>
<view class="text-df text-black flex-sub agree-text">
以上信息是我本人填写本人对信息的真实性和完整性负责
</view>
</view>
<user-agreement @changeIntentions="changeIntentions"></user-agreement>
<button class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="handleAddStroke">确认提交</button>
<!-- 历史 -->
<button class="shadow round bg-cyan history-btn iconfont icon-history" hover-class="cc-active" @tap="openPage('/pages/my-trips/my-trips')"></button>
@ -129,6 +124,11 @@ export default {
}
}
},
//
changeIntentions(data) {
this.agree = data;
},
/**
* 获取出发时间

70
pages/add-stroke/components/date-selector.vue

@ -3,54 +3,46 @@
<view @tap="$refs.calendar.open()" hover-class="cc-active">
<view class="iconfont icon-calendar timer"><text class="padding-left-xs">{{ date }}</text></view>
</view>
<uni-calendar
:insert="false"
:range="true"
:show-month="true"
@confirm="handleChange"
ref="calendar"
/>
<uni-calendar @confirm="handleChange" :insert="false" :range="false" :show-month="true" ref="calendar" />
</view>
</template>
<script>
export default {
name: 'DateSelector',
data() {
const start = this.$moment().format('YYYY-MM-DD');
const end = this.$moment().format('YYYY-MM-DD');
return {
start,
end,
};
},
export default {
name: 'DateSelector',
data() {
const time = this.$moment().format('YYYY-MM-DD');
return {
time,
};
},
computed: {
date() {
const { start, end } = this;
return start === end ? start : `${start} - ${end}`;
},
},
computed: {
date() {
const {
time
} = this;
return time;
},
},
methods: {
/**
* 日历确认选择了时间段
* @param {object} value 日历返回对象
*/
handleChange(value) {
const { before, after } = value.range;
this.start = before;
this.end = after;
this.menu = '';
this.$emit('change', before, after);
},
},
};
methods: {
/**
* 日历确认选择了时间段
* @param {object} value 日历返回对象
*/
handleChange(value) {
console.log('value', value.fulldate)
this.time = value.fulldate;
this.$emit('change', this.time);
},
},
};
</script>
<style lang="scss" scoped>
.timer{
font-size: 34rpx!important;
.timer {
font-size: 34rpx !important;
color: $gray;
}
</style>

12
pages/apply-code/apply-code.vue

@ -62,13 +62,7 @@
<input placeholder="请输入当前真实体温" name="input" type="number" v-model="animalHeat" />
</view>
</form>
<view class="margin flex flex-wrap">
<view @click="agree = !agree" class="iconfont agree-box" :class="[agree ? 'text-blue icon-check-square': 'text-gray icon-border']"></view>
<view class="text-df text-black flex-sub agree-text">
以上信息是我本人填写本人对信息的真实性和完整性负责
</view>
</view>
<user-agreement @changeIntentions="changeIntentions"></user-agreement>
<button class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="handleHealthSign">确认提交</button>
<!-- 历史 -->
<button class="shadow round bg-cyan history-btn iconfont icon-history" hover-class="cc-active" @tap="openPage('/pages/my-code/my-code')"></button>
@ -129,6 +123,10 @@
},
});
},
changeIntentions(data) {
this.agree = data;
},
//
StateChange: function(evt) {

2
pages/basic-info/basic-info.vue

@ -76,7 +76,7 @@
/>
</view>
</form>
<user-agreement @changeIntentions="changeIntentions" v-if="!(userinfo && userInfo.id)"></user-agreement>
<user-agreement @changeIntentions="changeIntentions"></user-agreement>
<button
@tap="handleSubmitUserInfo"
class="bg-cyan margin primary-btn"

33
pages/index/components/mine.vue

@ -1,20 +1,30 @@
<template>
<view>
<!-- 头部 -->
<view class="cu-card flex bg-white">
<view class="cu-card flex bg-white" v-if="user && user.wxInfo">
<view class="flex flex-sub align-center padding-xl">
<view class="round xl cu-avatar portrait">
<image class="xl cu-avatar" :src="userInfo.avatarUrl"></image>
<image class="xl cu-avatar" :src="user.wxInfo.headImgUrl"></image>
</view>
<view class="flex-sub padding-left">
<view class="text-xl">{{ userInfo.nickName }}</view>
<view class="text-df padding-top-xs">{{ userInfo.classes }}</view>
<view class="text-xxl">{{ user.wxInfo.nickname }}</view>
<!-- <view class="text-df padding-top-xs">{{ user.wxInfo.classes }}</view> -->
</view>
<!-- <image class="healthy-code" :src="healthCode"></image> -->
<image class="healthy-code" :src="healthCode"></image>
</view>
</view>
<view class="cu-card flex bg-white" v-else>
<view class="flex flex-sub align-center padding-xl">
<view class="round xl cu-avatar portrait">
<image class="xl cu-avatar" :src="userInfo.avatarUrl"></image>
</view>
<view class="flex-sub padding-left">
<view class="text-xxl">{{ userInfo.nickName }}</view>
<!-- <view class="text-df padding-top-sm">{{ userInfo.classes }}</view> -->
</view>
</view>
</view>
<!-- 列表 -->
<view class="bg-white margin-top">
<view class="cu-list menu margin-lr">
@ -41,20 +51,21 @@
</template>
<script>
import { mapState } from 'vuex';
import {
mapState
} from 'vuex';
export default {
name: 'Mine',
data() {
return {
userInfo: {
avatarUrl: '../../../static/head-portrait.jpg',
nickName: '丁菲菲',
classes: '计算机19级软工二班',
healthyCodeColor: '#11A20D',
nickName: '姓名',
// classes: '19',
},
};
},
computed: mapState('user', ['healthCode']),
computed: mapState('user', ['healthCode', 'user']),
};
</script>

31
pages/my-code/my-code.vue

@ -3,7 +3,7 @@
<!-- 添加 -->
<button class="shadow round bg-cyan add-btn iconfont icon-plus" hover-class="cc-active" @tap="openPage('/pages/apply-code/apply-code')"></button>
<view v-if="tableList && tableList.length>0" class="cu-timeline" :key="index" v-for="(item,index) in tableList">
<view class="cu-time">{{ $moment(+item.time).format('MM-DD') }}</view>
<view class="cu-time">{{ +item.time | datefmt('MM-DD') }}</view>
<view class="cu-item text-blue cuIcon-locationfill">
<view class="content shadow-blur bg-blue light">
{{ item.district }}{{ item.address }}
@ -51,24 +51,31 @@
};
},
created() {
this.getHealthSignHistory();
},
computed: mapState('user', ['token','userInfo','status']),
onLoad() {
const startTime = +this.$moment()
.startOf('year')
.format('x');
const endTime = +this.$moment()
.endOf('day')
.format('x');
const params = {
param: {
startTime,
endTime,
token: this.token
}
};
this.getHealthSignHistory(params);
},
methods: {
...mapMutations('user', ['setStatus','setUserInfo']),
//
async getHealthSignHistory() {
async getHealthSignHistory(params) {
try {
const { token } = this;
const params = {
param: {
token
}
};
const res = await this.$http.post(HEALTH_SIGN_HISTORY, params);
const {
success,

103
pages/my-trips/my-trips.vue

@ -3,43 +3,45 @@
<!-- 添加 -->
<button class="shadow round bg-cyan add-btn iconfont icon-plus" hover-class="cc-active" @tap="openPage('/pages/add-stroke/add-stroke')"></button>
<view v-if="tableList && tableList.length>0" class="cu-timeline" :key="index" v-for="(item,index) in tableList">
<view class="cu-time">{{ item.startTime }}</view>
<!-- <view class="cu-time">{{ $moment(+item.date).format('MM-DD') }}</view> -->
<view class="cu-item cuIcon-timefill">
<view class="content shadow-blur">
{{ item.startTime }} {{ item.endTime }}
<view class="cu-time">{{ +item.startTime | datefmt('MM-DD') }}</view>
<view class="cu-item cuIcon-timefill text-blue">
<view class="content shadow-blur bg-blue light">
{{ +item.startTime | datefmt('MM月DD日') }} -- {{ +item.endTime | datefmt('MM月DD日') }}
</view>
</view>
<view class="cu-item cuIcon-tagfill text-blue">
<view class="content shadow-blur bg-blue light">
<view class="cu-item cuIcon-tagfill text-green">
<view class="content shadow-blur bg-green light">
<view>
<text class="radius bg-blue margin-tb padding-xs" v-if="item.journeyType === '0'">返校行程</text>
<text class="radius bg-blue margin-tb padding-xs" v-if="item.journeyType === '1'">日常外出</text>
<text class="radius bg-green margin-tb padding-xs" v-if="item.journeyType === '0'">返校行程</text>
<text class="radius bg-green margin-tb padding-xs" v-if="item.journeyType === '1'">日常外出</text>
</view>
<view class="margin-top" v-if="item.together">
<view class="margin-bottom" v-if="item.together">
同行人{{ item.together }}
</view>
<view v-for="trip in transports" :key="trip.id" class="margin-top" v-if="trip.value === item.tripMode">
<view v-for="trip in transports" :key="trip.id" class="margin-bottom" v-if="trip.value === item.tripMode">
出行方式
{{ trip.name }}
</view>
<view class="margin-top">
<view>
乘坐航班车次或车牌号码及座位号
{{ item.carNo }}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
showToast
} from 'common/script/util';
import { mapState,mapMutations } from 'vuex';
import {
mapState,
mapMutations
} from 'vuex';
import {
GET_JOURNEYS
} from 'api/api';
@ -48,61 +50,57 @@
data() {
return {
tableList: [],
transports: [
{
value: '0',
transports: [{
value: 0,
name: '铁路',
},
{
value: '1',
value: 1,
name: '飞机',
},
{
value: '2',
value: 2,
name: '客运车辆',
},
{
value: '3',
value: 3,
name: '自驾',
},
{
value: '4',
value: 4,
name: '船',
},
{
value: '5',
value: 5,
name: '其他',
}
],
// tableList: [
// {
// startTime: '02-04',
// endTime: '02-05',
// journeyType: '1',
// carNo: '35212',
// tripMode: '3',
// together: ''
// },
// ],
]
};
},
computed: mapState('user', ['token']),
created() {
this.getJourneys()
onLoad() {
const startTime = +this.$moment()
.startOf('year')
.format('x');
const endTime = +this.$moment()
.endOf('day')
.format('x');
const params = {
param: {
startTime,
endTime,
token: this.token
}
};
this.getJourneys(params);
},
methods: {
//
async getJourneys() {
async getJourneys(params) {
try {
const { token } = this;
const params = {
param: {
token
}
};
const res = await this.$http.post(GET_JOURNEYS, params);
const {
success,
@ -129,7 +127,7 @@
}
}
},
},
};
</script>
@ -148,15 +146,15 @@
align-items: left;
font-size: 36rpx;
margin-bottom: 20rpx;
.data-title{
.data-title {
line-height: 60rpx;
color: $black;
}
}
}
.add-btn{
.add-btn {
position: fixed;
bottom: 40rpx;
right: 40rpx;
@ -166,7 +164,8 @@
padding: 0;
z-index: 1;
}
.add-btn::after{
.add-btn::after {
border: none;
}
</style>

BIN
static/head-portrait.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Loading…
Cancel
Save