医废工具端小程序源码
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<view>
|
||||
<scroll-view scroll-y class="page">
|
||||
<cu-custom bgColor="bg-cyan"><block slot="content">登录检测</block></cu-custom>
|
||||
<view class="photoView">
|
||||
<view class="photoImage">
|
||||
<open-data type="userAvatarUrl"></open-data>
|
||||
</view>
|
||||
</view>
|
||||
<view style="padding-top:20%;">
|
||||
<view class='text-center margin-bottom text-lg text-grey' style="padding-top:20px;">正在检测登录用户人员身份,请稍等...</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
hospital: '',
|
||||
sortHospital: '',
|
||||
department: '',
|
||||
name: '',
|
||||
openid: '',
|
||||
session_key: '',
|
||||
code: ''
|
||||
}
|
||||
},
|
||||
onShow(){
|
||||
// 获取用户登录信息
|
||||
let that = this;
|
||||
uni.login({
|
||||
success(res) {
|
||||
if(res.code){
|
||||
let new_that = that;
|
||||
uni.request({
|
||||
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getToolOpenid',
|
||||
data: {code: res.code},
|
||||
header: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
success: function(res) {
|
||||
new_that.openid = res.data.data.openid
|
||||
new_that.session_key = res.data.data.session_key
|
||||
// 判断是否可以登录
|
||||
let new_new_that = new_that;
|
||||
uni.request({
|
||||
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getIsHaveToolOpenid',
|
||||
data: {openid: new_new_that.openid},
|
||||
header: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
success: function(res) {
|
||||
if(res.data.data === 'false'){
|
||||
uni.navigateTo({
|
||||
url: '/pages/plugin/register'
|
||||
})
|
||||
}else{
|
||||
new_new_that.getIsHaveHandOpenid();
|
||||
}
|
||||
},
|
||||
error: () => {
|
||||
console.info('小程序域名不正确,请检查域名正确性')
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
console.info('小程序域名不正确,请检查域名正确性')
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(msg) {
|
||||
console.info('小程序登录失败!!!')
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 判断系统是否存在该用户的openid
|
||||
getIsHaveHandOpenid(){
|
||||
let that = this;
|
||||
// 获取登录人员的基本信息
|
||||
uni.request({
|
||||
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getToolUserBasisInfo',
|
||||
data: {openid: that.openid},
|
||||
header: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
success: function(res) {
|
||||
that.hospital = res.data.data.hospital
|
||||
that.sortHospital = res.data.data.sortHospital
|
||||
that.department = res.data.data.department
|
||||
that.name = res.data.data.name
|
||||
that.phone = res.data.data.phone
|
||||
// 将这些变量放置globalData中
|
||||
getApp().globalData.hospital = res.data.data.hospital
|
||||
getApp().globalData.sortHospital = res.data.data.sortHospital
|
||||
getApp().globalData.department = res.data.data.department
|
||||
getApp().globalData.name = res.data.data.name
|
||||
getApp().globalData.openid = that.openid
|
||||
getApp().globalData.phone = res.data.data.phone
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
console.info('小程序域名不正确,请检查域名正确性')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
width: 100vw;
|
||||
height: 100Vh;
|
||||
}
|
||||
.photoView {
|
||||
padding-top: 150rpx;
|
||||
position: relative;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.photoImage {
|
||||
overflow:hidden;
|
||||
display: block;
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 50%;
|
||||
border: 2px solid #fff;
|
||||
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<view>
|
||||
<scroll-view scroll-y class="page">
|
||||
<cu-custom bgColor="bg-cyan"><block slot="content">设备列表</block></cu-custom>
|
||||
<view class="cu-bar bg-white solid-bottom">
|
||||
<view class="action">
|
||||
<text class="cuIcon-title text-green" style="color:#2CC9EA;"></text>
|
||||
<text style="color:#B4B4C3;">设备列表</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-list menu-avatar" style="margin-top:5px;">
|
||||
<view class="cu-item" v-for="(value,index) in toolDeviceList" :key="index">
|
||||
<view class="cu-avatar round lg" style="background-image:url(https://lekapi.opmonitor.com/static/image/avatar.png);"></view>
|
||||
<view class="content">
|
||||
<view class="text-grey text-sm flex" style="">
|
||||
<text style="width:100px;">{{value.deviceCode}}</text>
|
||||
<text style='margin-left:5%;width:150px;font-family:Montserrat-Regular;font-weight:bold;color:red'>{{value.type}}</text>
|
||||
</view>
|
||||
<view class="text-grey text-sm flex">
|
||||
<text class="cuIcon-locationfill text-red margin-right-xs"></text>
|
||||
<text style="width:90px;">{{value.device}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action">
|
||||
<view class="text-grey text-xs">{{value.time}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
hospital: '',
|
||||
sortHospital: '',
|
||||
toolDeviceList: []
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
if(getApp().globalData.openid == '' || getApp().globalData.openid == 'undefined'){
|
||||
uni.navigateTo({
|
||||
url: '/pages/plugin/register'
|
||||
})
|
||||
}
|
||||
// 获取全局变量中的数据
|
||||
this.hospital = getApp().globalData.hospital
|
||||
this.sortHospital = getApp().globalData.sortHospital
|
||||
this.getToolDeviceList();
|
||||
},
|
||||
methods: {
|
||||
getToolDeviceList(){
|
||||
let that = this;
|
||||
uni.request({
|
||||
url: "https://lekapi.opmonitor.com/?c=app_api&a=getToolDeviceList",
|
||||
data: {hospital: that.hospital, sortHospital: that.sortHospital},
|
||||
header: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
success: function(res){
|
||||
that.toolDeviceList = res.data.data
|
||||
},
|
||||
fail: () => {
|
||||
console.info('小程序域名不正确,请检查域名的正确性')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.bg-gradual-pink{
|
||||
vertical-align: middle;
|
||||
font-size:18px;
|
||||
background:linear-gradient(135deg,rgba(45,201,235,1) 0%,rgba(20,210,184,1) 100%);
|
||||
}
|
||||
|
||||
.cu{
|
||||
height:89px;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 100vw;
|
||||
height: 200Vh;
|
||||
}
|
||||
|
||||
.page.show {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.cuIcon-locationfill{
|
||||
color:#2CC9EA;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<view>
|
||||
<scroll-view scroll-y class="page">
|
||||
<cu-custom bgColor="bg-cyan"><block slot="content">注册</block></cu-custom>
|
||||
<view class="photoView">
|
||||
<view class="photoImage">
|
||||
<open-data type="userAvatarUrl"></open-data>
|
||||
</view>
|
||||
</view>
|
||||
<form action="">
|
||||
<view class="cu-form-group">
|
||||
<view class="title">医院名称</view>
|
||||
<picker @change="pickerHospitalChange" :value="indexHospital" :range="pickerHospital">
|
||||
<view class="picker">
|
||||
{{indexHospital>-1?pickerHospital[indexHospital]:'请选择医院'}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">分院名称</view>
|
||||
<picker @change="pickerSortChange" :value="indexSort" :range="pickerSort">
|
||||
<view class="picker">
|
||||
{{indexSort>-1?pickerSort[indexSort]:'请选择分院'}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="cu-form-group margin-top">
|
||||
<view class="title">姓名</view>
|
||||
<input placeholder="请输入姓名" name="name" value="" @input="getName"></input>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">联系电话</view>
|
||||
<input placeholder="请输入联系电话" name="phone" value="" @input="getPhone"></input>
|
||||
</view>
|
||||
</form>
|
||||
<view class="padding flex flex-direction" style="padding-top: 40%;">
|
||||
<button class="cu-btn round bg-cyan margin-tb-sm lg" @click="buttonClick">注册</button>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
index: -1,
|
||||
indexHospital: -1,
|
||||
indexSort: -1,
|
||||
hospital: '',
|
||||
sortHospital: '',
|
||||
pickerHospital: [],
|
||||
pickerSort: [],
|
||||
name: '',
|
||||
idcard: '',
|
||||
openid: '',
|
||||
session_key: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 获取用户登录信息
|
||||
let that = this;
|
||||
uni.login({
|
||||
success(res) {
|
||||
if(res.code){
|
||||
let new_that = that;
|
||||
uni.request({
|
||||
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getToolOpenid',
|
||||
data: {code: res.code},
|
||||
header: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
success: function(res) {
|
||||
new_that.openid = res.data.data.openid
|
||||
new_that.session_key = res.data.data.session_key
|
||||
},
|
||||
fail: () => {
|
||||
console.info('小程序域名不正确,请检查域名正确性')
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(msg) {
|
||||
console.info('小程序登录失败!!!')
|
||||
}
|
||||
});
|
||||
this.getHospitalData();
|
||||
},
|
||||
methods: {
|
||||
getHospitalData(){
|
||||
let that = this;
|
||||
uni.request({
|
||||
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getHospitalList',
|
||||
data: {},
|
||||
header: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
success: function(res) {
|
||||
that.pickerHospital = res.data.data
|
||||
},
|
||||
fail: () => {
|
||||
console.info('小程序域名不正确,请检查域名正确性')
|
||||
}
|
||||
});
|
||||
},
|
||||
getSortHospital() {
|
||||
let that = this;
|
||||
uni.request({
|
||||
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getSortHospitalList',
|
||||
data: {hospital : that.hospital},
|
||||
header: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
success: function(res) {
|
||||
that.pickerSort = res.data.data
|
||||
},
|
||||
fail: () => {
|
||||
console.info('小程序域名不正确,请检查域名正确性')
|
||||
}
|
||||
});
|
||||
},
|
||||
pickerHospitalChange(e) {
|
||||
this.indexHospital = e.detail.value
|
||||
this.hospital = this.pickerHospital[this.indexHospital]
|
||||
this.getSortHospital();
|
||||
},
|
||||
pickerSortChange(e) {
|
||||
this.indexSort = e.detail.value
|
||||
this.sortHospital = this.pickerSort[this.indexSort]
|
||||
},
|
||||
getName: function(e){
|
||||
this.name = e.target.value
|
||||
},
|
||||
getPhone: function(e){
|
||||
this.phone = e.target.value
|
||||
},
|
||||
buttonClick(e) {
|
||||
let that = this;
|
||||
uni.showLoading({
|
||||
title: '页面跳转中',
|
||||
mask: true,
|
||||
success: function(res) {
|
||||
let new_that = that;
|
||||
uni.request({
|
||||
url: 'https://lekapi.opmonitor.com/?c=app_api&a=getRegisterToolInfo',
|
||||
data: {
|
||||
hospital: new_that.hospital,
|
||||
sortHospital: new_that.sortHospital,
|
||||
name: new_that.name,
|
||||
phone: new_that.phone,
|
||||
openid: new_that.openid
|
||||
},
|
||||
header: {
|
||||
'Content-type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
method: 'POST',
|
||||
success: function(res){
|
||||
if(res.data.data === 'false'){
|
||||
uni.navigateTo({
|
||||
url: '/pages/plugin/register'
|
||||
})
|
||||
}else{
|
||||
// 将这些变量放置globalData中
|
||||
getApp().globalData.hospital = new_that.hospital
|
||||
getApp().globalData.sortHospital = new_that.sortHospital
|
||||
getApp().globalData.name = new_that.name
|
||||
getApp().globalData.openid = new_that.openid
|
||||
getApp().globalData.phone = new_that.phone
|
||||
if(res.data.data === 'success'){
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
console.info('小程序域名不正确,请检查域名正确性')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
width: 100vw;
|
||||
height: 120Vh;
|
||||
}
|
||||
.photoView {
|
||||
padding-top: 50rpx;
|
||||
position: relative;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.photoImage {
|
||||
overflow:hidden;
|
||||
display: block;
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 50%;
|
||||
border: 2px solid #fff;
|
||||
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.cu-form-group .title{
|
||||
min-width: calc(4em + 15px);
|
||||
font-weight: 600;
|
||||
}
|
||||
.picker {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user