Browse Source

1.扫码功能完善

2.首页添加分享
remotes/origin/HEAD
wally 5 years ago
parent
commit
f111683d59
  1. 23
      main.js
  2. 5
      pages.json
  3. 555
      pages/apply-code/apply-code.vue
  4. 34
      pages/basic-info/basic-info.vue
  5. 14
      pages/healthy-card/healthy-card.vue
  6. 318
      pages/index/components/home.vue
  7. 15
      pages/index/index.vue
  8. 11
      pages/user-code/user-code.vue

23
main.js

@ -5,7 +5,15 @@ import App from './App';
import store from './store';
// 白名单页面
const whitePathList = ['basic-info', 'statistics', 'user-code'];
const whitePathList = [
'basic-info',
'statistics',
'user-code',
'sign',
'my-signs',
'my-code',
'my-trips',
];
/**
* 检查url是否在是否在白名单内
* @param {string} url path+query
@ -27,19 +35,6 @@ Vue.prototype.goHome = () => {
});
};
/**
* 打开某个页面
* @param {string} path 页面完成路径
* @param {string} query 参数字符串a=x&b=y
*/
// 白名单页面
const whiteListPath = [
'/pages/basic-info/basic-info',
'/pages/statistics/statistics',
'/pages/user-code/user-code',
];
Vue.prototype.openPage = function(path, query = '') {
let url = query ? `${path}?${query}` : path;
store.commit('user/setPagePath', url);

5
pages.json

@ -68,11 +68,6 @@
"navigationBarTitleText": "我的行程"
}
},
{
"path": "pages/healthy-card/healthy-card",
"style": {}
},
{
"path": "pages/service-agreement/service-agreement",
"style": {

555
pages/apply-code/apply-code.vue

@ -1,293 +1,310 @@
<template>
<view>
<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>
<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>
<input placeholder="请输入详细地址(含门牌号)" name="input" type="text" v-model="address" />
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm"><span class="text-red padding-right-xs">*</span>当前状态</view>
<radio-group class="block" @change="StateChange">
<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.id"></radio>
<view class="flex-sub" style="font-size: 34rpx;">{{ state.name }}</view>
</label>
</view>
</view>
</radio-group>
</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="hospital" />
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">最近14天是否有武汉居住史旅游史或武汉亲戚来访</view>
<radio-group class="block" @change="TourChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(tour,index) in tours" :key="index">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === touchHubei" :value="tour.value"></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ tour.name }}</text>
</label>
</view>
</view>
</radio-group>
</view>
<view>
<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>
<view class="flex align-center">
<input
@tap="handleSelectLocation"
class="flex-sub padding-left-xs"
name="input"
placeholder="请选择当前所在地区"
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>
<input name="input" placeholder="请输入详细地址(含门牌号)" type="text" v-model="address" />
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">
<span class="text-red padding-right-xs">*</span>当前状态
</view>
<radio-group @change="StateChange" class="block">
<view class="cu-list menu text-left">
<view :key="index" class="cu-item" v-for="(state,index) in status">
<label class="flex justify-between align-center">
<radio
:checked="index === healthTypeId"
:value="state.id"
class="round margin-right-xs"
></radio>
<view class="flex-sub" style="font-size: 34rpx;">{{ state.name }}</view>
</label>
</view>
</view>
</radio-group>
</view>
<view class="cu-form-group flex flex-direction padding-tb">
<view class="title padding-bottom-sm">就诊医院若无填无</view>
<input name="input" placeholder="请输入就诊医院" type="text" v-model="hospital" />
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">最近14天是否有武汉居住史旅游史或武汉亲戚来访</view>
<radio-group @change="TourChange" class="block">
<view class="flex">
<view :key="index" class="flex-sub margin-tb-sm" v-for="(tour,index) in tours">
<label class="flex justify-between align-center">
<radio
:checked="index === touchHubei"
:value="tour.value"
class="round margin-right-xs"
></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ tour.name }}</text>
</label>
</view>
</view>
</radio-group>
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">最近14天是否有新冠肺炎患者或疑似患者接触史</view>
<radio-group class="block" @change="TouchChange">
<view class="flex">
<view class="flex-sub margin-tb-sm" v-for="(touch,index) in touches" :key="index">
<label class="flex justify-between align-center">
<radio class="round margin-right-xs" :checked="index === touchSick" :value="touch.value"></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ touch.name }}</text>
</label>
</view>
</view>
</radio-group>
</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="number" v-model="animalHeat" />
</view>
</form>
<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>
</view>
<view class="cu-form-group flex flex-direction padding-top">
<view class="title padding-bottom-sm">最近14天是否有新冠肺炎患者或疑似患者接触史</view>
<radio-group @change="TouchChange" class="block">
<view class="flex">
<view :key="index" class="flex-sub margin-tb-sm" v-for="(touch,index) in touches">
<label class="flex justify-between align-center">
<radio
:checked="index === touchSick"
:value="touch.value"
class="round margin-right-xs"
></radio>
<text class="flex-sub" style="font-size: 34rpx;">{{ touch.name }}</text>
</label>
</view>
</view>
</radio-group>
</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 name="input" placeholder="请输入当前真实体温" type="number" v-model="animalHeat" />
</view>
</form>
<user-agreement @changeIntentions="changeIntentions"></user-agreement>
<button @tap="handleHealthSign" class="bg-cyan margin primary-btn" hover-class="cc-active">确认提交</button>
<!-- 历史 -->
<button
@tap="openPage('/pages/my-code/my-code')"
class="shadow round bg-cyan history-btn iconfont icon-history"
hover-class="cc-active"
></button>
</view>
</template>
<script>
import {
showToast
} from 'common/script/util';
import {
HEALTH_SIGN
} from 'api/api';
import {
mapState,
mapMutations
} from 'vuex';
import { showToast } from 'common/script/util';
import { HEALTH_SIGN } from 'api/api';
import { mapState, mapMutations } from 'vuex';
export default {
data() {
return {
district: '请选择当前所在地区',
address: '',
// status: [],
hospital: '',
tours: [{
value: '0',
name: '否'
}, {
value: '1',
name: '是'
}],
touches: [{
value: '0',
name: '否'
}, {
value: '1',
name: '是'
}],
animalHeat: 0,
healthTypeId: 0,
touchHubei: 0,
touchSick: 0,
agree: false,
};
},
computed: mapState('user', ['token', 'status']),
export default {
data() {
return {
district: '请选择当前所在地区',
address: '',
// status: [],
hospital: '',
tours: [
{
value: '0',
name: '否',
},
{
value: '1',
name: '是',
},
],
touches: [
{
value: '0',
name: '否',
},
{
value: '1',
name: '是',
},
],
animalHeat: 0,
healthTypeId: 0,
touchHubei: 0,
touchSick: 0,
agree: false,
};
},
computed: mapState('user', ['token', 'status']),
methods: {
...mapMutations('user', ['setHealthCode']),
handleSelectLocation() {
const that = this;
uni.chooseLocation({
success: function(res) {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
that.district = res.address;
},
});
},
methods: {
...mapMutations('user', ['setHealthCode']),
handleSelectLocation() {
const that = this;
uni.chooseLocation({
success: function(res) {
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
that.district = res.address;
},
});
},
changeIntentions(data) {
this.agree = data;
},
changeIntentions(data) {
this.agree = data;
},
//
StateChange: function(evt) {
for (let i = 0; i < this.status.length; i++) {
if (this.status[i].id === evt.target.value) {
this.healthTypeId = i;
break;
}
}
},
//
StateChange: function(evt) {
for (let i = 0; i < this.status.length; i++) {
if (this.status[i].id === evt.target.value) {
this.healthTypeId = i;
break;
}
}
},
//
TourChange: function(evt) {
for (let i = 0; i < this.tours.length; i++) {
if (this.tours[i].value === evt.target.value) {
this.touchHubei = i;
break;
}
}
},
//
TourChange: function(evt) {
for (let i = 0; i < this.tours.length; i++) {
if (this.tours[i].value === evt.target.value) {
this.touchHubei = i;
break;
}
}
},
//
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;
}
}
},
//
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;
}
}
},
/**
* 申请健康码
*/
async handleHealthSign() {
try {
if (!this.checkRules()) return;
/**
* 申请健康码
*/
async handleHealthSign() {
try {
if (!this.checkRules()) return;
const {
address,
animalHeat,
district,
healthTypeId,
hospital,
token,
touchHubei,
touchSick
} = this;
const params = {
param: {
address,
animalHeat,
district,
healthTypeId: healthTypeId + 1,
hospital,
token,
touchHubei,
touchSick
}
};
const {
address,
animalHeat,
district,
healthTypeId,
hospital,
token,
touchHubei,
touchSick,
} = this;
const params = {
param: {
address,
animalHeat,
district,
healthTypeId: healthTypeId + 1,
hospital,
token,
touchHubei,
touchSick,
},
};
const res = await this.$http.post(HEALTH_SIGN, params);
const {
success,
code,
msg,
data
} = res.data;
if (success && code === 200) {
uni.showToast({
title: '申请健康码成功',
duration: 2000
});
this.success = true;
this.setHealthCode(data.healthCode)
uni.reLaunch({
url: `/pages/index/index`,
});
} else {
uni.showToast({
title: msg || '申请健康码失败',
icon: 'none'
});
}
} catch (error) {
console.log('error: ', error);
if (error.msg) {
uni.showToast({
title: error.msg || '申请健康码失败',
icon: 'none'
});
}
}
},
const res = await this.$http.post(HEALTH_SIGN, params);
const { success, code, msg, data } = res.data;
if (success && code === 200) {
uni.showToast({
title: '申请健康码成功',
duration: 2000,
});
this.success = true;
this.setHealthCode(data.healthCode);
uni.reLaunch({
url: `/pages/index/index`,
});
} else {
uni.showToast({
title: msg || '申请健康码失败',
icon: 'none',
});
}
} catch (error) {
console.log('error: ', error);
if (error.msg) {
uni.showToast({
title: error.msg || '申请健康码失败',
icon: 'none',
});
}
}
},
//
checkRules() {
const {
district,
address,
healthTypeId,
animalHeat,
agree
} = this;
if (!district || district === '请选择当前所在地区') {
showToast('请选择当前所在地区');
return;
}
if (!address) {
showToast('请输入当前所在地址');
return;
}
if (healthTypeId < 0) {
showToast('请选择状态');
return;
}
if (!animalHeat) {
showToast('请输入当前体温');
return;
}
if (!agree) {
showToast('请确定是否为本人填写');
return;
}
return true;
},
},
};
//
checkRules() {
const { district, address, healthTypeId, animalHeat, agree } = this;
if (!district || district === '请选择当前所在地区') {
showToast('请选择当前所在地区');
return;
}
if (!address) {
showToast('请输入当前所在地址');
return;
}
if (healthTypeId < 0) {
showToast('请选择状态');
return;
}
if (!animalHeat) {
showToast('请输入当前体温');
return;
}
if (!agree) {
showToast('请确定是否为本人填写');
return;
}
return true;
},
},
};
</script>
<style lang="scss" scoped>
.agree-box {
width: 70rpx;
}
.agree-box {
width: 70rpx;
}
.agree-text {
line-height: 60rpx;
}
.agree-text {
line-height: 60rpx;
}
.timer {
font-size: 34rpx !important;
color: $gray;
}
.timer {
font-size: 34rpx !important;
color: $gray;
}
.primary-btn {
border-radius: 15rpx;
}
.primary-btn {
border-radius: 15rpx;
}
.history-btn {
position: fixed;
bottom: 40rpx;
right: 40rpx;
width: 96rpx;
height: 96rpx;
line-height: 96rpx;
padding: 0;
}
.history-btn {
position: fixed;
bottom: 40rpx;
right: 40rpx;
width: 96rpx;
height: 96rpx;
line-height: 96rpx;
padding: 0;
}
.history-btn::after {
border: none;
}
.history-btn::after {
border: none;
}
</style>

