Browse Source

1.领取健康码api

remotes/origin/HEAD
songsong428 5 years ago
parent
commit
0a081237e5
  1. 37
      App.vue
  2. 19
      components/user-agreement/user-agreement.vue
  3. 3
      manifest.json
  4. 7
      pages.json
  5. 111
      pages/add-stroke/add-stroke.vue
  6. 101
      pages/apply-code/apply-code.vue
  7. 92
      pages/my-code/my-code.vue
  8. 138
      pages/my-trips/my-trips.vue
  9. 2
      pages/service-agreement/service-agreement.vue
  10. 9
      store/modules/user/mutations.js
  11. 1
      store/modules/user/state.js

37
App.vue

@ -1,6 +1,6 @@
<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import { GET_USER_INFO } from 'api/api';
import { GET_USER_INFO, HEALTH_TYPE_STATUS } from 'api/api';
export default {
async onLaunch() {
@ -17,13 +17,14 @@ export default {
await this.login();
await this.getUserInfo();
await this.getHealthTypeStaus();
this.getSites();
},
computed: mapState('user', ['token']),
methods: {
...mapMutations('user', ['setUserInfo','setHealthCode']),
...mapMutations('user', ['setStatus','setUserInfo','setHealthCode']),
...mapActions('user', ['login']),
...mapActions('site', ['getSites']),
@ -70,6 +71,38 @@ export default {
}
},
/**
* 查询健康状态类型
*/
async getHealthTypeStaus() {
try {
const res = await this.$http.post(HEALTH_TYPE_STATUS);
const {
success,
code,
msg,
data
} = res.data;
if (success && code === 200) {
this.success = true;
this.setStatus(data)
} else {
uni.showToast({
title: msg || '申请健康码成功',
icon: 'none'
});
}
} catch (error) {
console.log('error: ', error);
if (error.msg) {
uni.showToast({
title: error.msg || '申请健康码失败',
icon: 'none'
});
}
}
},
},
};
</script>

19
components/user-agreement/user-agreement.vue

