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

5
main.js

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

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

@ -44,12 +44,7 @@
<input placeholder="请输入同行人" name="input" type="text" v-model="together" /> <input placeholder="请输入同行人" name="input" type="text" v-model="together" />
</view> </view>
</form> </form>
<view class="margin flex flex-wrap"> <user-agreement @changeIntentions="changeIntentions"></user-agreement>
<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>
<button class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="handleAddStroke">确认提交</button> <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> <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 @tap="$refs.calendar.open()" hover-class="cc-active">
<view class="iconfont icon-calendar timer"><text class="padding-left-xs">{{ date }}</text></view> <view class="iconfont icon-calendar timer"><text class="padding-left-xs">{{ date }}</text></view>
</view> </view>
<uni-calendar <uni-calendar @confirm="handleChange" :insert="false" :range="false" :show-month="true" ref="calendar" />
:insert="false"
:range="true"
:show-month="true"
@confirm="handleChange"
ref="calendar"
/>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'DateSelector', name: 'DateSelector',
data() { data() {
const start = this.$moment().format('YYYY-MM-DD'); const time = this.$moment().format('YYYY-MM-DD');
const end = this.$moment().format('YYYY-MM-DD'); return {
return { time,
start, };
end, },
};
},
computed: { computed: {
date() { date() {
const { start, end } = this; const {
return start === end ? start : `${start} - ${end}`; time
}, } = this;
}, return time;
},
},
methods: { methods: {
/** /**
* 日历确认选择了时间段 * 日历确认选择了时间段
* @param {object} value 日历返回对象 * @param {object} value 日历返回对象
*/ */
handleChange(value) { handleChange(value) {
const { before, after } = value.range; console.log('value', value.fulldate)
this.start = before; this.time = value.fulldate;
this.end = after; this.$emit('change', this.time);
this.menu = ''; },
this.$emit('change', before, after); },
}, };
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.timer{ .timer {
font-size: 34rpx!important; font-size: 34rpx !important;
color: $gray; color: $gray;
} }
</style> </style>

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

