Browse Source

peter

master
peter 3 years ago
commit
58f5702fd2
  1. 9
      .editorconfig
  2. 1
      .eslintignore
  3. 30
      .eslintrc.js
  4. 4
      .gitignore
  5. 3
      .prettierrc
  6. 1
      .wepycache
  7. 4
      .wepyignore
  8. 26786
      package-lock.json
  9. 42
      package.json
  10. 44
      project.config.json
  11. 22
      project.private.config.json
  12. 47
      src/app.wpy
  13. 18
      src/common/eventHub.js
  14. BIN
      src/images/bg.png
  15. BIN
      src/images/idcard-sel.png
  16. BIN
      src/images/idcard.png
  17. BIN
      src/images/logo.png
  18. BIN
      src/images/num-sel.png
  19. BIN
      src/images/num.png
  20. BIN
      src/images/person.png
  21. BIN
      src/images/phone-sel.png
  22. BIN
      src/images/phone.png
  23. 318
      src/pages/index.wpy
  24. 229
      src/pages/login.wpy
  25. 38
      wepy.config.js

9
.editorconfig

@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

1
.eslintignore

@ -0,0 +1 @@
dist/*

30
.eslintrc.js

@ -0,0 +1,30 @@
module.exports = {
root: true,
globals: { wx: true },
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.wpy files
plugins: [
'html'
],
settings: {
'html/html-extensions': ['.html', '.wpy']
},
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'space-before-function-paren': 0
}
}

4
.gitignore

@ -0,0 +1,4 @@
node_modules
dist
weapp
.DS_Store

3
.prettierrc

@ -0,0 +1,3 @@
{
"singleQuote": true
}

1
.wepycache

@ -0,0 +1 @@
{"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\wepy.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy-async-function\\index.js":1487759227000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy-com-toast\\toast.wpy":1488432898000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\app.js":1508932484000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\page.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\component.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\event.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\base.js":1508932484000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\util.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\mixin.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy-async-function\\global.js":1487760749000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\promise-polyfill\\promise.js":1511627065000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\regenerator-runtime\\runtime.js":1493390741000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\native.js":1508932485000}

4
.wepyignore

@ -0,0 +1,4 @@
node_modules
dist
.DS_Store
*.wpy___jb_tmp___

26786
package-lock.json

File diff suppressed because it is too large

42
package.json

@ -0,0 +1,42 @@
{
"name": "myproj",
"version": "0.0.2",
"description": "A WePY project",
"main": "weapp/app.js",
"scripts": {
"dev": "./node_modules/.bin/wepy build --watch",
"build": "cross-env NODE_ENV=production ./node_modules/.bin/wepy build --no-cache",
"clean": "rm -rf weapp",
"test": "echo \"Error: no test specified\" && exit 1"
},
"wepy": {
"module-a": false,
"./src/components/list": "./src/components/wepy-list.wpy"
},
"author": "peter <7359464+lasalu@user.noreply.gitee.com>",
"license": "MIT",
"dependencies": {
"@wepy/core": "^2.0.0-alpha.16",
"@wepy/x": "^2.0.2",
"miniprogram-slide-view": "0.0.3",
"npm": "^6.0.1"
},
"devDependencies": {
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@wepy/babel-plugin-import-regenerator": "0.0.2",
"@wepy/cli": "^2.0.0-alpha.28",
"@wepy/compiler-babel": "^2.0.1",
"@wepy/compiler-less": "^2.0.1",
"babel-eslint": "^7.2.1",
"cross-env": "^5.1.3",
"eslint": "^3.18.0",
"eslint-config-standard": "^7.1.0",
"eslint-friendly-formatter": "^2.0.7",
"eslint-plugin-html": "^2.0.1",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^2.0.1",
"less": "^3.8.1",
"wepy-eslint": "^1.5.3"
}
}

44
project.config.json

@ -0,0 +1,44 @@
{
"description": "A WePY project",
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": false,
"preloadBackgroundData": false,
"minified": false,
"newFeature": false,
"coverView": true,
"nodeModules": true,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"bundle": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true
},
"compileType": "miniprogram",
"appid": "wxfdd9c0d3a3b1dd43",
"projectname": "%E6%99%BA%E8%83%BD%E5%AF%BC%E6%A3%80",
"miniprogramRoot": "weapp/",
"condition": {}
}

22
project.private.config.json

@ -0,0 +1,22 @@
{
"condition": {
"plugin": {
"list": []
},
"game": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": [
{
"name": "pages/index",
"pathName": "pages/index",
"scene": null
}
]
}
}
}

47
src/app.wpy

@ -0,0 +1,47 @@
<style lang="less">
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}
</style>
<script>
import wepy from '@wepy/core'
wepy.app({
// hooks: {
// // App 级别 hook,对整个 App 生效
// // 同时存在 Page hook 和 App hook 时,优先执行 Page hook,返回值再交由 App hook 处
// 'before-setData': function (dirty) {
// console.log('setData dirty: ', dirty);
// return dirty;
// }
// },
globalData: {
userInfo: null
},
onLaunch() {
},
methods: {}
})
</script>
<config>
{
pages: [
'pages/login',
'pages/index'
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black',
enablePullDownRefresh:true
}
}
</config>

18
src/common/eventHub.js

@ -0,0 +1,18 @@
// 防抖节流 防止重复点击
function throttle(fn, gapTime) {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
// 返回新的函数
return function () {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments) // 将this和参数传给原函数
_lastTime = _nowTime
}
}
}
module.exports = {
throttle: throttle
}

BIN
src/images/bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
src/images/idcard-sel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

BIN
src/images/idcard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/images/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
src/images/num-sel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

BIN
src/images/num.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/images/person.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

BIN
src/images/phone-sel.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

BIN
src/images/phone.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

318
src/pages/index.wpy

@ -0,0 +1,318 @@
<style lang="less">
page{
min-height: 100%;
}
.container-info{
min-height: 100vh;
padding: 0 32rpx;
background: #F4F4F4;
box-sizing: border-box;
.header{
display: flex;
align-items: center;
width: 100%;
padding: 16rpx;
margin-bottom: 16rpx;
}
.logo{
width: 422rpx;
vertical-align: middle;
margin-right: 42rpx;
margin-left: 16rpx;
}
.logo-r{
font-family: 'PingFang SC';
font-style: normal;
font-weight: 600;
font-size: 40rpx;
}
.personInfo{
width: 100%;
height: 102rpx;
padding: 28rpx 32rpx;
box-sizing: border-box;
background: #FFFFFF;
border-radius: 4px;
margin-bottom: 32rpx;
.person{
width: 42rpx;
height: 44rpx;
margin-right: 20rpx;
vertical-align: bottom;
}
.person-info{
font-family: 'PingFang SC';
font-style: normal;
font-weight: 400;
font-size: 32rpx;
color: #838383;
}
.person-l{
margin-left: 60rpx;
}
}
.nextBox-t{
display: flex;
align-items: center;
width: 100%;
height: 78rpx;
padding: 18rpx 17rpx;
border-top-left-radius: 8rpx;
border-top-right-radius: 8rpx;
box-sizing: border-box;
.next-title{
font-family: 'PingFang SC';
font-style: normal;
font-weight: 500;
font-size: 32rpx;
}
}
.bg-t{
background: #4477FA;
}
.bg-w{
background: #FFFFFF;
border-bottom: 1rpx solid #F4F4F4;
}
.color-t{
color: #FFFFFF;
}
.color-b{
color: #353B49;
font-weight: 500;
}
.line{
display: inline-block;
width: 8rpx;
height: 32rpx;
margin-top: 4rpx;
border-radius: 8rpx;
margin-right: 16rpx;
}
.line-one{
background-color: #FFFFFF;
}
.line-two{
background-color: #FA9435;
}
.line-three{
background: #00C77F;
}
.nextBox-b{
width: 100%;
padding: 16rpx 32rpx;
border-bottom-left-radius: 8rpx;
border-bottom-right-radius: 8rpx;
box-sizing: border-box;
margin-bottom: 32rpx;
.disExam{
display: flex;
justify-content: space-between;
}
.examPro{
font-family: 'PingFang SC';
font-style: normal;
font-weight: 400;
font-size: 24rpx;
color: #828080;
margin-bottom: 32rpx;
}
.exam-l{
display: inline-block;
width: 250rpx;
}
.exam-m{
display: inline-block;
width: 128rpx;
}
.exam-r{
display: inline-block;
width: 180rpx;
}
.exam-z{
display: inline-block;
width: 320rpx;
}
.examContain{
font-family: 'PingFang SC';
font-style: normal;
font-size: 28rpx;
margin-bottom: 32rpx;
}
.mColor{
color: #A80909;
font-weight: bold;
font-size: 29rpx;
}
}
.next-t{
background: #EDF2FF;
border: 0.5px solid #4477FA;
}
.next-m{
background: #FFFFFF;
//border: 1rpx solid #F4F4F4;
}
}
</style>
<template>
<div class="container-info">
<div>
<div class="header">
<image class="logo" src="../images/logo.png" mode="widthFix"></image>
<span class="logo-r">智能导检</span>
</div>
<div class="personInfo">
<image class="person" src="../images/person.png"></image>
<span class="person-info">姓名: </span>
<span>{{name}}</span>
<span class="person-l person-info">病案号: </span>
<span class="">{{pid}}</span>
</div>
<div style="width: 100%">
<div class="nextBox-t bg-t">
<div class="line line-one"></div>
<span class="next-title color-t">下一站(请在检查室门口等待)</span>
</div>
<div class="nextBox-b next-t">
<div class="examPro">
<span class="exam-l">检查项目</span>
<span class="exam-m">房间号</span>
<span class="exam-m">排队序号</span>
<span>叫号时间</span>
</div>
<div class="examContain" v-for="(item, index) in nextRoomList" :key="index">
<span class="exam-l">{{ item.examItem }}</span>
<span class="exam-m mColor">{{ item.examRoom }}</span>
<span class="exam-m">{{ item.queueIndex }}</span>
<span>{{ item.callTime }}</span>
</div>
</div>
</div>
<div style="width: 100%">
<div class="nextBox-t bg-w">
<div class="line line-two"></div>
<span class="next-title color-b">未完成检查</span>
</div>
<div class="nextBox-b next-m">
<div class="examPro">
<span class="exam-l">检查项目</span>
<span class="exam-r">房间号</span>
<span class="exam-r">排队序号</span>
<!-- <span>叫号时间</span>-->
</div>
<div class="examContain" v-for="(item, index) in unFinishedList" :key="index">
<span class="exam-l">{{ item.examItem }}</span>
<span class="exam-r">{{ item.examRoom }}</span>
<span class="exam-r">{{ item.queueIndex }}</span>
<!-- <span>{{ item.callTime }}</span>-->
</div>
</div>
</div>
<div style="width: 100%">
<div class="nextBox-t bg-w">
<div class="line line-three"></div>
<span class="next-title color-b">已完成检查</span>
</div>
<div class="nextBox-b next-m">
<div class="examPro disExam">
<span class="exam-z">检查项目</span>
<span class="exam-m">房间号</span>
</div>
<div class="examContain disExam" v-for="(item, index) in finishedList" :key="index">
<span class="exam-z">{{ item.examItem }}</span>
<span class="exam-m">{{ item.examRoom }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import wepy from '@wepy/core'
wepy.page({
data: {
name: '',
pid: '',
examList: [],
nextRoomList: [],
unFinishedList: [],
finishedList: []
},
methods: {
queryToken() {
return new Promise((resolve, reject) => {
wx.request({
url: 'http://pacs.wzeye.cn/EyeIG/api/CallHelp/Token',
success(res) {
if (res.statusCode === 200) {
resolve(res)
wx.setStorage({
key: 'token',
data: res.data
})
}
},
fail(err) {
reject(err)
}
})
})
},
queryData() {
this.queryToken().then(()=>{
let that = this
wx.request({
url: 'http://pacs.wzeye.cn/EyeIG/api/CallHelp/Get',
header: {
'token': wx.getStorageSync('token')
},
data: {
jsonString: {
'body': {
pid: this.pid
},
'code': 'Queue'
}
},
success(res) {
if (res.data && res.data.status === '0') {
const data = res.data.body
that.examList = data.exam || []
// eslint-disable-next-line no-return-assign
that.examList.forEach(item => item.callTime = item.callTime.slice(0, 5))
that.nextRoomList = that.examList.filter(item => (item.nextRoomFlag === '1' || item.callTime != '') && (item.examStatus !== '已完成'))
that.unFinishedList = that.examList.filter(item => item.examStatus === '未完成')
that.finishedList = that.examList.filter(item => item.examStatus === '已完成')
}
},
complete() {
wx.hideNavigationBarLoading()
wx.stopPullDownRefresh()
}
})
})
}
},
created () {
},
onPullDownRefresh: function() {
wx.showNavigationBarLoading()
this.queryData()
},
onLoad(options) {
this.pid = options.pid
this.name = options.name
this.queryData()
}
})
</script>
<config>
{
navigationBarTitleText: '智能导检'
}
</config>

229
src/pages/login.wpy

@ -0,0 +1,229 @@
<style lang="less">
.container{
width: 100%;
padding: 32rpx 64rpx 64rpx;
box-sizing: border-box;
.head{
width: 100%;
font-size: 48rpx;
font-weight: 600;
font-family: 'PingFang SC';
color: #0074F7;
text-align: left;
margin-bottom: 24rpx;
}
.info{
font-family: 'PingFang SC';
font-style: normal;
font-weight: 600;
font-size: 28rpx;
color: #767676;
margin-bottom: 80rpx;
}
.bgImage{
width: 100%;
margin-bottom: 100rpx;
}
.loginTab{
width: 100%;
display: flex;
justify-content: space-between;
.btn{
position: relative;
padding: 16rpx 32rpx 16rpx 60rpx;
border-radius: 4rpx;
margin-right: 8rpx;
.btn-info{
font-size: 32rpx;
color: rgba(96, 96, 96, 0.94);
}
.btn-icon{
position: absolute;
left: 25rpx;
top: 22rpx;
}
}
.icon-t{
width: 30rpx;
height: 30rpx;
}
.icon-m{
width: 32rpx;
height: 32rpx;
top: 21rpx !important;
}
.icon-b{
width: 24rpx;
height: 32rpx;
left: 34rpx !important;
}
.sel{
background: #0074F7;
}
.infoColor{
color: #FFFFFF !important;
}
}
.login-input{
width: 100%;
margin: 32rpx 0;
.ipt{
height: 48px;
padding: 0px 16px;
color: #000000;
font-size: 32rpx;
background: #F1F1F1;
border-radius: 4px;
}
}
.submitBtn{
width: 100%;
text-align: center;
font-weight: 600;
height: 96rpx;
line-height: 96rpx;
font-size: 40rpx;
color: #FFFFFF;
background: #0074F7;
box-shadow: 0 8rpx 24rpx rgba(38, 59, 91, 0.13);
border-radius: 8rpx;
}
}
</style>
<template>
<div class="container">
<div>
<p class="head">登录</p>
<p class="info">请输入病案号、身份证或电话号码进行登录查看导检信息</p>
</div>
<div class="bgImage">
<image src="../images/bg.png" mode="widthFix"></image>
</div>
<div class="loginTab">
<div class="btn {{[curIndex === index ? 'sel' : '']}}" v-for="(item,index) in tabList" @tap="selectBtn(index)">
<image v-if="index === 0 && curIndex != 0" class="btn-icon {{[index === 0 ? 'icon-t' : '']}}" src="../images/num.png"></image>
<image v-if="index === 0 && curIndex === 0" class="btn-icon {{[index === 0 ? 'icon-t' : '']}}" src="../images/num-sel.png"></image>
<image v-if="index === 1 && curIndex != 1" class="btn-icon {{[index === 1 ? 'icon-m' : '']}}" src="../images/idcard.png"></image>
<image v-if="index === 1 && curIndex === 1" class="btn-icon {{[index === 1 ? 'icon-m' : '']}}" src="../images/idcard-sel.png"></image>
<image v-if="index === 2 && curIndex != 2" class="btn-icon {{[index === 2 ? 'icon-b' : '']}}" src="../images/phone.png"></image>
<image v-if="index === 2 && curIndex === 2" class="btn-icon {{[index === 2 ? 'icon-b' : '']}}" src="../images/phone-sel.png"></image>
<div class="btn-info {{[curIndex === index ? 'infoColor' : '']}}">{{ item }}</div>
</div>
</div>
<div class="login-input">
<input class="ipt" type="text" placeholder="请输入" v-model="pid">
</div>
<div class="submitBtn" @tap="handleSubmit">
登 录
</div>
</div>
</template>
<script>
import wepy from '@wepy/core'
const util = require('../common/eventHub')
wepy.page({
data: {
curIndex: 0,
pid: '3141462',
tabList: ['病案号', '身份证', '电话号码']
},
methods: {
selectBtn(index) {
this.pid = ''
this.curIndex = index
},
throttle(fn, gapTime) {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
// 返回新的函数
return function () {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
}
}
},
queryToken() {
return new Promise((resolve, reject) => {
wx.request({
url: 'http://pacs.wzeye.cn/EyeIG/api/CallHelp/Token',
success(res) {
if (res.statusCode === 200) {
resolve(res)
wx.setStorage({
key: 'token',
data: res.data
})
}
},
fail(err) {
reject(err)
}
})
})
},
// eslint-disable-next-line no-undef
handleSubmit: util.throttle(function(){
if (this.pid === '') return wx.showToast({title: '输入框不能为空!',icon: 'error'})
this.queryToken().then(()=>{
wx.login({
success: (res) => {
if (res.code) {
let params = {
jsonString: {
'body': {},
'code': 'Login'
}
}
params.jsonString.body.userCode = res.code
if (this.curIndex === 0) {
params.jsonString.body.pid = this.pid
} else if (this.curIndex === 1) {
params.jsonString.body.idCard = this.pid
} else {
params.jsonString.body.phone = this.pid
}
wx.request({
url: 'http://pacs.wzeye.cn/EyeIG/api/CallHelp/Get',
header: {
'content-type': 'application/json',
'token': wx.getStorageSync('token')
},
data: params,
success(res) {
if (res.data && res.data.status === '0') {
const data = res.data.body
wx.navigateTo({
url: '/pages/index?pid=' + data.pid + '&name=' + data.name
})
} else {
wx.showToast({title: '登陆失败!',icon: 'error'})
}
}
})
}
}
})
})
})
},
created () {
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
})
}
})
</script>
<config>
{
navigationBarTitleText: '智能导检',
}
</config>

38
wepy.config.js

@ -0,0 +1,38 @@
const path = require('path');
var prod = process.env.NODE_ENV === 'production';
module.exports = {
wpyExt: '.wpy',
eslint: true,
cliLogs: !prod,
static: ['static'],
build: {
},
resolve: {
alias: {
counter: path.join(__dirname, 'src/components/counter'),
'@': path.join(__dirname, 'src')
},
aliasFields: ['wepy', 'weapp'],
modules: ['node_modules']
},
compilers: {
less: {
compress: prod
},
babel: {
sourceMap: true,
presets: [
'@babel/preset-env'
],
plugins: [
'@wepy/babel-plugin-import-regenerator'
]
}
},
plugins: [],
appConfig: {
noPromiseAPI: ['createSelectorQuery']
}
}
Loading…
Cancel
Save