@ -6,6 +6,7 @@
<text class="text-blue" @tap="serviceAgreement">用户服务协议</text>
<text class="text-blue" @tap="privacyAolicy">隐私政策</text>,
勾选代表您已同意此协议
</view>
</view>
</template>
@ -30,17 +31,25 @@ export default {
//
serviceAgreement(){
uni.navigateTo({
url: '/pages/service-agreement/service-agreement',
console.log('用户服务协议')
uni.navigateToMiniProgram({
appId: 'wx5b97b0686831c076',
path: 'pages/preview/preview?sid=&fid=60774991254',
success(res) {
console.log(res);
},
});
},
//
privacyAolicy(){
uni.navigateTo({
url: '/pages/privacy-aolicy/privacy-aolicy',
uni.navigateToMiniProgram({
appId: 'wx5b97b0686831c076',
path: 'pages/preview/preview?sid=&fid=60774976650',
success(res) {
console.log(res);
},
});
}
},
};

3
manifest.json

@ -69,7 +69,8 @@
"desc": "你的位置信息将用于获取地理位置及地图展示"
}
},
"usingComponents" : true
"usingComponents" : true,
"navigateToMiniProgramAppIdList": ["wx5b97b0686831c076"]
},
"mp-alipay" : {
"usingComponents" : true

7
pages.json

@ -1,5 +1,12 @@
{
"pages": [
// {
// "path": "pages/my-trips/my-trips",
// "style": {
// "navigationBarTitleText": "我的行程"
// }
// },
{
"path": "pages/index/index",
"style": {

111
pages/add-stroke/add-stroke.vue

@ -9,13 +9,26 @@
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>抵达时间</view>
<date-selector @change="getEndData" />
</view>
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>行程类型</view>
<radio-group class="block" @change="TypeChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(journey,index) in journeys" :key="index">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === journeyType" :value="journey.value"></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ journey.name }}</text>
</label>
</view>
</view>
</radio-group>
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="text-xl padding-tb-sm">出行交通方式必选</view>
<radio-group class="block" @change="RadioChange">
<view class="cu-list menu text-left">
<view class="cu-item" v-for="(transport,index) in transports" :key="index">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === current" :value="transport.value"></radio>
<radio class="round margin-right-xs" :checked="index === tripMode" :value="transport.value"></radio>
<view class="flex-sub" style="font-size: 34rpx;">{{ transport.name }}</view>
</label>
</view>
@ -24,7 +37,11 @@
</view>
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>乘坐航班车次或车牌号码及座位号没有填无</view>
<input placeholder="请输入" name="input" type="text" v-model="carNumber" />
<input placeholder="请输入" name="input" type="text" v-model="carNo" />
</view>
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm">同行人</view>
<input placeholder="请输入同行人" name="input" type="text" v-model="together" />
</view>
</form>
<view class="margin flex flex-wrap">
@ -49,6 +66,8 @@ export default {
components: {UniCalendar,DateSelector},
data() {
return {
startTime: this.$moment().format('YYYY-MM-DD'),
endTime: this.$moment().format('YYYY-MM-DD'),
transports: [
{
value: '0',
@ -75,8 +94,20 @@ export default {
name: '其他',
}
],
carNumber: '',
current: 0,
carNo: '',
journeys: [
{
value: '0',
name: '返校行程',
},
{
value: '1',
name: '日常外出',
}
],
together: '',
tripMode: 0,
journeyType: 0,
agree: false
};
},
@ -84,7 +115,16 @@ export default {
RadioChange: function(evt) {
for (let i = 0; i < this.transports.length; i++) {
if (this.transports[i].value === evt.target.value) {
this.current = i;
this.tripMode = i;
break;
}
}
},
TypeChange: function(evt) {
for (let i = 0; i < this.journeys.length; i++) {
if (this.journeys[i].value === evt.target.value) {
this.journeyType = i;
break;
}
}
@ -97,6 +137,7 @@ export default {
*/
getStartData(start) {
console.log('出发时间 start: ', start);
this.startTime = start;
},
/**
@ -106,6 +147,7 @@ export default {
*/
getEndData(end) {
console.log('抵达时间 end: ', end);
this.endTime = end;
},
/**
@ -114,30 +156,26 @@ export default {
async handleAddStroke() {
try {
if (!this.checkRules()) return;
const {
address,
animalHeat,
district,
healthTypeId,
hospital,
token,
touchHubei,
touchSick
carNo,
endTime,
journeyType,
startTime,
together,
tripMode
} = this;
const params = {
param: {
address,
animalHeat,
district,
healthTypeId,
hospital,
token,
touchHubei,
touchSick
carNo,
endTime: +this.$moment(endTime).format('x'),
journeyType: journeyType+1,
startTime: +this.$moment(startTime).format('x'),
together,
tripMode
}
};
const res = await this.$http.post(HEALTH_SIGN, params);
console.log('params2',params)
const res = await this.$http.post(SUBMIT_JOURNEYS, params);
const {
success,
code,
@ -145,14 +183,13 @@ export default {
data
} = res.data;
if (success && code === 200) {
this.setHealthCode(data.healthCode)
this.success = true;
uni.reLaunch({
url: `/pages/index/index`,
});
} else {
uni.showToast({
title: msg || '申请健康码成功',
title: msg || '行程添加成功',
icon: 'none'
});
}
@ -160,7 +197,7 @@ export default {
console.log('error: ', error);
if (error.msg) {
uni.showToast({
title: error.msg || '申请健康码失败',
title: error.msg || '行程添加失败',
icon: 'none'
});
}
@ -169,13 +206,25 @@ export default {
//
checkRules() {
const { district,address,healthTypeId,animalHeat,agree } = this;
if (!this.transports) {
showToast('请选择身份');
const { startTime,endTime,journeyType,tripMode,carNo,agree } = this;
if (!this.startTime) {
showToast('请选择出发时间');
return;
}
if (!this.endTime) {
showToast('请选择抵达时间');
return;
}
if (this.journeyType<0) {
showToast('请选择行程类型');
return;
}
if (this.tripMode<0) {
showToast('请选择出行交通方式');
return;
}
if (!this.carNumber) {
showToast('请输入学号');
if (!this.carNo) {
showToast('乘坐航班车次或车牌号码及座位号');
return;
}
if (!this.agree) {

101
pages/apply-code/apply-code.vue

@ -3,7 +3,11 @@
<form class="padding-lr cu-form-group flex-direction">
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>当前所在地区</view>
<input @tap="handleSelectLocation" placeholder="请选择当前所在地区" name="input" type="btn" v-model="district" />
<view class="flex align-center">
<input class="flex-sub padding-left-xs" @tap="handleSelectLocation" placeholder="请选择当前所在地区" name="input" type="btn"
v-model="district" />
<text class="cuIcon-location timer"></text>
</view>
</view>
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>当前所在详细地址</view>
@ -15,7 +19,7 @@
<view class="cu-list menu text-left">
<view class="cu-item" v-for="(state,index) in status" :key="index">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === healthTypeId" :value="state.value"></radio>
<radio class="round margin-right-xs" :checked="index === healthTypeId" :value="state.id"></radio>
<view class="flex-sub" style="font-size: 34rpx;">{{ state.name }}</view>
</label>
</view>
@ -78,61 +82,32 @@
import {
HEALTH_SIGN
} from 'api/api';
import { mapState,mapMutations } from 'vuex';
import {
mapState,
mapMutations
} from 'vuex';
export default {
data() {
return {
district: '请选择当前所在地区',
address: '',
status: [{
value: '0',
name: '正常',
},
{
value: '1',
name: '发烧(37.3度以上)',
},
{
value: '2',
name: '咳嗽',
},
{
value: '3',
name: '咽喉疼痛',
},
{
value: '4',
name: '流鼻涕',
},
{
value: '5',
name: '头痛',
},
{
value: '6',
name: '其他',
}
],
// status: [],
hospital: '',
tours: [{
value: 1,
name: '是'
},
{
value: 0,
value: '0',
name: '否'
}
],
touches: [{
value: 1,
}, {
value: '1',
name: '是'
},
{
value: 0,
}],
touches: [{
value: '0',
name: '否'
}
],
}, {
value: '1',
name: '是'
}],
animalHeat: 0,
healthTypeId: 0,
touchHubei: 0,
@ -140,7 +115,8 @@
agree: false,
};
},
computed: mapState('user', ['token']),
computed: mapState('user', ['token', 'status']),
methods: {
...mapMutations('user', ['setHealthCode']),
handleSelectLocation() {
@ -157,7 +133,7 @@
//
StateChange: function(evt) {
for (let i = 0; i < this.status.length; i++) {
if (this.status[i].value === evt.target.value) {
if (this.status[i].id === evt.target.value) {
this.healthTypeId = i;
break;
}
@ -175,10 +151,11 @@
},
//
TouchChange: function(evt) {
for (let i = 0; i < this.touches.length; i++) {
if (this.touches[i].value === evt.target.value) {
this.touchSick = i;
TouchChange(evt) {
console.log(this.touches,'aa')
for (let b = 0; b < this.touches.length; b++) {
if (this.touches[b].value === evt.target.value) {
this.touchSick = b;
break;
}
}
@ -206,13 +183,14 @@
address,
animalHeat,
district,
healthTypeId,
healthTypeId: healthTypeId + 1,
hospital,
token,
touchHubei,
touchSick
}
};
console.log('params1', params)
const res = await this.$http.post(HEALTH_SIGN, params);
const {
success,
@ -221,8 +199,8 @@
data
} = res.data;
if (success && code === 200) {
this.setHealthCode(data.healthCode)
this.success = true;
this.setHealthCode(data.healthCode)
uni.reLaunch({
url: `/pages/index/index`,
});
@ -245,7 +223,13 @@
//
checkRules() {
const { district,address,healthTypeId,animalHeat,agree } = this;
const {
district,
address,
healthTypeId,
animalHeat,
agree
} = this;
if (!district || district === '请选择当前所在地区') {
showToast('请选择当前所在地区');
return;
@ -254,7 +238,7 @@
showToast('请输入当前所在地址');
return;
}
if (healthTypeId<0) {
if (healthTypeId < 0) {
showToast('请选择状态');
return;
}
@ -282,6 +266,11 @@
line-height: 60rpx;
}
.timer {
font-size: 34rpx !important;
color: $gray;
}
.primary-btn {
border-radius: 15rpx;
}

92
pages/my-code/my-code.vue

@ -2,9 +2,8 @@
<view>
<!-- 添加 -->
<button class="shadow round bg-cyan add-btn iconfont icon-plus" hover-class="cc-active" @tap="openPage('/pages/apply-code/apply-code')"></button>
<view class="cu-timeline" :key="index" v-for="(item,index) in tableList">
<view class="cu-time">{{ item.time }}</view>
<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-item text-blue cuIcon-locationfill">
<view class="content shadow-blur bg-blue light">
{{ item.district }}{{ item.address }}
@ -14,8 +13,11 @@
<view class="content shadow-blur light"
:class="item.healthLevel === 0 ? 'bg-green' : item.healthLevel === 1 ? 'bg-yellow' : 'bg-red'"
>
<view class="margin-bottom">
体温{{ item.animalHeat }}状态{{ item.healthTypeId }}
<view class="margin-bottom flex">
体温{{ item.animalHeat }}
<text v-for="state in status" :key="state.id">
<text v-if="state.id === item.healthTypeId">状态{{ state.name }}</text>
</text>
</view>
<view>
<text class="radius bg-red margin-tb margin-right padding-xs" v-show="item.touchHubei === 1">
@ -38,61 +40,61 @@
showToast
} from 'common/script/util';
import {
SUBMIT_USER_INFO
HEALTH_SIGN_HISTORY
} from 'api/api';
import { mapState,mapMutations } from 'vuex';
export default {
data() {
return {
tableList: [{
time: '2020-02-05',
district: '太原',
address: '小店',
healthTypeId: '正常',
hospital: '是深V',
touchHubei: 1,
touchSick: 1,
animalHeat: 0,
healthLevel: 0, // 0 1 2
},
{
time: '2020-02-05',
district: '太原',
address: '小店',
healthTypeId: '正常',
hospital: '',
touchHubei: 1,
touchSick: 0,
animalHeat: 0,
healthLevel: 1
},
{
time: '2020-02-05',
district: '太原',
address: '小店',
healthTypeId: '正常',
hospital: '',
touchHubei: 1,
touchSick: 0,
animalHeat: 0,
healthLevel: 2
}
],
tableList: [],
};
},
created() {
if(this.userInfo){
}
this.getHealthSignHistory();
},
computed: mapState('user', ['userInfo']),
computed: mapState('user', ['token','userInfo','status']),
methods: {
...mapMutations('user', ['setUserInfo']),
...mapMutations('user', ['setStatus','setUserInfo']),
//
async getHealthSignHistory() {
try {
const { token } = this;
const params = {
param: {
token
}
};
const res = await this.$http.post(HEALTH_SIGN_HISTORY, params);
const {
success,
code,
msg,
data
} = res.data;
if (success && code === 200) {
this.success = true;
this.tableList = data;
} else {
uni.showToast({
title: msg || '获取健康打卡记录成功',
icon: 'none'
});
}
} catch (error) {
console.log('error: ', error);
if (error.msg) {
uni.showToast({
title: error.msg || '获取健康打卡记录失败',
icon: 'none'
});
}
}
},
},
};
</script>

138
pages/my-trips/my-trips.vue

@ -2,40 +2,35 @@
<view>
<!-- 添加 -->
<button class="shadow round bg-cyan add-btn iconfont icon-plus" hover-class="cc-active" @tap="openPage('/pages/add-stroke/add-stroke')"></button>
<view class="card radius shadow-warp bg-white margin" :key="index" v-for="(item,index) in tableList">
<view class="card-head solid-bottom">
<view class="round bg-green cu-avatar">{{ index+1 }}</view>
<view class="flex flex-sub"></view>
<view class="flex justify-end">
<text class="text-grey text-xl">{{ item.date }}</text>
<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>
</view>
<view class="card-content padding-lr">
<view class="data-wrap">
<view class="data-item">
<view class="data-title">出发时间
<text class="text-gray padding-left-xs">{{ item.startTime }}</text>
</view>
</view>
<view class="data-item">
<view class="data-title">抵达时间:
<text class="text-gray padding-left-xs">{{ item.endTime }}</text>
</view>
</view>
<view class="data-item">
<view class="data-title">出行交通方式:
<text class="text-gray padding-left-xs">{{ item.transport }}</text>
<view class="cu-item cuIcon-tagfill text-blue">
<view class="content shadow-blur bg-blue 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>
</view>
<view class="margin-top" v-if="item.together">
同行人{{ item.together }}
</view>
<view class="data-item">
<view class="data-title">乘坐航班车次或车牌号码及座位号:
<text class="text-gray padding-left-xs">{{ item.carNumber }}</text>
<view v-for="trip in transports" :key="trip.id" class="margin-top" v-if="trip.value === item.tripMode">
出行方式
{{ trip.name }}
</view>
<view class="margin-top">
乘坐航班车次或车牌号码及座位号
{{ item.carNo }}
</view>
</view>
</view>
</view>
</view>
</template>
@ -44,35 +39,96 @@
import {
showToast
} from 'common/script/util';
import { mapState,mapMutations } from 'vuex';
import {
GET_JOURNEYS
} from 'api/api';
export default {
data() {
return {
tableList: [{
date: '2020-02-05',
startTime: '2020-02-04',
endTime: '2020-02-05',
transport: '铁路',
carNumber: '32'
tableList: [],
transports: [
{
value: '0',
name: '铁路',
},
{
value: '1',
name: '飞机',
},
{
value: '2',
name: '客运车辆',
},
{
date: '2020-02-05',
startTime: '2020-02-04',
endTime: '2020-02-05',
transport: '飞机',
carNumber: '3282'
value: '3',
name: '自驾',
},
{
date: '2020-02-05',
startTime: '2020-02-04',
endTime: '2020-02-05',
transport: '自驾',
carNumber: '35212'
value: '4',
name: '船',
},
{
value: '5',
name: '其他',
}
],
// tableList: [
// {
// startTime: '02-04',
// endTime: '02-05',
// journeyType: '1',
// carNo: '35212',
// tripMode: '3',
// together: ''
// },
// ],
};
},
computed: mapState('user', ['token']),
created() {
this.getJourneys()
},
methods: {
//
async getJourneys() {
try {
const { token } = this;
const params = {
param: {
token
}
};
const res = await this.$http.post(GET_JOURNEYS, params);
const {
success,
code,
msg,
data
} = res.data;
if (success && code === 200) {
this.success = true;
this.tableList = data;
} else {
uni.showToast({
title: msg || '获取健康打卡记录成功',
icon: 'none'
});
}
} catch (error) {
console.log('error: ', error);
if (error.msg) {
uni.showToast({
title: error.msg || '获取健康打卡记录失败',
icon: 'none'
});
}
}
},
},
};

2
pages/service-agreement/service-agreement.vue

@ -6,7 +6,7 @@
export default {
data() {
return {
url: 'https://www.yuque.com/docs/share/00738d22-45de-46d0-8473-4275ac421fbd?#'
url: 'pages/preview/preview?sid=&fid=60774991254&fname=%25E7%2594%25A8%25E6%2588%25B7%25E6%259C%258D%25E5%258A%25A1%25E5%258D%258F%25E8%25AE%25AE.docx&ftype=file&groupid=821063867&needUpdateRecent=true'
}
},
}

9
store/modules/user/mutations.js

@ -60,6 +60,15 @@ const mutations = {
*/
setPagePath(state, data) {
state.pagePath = data;
},
/**
* 设置健康状态类型 status
* @param {*} state
* @param {array} data
*/
setStatus(state, data) {
state.status = data || [];
}
};

1
store/modules/user/state.js

@ -4,6 +4,7 @@ const state = {
healthCode: '', // 健康码
userInfo: '', // 个人基本信息
pagePath: '', //页面跳转参数
status: [], // 健康状态类型
};
export default state;

Loading…
Cancel
Save