@ -62,13 +62,7 @@
<input placeholder="请输入当前真实体温" name="input" type="number" v-model="animalHeat" /> <input placeholder="请输入当前真实体温" name="input" type="number" v-model="animalHeat" />
</view> </view>
</form> </form>
<user-agreement @changeIntentions="changeIntentions"></user-agreement>
<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>
<button class="bg-cyan margin primary-btn" hover-class="cc-active" @tap="handleHealthSign">确认提交</button> <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> <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) { StateChange: function(evt) {

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

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

33
pages/index/components/mine.vue

@ -1,20 +1,30 @@
<template> <template>
<view> <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="flex flex-sub align-center padding-xl">
<view class="round xl cu-avatar portrait"> <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>
<view class="flex-sub padding-left"> <view class="flex-sub padding-left">
<view class="text-xl">{{ userInfo.nickName }}</view> <view class="text-xxl">{{ user.wxInfo.nickname }}</view>
<view class="text-df padding-top-xs">{{ userInfo.classes }}</view> <!-- <view class="text-df padding-top-xs">{{ user.wxInfo.classes }}</view> -->
</view> </view>
<!-- <image class="healthy-code" :src="healthCode"></image> -->
<image class="healthy-code" :src="healthCode"></image> <image class="healthy-code" :src="healthCode"></image>
</view> </view>
</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="bg-white margin-top">
<view class="cu-list menu margin-lr"> <view class="cu-list menu margin-lr">
@ -41,20 +51,21 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'; import {
mapState
} from 'vuex';
export default { export default {
name: 'Mine', name: 'Mine',
data() { data() {
return { return {
userInfo: { userInfo: {
avatarUrl: '../../../static/head-portrait.jpg', avatarUrl: '../../../static/head-portrait.jpg',
nickName: '丁菲菲', nickName: '姓名',
classes: '计算机19级软工二班', // classes: '19',
healthyCodeColor: '#11A20D',
}, },
}; };
}, },
computed: mapState('user', ['healthCode']), computed: mapState('user', ['healthCode', 'user']),
}; };
</script> </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> <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 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="cu-item text-blue cuIcon-locationfill">
<view class="content shadow-blur bg-blue light"> <view class="content shadow-blur bg-blue light">
{{ item.district }}{{ item.address }} {{ item.district }}{{ item.address }}
@ -51,24 +51,31 @@
}; };
}, },
created() {
this.getHealthSignHistory();
},
computed: mapState('user', ['token','userInfo','status']), 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: { methods: {
...mapMutations('user', ['setStatus','setUserInfo']), ...mapMutations('user', ['setStatus','setUserInfo']),
// //
async getHealthSignHistory() { async getHealthSignHistory(params) {
try { try {
const { token } = this;
const params = {
param: {
token
}
};
const res = await this.$http.post(HEALTH_SIGN_HISTORY, params); const res = await this.$http.post(HEALTH_SIGN_HISTORY, params);
const { const {
success, 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> <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 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">{{ +item.startTime | datefmt('MM-DD') }}</view>
<!-- <view class="cu-time">{{ $moment(+item.date).format('MM-DD') }}</view> --> <view class="cu-item cuIcon-timefill text-blue">
<view class="cu-item cuIcon-timefill"> <view class="content shadow-blur bg-blue light">
<view class="content shadow-blur"> {{ +item.startTime | datefmt('MM月DD日') }} -- {{ +item.endTime | datefmt('MM月DD日') }}
{{ item.startTime }} {{ item.endTime }}
</view> </view>
</view> </view>
<view class="cu-item cuIcon-tagfill text-blue"> <view class="cu-item cuIcon-tagfill text-green">
<view class="content shadow-blur bg-blue light"> <view class="content shadow-blur bg-green light">
<view> <view>
<text class="radius bg-blue margin-tb padding-xs" v-if="item.journeyType === '0'">返校行程</text> <text class="radius bg-green 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 === '1'">日常外出</text>
</view> </view>
<view class="margin-top" v-if="item.together"> <view class="margin-bottom" v-if="item.together">
同行人{{ item.together }} 同行人{{ item.together }}
</view> </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 }} {{ trip.name }}
</view> </view>
<view class="margin-top"> <view>
乘坐航班车次或车牌号码及座位号 乘坐航班车次或车牌号码及座位号
{{ item.carNo }} {{ item.carNo }}
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { import {
showToast showToast
} from 'common/script/util'; } from 'common/script/util';
import { mapState,mapMutations } from 'vuex'; import {
mapState,
mapMutations
} from 'vuex';
import { import {
GET_JOURNEYS GET_JOURNEYS
} from 'api/api'; } from 'api/api';
@ -48,61 +50,57 @@
data() { data() {
return { return {
tableList: [], tableList: [],
transports: [ transports: [{
{ value: 0,
value: '0',
name: '铁路', name: '铁路',
}, },
{ {
value: '1', value: 1,
name: '飞机', name: '飞机',
}, },
{ {
value: '2', value: 2,
name: '客运车辆', name: '客运车辆',
}, },
{ {
value: '3', value: 3,
name: '自驾', name: '自驾',
}, },
{ {
value: '4', value: 4,
name: '船', name: '船',
}, },
{ {
value: '5', value: 5,
name: '其他', name: '其他',
} }
], ]
// tableList: [
// {
// startTime: '02-04',
// endTime: '02-05',
// journeyType: '1',
// carNo: '35212',
// tripMode: '3',
// together: ''
// },
// ],
}; };
}, },
computed: mapState('user', ['token']), computed: mapState('user', ['token']),
created() { onLoad() {
this.getJourneys() 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: { methods: {
// //
async getJourneys() { async getJourneys(params) {
try { try {
const { token } = this;
const params = {
param: {
token
}
};
const res = await this.$http.post(GET_JOURNEYS, params); const res = await this.$http.post(GET_JOURNEYS, params);
const { const {
success, success,
@ -129,7 +127,7 @@
} }
} }
}, },
}, },
}; };
</script> </script>
@ -148,15 +146,15 @@
align-items: left; align-items: left;
font-size: 36rpx; font-size: 36rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
.data-title{ .data-title {
line-height: 60rpx; line-height: 60rpx;
color: $black; color: $black;
} }
} }
} }
.add-btn{ .add-btn {
position: fixed; position: fixed;
bottom: 40rpx; bottom: 40rpx;
right: 40rpx; right: 40rpx;
@ -166,7 +164,8 @@
padding: 0; padding: 0;
z-index: 1; z-index: 1;
} }
.add-btn::after{
.add-btn::after {
border: none; border: none;
} }
</style> </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