34
pages/basic-info/basic-info.vue

@ -6,7 +6,7 @@
<span class="text-red padding-right-xs" v-show="!(userInfo && userInfo.id)">*</span>姓名
</view>
<input
:disabled="(userInfo && userInfo.id) ? true : false"
:disabled="userInfo && userInfo.id ? true : false"
name="input"
placeholder="请输入真实姓名"
type="text"
@ -18,7 +18,7 @@
<span class="text-red padding-right-xs" v-show="!(userInfo && userInfo.id)">*</span>身份证
</view>
<input
:disabled="(userInfo && userInfo.id) ? true : false"
:disabled="userInfo && userInfo.id ? true : false"
name="input"
placeholder="请输入身份证号"
type="text"
@ -30,7 +30,7 @@
<span class="text-red padding-right-xs" v-show="!(userInfo && userInfo.id)">*</span>联系方式
</view>
<input
:disabled="(userInfo && userInfo.id) ? true : false"
:disabled="userInfo && userInfo.id ? true : false"
name="input"
placeholder="请输入手机号码"
type="number"
@ -43,7 +43,7 @@
</view>
<radio-group @change="RadioChange" class="block" v-if="!(userInfo && userInfo.id)">
<view class="flex">
<view :key="index" class="flex-sub margin-tb-sm" v-for="(identity,index) in identitys">
<view :key="index" class="flex-sub margin-tb-sm" v-for="(identity, index) in identitys">
<label class="flex justify-between align-center">
<radio
:checked="index === current"
@ -68,7 +68,7 @@
<span class="text-red padding-right-xs" v-show="!(userInfo && userInfo.id)">*</span>学号
</view>
<input
:disabled="(userInfo && userInfo.id) ? true : false"
:disabled="userInfo && userInfo.id ? true : false"
name="input"
placeholder="请输入学号"
type="text"
@ -76,7 +76,7 @@
/>
</view>
</form>
<user-agreement v-if="!(userInfo && userInfo.id)" @changeIntentions="changeIntentions"></user-agreement>
<user-agreement @changeIntentions="changeIntentions" v-if="!(userInfo && userInfo.id)"></user-agreement>
<button
@tap="handleSubmitUserInfo"
class="bg-cyan margin primary-btn"
@ -165,19 +165,19 @@ export default {
const res = await this.$http.post(SUBMIT_USER_INFO, params);
const { success, code, msg, data } = res.data;
if (success && code === 200) {
uni.showToast({
title: '基本信息提交成功',
duration: 2000
});
uni.showToast({
title: '基本信息提交成功',
duration: 2000,
});
this.success = true;
this.setUserInfo(data);
if(pagePath === '/pages/basic-info/basic-info'){
uni.reLaunch({
url: `/pages/index/index`,
});
}else{
this.openPage(pagePath);
}
if (pagePath === '/pages/basic-info/basic-info') {
uni.reLaunch({
url: `/pages/index/index`,
});
} else {
uni.redirectTo({ url: pagePath });
}
} else {
uni.showToast({
title: msg || '基本信息提交失败',

14
pages/healthy-card/healthy-card.vue

@ -1,14 +0,0 @@
<template>
<view>扫别人的码</view>
</template>
<script>
export default {
data() {
return {};
},
};
</script>
<style lang="scss">
</style>

318
pages/index/components/home.vue

@ -1,159 +1,175 @@
<template>
<view class="content flex flex-direction">
<view v-if="healthCode" style="position: relative;">
<image src="http://m.qpic.cn/psc?/V11kyB1O080aC1/cnQ2D7YjAZ5R6pY0fmc9joZ6fC6TxFlt9mW4UhUn2PEgUne7OUt4q4mNE.k9gU.rSr8Eu*pFToZoVwUOEGDrKMycDqdn1mLFGE1dxYTGUcE!/b&bo=7gKRAu4CkQIDWXw!&rf=viewer_4&t=5"
class="bg1"></image>
<view class="bg-code" @click="getPreviewImg(healthCode)">
<view class="healthy-code-bg shadow-lg">
<image class="healthy-code" :src="healthCode"></image>
</view>
</view>
</view>
<image v-else src="http://m.qpic.cn/psc?/V11kyB1O080aC1/cnQ2D7YjAZ5R6pY0fmc9jhx9v1rh8VuBAojvYxrYvg*uVMAXaD2En3CPiaHx7AWMjFTafVrGxwJR4jZd5s4ProhQT1ceDVquyQR7HVquBKk!/b&bo=7gLuAe4C7gEDORw!&rf=viewer_4&t=5"
class="bg"></image>
<view :class="healthCode ? 'box1' : 'box'">
<view v-show="!healthCode" class="cu-card flex margin bg-white shadow card-radius" hover-class="cc-active" @tap="openPage('/pages/apply-code/apply-code')">
<view class="flex align-center padding">
<view class="round lg cu-avatar icon1">
<view class="iconfont icon-qrcode"></view>
</view>
<view class="padding-left-sm flex-sub">
<view class="text-xl">领取健康码</view>
<view class="text-df padding-top-xs description">领取健康码查看健康状态</view>
</view>
</view>
</view>
<view class="cu-card flex margin bg-white shadow card-radius" hover-class="cc-active" @tap="openPage('/pages/punch-the-clock/punch-the-clock')">
<view class="flex align-center padding">
<view class="round lg cu-avatar icon2">
<view class="iconfont icon-carryout"></view>
</view>
<view class="padding-left-sm flex-sub">
<view class="text-xl">每日健康打卡</view>
<view class="text-df padding-top-xs description">山大人员健康情况打卡</view>
</view>
</view>
</view>
<view class="cu-card flex margin bg-white shadow card-radius" hover-class="cc-active" @tap="openPage('/pages/add-stroke/add-stroke')">
<view class="flex align-center padding">
<view class="round lg cu-avatar icon3">
<view class="iconfont icon-car"></view>
</view>
<view class="padding-left-sm flex-sub">
<view class="text-xl">行程上报</view>
<view class="text-df padding-top-xs description">外出行程及时上报</view>
</view>
</view>
</view>
<view class="cu-card flex margin bg-white shadow card-radius" hover-class="cc-active" @tap="openPage('/pages/statistics/statistics')">
<view class="flex align-center padding">
<view class="round lg cu-avatar icon4">
<view class="iconfont icon-linechart"></view>
</view>
<view class="padding-left-sm flex-sub">
<view class="text-xl">统计</view>
<view class="text-df padding-top-xs description">山大校园疫情统计</view>
</view>
</view>
</view>
</view>
</view>
<view class="content flex flex-direction">
<view v-if="healthCode" style="position: relative;">
<image
src="http://m.qpic.cn/psc?/V11kyB1O080aC1/cnQ2D7YjAZ5R6pY0fmc9joZ6fC6TxFlt9mW4UhUn2PEgUne7OUt4q4mNE.k9gU.rSr8Eu*pFToZoVwUOEGDrKMycDqdn1mLFGE1dxYTGUcE!/b&bo=7gKRAu4CkQIDWXw!&rf=viewer_4&t=5"
class="bg1"
></image>
<view class="bg-code" @click="getPreviewImg(healthCode)">
<view class="healthy-code-bg shadow-lg">
<image class="healthy-code" :src="healthCode"></image>
</view>
</view>
</view>
<image
v-else
src="http://m.qpic.cn/psc?/V11kyB1O080aC1/cnQ2D7YjAZ5R6pY0fmc9jhx9v1rh8VuBAojvYxrYvg*uVMAXaD2En3CPiaHx7AWMjFTafVrGxwJR4jZd5s4ProhQT1ceDVquyQR7HVquBKk!/b&bo=7gLuAe4C7gEDORw!&rf=viewer_4&t=5"
class="bg"
></image>
<view :class="healthCode ? 'box1' : 'box'">
<view
@tap="openPage('/pages/apply-code/apply-code')"
class="cu-card flex margin bg-white shadow card-radius"
hover-class="cc-active"
v-show="!healthCode"
>
<view class="flex align-center padding">
<view class="round lg cu-avatar icon1">
<view class="iconfont icon-qrcode"></view>
</view>
<view class="padding-left-sm flex-sub">
<view class="text-xl">领取健康码</view>
<view class="text-df padding-top-xs description">领取健康码查看健康状态</view>
</view>
</view>
</view>
<view
@tap="openPage('/pages/punch-the-clock/punch-the-clock')"
class="cu-card flex margin bg-white shadow card-radius"
hover-class="cc-active"
>
<view class="flex align-center padding">
<view class="round lg cu-avatar icon2">
<view class="iconfont icon-carryout"></view>
</view>
<view class="padding-left-sm flex-sub">
<view class="text-xl">每日健康打卡</view>
<view class="text-df padding-top-xs description">山大人员健康情况打卡</view>
</view>
</view>
</view>
<view
@tap="openPage('/pages/add-stroke/add-stroke')"
class="cu-card flex margin bg-white shadow card-radius"
hover-class="cc-active"
>
<view class="flex align-center padding">
<view class="round lg cu-avatar icon3">
<view class="iconfont icon-car"></view>
</view>
<view class="padding-left-sm flex-sub">
<view class="text-xl">行程上报</view>
<view class="text-df padding-top-xs description">外出行程及时上报</view>
</view>
</view>
</view>
<view
@tap="openPage('/pages/statistics/statistics')"
class="cu-card flex margin bg-white shadow card-radius"
hover-class="cc-active"
>
<view class="flex align-center padding">
<view class="round lg cu-avatar icon4">
<view class="iconfont icon-linechart"></view>
</view>
<view class="padding-left-sm flex-sub">
<view class="text-xl">统计</view>
<view class="text-df padding-top-xs description">山大校园疫情统计</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from 'vuex';
export default {
name: 'Home',
data() {
return {}
},
computed: mapState('user', ['userInfo', 'healthCode']),
methods: {
//
getPreviewImg(image) {
var imgArr = [];
imgArr.push(image);
uni.previewImage({
urls: imgArr,
current: imgArr[0]
});
},
}
};
import { mapState } from 'vuex';
export default {
name: 'Home',
data() {
return {};
},
computed: mapState('user', ['userInfo', 'healthCode']),
methods: {
//
getPreviewImg(image) {
var imgArr = [];
imgArr.push(image);
uni.previewImage({
urls: imgArr,
current: imgArr[0],
});
},
},
};
</script>
<style scoped lang="scss">
.bg {
width: 100%;
height: 495rpx;
}
.bg1 {
width: 100%;
height: 635rpx;
}
.bg-code {
display: flex;
width: 100%;
position: absolute;
top: 370rpx;
.healthy-code-bg {
margin: 0 auto;
width: 230rpx;
height: 230rpx;
border-radius: 6px;
overflow: hidden;
background: $whiteShadow;
.healthy-code {
margin: 5rpx;
width: 220rpx;
height: 220rpx;
border-radius: 6px;
}
}
}
.box {
position: relative;
top: -100rpx;
}
.box1 {
position: relative;
top: 0;
}
.card-radius {
border-radius: 15rpx;
}
.description {
color: $grey;
}
.icon1 {
background: $iconGreen;
}
.icon2 {
background: $iconCyan;
}
.icon3 {
background: $iconBlue;
}
.icon4 {
background: $iconPurple;
}
.bg {
width: 100%;
height: 495rpx;
}
.bg1 {
width: 100%;
height: 635rpx;
}
.bg-code {
display: flex;
width: 100%;
position: absolute;
top: 370rpx;
.healthy-code-bg {
margin: 0 auto;
width: 230rpx;
height: 230rpx;
border-radius: 6px;
overflow: hidden;
background: $whiteShadow;
.healthy-code {
margin: 5rpx;
width: 220rpx;
height: 220rpx;
border-radius: 6px;
}
}
}
.box {
position: relative;
top: -100rpx;
}
.box1 {
position: relative;
top: 0;
}
.card-radius {
border-radius: 15rpx;
}
.description {
color: $grey;
}
.icon1 {
background: $iconGreen;
}
.icon2 {
background: $iconCyan;
}
.icon3 {
background: $iconBlue;
}
.icon4 {
background: $iconPurple;
}
</style>

15
pages/index/index.vue

@ -24,7 +24,14 @@ export default {
navIndex: 0,
};
},
onLoad() {},
//
onShareAppMessage() {
return {
title: '健康码小程序',
path: '/pages/index/index?scene=1008',
};
},
methods: {
/**
* 监听nav-bottom的点击事件
@ -44,8 +51,10 @@ export default {
console.log('res: ', res);
//
if (res && res.path) {
const path = `${res.path}&scan=true`;
this.openPage(res.path);
const pathArr = res.path.split('?scene=');
const query = encodeURIComponent(pathArr[1]);
const path = `/${pathArr[0]}?scene=${query}&scan=true`;
this.openPage(path);
} else {
uni.showModal({
title: '提示',

11
pages/user-code/user-code.vue

@ -42,7 +42,7 @@
</template>
<script>
import { mapActions } from 'vuex';
import { mapState, mapActions } from 'vuex';
import { formatQuery } from 'utils/util';
export default {
@ -69,6 +69,8 @@ export default {
},
computed: {
...mapState('user', ['token']),
//
post() {
if (!this.userInfo) return '学生';
@ -116,7 +118,7 @@ export default {
},
},
async onLoad(options) {
onLoad(options) {
this.init(options);
},
@ -127,7 +129,6 @@ export default {
try {
console.log('options: ', options);
const query = formatQuery(decodeURIComponent(options.scene));
console.log('query: ', query);
const { d } = query;
if (!d) {
uni.showToast({
@ -154,7 +155,11 @@ export default {
this.getUserInfoData(params);
}, 100);
} else {
console.log('params: ', params);
this.userInfo = await this.getUserInfo(params);
if (!this.userInfo.healthCodeList.length) {
showToast('健康码信息有误, 请重新生成');
}
}
},
},

Loading…
Cancel
Save