first commit

This commit is contained in:
callmeyan 2019-06-22 22:01:46 +08:00
commit 0175c02241
45 changed files with 7089 additions and 0 deletions

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# score-manage
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run dev
```
### Compiles and minifies for production
```
npm run build
```

46
app.js Normal file
View File

@ -0,0 +1,46 @@
//app.js
// global.regeneratorRuntime = require('./utils/regenerator/runtime-module')
App({
onLaunch: function() {
// 展示本地存储能力
// var logs = wx.getStorageSync('logs') || []
// logs.unshift(Date.now())
// wx.setStorageSync('logs', logs)
this.globalData.openId = wx.getStorageSync('openId') || '';
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
console.log('login==>', res);
}
})
// 获取用户信息
wx.getSetting({
success: res => {
console.log('getSetting==>', res);
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null,
openId: ''
}
})

19
app.json Normal file
View File

@ -0,0 +1,19 @@
{
"pages": [
"pages/user/index",
"pages/index/index",
"pages/user/evaluation",
"pages/init/userinfo",
"pages/init/agreement"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#2EC7A5",
"navigationBarTitleText": "急性高原反应自评",
"navigationBarTextStyle": "white"
},
"usingComponents": {
"cu-custom": "/colorui/components/cu-custom"
},
"sitemapLocation": "sitemap.json"
}

143
app.wxss Normal file
View File

@ -0,0 +1,143 @@
/**app.wxss**/
@import "colorui/main.wxss";
@import "colorui/icon.wxss";
page {
font-size: 28rpx;
}
.container {
box-sizing: border-box;
}
.container-card {
margin: 20rpx 40rpx;
}
.card {
background-color: #f7f7f7;
border: solid 1rpx #bbb;
padding: 20rpx;
margin: 20rpx 40rpx;
border-radius: 6rpx;
}
.text-center {
text-align: center;
}
.text-strong {
font-weight: bold;
}
button {
color: #2ec7a5;
border: 1px solid #2ec7a5;
background-color: #fff;
margin-top: 60rpx;
margin-bottom: 40rpx;
}
button::after {
border: none;
}
.btn-single {
width: 60%;
}
.btn-green {
color: #fff;
background-color: #2ec7a5;
}
.btn-round {
border-radius: 100rpx;
}
/*checkbox 整体大小 */
/*checkbox 选项框大小 */
checkbox .wx-checkbox-input {
border-radius: 50%;
overflow: hidden;
}
/*checkbox选中后样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
background: #09bb07;
}
/*checkbox选中后图标样式 */
checkbox::before {
top: 25rpx;
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
text-align: center;
font-size: 24rpx;
color: #fff;
background: transparent;
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
.row {
display: flex;
}
.col {
flex: 1;
margin: 0 40rpx;
}
.form-group {
margin-bottom: 40rpx;
}
.form-group > label {
font-weight: bold;
display: block;
margin-bottom: 20rpx;
}
input, .select-input {
border-radius: 4px 4px 4px 4px;
background-color: rgba(255, 255, 255, 1);
border: 1px solid rgba(220, 223, 230, 1);
padding: 0 14rpx;
height: 60rpx;
line-height: 60rpx;
position: relative;
}
.select-input::after {
content: '▲';
color: #ccc;
position: absolute;
right: 14rpx;
top: 4rpx;
font-size: 20rpx;
transform: rotate(180deg);
}
.page-title {
font-size: 30rpx;
margin: 30rpx 0;
font-weight: bold;
}
.actionsheet button {
margin: 0;
border-right: none;
border-left: none;
border-bottom: none;
border-radius: 0;
border-color:#eee;
}

BIN
assets/index.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

184
colorui/animation.wxss Normal file
View File

@ -0,0 +1,184 @@
/*
Animation 微动画
基于ColorUI组建库的动画模块 by 文晓港 2019年3月26日19:52:28
*/
/* css 滤镜 控制黑白底色gif的 */
.gif-black{
mix-blend-mode: screen;
}
.gif-white{
mix-blend-mode: multiply;
}
/* Animation css */
[class*=animation-] {
animation-duration: .5s;
animation-timing-function: ease-out;
animation-fill-mode: both
}
.animation-fade {
animation-name: fade;
animation-duration: .8s;
animation-timing-function: linear
}
.animation-scale-up {
animation-name: scale-up
}
.animation-scale-down {
animation-name: scale-down
}
.animation-slide-top {
animation-name: slide-top
}
.animation-slide-bottom {
animation-name: slide-bottom
}
.animation-slide-left {
animation-name: slide-left
}
.animation-slide-right {
animation-name: slide-right
}
.animation-shake {
animation-name: shake
}
.animation-reverse {
animation-direction: reverse
}
@keyframes fade {
0% {
opacity: 0
}
100% {
opacity: 1
}
}
@keyframes scale-up {
0% {
opacity: 0;
transform: scale(.2)
}
100% {
opacity: 1;
transform: scale(1)
}
}
@keyframes scale-down {
0% {
opacity: 0;
transform: scale(1.8)
}
100% {
opacity: 1;
transform: scale(1)
}
}
@keyframes slide-top {
0% {
opacity: 0;
transform: translateY(-100%)
}
100% {
opacity: 1;
transform: translateY(0)
}
}
@keyframes slide-bottom {
0% {
opacity: 0;
transform: translateY(100%)
}
100% {
opacity: 1;
transform: translateY(0)
}
}
@keyframes shake {
0%,
100% {
transform: translateX(0)
}
10% {
transform: translateX(-9px)
}
20% {
transform: translateX(8px)
}
30% {
transform: translateX(-7px)
}
40% {
transform: translateX(6px)
}
50% {
transform: translateX(-5px)
}
60% {
transform: translateX(4px)
}
70% {
transform: translateX(-3px)
}
80% {
transform: translateX(2px)
}
90% {
transform: translateX(-1px)
}
}
@keyframes slide-left {
0% {
opacity: 0;
transform: translateX(-100%)
}
100% {
opacity: 1;
transform: translateX(0)
}
}
@keyframes slide-right {
0% {
opacity: 0;
transform: translateX(100%)
}
100% {
opacity: 1;
transform: translateX(0)
}
}

View File

@ -0,0 +1,54 @@
const app = getApp();
Component({
/**
* 组件的一些选项
*/
options: {
addGlobalClass: true,
multipleSlots: true
},
/**
* 组件的对外属性
*/
properties: {
bgColor: {
type: String,
default: ''
},
isCustom: {
type: [Boolean, String],
default: false
},
isBack: {
type: [Boolean, String],
default: false
},
bgImage: {
type: String,
default: ''
},
},
/**
* 组件的初始数据
*/
data: {
StatusBar: app.globalData.StatusBar,
CustomBar: app.globalData.CustomBar,
Custom: app.globalData.Custom
},
/**
* 组件的方法列表
*/
methods: {
BackPage() {
wx.navigateBack({
delta: 1
});
},
toHome(){
wx.reLaunch({
url: '/pages/index/index',
})
}
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,16 @@
<view class="cu-custom" style="height:{{CustomBar}}px">
<view class="cu-bar fixed {{bgImage!=''?'none-bg text-white bg-img':''}} {{bgColor}}" style="height:{{CustomBar}}px;padding-top:{{StatusBar}}px;{{bgImage?'background-image:url(' + bgImage+')':''}}">
<view class="action" bindtap="BackPage" wx:if="{{isBack}}">
<text class="cuIcon-back"></text>
<slot name="backText"></slot>
</view>
<view class="action border-custom" wx:if="{{isCustom}}" style="width:{{Custom.width}}px;height:{{Custom.height}}px;margin-left:calc(750rpx - {{Custom.right}}px)">
<text class="cuIcon-back" bindtap="BackPage"></text>
<text class="cuIcon-homefill" bindtap="toHome"></text>
</view>
<view class="content" style="top:{{StatusBar}}px">
<slot name="content"></slot>
</view>
<slot name="right"></slot>
</view>
</view>

View File

@ -0,0 +1 @@
/* colorui/components/cu-custom.wxss */

1226
colorui/icon.wxss Normal file

File diff suppressed because one or more lines are too long

3942
colorui/main.wxss Normal file

File diff suppressed because it is too large Load Diff

23
components/navbar.js Normal file
View File

@ -0,0 +1,23 @@
// components/navbar.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

4
components/navbar.json Normal file
View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

2
components/navbar.wxml Normal file
View File

@ -0,0 +1,2 @@
<!--components/navbar.wxml-->
<text>components/navbar.wxml</text>

1
components/navbar.wxss Normal file
View File

@ -0,0 +1 @@
/* components/navbar.wxss */

63
pages/index/index.js Normal file
View File

@ -0,0 +1,63 @@
//"navigationStyle": "custom",
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {
avatarUrl: 'http://thirdwx.qlogo.cn/mmopen/vi_32/9xkaQhBrbjIsJNJkxKicKayJiajy2ZsKFHM7vhibPjic0sLhn0cxCicxgQUl9VDF9o02NsQlcxZicJPWb4K9RibQJ8ibDQ/132'
},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
//事件处理函数
bindViewTap: function() {
wx.showModal({
title: '测试',
content: '',
})
},
onUserInfoTap(){
wx.navigateTo({
url: '../user/index'
})
},
onLoad: function() {
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse) {
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}
},
getUserInfo: function(e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})

33
pages/index/index.wxml Normal file
View File

@ -0,0 +1,33 @@
<!--index.wxml-->
<view class="container page-user">
<view class="cu-list menu-avatar user-info">
<view class="cu-item" bindtap="onUserInfoTap">
<view class="cu-avatar round lg" style="background-image:url({{userInfo.avatarUrl}});"></view>
<view class="content">
<view class="text-grey">
<text class="text-cut">张二娃</text>
</view>
<view class="text-gray text-sm flex">
<text class="text-cut">评估时间: <text>2019/06/01 12:22</text></text>
</view>
</view>
<view class="action">
<view class="cuIcon-right text-gray"></view>
<view class="text-gray text-sm flex"> </view>
</view>
</view>
</view>
<!-- <block>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block> -->
<view class="usermotto text-center">
<view>
<image src="/assets/index.png"></image>
</view>
<view>
<button wx:if="{{hasUserInfo}}" class="btn-green btn-single btn-round" open-type="getUserInfo" bindgetuserinfo="getUserInfo">开始自评</button>
<button wx:else class="btn-green btn-single btn-round" open-type="getUserInfo" bindgetuserinfo="getUserInfo">开始自评</button>
</view>
</view>
</view>

28
pages/index/index.wxss Normal file
View File

@ -0,0 +1,28 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.userinfo-nickname {
color: #aaa;
}
.usermotto {
margin-top: 30px;
}
.usermotto image{
width: 290px;
height: 390px;
}
.user-info{
border-bottom: solid 1px #efefef;
}

14
pages/init/agreement.js Normal file
View File

@ -0,0 +1,14 @@
// pages/init/agreement.js
Page({
bindExitTap(){
//返回上一页
wx.navigateBack({
delta: 1
});
},
bindAgreeTap: function () {
wx.navigateTo({
url: 'userinfo',
});
},
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

30
pages/init/agreement.wxml Normal file
View File

@ -0,0 +1,30 @@
<!--pages/init/agreement.wxml-->
<view class="container">
<view class="page-title text-center">临床科研知情同意书</view>
<view class="card">
<text>一、研究项目简介:
急性高原反应自评表2018圣路易斯湖版-西藏改良版)评分对进藏游客的指导意义
二、参与试验的内容和过程:
通过明确诊断为急性高原病被调查者对急性高原反应自评表评分情况及相关检查血氧饱和度、胸片、头部CT等评估高原病严重程度通过分析希望获得路易斯湖急性高原病评分对进藏游客的指导意义及评分的程度指导被调查者下一步计划
三、目前此种疾病的诊治方法:
根据被调查者病情采取吸氧等治疗
四、参与本项目的好处:
指导患者如何更好的适应高原环境,同时根据被调查者症状及评分的程度指导患者下一步计划
五、参加本项目的风险及补偿措施:
(可能出现的不良反应及其程度、补偿措施:治疗费用、赔付等)无风险
六、您的权力:
您参与试验是完全自愿的,您可以随时退出试验而无需理由,绝不会影响您和医务人员的关系及今后的诊治;您的所有个人资料和观察记录均属保密,仅供本研究使用。
</text>
<text class="text-strong">
作为一名被调查者,我在了解了本项试验的目的、方法、可能获得的治疗利益和可能发生的不良反应后,愿意参加此项研究,并与医生充分合作。
</text>
</view>
<view class="row agree-btn">
<view class="col">
<button bindtap="bindExitTap">退 出</button>
</view>
<view class="col">
<button bindtap="bindAgreeTap" class="btn-green">同 意</button>
</view>
</view>
</view>

View File

@ -0,0 +1,4 @@
/* pages/init/agreement.wxss */
.agree-btn{
margin-top:30rpx
}

89
pages/init/userinfo.js Normal file
View File

@ -0,0 +1,89 @@
// pages/init/userinfo.js
const allCities = [{
'code': '123',
'name': '北京',
children: [{
"code": "110101",
"name": "东城区"
},
{
"code": "110102",
"name": "西城区"
}
]
},
{
'code': '123',
'name': '天津',
children: [{
"code": "110105",
"name": "朝阳区"
},
{
"code": "110106",
"name": "丰台区"
}
]
},
{
'code': '123',
'name': '上海',
children: [{
"code": "110107",
"name": "石景山区"
},
{
"code": "110108",
"name": "海淀区"
}
]
}
];
Page({
/**
* 页面的初始数据
*/
data: {
subjects: {
smoke: [
'不吸烟',
'10支/天以下',
'10~20支/天',
'20支/天以上',
],
medical_histories:[
'慢性支气管炎、支气管哮喘、支气管扩张病、肺心病',
'高血压、冠心病、心肌病、先天性心脏病、风湿性心脏病',
'反流性食道炎、慢性胃炎、胃溃疡、慢性胰腺炎、肠易激惹综合征、结肠炎',
'3个月内脑梗塞和/或脑出血、癫痫、脑炎、脑膜炎',
'特发性或继发性肺动脉高压症',
'其他疾病'
]
},
provinces: allCities,
cities: allCities[0].children,
provinceId: 0,
cityId: 0
},
bindProvinceChange(e) {
this.setData({
provinceId: e.detail.value,
cities: allCities[e.detail.value].children
})
},
bindCityChange(e) {
this.setData({
cityId: e.detail.value
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})

3
pages/init/userinfo.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

103
pages/init/userinfo.wxml Normal file
View File

@ -0,0 +1,103 @@
<!--pages/init/userinfo.wxml-->
<view class="container">
<view class="page-title text-center">基本信息采集表</view>
<view class="container-card">请据实填写您的基本情况,为评估提供依据:</view>
<view class="card">
<view class="form-group">
<label>1、您的姓名</label>
<input />
</view>
<view class="form-group">
<label>2、您的性别</label>
<radio-group>
<label class="radio" c>
<radio value="1" checked="true" />男
</label>
<label class="radio">
<radio value="0" />女
</label>
</radio-group>
</view>
<view class="form-group">
<label>3、您的年龄</label>
<input />
</view>
<view class="form-group">
<label>4、您是否第一次进藏</label>
<radio-group>
<label class="radio">
<radio value="1" checked="true" />是
</label>
<label class="radio">
<radio value="0" />否
</label>
</radio-group>
</view>
<view class="form-group">
<label>5、您的世居地居住十年以上</label>
<picker bindchange="bindProvinceChange" value="{{provinceId}}" range="{{provinces}}" range-key="name">
<view class="select-input">{{provinces[provinceId].name}}</view>
</picker>
<picker bindchange="bindCityChange" value="{{cityId}}" range="{{cities}}" range-key="name">
<view class="select-input">{{cities[cityId].name}}</view>
</picker>
</view>
<view class="form-group">
<label>6、您的身高cm</label>
<input />
</view>
<view class="form-group">
<label>7、您的体重kg</label>
<input />
</view>
<view class="form-group">
<label>8、您是否长期吸烟吸烟量支/天):</label>
<radio-group>
<view class="item" wx:for="{{subjects.smoke}}">
<label>
<radio value="{{index}}" checked="{{index == 0}}" />{{item}}</label>
</view>
</radio-group>
</view>
<view class="form-group">
<label>9、您是否长期饮酒</label>
<radio-group>
<label class="radio">
<radio value="1" checked="true" />是
</label>
<label class="radio">
<radio value="0" />否
</label>
</radio-group>
</view>
<view class="form-group">
<label>10、您是否有既往基础疾病</label>
<radio-group>
<label class="radio">
<radio value="1" checked="true" />是
</label>
<label class="radio">
<radio value="0" />否
</label>
</radio-group>
</view>
<view class="form-group">
<label>11、既往疾病包括多选</label>
<checkbox-group>
<view class="item" wx:for="{{subjects.medical_histories}}">
<label>
<checkbox value="{{index}}" />
<text>{{item}}</text>
</label>
</view>
</checkbox-group>
</view>
</view>
<view class="text-center container-card">
<button class="btn-green go-to-next btn-round">下一步</button>
</view>
</view>

20
pages/init/userinfo.wxss Normal file
View File

@ -0,0 +1,20 @@
/* pages/init/userinfo.wxss */
radio-group > label {
margin-right: 40rpx;
}
radio-group > label > radio {
margin-right: 5rpx;
}
.form-group picker, radio-group .item, checkbox-group .item {
margin-bottom: 30rpx;
}
checkbox-group .item>label {
display: flex;
}
.go-to-next{
}

15
pages/logs/logs.js Normal file
View File

@ -0,0 +1,15 @@
//logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad: function () {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return util.formatTime(new Date(log))
})
})
}
})

3
pages/logs/logs.json Normal file
View File

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "查看启动日志"
}

6
pages/logs/logs.wxml Normal file
View File

@ -0,0 +1,6 @@
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log}}</text>
</block>
</view>

8
pages/logs/logs.wxss Normal file
View File

@ -0,0 +1,8 @@
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}

134
pages/user/evaluation.js Normal file
View File

@ -0,0 +1,134 @@
// pages/user/evaluation.js
Page({
/**
* 页面的初始数据
*/
data: {
subjects: [{
"title": "您是否感到头疼不适?",
"subject": "headache",
"options": [{
"text": "无头痛",
"score": 0
}, {
"text": "轻度头痛",
"score": 1
}, {
"text": "重度头痛",
"score": 2
}, {
"text": "严重头痛,丧失活动能力",
"score": 3
}]
},
{
"title": "您是否感觉到胃肠道不适?",
"subject": "gastrointestinal",
"options": [{
"text": "食欲好",
"score": 0
}, {
"text": "食欲不振或恶心",
"score": 1
}, {
"text": "恶心或呕吐(小于等于5次呕吐)",
"score": 2
}, {
"text": "严重恶心或呕吐(大于5次呕吐),丧失活动能力",
"score": 3
}]
},
{
"title": "您是否感觉到疲劳或虚弱?",
"subject": "tired",
"options": [{
"text": "疲劳或虚弱",
"score": 0
}, {
"text": "轻度疲劳或虚弱",
"score": 1
}, {
"text": "重度疲劳或虚弱",
"score": 2
}, {
"text": "严重疲劳或虚弱,丧失活动能力",
"score": 3
}]
},
{
"title": "您是否感觉到头晕或眩晕?",
"subject": "dizzy",
"options": [{
"text": "无头晕或眩晕",
"score": 0
}, {
"text": "轻度头晕或眩晕",
"score": 1
}, {
"text": "重度头晕或眩晕",
"score": 2
}, {
"text": "严重头晕或眩晕,丧失活动能力",
"score": 3
}]
}
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,27 @@
<!--pages/user/evaluation.wxml-->
<view class="container">
<view class="page-title text-center">急性高原反应自评表</view>
<view class="container-card text-strong">
如果未经训练,请在进入
<text class="text-red">海拔</text>
<text class="text-red text-big">2500米</text>
<text class="text-red text-big">6-72</text>
<text class="text-red">小时内</text>
,判断是否具有以下症状:
</view>
<view class="card"wx:for="{{subjects}}">
<view class="form-group" >
<label>{{index+1}}、{{item.title}}</label>
<radio-group>
<view class="item" wx:for="{{item.options}}" wx:for-index="idx" wx:for-item="itemName">
<label>
<radio value="{{idx}}" />{{itemName.text}}</label>
</view>
</radio-group>
</view>
</view>
<view class="text-center container-card">
<button class="btn-green btn-single go-to-next btn-round">提交自评</button>
</view>
</view>

View File

@ -0,0 +1,11 @@
/* pages/user/evaluation.wxss */
.text-red{
color:#E51C23;
}
.text-big{
font-size:36rpx;
}
.form-group picker, radio-group .item, checkbox-group .item {
margin-bottom: 30rpx;
}

153
pages/user/index.js Normal file
View File

@ -0,0 +1,153 @@
// pages/user/index.js
import allCities from './../../utils/allCities.js';
import api from './../../utils/api.js';
// const { regeneratorRuntime } = global
Page({
/**
* 页面的初始数据
*/
data: {
allCities,
userInfo: {
avatarUrl: 'http://thirdwx.qlogo.cn/mmopen/vi_32/9xkaQhBrbjIsJNJkxKicKayJiajy2ZsKFHM7vhibPjic0sLhn0cxCicxgQUl9VDF9o02NsQlcxZicJPWb4K9RibQJ8ibDQ/132',
address: '北京 东城区',
realname: '',
},
subjects: {
smoke: [
'不吸烟',
'10支/天以下',
'10~20支/天',
'20支/天以上',
],
medical_histories: [
'慢性支气管炎、支气管哮喘、支气管扩张病、肺心病',
'高血压、冠心病、心肌病、先天性心脏病、风湿性心脏病',
'反流性食道炎、慢性胃炎、胃溃疡、慢性胰腺炎、肠易激惹综合征、结肠炎',
'3个月内脑梗塞和/或脑出血、癫痫、脑炎、脑膜炎',
'特发性或继发性肺动脉高压症',
'其他疾病'
]
},
provinces: allCities,
cities: allCities[0].children,
showRecord: true,
dialog: {
title: '姓名',
default: '',
show: false,
value: ''
},
userDetail: {},
dataList: Array(2).fill({
create_time: '2019-06-20 12:20',
totalScore: 4,
headache: {
subject: '头痛',
text: '无头痛',
score: '0'
},
gastrointestinal: {
subject: '胃肠道症状',
text: '食欲不振或恶心',
score: '2'
},
tired: {
subject: '劳累或虚弱',
text: '轻度疲劳或虚弱',
score: '2'
},
dizzy: {
subject: '头晕或眩晕',
text: '无头晕或眩晕',
score: '0'
},
}),
collapseTags: []
},
onLoad: function() {
this.initUserData();
},
/**
* 初始化用户数据
*/
async initUserData() {
let evaluationData = await api.queryAllEvaluation();
var tags = [];
evaluationData.data.forEach((o,i) => {
tags.push(true);
let level = 0;
// 判断结果
if(o.options[0].score == 0 || o.score < 3){
// 没有高反
level = 0;
} else if (o.score <= 5) {
level = 1;
} else if (o.score <= 9) {
level = 2;
} else if (o.score <= 12) {
level = 3;
} else {
level = 4;
}
evaluationData.data[i]['level'] = level;
})
this.setData({
dataList: evaluationData.data,
collapseTags: tags
});
let userDetail = await api.queryUserDetail();
this.setData({
userDetail: userDetail.data
});
},
switchView() {
this.setData({
showRecord: !this.data.showRecord
})
},
toggleCollapse(e) {
console.log(e);
let index = e.currentTarget.dataset.index;
this.data.collapseTags[index] = !this.data.collapseTags[index];
this.setData({
collapseTags: this.data.collapseTags
});
},
bindDialogInput: function(e) {
this.setData({
dialog: {
value: e.detail.value
}
})
},
hideInputDialog() {
this.setData({
dialog: {
show: false
}
})
},
showModal(e) {
this.setData({
modalName: e.currentTarget.dataset.target
})
},
hideModal(e) {
this.setData({
modalName: null
})
},
bindCityChange(e) {
let data = e.detail.value;
this.setData({
cities: allCities[data[0]].children
})
},
showAlert() {
}
})

3
pages/user/index.json Normal file
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

247
pages/user/index.wxml Normal file
View File

@ -0,0 +1,247 @@
<!--pages/user/index.wxml-->
<view class="cu-list menu-avatar user-info">
<view class="cu-item" bindtap="onUserInfoTap">
<view class="cu-avatar round lg" style="background-image:url({{userInfo.avatarUrl}});"></view>
<view class="content">
<view class="">
<text class="text-cut nickname">{{userDetail.realname}}</text>
</view>
<view class=" text-sm flex">
<text class="text-cut">地区: <text>{{userInfo.address}}</text></text>
</view>
</view>
<view class="action" bindtap="switchView">
<view class="">
{{showRecord?'基本信息':'自评记录'}}
<text class="cuIcon-right"></text>
</view>
</view>
</view>
<view wx:if="{{showRecord}}">
<view class="collapse">
<view class="item" wx:for="{{dataList}}" wx:key="collapse_item" wx:for-item="item">
<view class="title" bindtap="toggleCollapse" data-index="{{index}}">
<view class="row">
<view class="col">
<text class="{{collapseTags[index]?'cuIcon-unfold':'cuIcon-right'}} icon"></text>
<text class="text-strong">自评时间:{{item.create_time}}</text>
</view>
<view class="text-right">
<text class="level-0" wx:if="{{item.level == 0}}">({{item.score}}分)</text>
<text class="level-1" wx:if="{{item.level == 1}}">轻度 ({{item.score}}分)</text>
<text class="level-2" wx:if="{{item.level == 2}}">中度 ({{item.score}}分)</text>
<text class="level-3" wx:if="{{item.level == 3}}">重度 ({{item.score}}分)</text>
</view>
</view>
</view>
<view hidden="{{!collapseTags[index]}}" class="content">
<view class="table-list">
<view class="row header">
<view class="subject">症状</view>
<view class="col">程度</view>
<view class="score">得分</view>
</view>
<view class="row" wx:for="{{item.options}}" wx:key="op" wx:for-item="op">
<view class="subject">{{op.subject}}</view>
<view class="col">{{op.text}}</view>
<view class="score">{{op.score}}</view>
</view>
</view>
<view class="result">
<view class="level-0" wx:if="{{item.level == 0}}">
<view>自评结果:{{item.result}} - {{item.level}}</view>
<view hidden="{{item.level == 0}}">医疗建议:{{item.suggest}}</view>
</view>
<view class="level-1" wx:if="{{item.level == 1}}">
<view>自评结果:{{item.result}} - {{item.level}}</view>
<view hidden="{{item.level == 0}}">医疗建议:{{item.suggest}}</view>
</view>
<view class="level-2" wx:if="{{item.level == 2}}">
<view>自评结果:{{item.result}} - {{item.level}}</view>
<view hidden="{{item.level == 0}}">医疗建议:{{item.suggest}}</view>
</view>
<view class="level-3" wx:if="{{item.level == 3}}">
<view>自评结果:{{item.result}} - {{item.level}}</view>
<view hidden="{{item.level == 0}}">医疗建议:{{item.suggest}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:else>
<!-- 姓名 -->
<view class="cu-form-group">
<view class="title">姓名</view>
<view class="action" bindtap="showAlert">
<view class="">
{{userDetail.realname}}
<text class="cuIcon-right"></text>
</view>
</view>
</view>
<!-- 性别 -->
<view class="cu-form-group">
<view class="title">性别</view>
<view class="action" bindtap="showModal" data-target="ChooseModal">
<view class="">
{{userDetail.gender==1?'男':'女'}}
<text class="cuIcon-right"></text>
</view>
</view>
</view>
<!-- 年龄 -->
<view class="cu-form-group">
<view class="title">年龄</view>
<view class="action" bindtap="showModal" data-target="ChooseModal">
<view class="">
{{userDetail.age}}
<text class="cuIcon-right"></text>
</view>
</view>
</view>
<!-- 身高 -->
<view class="cu-form-group">
<view class="title">身高</view>
<view class="action" bindtap="showModal" data-target="ChooseModal">
<view class="">
{{userDetail.height}}cm
<text class="cuIcon-right"></text>
</view>
</view>
</view>
<!-- 体重 -->
<view class="cu-form-group">
<view class="title">体重</view>
<view class="action" bindtap="showModal" data-target="ChooseModal">
<view class="">
{{userDetail.weight}}kg
<text class="cuIcon-right"></text>
</view>
</view>
</view>
<!-- 世居地 -->
<view class="cu-form-group">
<view class="title">世居地</view>
<view class="action" bindtap="showModal" data-target="ChooseCityModal">
<view class="">
北京市 东城区
<text class="cuIcon-right"></text>
</view>
</view>
<view class="cu-modal actionsheet bottom-modal {{modalName=='ChooseCityModal'?'show':''}}" bindtap="hideModal">
<view class="cu-dialog" catchtap>
<picker-view indicator-style="height: 36px;" style="width: 100%; height: 200px;" value="{{value}}" bindchange="bindCityChange">
<picker-view-column>
<view wx:for="{{provinces}}" wx:key="item" style="line-height: 36px">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{cities}}" wx:key="item" style="line-height: 36px">{{item.name}}</view>
</picker-view-column>
</picker-view>
</view>
</view>
</view>
<!-- 首次进藏 -->
<view class="cu-form-group">
<view class="title">抽次进藏</view>
<view class="action" bindtap="showModal" data-target="ChooseModal">
<view class="">
{{userDetail.gender==1?'是':'否'}}
<text class="cuIcon-right"></text>
</view>
<view class="cu-modal actionsheet bottom-modal {{modalName=='ChooseModal'?'show':''}}" bindtap="hideModal">
<view class="cu-dialog" catchtap>
<view class="list-item-se">
<text class="dialog-head-title">首次进藏</text>
<radio-group>
<label class="radio" c>
<radio value="1" checked="true" />是
</label>
<label class="radio">
<radio value="0" />否
</label>
</radio-group>
</view>
<view class="btns">
<view>
<button class="text-red" bindtap="hideModal">确定</button>
</view>
<view>
<button bindtap="hideModal">取消</button>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 既往病史 -->
<view class="cu-form-group">
<view class="title">既往病史</view>
<!-- <picker bindchange="PickerChange" value="{{index}}" range="{{userInfo.subjects.medical_histories}}">
<view class="picker">
{{index?userInfo.subjects.medical_histories[index]:'禁止换行,超出容器部分会以 ... 方式截断'}}
</view>
</picker> -->
<view class="action" bindtap="showModal" data-target="ChooseModal">
<view class="">
<text class="cuIcon-right"></text>
</view>
</view>
<view class="cu-modal actionsheet bottom-modal {{modalName=='ChooseModal'?'show':''}}" bindtap="hideModal">
<view class="cu-dialog" catchtap>
<view class=" medical-info-select">
<text class="dialog-head-title">既往疾病(多选)</text>
<checkbox-group>
<view class="item" wx:for="{{subjects.medical_histories}}" wx:key="item">
<label>
<checkbox value="{{index}}" />
<text>{{item}}</text>
</label>
</view>
</checkbox-group>
</view>
<view class="btns">
<view>
<button class="text-red" bindtap="hideModal">确定</button>
</view>
<view>
<button bindtap="hideModal">取消</button>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="toast-box" hidden="{{!dialog.show}}">
<view class="toastbg"></view>
<view class="showToast">
<view class="toast-title" wx:if="{{!!dialog.title}}">
<text>{{dialog.title}}</text>
</view>
<view class="toast-main">
<view class="toast-input">
<input placeholder="请输入" bindinput="setValue" data-name="stuEidtName" />
</view>
</view>
<view class="toast-button">
<view class="button1">
<button bindtap="hideInputDialog">取消</button>
</view>
<view class="button2">
<button bindtap="hideInputDialog">确定</button>
</view>
</view>
</view>
</view>
</view>

231
pages/user/index.wxss Normal file
View File

@ -0,0 +1,231 @@
/* pages/user/index.wxss */
page {
--tableDataPaddding: 20rpx;
--subjectWidth: 160rpx;
--scoreWidth: 100rpx;
--nameSize: 34rpx;
--dataTextSize: 24rpx;
}
.user-info .cu-item {
background: #2ec7a5 !important;
color: #fff;
}
text.nickname {
font-size: var(--nameSize);
/* font-weight: bold; */
}
.user-info .cu-item .action {
width: 150rpx !important;
margin-right: 15rpx;
}
checkbox-group {
padding: 20rpx;
}
checkbox-group .item {
margin-bottom: 30rpx;
}
checkbox-group .item:last-child {
margin-bottom: 0;
}
checkbox-group .item>label {
display: flex;
text-align: left;
}
checkbox-group .item>label>checkbox {
margin-right: 20rpx;
}
.medical-info-select {
padding: 20rpx;
text-align: left;
background: #fff;
margin-bottom: 20rpx;
}
/* dialog */
.toast-box {
width: 100%;
height: 100%;
opacity: 1;
position: fixed;
top: 0px;
left: 0px;
}
.toastbg {
opacity: 0.6;
background-color: black;
position: absolute;
width: 100%;
min-height: 100vh;
}
.showToast {
position: absolute;
opacity: 1;
width: 70%;
margin-left: 15%;
margin-top: 40%;
border-radius: 10rpx;
overflow: hidden;
}
.toast-title {
background-color: white;
padding-top: 2vh;
text-align: center;
font-size: 1rem;
}
.toast-main {
padding-top: 2vh;
padding-bottom: 2vh;
background-color: white;
}
.toast-input {
margin: 0 5%;
padding: 1vh 2vh;
}
.toast-input input {
height: 80rpx;
line-height: 80rpx;
}
.toast-button {
display: flex;
}
.toast-button button {
margin: 0;
border: none;
border-top: solid 1px rgba(220, 223, 230, 1);
width: 100%;
background-color: white;
border-radius: 0px;
color: black;
}
.button1, .button2 {
width: 50%;
}
.button1 button {
border-right: solid 1px rgba(220, 223, 230, 1);
}
.button2 button {
color: red;
}
.toast-button button:active {
background-color: solid 1px rgba(220, 223, 230, 0.7) !important;
}
.picker {
padding-top: 1vh;
padding-bottom: 1vh;
}
.collapse {
line-height: 30px;
}
.collapse .title {
background: rgba(0, 0, 0, 0.04);
}
.collapse .row view {
padding: var(--tableDataPaddding);
}
.collapse .item .title .col {
/* padding: 0 var(--tableDataPaddding); */
margin: 0;
}
.collapse .item .title .col .icon {
margin-right: 10rpx;
}
.table-list {
border-top: solid 1px #eaeaea;
}
.table-list .row, .item {
border-bottom: solid 1px #eaeaea;
}
.content .result {
background-color: #eefdf9;
padding: var(--tableDataPaddding);
font-weight: bold;
}
.item:last-child .content .result {
border-bottom: none;
}
.content .row {
font-size: var(--dataTextSize);
}
.row .subject {
width: var(--subjectWidth);
}
.row .score {
width: var(--scoreWidth);
text-align: center;
}
/* */
.text-right>text {
background-color: #259b24;
border-radius: 8rpx;
color: #fff;
display: inline-block;
padding: 2px 6px;
line-height: 40rpx;
}
.text-right .level-0 {
color: #000;
background: none;
}
.text-right .level-1 {
background-color: #259b24;
}
.text-right .level-2 {
background-color: #ff9800;
}
.text-right .level-3 {
background-color: #e51c23;
}
.result .level-1 {
color: #259b24;
}
.result .level-2 {
color: #ff9800;
}
.result .level-3 {
color: #e51c23;
}

50
project.config.json Normal file
View File

@ -0,0 +1,50 @@
{
"description": "高原反应自我评估",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enhance": true
},
"compileType": "miniprogram",
"libVersion": "2.2.0",
"appid": "wxba6738e3d81f8461",
"projectname": "AltitudeReactionEvaluation",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}

7
sitemap.json Normal file
View File

@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

41
utils/allCities.js Normal file
View File

@ -0,0 +1,41 @@
const cities = [{
'code': '123',
'name': '北京',
children: [{
"code": "110101",
"name": "东城区"
},
{
"code": "110102",
"name": "西城区"
}
]
},
{
'code': '123',
'name': '天津',
children: [{
"code": "110105",
"name": "朝阳区"
},
{
"code": "110106",
"name": "丰台区"
}
]
},
{
'code': '123',
'name': '上海',
children: [{
"code": "110107",
"name": "石景山区"
},
{
"code": "110108",
"name": "海淀区"
}
]
}
];
export default cities;

60
utils/api.js Normal file
View File

@ -0,0 +1,60 @@
const API_URL = 'http://192.168.10.80:8000';
const app = getApp();
const openId = app.globalData.openId;
const requestApi = (api, data = {}, method = "GET") => {
return new Promise((resolve, reject) => {
data['open_id'] = openId;
wx.showLoading({
title: '请求数据中...',
});
wx.request({
url: API_URL + api,
data,
header: {
'content-type': 'application/json' // 默认值
},
method,
dataType: 'json',
responseType: 'text',
success: function(res) {
wx.hideLoading();
resolve(res);
},
fail: function(res) {
wx.hideLoading();
reject(res);
}
});
});
}
/**
* 查询用户基本信息
*/
export function queryUserInfo() {
return requestApi('/user/info');
}
/**
* 查询用户详细信息
*/
export function queryUserDetail() {
return requestApi('/user/detail');
}
/**
* 查询用户所有的评估数据
*/
export function queryAllEvaluation() {
return requestApi('/evaluation/all');
}
/**
* 创建用户评估数据
*/
export function createEvaluation(data) {
return requestApi('/evaluation/create', data, 'POST');
}
export default {
queryUserInfo,
queryUserDetail,
queryAllEvaluation,
createEvaluation
}

19
utils/util.js Normal file
View File

@ -0,0 +1,19 @@
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime
}