master
lion 7 months ago
parent 0c75b5fc2e
commit 30fcc675f7

@ -2,15 +2,15 @@
export default {
onLaunch: async function() {
try {
if(this.base.isNull(this.vuex_token)){
uni.redirectTo({
url:'/package_sub/login/login'
})
}else{
const user = await this.$u.api.getUser()
console.log("user",user)
this.$u.vuex('vuex_user', user)
}
// if(this.base.isNull(this.vuex_token)){
// uni.redirectTo({
// url:'/package_sub/login/login'
// })
// }else{
// const user = await this.$u.api.getUser()
// console.log("user",user)
// this.$u.vuex('vuex_user', user)
// }

@ -1,5 +1,5 @@
const mode = 'production'; //devLocal本地测试、devOnline线上测试、production生产环境
let ROOTPATH = 'https://yikangyang.ali251.langye.net'; //域名
let ROOTPATH = 'https://vr.ali251.langye.net'; //域名
switch (mode) {
case 'devLocal':
ROOTPATH = ROOTPATH

@ -2,22 +2,3 @@
* 公用变量
*
*/
const statusList = [{
id: 0,
name: '待处理'
}, {
id: 1,
name: '已到客户家'
}, {
id: 2,
name: '已接到客户'
}, {
id: 3,
name: '已到医院'
}, {
id: 4,
name: '已完成诊疗'
}]
export {
statusList
}

@ -1,30 +1,16 @@
//api集合
let apiApp = {
login: '/api/nurse/auth/login',
getUser:'/api/nurse/auth/me',
loginOut:'/api/nurse/auth/logout',
saveUser:'/api/nurse/auth/save',
order:'/api/nurse/order/index',
orderDetail:'/api/nurse/order/detail',
saveOrder:'/api/nurse/order/save',
payCode:'/api/nurse/order/pay-diff'
// login: '/api/nurse/auth/login',
}
const install = (Vue, vm) => {
//api方法
let login = (params = {}) => vm.$u.post(apiApp.login, params);
let getUser = (params = {}) => vm.$u.post(apiApp.getUser, params);
let loginOut = (params = {}) => vm.$u.post(apiApp.loginOut, params);
let saveUser = (params = {}) => vm.$u.post(apiApp.saveUser, params);
let order = (params = {}) => vm.$u.get(apiApp.order, params);
let orderDetail = (params = {}) => vm.$u.get(apiApp.orderDetail, params);
let saveOrder = (params = {}) => vm.$u.post(apiApp.saveOrder, params);
let payCode = (params = {}) => vm.$u.get(apiApp.payCode, params);
// let login = (params = {}) => vm.$u.post(apiApp.login, params);
vm.$u.api = {
login,getUser,loginOut,saveUser,order,orderDetail,saveOrder,payCode
// login,
};
}

@ -40,7 +40,7 @@ const install = (Vue, vm) => {
})
setTimeout(() => {
uni.redirectTo({
url: '/package_sub/login/login'
// url: '/package_sub/login/login'
})
}, 1500)
})

@ -1,6 +1,6 @@
{
"name" : "医康养-护工端",
"appid" : "__UNI__1EF504F",
"name" : "胥口闸站购票",
"appid" : "__UNI__421D47B",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
@ -50,7 +50,7 @@
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wxcc43f296a2104fe2",
"appid" : "wx2129de75c4937c40",
"setting" : {
"urlCheck" : false
},
@ -77,6 +77,6 @@
"disableHostCheck" : true,
"https" : false
},
"title" : "医康养-护工端"
"title" : "胥口闸站购票"
}
}

4
package-lock.json generated

@ -1,11 +1,11 @@
{
"name": "yikangyang-hg-wx",
"name": "xukou-ticket-wx",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "yikangyang-hg-wx",
"name": "xukou-ticket-wx",
"version": "1.0.0",
"license": "ISC",
"dependencies": {

@ -1,5 +1,5 @@
{
"name": "yikangyang-hg-wx",
"name": "xukou-ticket-wx",
"version": "1.0.0",
"description": "",
"main": "main.js",
@ -11,7 +11,7 @@
},
"repository": {
"type": "git",
"url": "http://gogs.langye.net:3000/langye/yikangyang-hg-wx.git"
"url": "http://gogs.langye.net:3000/langye/xukou-ticket-wx.git"
},
"keywords": [],
"author": "",

@ -1,126 +0,0 @@
<template>
<view class="container">
<image class="bkg" mode="aspectFill" src="../static/login-bg.png"></image>
<view class="login">
<view class="login-title">
<view>Hello</view>
<view>欢迎登录护工端</view>
</view>
<view class="login-form">
<view>
<u-input v-model="form.username" border-color="#f5f5f5" placeholder="请输入用户名"></u-input>
</view>
<view>
<u-input v-model="form.password" border-color="#f5f5f5" type="password"
placeholder="请输入密码"></u-input>
</view>
</view>
<view class="login-btn">
<view @click="login"></view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
username: '',
password: ''
},
}
},
onReady() {},
methods: {
login() {
let that = this
if(this.base.isNull(this.form.username)){
this.base.toast("请输入用户名")
return
}
if(this.base.isNull(this.form.password)){
this.base.toast("请输入密码")
return
}
this.$u.api.login({
...this.form
}).then(res=>{
console.log("res1",res)
that.base.toast("登录成功",1500,function(){
that.$u.vuex('vuex_token', res.token)
setTimeout(function(){
uni.switchTab({
url:'/pages/index/index'
})
},1500)
})
})
}
}
}
</script>
<style lang="scss" scoped>
.container {
width: 100vw;
height: 100vh;
background-color: #fff;
font-size: 32rpx;
.bkg {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
}
.login {
position: absolute;
top: 0;
left: 0;
padding-top: 150rpx;
// text-align: center;
width: 100%;
&-title {
font-size: 50rpx;
color: #fff;
text-align: left;
&>view {
width: 50%;
margin: 0 auto;
}
}
&-form {
padding: 400rpx 65rpx 100rpx 65rpx;
&>view {
background-color: #f5f5f5;
border-radius: 60rpx;
padding: 10rpx 30rpx;
margin-bottom: 35rpx;
}
}
&-btn{
padding: 0 65rpx;
&>view{
font-size: 33rpx;
border-radius: 60rpx;
margin-bottom: 35rpx;
height:90rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
background: linear-gradient(-90deg, #e26165 0%, #c10d12 94%, #c10d12 100%);
box-shadow: 1rpx 1rpx 10rpx #c10d12;
}
}
}
}
</style>

@ -1,194 +0,0 @@
<template>
<view class="modify-page">
<!-- 顶部导航 -->
<u-navbar title="修改订单" :is-back="true" back-icon-color="#fff" :background="{'background':'#1479ff'}"
title-color="#fff" :border-bottom="false"></u-navbar>
<view class="b-border"></view>
<!-- 修改表单 -->
<view class="modify-form">
<!-- 金额修改 -->
<view class="form-card">
<view class="card-title">修改总金额</view>
<view class="amount-input">
<text class="symbol">¥</text>
<u-input placeholder="请输入修改后的总金额" v-model="form.price" type="number" :border="false" font-size="40">
</u-input>
<u-icon name="pan"></u-icon>
</view>
<view class="original-price">原价格 ¥{{orderInfo.from_price}}</view>
</view>
<!-- 修改原因 -->
<view class="form-card">
<view class="card-title">修改原因</view>
<u-input v-model="form.update_price_reason" placeholder="请输入修改原因" height="200" :border="false"
type="textarea"></u-input>
</view>
<!-- 底部按钮 -->
<view class="bottom-btns">
<u-button size="mini" shape="circle" type="primary" :custom-style="normalStyle"
@click="cancel">取消</u-button>
<u-button type="primary" @click="confirm" size="mini" shape="circle"
:custom-style="parStyle" :throttle-time="2000">确认修改</u-button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
orderId: '',
orderInfo:{},
form:{
update_price_reason:'',
price:''
},
normalStyle: {
'background': '#969da7',
'color': '#fff',
'font-size': '28rpx',
'padding': '0 30rpx',
'margin-left': '15rpx'
},
parStyle: {
'background': 'linear-gradient(to right, #476de4, #7bb9f7)',
'color': '#fff',
'font-size': '28rpx',
'padding': '10rpx 30rpx',
'margin-left': '15rpx'
},
}
},
onLoad(options) {
if (options.id) {
this.orderId = options.id;
this.getOrderInfo(options.id);
}
},
methods: {
async getOrderInfo(id) {
//
const res = await this.$u.api.orderDetail({
id: id
})
this.orderInfo = res
},
cancel() {
uni.navigateBack();
},
async confirm() {
if (!this.form.price) {
uni.showToast({
title: '请输入修改金额',
icon: 'none'
});
return;
}
if(parseFloat(this.form.price)<parseFloat(this.orderInfo.price)){
uni.showToast({
title: '修改总金额小于原价',
icon: 'none'
});
return;
}
if (!this.form.update_price_reason) {
uni.showToast({
title: '请输入修改原因',
icon: 'none'
});
return;
}
//
let that = this
that.$u.api.saveOrder({
id: that.orderId,
price:that.form.price,
update_price_reason:that.form.update_price_reason,
status:3
}).then(res => {
that.base.toast("修改成功", 1500, function() {
setTimeout(function() {
uni.switchTab({
url:'/pages/index/index'
})
}, 1500)
})
})
}
}
}
</script>
<style lang="scss" scoped>
.modify-page {
min-height: 100vh;
background: #f5f5f5;
::v-deep .u-navbar-fixed{
background-color: #1479ff!important;
}
.b-border {
width: 100%;
height: 30rpx;
border-radius: 0 0 120rpx 120rpx;
background-color: #1479ff;
}
.form-card {
background: #fff;
border-radius: 20rpx;
margin: 30rpx;
box-shadow: 0 4rpx 16rpx #e6eaf1;
padding: 30rpx;
.card-title {
font-size: 28rpx;
color: #333;
margin-bottom: 30rpx;
}
.amount-input {
display: flex;
align-items: center;
justify-content: center;
.symbol {
font-size: 40rpx;
color: #333;
margin-right: 10rpx;
}
// .u-input {
// flex: 1;
// }
}
.original-price {
font-size: 24rpx;
color: #999;
margin-top: 20rpx;
text-align: center;
}
}
.bottom-btns {
// position: fixed;
// left: 0;
// right: 0;
// bottom: 0;
padding: 20rpx;
// background: #fff;
display: flex;
justify-content: flex-end;
.u-button {
width: 45%;
}
}
}
</style>

@ -1,237 +0,0 @@
<template>
<view class="container">
<view class="select">
<view class="select-keyword">
<u-input v-model="select.keyword" placeholder="关键词"></u-input>
</view>
<view class="select-select">
<u-input v-model="select.statusName" @click="isShowStatus = true" type="select"
placeholder="状态"></u-input>
</view>
<view class="select-btn" @click="search">
<view>搜索</view>
</view>
</view>
<view class="order">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
<view v-if="list.length>0">
<view class="order-item" @click="toUrl(item.id)" v-for="item in list">
<view class="order-item-status">
{{item.type===1?'陪诊服务':'居家照护'}}
</view>
<view class="order-item-info">
<view>
<text>编号</text><text>{{item.no}}</text>
</view>
<view>
<text>就诊时间</text><text>{{item.time}}</text>
</view>
<view>
<text>联系人</text><text>{{item.appoint_name}}</text>
</view>
<view class="flex-center" @click.stop="callTel(item.appoint_mobile)">
<view>
<text>联系人电话</text><text>{{item.appoint_mobile}}</text>
</view>
<view style="margin-left:10rpx">
<u-icon name="phone-fill" color="#d61b24"></u-icon>
</view>
</view>
<view>
<text>医院</text><text>{{item.hospital?item.hospital.name:''}}</text>
</view>
</view>
<view class="order-item-btn">
<block v-for="s in statusList">
<view v-if="item.status===s.id">{{s.name}}</view>
</block>
</view>
</view>
<u-loadmore v-if="!(list.length===0 && select.page===1)" :margin-top="20" :margin-bottom="40"
:status="loadStatus"></u-loadmore>
</view>
<view v-else style="height: 100%;" class="d-flex ai-center jc-center">
<u-empty mode="list" text="暂无订单"></u-empty>
</view>
</scroll-view>
</view>
<!-- 选择搜索 状态 -->
<u-select v-model="isShowStatus" value-name="id" @confirm="confirmStatus" label-name="name"
:list="statusList"></u-select>
</view>
</template>
<script>
import {
statusList
} from "@/common/const.js"
export default {
data() {
return {
isShowStatus: false,
statusList: [{
id:'',
name:'全部'
}],
select: {
page: 1,
page_size: 5,
keyword: '',
status: '',
statusName: ''
},
last_page: 1,
list: [],
loadStatus: 'loadmore',
}
},
onShow() {
this.getOrderList()
},
onLoad() {
this.statusList.push(...statusList)
},
methods: {
toUrl(id) {
uni.navigateTo({
url: '/package_sub/order/orderDetail?type=order&id='+id
})
},
callTel(tel) {
if (this.base.isNull(tel)) {
return
}
uni.makePhoneCall({
phoneNumber: tel
});
},
confirmStatus(e) {
console.log("e",e)
this.select.status = e[0].value
this.select.statusName = e[0].label
},
search(){
this.select.page = 1
this.list = []
this.loadStatus = 'loadmore'
this.getOrderList()
},
async getOrderList() {
const res = await this.$u.api.order({
...this.select
})
this.last_page = res.last_page
this.loadStatus = this.select.page >= this.last_page ? 'nomore' : 'loadmore'
this.list.push(...res.data)
},
reachBottom() {
if (this.select.page > this.last_page) {
this.loadStatus = 'nomore'
return
}
this.loadStatus = 'loading'
this.select.page++
this.getOrderList()
},
}
}
</script>
<style lang="scss" scoped>
.container {
width: 100vw;
height: 100vh;
background-color: #F8F8F8;
font-size: 32rpx;
.select {
width: 100vw;
padding: 40rpx 28rpx;
z-index: 4;
position: fixed;
top: 0rpx;
height: 94rpx;
display: flex;
align-items: center;
justify-content: space-between;
background-color: #fff;
box-shadow: 1rpx 1rpx 10rpx #fdf0f0;
&-keyword {
background-color: #f5f5f5;
border-radius: 60rpx;
padding: 0rpx 30rpx;
width: 40%;
}
&-select {
background-color: #f5f5f5;
border-radius: 60rpx;
padding: 0rpx 30rpx;
width: 40%;
}
&-btn {
width: 10%;
}
}
.flex-center {
display: flex;
align-items: center;
.u-icon {
margin-left: 10rpx;
}
}
.order {
padding: 20rpx;
margin-top: 0;
position: relative;
padding-top: 120rpx;
padding-bottom: 40rpx;
background-color: #F8F8F8;
height:100vh;
&-item {
background-color: #fff;
padding: 20rpx;
box-shadow: 1rpx 1rpx 10rpx #fdf0f0;
border-radius: 10rpx;
margin-bottom: 20rpx;
border: 1rpx solid #fdf0f0;
&-status {
border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
padding-bottom: 20rpx;
}
&-info {
padding: 20rpx 0;
&>view {
margin-bottom: 10rpx;
}
}
&-btn {
display: flex;
justify-content: flex-end;
&>view {
text-align: center;
color: #d61b24;
background: #fdf0f0;
padding: 10rpx 30rpx;
border-radius: 40rpx;
border: 1rpx solid #d61b24;
}
}
}
}
}
</style>

@ -1,321 +0,0 @@
<template>
<view class="container">
<!-- <image class="bkg" mode="aspectFill" src="@/static/order-bg.png"></image> -->
<!-- <view class="user">
<u-navbar :background="{'background':'transparent'}" title-color="#000" :border-bottom="false" title="订单详情"></u-navbar>
</view> -->
<view class="order">
<view class="order-title">基本信息</view>
<view class="order-item">
<view class="order-item-info">
<view>
<text>编号</text><text>{{info.no}}</text>
</view>
<view>
<text>预约时间</text><text>{{info.time}}</text>
</view>
<!-- <view>
<text>结束时间</text><text>2025-01-17 15:30</text>
</view> -->
<view>
<text>联系人</text><text>{{info.appoint_name}}</text>
</view>
<view class="flex-center" @click.stop="callTel(info.appoint_mobile)">
<view>
<text>联系人电话</text><text>{{info.appoint_mobile}}</text>
</view>
<view style="margin-left:10rpx">
<u-icon name="phone-fill" color="#d61b24"></u-icon>
</view>
</view>
<view>
<text>医院</text><text>{{info.hospital?info.hospital.name:''}}</text>
</view>
</view>
</view>
<view class="order-item">
<view class="order-item-info">
<view>
<text>是否可以自理</text><text>{{info.my_provide===1?'可以自理':'不能自理'}}</text>
</view>
<view>
<text>就诊人</text><text>{{info.user_archive?info.user_archive.name:''}}/{{base.getAgeFromId(info.user_archive?info.user_archive.idcard:'')}}</text>
</view>
<view>
<view>就诊资料</view>
<view class="order-item-img">
<image v-for="(item,index) in imgs" :src="item" @click="imgPreview(index)"></image>
</view>
</view>
</view>
</view>
<view class="order-item">
<view class="order-item-info">
<view>
<view>其他要求</view>
<view>{{info.content?info.content:'暂无'}}</view>
</view>
</view>
</view>
<view class="order-title" v-if="info.accompany_order_log && info.accompany_order_log.length>0"></view>
<view class="order-item" v-if="info.accompany_order_log && info.accompany_order_log.length>0">
<view class="order-item-info">
<view>
<view v-for="item in info.accompany_order_log">
<block v-for="s in statusList">
<view v-if="item.status===s.id">
{{item.created_at}} {{s.name}}
</view>
</block>
<view class="order-item-img">
<image v-for="(i,index) in item.files" :src="i.url" @click="imgPreviewList(item.files,index)"></image>
</view>
<view>{{item.remark}}</view>
</view>
</view>
</view>
</view>
<view class="order-item">
<view>服务照片</view>
<u-upload :action="action" ref="uUpload" :header="{
['Authorization']: `Bearer ${vuex_token}`,
}"></u-upload>
</view>
<view class="order-item">
<view class="order-item-input">
<u-input :border="true" v-model="form.statusName" @click="isShowStatus = true" type="select"
placeholder="请选择状态"></u-input>
</view>
<view class="order-item-input">
<u-input :border="true" v-model="form.remark" type="textarea" placeholder="备注"></u-input>
</view>
</view>
<view class="order-btn">
<view @click="$u.throttle(submit,2000)"></view>
</view>
<u-select v-model="isShowStatus" value-name="id" @confirm="confirmStatus" label-name="name"
:list="statusList"></u-select>
</view>
</view>
</template>
<script>
import {
statusList
} from "@/common/const.js"
import {
ROOTPATH as baseUrl
} from "@/common/config.js";
export default {
data() {
return {
imgs: [],
type: 'index',
action: '',
id: '',
isShowStatus: false,
form: {
status: '',
statusName: '',
remark: ''
},
action: `${baseUrl}/api/nurse/upload-file`,
statusList: [],
info: {}
}
},
onLoad(options) {
this.statusList = statusList
this.id = options.id ? options.id : ''
this.type = options.type ? options.type : 'index'
this.getDetail(this.id)
},
methods: {
toUrl() {
uni.navigateTo({
url: '/package_sub/order/orderDetail'
})
},
imgPreview(index) {
uni.previewImage({
current: index, //
urls: this.imgs // http
});
},
imgPreviewList(list,index){
let imgs = []
list.map(item=>{
imgs.push(item.url)
})
console.log("imgs",imgs)
uni.previewImage({
current: index, //
urls: imgs // http
});
},
callTel(tel) {
if (this.base.isNull(tel)) {
return
}
uni.makePhoneCall({
phoneNumber: tel
});
},
confirmStatus(e) {
this.form.status = e[0].value
this.form.statusName = e[0].label
},
async getDetail(id) {
const res = await this.$u.api.orderDetail({
id: id
})
this.info = res
this.form.status = res.status
this.form.remark = res.remark
if (res.files.length > 0) {
res.files.map(item => {
this.imgs.push(item.url)
})
}
this.statusList.map(item => {
if (item.id === res.status) {
this.form.statusName = item.name
}
})
console.log("res", res)
},
submit() {
let that = this
let url = this.type === 'index' ? '/pages/index/index' : '/package_sub/order/order'
this.form.file_ids =
this.$refs.uUpload?.lists
?.filter((val) => {
return val.progress === 100;
})
?.map((i) => i.response?.id) || [];
this.$u.api.saveOrder({
id: this.info.id,
...this.form
}).then(res => {
that.base.toast("提交成功", 1500, function() {
setTimeout(function() {
if (that.type === 'index') {
uni.switchTab({
url: url
})
} else {
uni.redirectTo({
url: url
})
}
}, 1500)
})
})
console.log("123")
},
}
}
</script>
<style lang="scss" scoped>
.container {
width: 100vw;
height: 100vh;
background-color: #fff;
font-size: 32rpx;
.bkg {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 686rpx;
}
.user {
font-size: 36rpx;
color: #000;
position: relative;
padding: 20rpx;
}
.flex-center {
display: flex;
align-items: center;
.u-icon {
margin-left: 10rpx;
}
}
.order {
margin: 20rpx;
position: relative;
padding-bottom: 40rpx;
&-title {
font-size: 36rpx;
color: #000;
position: relative;
padding: 20rpx;
}
&-item {
background-color: #fff;
padding: 20rpx;
box-shadow: 1rpx 1rpx 10rpx rgba(0, 0, 0, 0.2);
border-radius: 10rpx;
margin-bottom: 30rpx;
&-info {
padding: 20rpx 0;
&>view {
margin-bottom: 10rpx;
}
}
&-img {
display: flex;
flex-wrap: wrap;
image {
width: 140rpx;
height: 140rpx;
margin: 10rpx;
}
}
&-input {
margin-bottom: 20rpx;
}
}
&-btn {
padding: 0 65rpx;
&>view {
font-size: 33rpx;
border-radius: 60rpx;
margin-bottom: 35rpx;
height: 90rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
background: linear-gradient(-90deg, #e26165 0%, #c10d12 94%, #c10d12 100%);
box-shadow: 1rpx 1rpx 10rpx #c10d12;
}
}
}
}
</style>

@ -1,339 +0,0 @@
<template>
<view class="detail-page">
<!-- 顶部导航 -->
<u-navbar title="查看详情" :is-back="true" back-icon-color="#fff" :background="{'background':'#1479ff'}"
title-color="#fff" :border-bottom="false"></u-navbar>
<view class="b-border"></view>
<!-- 订单信息 -->
<view class="order-info">
<view class="info-item">
<text class="label">订单号</text>
<text class="value">{{orderInfo.no}}</text>
</view>
<view class="info-item">
<text class="label">服务项目</text>
<text class="value">{{orderInfo.accompany_product?orderInfo.accompany_product.name:''}}</text>
</view>
<view class="info-item">
<text class="label">服务时间</text>
<text class="value">{{orderInfo.time}}</text>
</view>
<view class="info-item" v-if="orderInfo.type === 2">
<text class="label">服务地址</text>
<text class="value">{{item.city?item.city:'' }}</text>
</view>
<view class="info-item" v-else>
<text class="label">就诊医院</text>
<text class="value">{{orderInfo.hospital?orderInfo.hospital.name:''}}</text>
</view>
<view class="info-item">
<text class="label">联系人</text>
<text class="value">{{orderInfo.appoint_name?orderInfo.appoint_name:''}}</text>
</view>
<view class="info-item">
<text class="label">联系方式</text>
<text class="value">{{orderInfo.appoint_mobile?orderInfo.appoint_mobile:''}}</text>
</view>
<view class="info-item">
<text class="label">被服务人</text>
<text class="value">{{orderInfo.user_archive?orderInfo.user_archive.name:''}}</text>
</view>
<view class="info-item">
<text class="label">是否可以自理</text>
<text class="value">{{orderInfo.my_provide===1?'可以自理':'不能自理'}}</text>
</view>
<view class="info-item info-item-reason">
<text class="label">就诊资料</text>
<view class="value">
<view class="order-item-img">
<image v-for="(item,index) in imgs" :src="item" @click="imgPreview(index)"></image>
</view>
</view>
</view>
<view class="info-item info-item-reason">
<text class="label">其他需求</text>
<text class="value">{{orderInfo.content?orderInfo.content:''}}</text>
</view>
<view class="info-item">
<text class="label">订单金额</text>
<text class="value">¥{{orderInfo.price}}</text>
</view>
<view class="info-item">
<text class="label">原始金额</text>
<text class="value">¥{{orderInfo.from_price}}</text>
</view>
<view class="info-item" v-if="orderInfo.status===3||orderInfo.status===4">
<text class="label">待付金额</text>
<text class="value price">¥{{orderInfo.diff_price}}</text>
</view>
<view class="info-item info-item-reason">
<text class="label">修改原因</text>
<text class="value reason">{{orderInfo.update_price_reason?orderInfo.update_price_reason:''}}</text>
</view>
</view>
<!-- 服务记录 -->
<!-- <view class="order-info" v-if="orderInfo.accompany_order_log && orderInfo.accompany_order_log.length>0">
<view class="info-item info-item-reason">
<text class="label">服务记录</text>
<view class="value">
<view class="">
<view v-for="item in orderInfo.accompany_order_log">
<view>备注{{item.remark}}</view>
<view class="order-item-img">
<image v-for="(i,index) in item.files" :src="i.url"
@click="imgPreviewList(item.files,index)"></image>
</view>
</view>
</view>
</view>
</view>
</view> -->
<!-- 支付二维码 -->
<view class="payment-popup" v-if="orderInfo.status===3">
<view class="title">付款二维码</view>
<view class="amount">
<text class="symbol">¥</text>
<text class="number">{{orderInfo.diff_price}}</text>
</view>
<view class="qr-code">
<!-- <image :src="qrCodeUrl" mode="aspectFit"></image> -->
<uqrcode v-if="myQrcode" ref="uqrcode" canvas-id="qrcode" :value="myQrcode" :sizeUnit="'rpx'"
:size="200" :options="{
margin: 10,
}"></uqrcode>
</view>
<view class="tips">
<text>请扫码支付差额</text>
<text class="sub-tips">支付完成后订单将自动完成</text>
</view>
<view class="close-btn">
<u-button size="mini" shape="circle" type="default" :custom-style="parStyle"
@click="isPayCode">我已支付</u-button>
</view>
</view>
</view>
</template>
<script>
import uqrcode from '@/uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode.vue'
export default {
components: {
uqrcode
},
data() {
return {
myQrcode: '',
imgs: [],
orderId: '',
orderInfo: {},
parStyle: {
'background': 'linear-gradient(to right, #476de4, #7bb9f7)',
'color': '#fff',
'font-size': '28rpx',
'padding': '0 30rpx',
'margin-left': '15rpx'
},
}
},
onLoad(options) {
//
this.orderId = options.id
this.getOrderDetail(options.id);
},
methods: {
imgPreview(index) {
uni.previewImage({
current: index, //
urls: this.imgs // http
});
},
async getOrderDetail(orderId) {
//
const res = await this.$u.api.orderDetail({
id: orderId
})
this.orderInfo = res
let _arr = []
if (res.files.length > 0) {
res.files.map(item => {
_arr.push(item.url)
})
this.imgs = _arr
}
if (res.status === 3) {
await this.getCode(res.no)
}
},
async getCode(no) {
const res = await this.$u.api.payCode({
no: no
})
if (res.result.return_code === 'SUCCESS') {
if (res.result.code_url) {
this.myQrcode = res.result.code_url
} else {
uni.showToast({
icon: 'none',
title: res.result.err_code_des || '获取失败'
})
}
} else {
uni.showToast({
icon: 'none',
title: '获取失败'
})
}
},
isPayCode() {
this.myQrcode = ''
this.getOrderDetail(this.orderId)
},
}
}
</script>
<style lang="scss" scoped>
.detail-page {
min-height: 100vh;
background: #f5f5f5;
padding-bottom: 40rpx;
.b-border {
width: 100%;
height: 30rpx;
border-radius: 0 0 120rpx 120rpx;
background-color: #1479ff;
}
.order-info {
background: #fff;
border-radius: 20rpx;
margin: 30rpx;
box-shadow: 0 4rpx 16rpx #e6eaf1;
padding: 0 30rpx;
.info-item {
padding: 30rpx;
display: flex;
justify-content: space-between;
// margin-bottom: 30rpx;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
.label {
color: #666;
font-size: 28rpx;
}
.value {
color: #333;
font-size: 28rpx;
// &.price {
// color: #f56c6c;
// font-weight: bold;
// }
&.reason {
color: #999;
}
}
}
.info-item-reason {
flex-wrap: wrap;
&>text {
width: 100%
}
}
.order-item-img {
display: flex;
flex-wrap: wrap;
image {
width: 140rpx;
height: 140rpx;
margin: 10rpx;
}
}
}
.payment-popup {
background: #fff;
border-radius: 20rpx;
margin: 30rpx;
box-shadow: 0 4rpx 16rpx #e6eaf1;
padding: 30rpx;
.title {
font-size: 32rpx;
color: #333;
text-align: center;
font-weight: 500;
margin-bottom: 20rpx;
}
.amount {
text-align: center;
margin-bottom: 20rpx;
.symbol {
font-size: 36rpx;
color: #000;
}
.number {
font-size: 48rpx;
color: #d80808;
font-weight: bold;
}
}
.qr-code {
width: 200rpx;
height: 200rpx;
margin: 0 auto 20rpx;
image {
width: 100%;
height: 100%;
}
}
.tips {
text-align: center;
margin-bottom: 20rpx;
text {
display: block;
color: #333;
font-size: 28rpx;
line-height: 1.8;
}
.sub-tips {
color: #999;
font-size: 24rpx;
}
}
.close-btn {
width: 80%;
margin: 0 auto;
display: flex;
justify-content: center;
}
}
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

@ -3,70 +3,22 @@
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
},
"pages": [{
"path": "pages/index/index",
"style": {
"navigationStyle": "custom"
}
}, {
"path": "pages/me/index",
"style": {
"navigationStyle": "custom"
}
}],
"pages": [],
"tabBar": {
"color": "#686868",
"selectedColor": "#686868",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/home.png",
"selectedIconPath": "static/home-active.png",
"text": "首页"
}, {
"pagePath": "pages/me/index",
"iconPath": "static/user.png",
"selectedIconPath": "static/user-active.png",
"text": "我的"
}]
"list": []
},
"subPackages": [{
"root": "package_sub",
"pages": [{
"path": "login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
},
{
"path": "order/order",
"style": {
"navigationBarTitleText": "我的订单"
// "navigationStyle": "custom"
}
},
{
"path": "order/orderDetail",
"style": {
// "navigationBarTitleText": "订单详情"
"navigationStyle": "custom"
}
},
{
"path": "order/editPrice",
"style": {
// "navigationBarTitleText": "订单详情"
"navigationStyle": "custom"
}
}
]
"pages": []
}],
"preloadRule": {},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "医康养-护工端",
"navigationBarTitleText": "胥口闸站购票",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}

@ -1,191 +0,0 @@
<template>
<view class="container">
<image class="bkg" mode="aspectFill" src="@/static/order-bg.png"></image>
<view class="user" :style="{'padding-top':statusBarHeight+'px'}">
<view>
<view>{{vuex_user.name || '微信用户' }}</view>
<view>{{today}}</view>
</view>
</view>
<view class="order">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
<view v-if="list.length>0">
<view class="order-item" @click="toUrl(item.id)" v-for="item in list">
<view class="order-item-status">
{{item.type===1?'陪诊服务':'居家照护'}}
</view>
<view class="order-item-info">
<view>
<text>编号</text><text>{{item.no}}</text>
</view>
<view>
<text>就诊时间</text><text>{{item.time}}</text>
</view>
<view>
<text>联系人</text><text>{{item.appoint_name}}</text>
</view>
<view class="flex-center" @click.stop="callTel(item.appoint_mobile)">
<view>
<text>联系人电话</text><text>{{item.appoint_mobile}}</text>
</view>
<view style="margin-left:10rpx">
<u-icon name="phone-fill" color="#d61b24"></u-icon>
</view>
</view>
<view>
<text>医院</text><text>{{item.hospital?item.hospital.name:''}}</text>
</view>
</view>
<view class="order-item-btn">
<block v-for="s in statusList">
<view v-if="item.status===s.id">{{s.name}}</view>
</block>
</view>
</view>
<u-loadmore v-if="!(list.length===0 && select.page===1)" :margin-top="20" :margin-bottom="40" :status="loadStatus"></u-loadmore>
</view>
<view v-else style="height: 100%;" class="d-flex ai-center jc-center">
<u-empty mode="list" text="暂无订单"></u-empty>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import {statusList} from "@/common/const.js"
export default {
data() {
return {
today:'',
statusBarHeight: 40,
statusList:[],
last_page:1,
select: {
page: 1,
page_size: 5,
},
list: [],
loadStatus: 'loadmore',
}
},
onShow() {
this.list = []
this.getOrderList()
},
onLoad() {
this.statusList = statusList
this.today = this.$moment(new Date()).format("YYYY-MM-DD")
this.statusBarHeight = uni.getMenuButtonBoundingClientRect().top;
},
methods: {
toUrl(id) {
uni.navigateTo({
url: '/package_sub/order/orderDetail?type=index&id='+id
})
},
async getOrderList() {
const res = await this.$u.api.order({
page: 1,
page_size: 5,
})
this.last_page = res.last_page
this.loadStatus = this.select.page >= this.last_page ?'nomore':'loadmore'
this.list.push(...res.data)
},
reachBottom() {
if (this.select.page > this.last_page) {
this.loadStatus = 'nomore'
return
}
this.loadStatus = 'loading'
this.select.page++
this.getOrderList()
},
callTel(tel) {
if (this.base.isNull(tel)) {
return
}
uni.makePhoneCall({
phoneNumber: tel
});
},
}
}
</script>
<style lang="scss" scoped>
.container {
width: 100vw;
height: 100vh;
background-color: #fff;
font-size: 32rpx;
.bkg {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 686rpx;
}
.user {
font-size: 36rpx;
color: #000;
position: relative;
padding: 20rpx;
}
.flex-center {
display: flex;
align-items: center;
.u-icon {
margin-left: 10rpx;
}
}
.order {
margin: 20rpx;
padding-bottom:40rpx;
position: relative;
height:calc(100vh - 240rpx);
&-item {
background-color: #fff;
padding: 20rpx;
box-shadow: 1rpx 1rpx 5rpx #fdf0f0;
border-radius: 10rpx;
margin:20rpx 0;
border: 1rpx solid #fdf0f0;
&-status {
border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
padding-bottom: 20rpx;
}
&-info {
padding: 20rpx 0;
&>view {
margin-bottom: 10rpx;
}
}
&-btn {
display: flex;
justify-content: flex-end;
&>view {
text-align: center;
color: #d61b24;
background: #fdf0f0;
padding: 10rpx 30rpx;
border-radius: 40rpx;
border: 1rpx solid #d61b24;
}
}
}
}
}
</style>

@ -1,534 +0,0 @@
<template>
<view class="order-page">
<!-- 顶部栏 -->
<u-navbar :is-back="false" title="订单管理系统" :background="{'background':'#1479ff'}" title-color="#fff"
:border-bottom="false">
</u-navbar>
<view class="b-border"></view>
<!-- Tabs -->
<view class="tabs">
<view v-for="(tab, idx) in statusList" :key="idx" :class="['tab', {active: currentTab === idx}]"
@click="changeTab(idx)">
{{ tab.name }}
</view>
</view>
<!-- 订单列表 -->
<view class="order">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
<block v-if="list.length>0">
<view class="order-list">
<view class="order-card" v-for="item in list" :key="item.id">
<view class="order-icon" :class="typeText[item.type]['class']">
{{ typeText[item.type]['name'] }}
</view>
<view class="order-header">
<view class="order-time">
服务时间<text>{{ item.time }}</text>
</view>
<view class="order-status">{{ statusList[currentTab].name }}</view>
</view>
<view class="order-body">
<view class="order-left">
<block v-if="item.type === 2">
<view>服务地址{{ item.city?item.city:'' }}</view>
</block>
<block v-else>
<view>就诊医院{{ item.hospital?item.hospital.name:'' }}</view>
</block>
<view>被服务人{{ item.user_archive?item.user_archive.name:'' }}</view>
<view>服务项目{{ item.accompany_product?item.accompany_product.name:'' }}</view>
<view>订单号{{ item.no }} <text class="copy" @click="copy(item.no)"></text></view>
</view>
<view class="order-price"><text>{{ item.price }}</text></view>
</view>
<view class="order-footer">
<u-button size="mini" @click="toUrl(item.id)" shape="circle" type="default"
:custom-style="normalStyle">详情</u-button>
<u-button v-if="item.status===1" @click="editOrder(item.id)" size="mini" shape="circle" type="default"
:custom-style="normalStyle">修改</u-button>
<u-button v-if="item.status===0" @click="takeOrder(item.id)" size="mini" shape="circle"
type="default" :custom-style="parStyle">接单</u-button>
<u-button v-if="item.status===3" @click="showCode(item)" size="mini" shape="circle"
type="default" :custom-style="parStyle">付款码</u-button>
<u-button v-if="item.status===1" @click="closeOrder(item)" size="mini" shape="circle" type="default"
:custom-style="parStyle">结束服务</u-button>
</view>
</view>
</view>
<u-loadmore v-if="!(list.length===0 && select.page===1)" :margin-top="20" :margin-bottom="40"
:status="loadStatus"></u-loadmore>
</block>
<view v-else style="height: 100%;" class="d-flex ai-center jc-center">
<u-empty mode="list" text="暂无订单"></u-empty>
</view>
</scroll-view>
</view>
<!-- 二维码 -->
<u-popup v-model="showPayCode" z-index="99999" :mask-close-able="false" mode="center" border-radius="12"
width="690rpx">
<view class="payment-popup">
<view class="title">付款二维码</view>
<view class="amount">
<text class="symbol">¥</text>
<text class="number">{{diff_price}}</text>
</view>
<view class="qr-code">
<!-- <image :src="qrCodeUrl" mode="aspectFit"></image> -->
<uqrcode v-if="myQrcode" ref="uqrcode" canvas-id="qrcode" :value="myQrcode" :sizeUnit="'rpx'"
:size="200" :options="{
margin: 10,
}"></uqrcode>
</view>
<view class="tips">
<text>请扫码支付差额</text>
<text class="sub-tips">支付完成后订单将自动完成</text>
</view>
<view class="close-btn">
<u-button size="mini" shape="circle" type="default" :custom-style="normalStyle"
@click="closePayCode">关闭</u-button>
<u-button size="mini" shape="circle" type="default" :custom-style="parStyle"
@click="isPayCode">我已支付</u-button>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import uqrcode from '@/uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode.vue'
export default {
components: {
uqrcode
},
data() {
return {
// tabs: ['', '', '', ''],
showPayCode: false,
diff_price: '0.00',
myQrcode: '',
// 0134
statusList: [{
id: 0,
name: "待处理"
}, {
id: 1,
name: "服务中"
}, {
id: 3,
name: "待结清"
}, {
id: 4,
name: "已完成"
}],
typeText: {
1: {
name: '诊',
class: 'doctor'
},
2: {
name: '护',
class: 'nurse'
},
},
currentTab: 0,
normalStyle: {
'background': '#969da7',
'color': '#fff',
'font-size': '28rpx',
'padding': '0 30rpx',
'margin-left': '15rpx'
},
parStyle: {
'background': 'linear-gradient(to right, #476de4, #7bb9f7)',
'color': '#fff',
'font-size': '28rpx',
'padding': '0 30rpx',
'margin-left': '15rpx'
},
last_page: 1,
select: {
page: 1,
page_size: 5,
status: 0,
},
list: [],
loadStatus: 'loadmore',
list: [],
}
},
onShow() {
this.select.page = 1
this.list = []
this.getOrderList()
},
methods: {
copy(text) {
uni.setClipboardData({
data: text,
success: () => {
uni.showToast({
title: '已复制',
icon: 'none'
});
}
});
},
//
toUrl(id) {
uni.navigateTo({
url: '/package_sub/order/orderDetail?&id=' + id
})
},
//
editOrder(id) {
uni.navigateTo({
url: '/package_sub/order/editPrice?&id=' + id
})
},
//
takeOrder(id) {
let that = this
uni.showModal({
title: '是否确认接收订单?',
success(res) {
if (res.confirm) {
that.$u.api.saveOrder({
id: id,
status:1
}).then(res => {
that.base.toast("接收成功", 1500, function() {
setTimeout(function() {
that.select.status = 1
that.select.page = 1
that.currentTab = 1
that.list = []
that.getOrderList()
}, 1500)
})
})
}
}
})
},
//
async showCode(item) {
const res = await this.$u.api.payCode({
no:item.no
})
if(res.result.return_code==='SUCCESS'){
this.myQrcode = res.result.code_url
this.diff_price = parseFloat(item.diff_price).toFixed(2)
this.showPayCode = true
}else{
uni.showToast({
icon:'none',
title:'获取失败'
})
}
},
closePayCode(){
this.myQrcode = ''
this.diff_price = '0.00'
this.showPayCode = false
},
isPayCode(){
this.myQrcode = ''
this.diff_price = '0.00'
this.showPayCode = false
this.list = []
this.select.page = 1
this.getOrderList()
},
//
closeOrder(item){
// uni.navigateTo({
// url: '/package_sub/order/orderDetail?&id=' + itemid
// })
let that = this
uni.showModal({
title: '是否确认订单已完成?',
success(res) {
if (res.confirm) {
that.$u.api.saveOrder({
id: item.id,
status:4
}).then(res => {
that.base.toast("服务完成", 1500, function() {
setTimeout(function() {
that.select.status = 4
that.select.page = 1
that.currentTab = 3
that.list = []
that.getOrderList()
}, 1500)
})
})
}
}
})
},
changeTab(idx) {
this.currentTab = idx
this.select.status = this.statusList[idx].id
this.list = []
this.select.page = 1
this.getOrderList()
},
async getOrderList() {
const res = await this.$u.api.order({
page: this.select.page,
page_size: this.select.page_size,
status: this.select.status
})
this.last_page = res.last_page
this.loadStatus = this.select.page >= this.last_page ? 'nomore' : 'loadmore'
this.list.push(...res.data)
},
reachBottom() {
if (this.select.page >= this.last_page) {
this.loadStatus = 'nomore'
return
}
this.loadStatus = 'loading'
this.select.page++
this.getOrderList()
},
}
}
</script>
<style scoped lang="scss">
.order-page {
background: #f6f8fb;
min-height: 100vh;
}
.b-border {
width: 100%;
height: 30rpx;
border-radius: 0 0 120rpx 120rpx;
background-color: #1479ff;
}
.tabs {
display: flex;
padding: 0 30rpx;
}
.tab {
flex: 1;
text-align: center;
font-size: 28rpx;
padding: 30rpx 0 20rpx 0;
color: #333333;
position: relative;
}
.tab.active {
color: #000;
font-weight: bold;
font-size: 32rpx;
}
.tab.active::after {
content: '';
display: block;
width: 70%;
height: 9rpx;
background: linear-gradient(to right, #476de4, #7bb9f7);
border-radius: 6rpx;
margin: 0 auto;
margin-top: -10rpx;
}
.order {
height: calc(100vh - 270rpx);
padding-bottom: 30rpx;
}
.order-list {
padding: 30rpx 0;
padding-bottom: 0;
}
.order-card {
background: #fff;
border-radius: 20rpx;
margin: 0 30rpx 30rpx 30rpx;
box-shadow: 0 4rpx 16rpx #e6eaf1;
padding: 30rpx;
position: relative;
overflow: hidden;
padding-top: 25rpx;
}
.order-icon {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
border: 2rpx solid #e6eaf1;
display: flex;
align-items: center;
justify-content: center;
font-size: 40rpx;
font-weight: bold;
position: absolute;
top: -15rpx;
left: -15rpx;
}
.order-icon.nurse {
color: #cce0ff;
border-color: #cce0ff;
}
.order-icon.doctor {
color: #ffe0b2;
border-color: #ffe0b2;
}
.order-header {
display: flex;
align-items: center;
padding-bottom: 20rpx;
border-bottom: 1rpx dotted #bbb;
width: calc(100% - 80rpx);
margin-left: 80rpx;
}
.order-time {
flex: 1;
color: #969da7;
font-size: 28rpx;
text {
color: #000;
}
}
.order-status {
color: #969da7;
font-size: 28rpx;
}
.order-body {
color: #333;
margin-top: 30rpx;
// margin-bottom: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
.order-left {
&>view {
margin-bottom: 20rpx;
}
}
}
.copy {
color: #969da7;
margin-left: 10rpx;
font-size: 28rpx;
}
.order-price {
color: #333;
font-size: 36rpx;
font-weight: bold;
}
.order-price text {
font-size: 46rpx;
color: #d80808;
}
.order-footer {
display: flex;
align-items: center;
justify-content: flex-end;
}
.order-actions {
display: flex;
align-items: center;
}
.payment-popup {
background: #fff;
padding: 40rpx;
.title {
font-size: 32rpx;
color: #333;
text-align: center;
font-weight: 500;
margin-bottom: 30rpx;
}
.amount {
text-align: center;
margin-bottom: 40rpx;
.symbol {
font-size: 36rpx;
color: #000;
}
.number {
font-size: 48rpx;
color: #d80808;
font-weight: bold;
}
}
.qr-code {
width: 200rpx;
height: 200rpx;
margin: 0 auto 40rpx;
image {
width: 100%;
height: 100%;
}
}
.tips {
text-align: center;
margin-bottom: 40rpx;
text {
display: block;
color: #333;
font-size: 28rpx;
line-height: 1.8;
}
.sub-tips {
color: #999;
font-size: 24rpx;
}
}
.close-btn {
width: 80%;
margin: 0 auto;
display: flex;
justify-content: center;
}
}
</style>

@ -1,283 +0,0 @@
<template>
<view class="container">
<!-- <image class="bkg" mode="aspectFill" src="@/static/order-bg.png"></image> -->
<!-- 顶部导航 -->
<u-navbar title="我的" :is-back="false" back-icon-color="#fff" :background="{'background':'#1479ff'}"
title-color="#fff" :border-bottom="false"></u-navbar>
<view class="b-border"></view>
<view @click="showMyInfo = true" class="top">
<image class="avatar" mode="aspectFit" :src="avatar_img || vuex_default_icon"></image>
<view class="info">
<view class="info-name">{{ vuex_user.name || '微信用户' }}</view>
<view class="info-mobile">手机号{{ vuex_user.mobile || '' }}</view>
</view>
</view>
<view class="panel panel2">
<view class="row" @click="toUrl">
<u-icon class="row__icon" name="heart" color="#1479ff"></u-icon>
<view>我的订单</view>
</view>
<view class="row" @click="loginOut">
<u-icon class="row__icon" name="account" color="#1479ff"></u-icon>
<view>退出</view>
</view>
</view>
<!-- 设置头像 -->
<view class="myinfo">
<u-popup v-model="showMyInfo" mode="bottom" :border-radius="30">
<view class="form-wrapper">
<u-form :model="form" ref="uForm" label-width="140rpx">
<u-form-item label="头像">
<button class="btn-normal" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image :src="avatar_img || vuex_default_icon"></image>
</button>
</u-form-item>
</u-form>
</view>
<!-- 操作按钮 -->
<view class="footer">
<view class="btn-wrapper">
<view class="btn-item btn-item-main" @click="saveInfo"></view>
</view>
</view>
</u-popup>
</view>
</view>
</template>
<script>
import {
ROOTPATH as baseUrl
} from "@/common/config.js"
export default {
components: {},
data() {
return {
statusBarHeight: 40,
showMyInfo: false,
form: {
avatar: ''
},
avatar_img: ''
};
},
onLoad() {
this.statusBarHeight = uni.getMenuButtonBoundingClientRect().top;
this.getUserInfo()
},
methods: {
toUrl() {
// uni.navigateTo({
// url: '/package_sub/order/order'
// })
},
loginOut() {
let that = this
uni.showModal({
content: "是否确认退出?",
success(res) {
if (res.confirm) {
that.$u.api.loginOut().then(res => {
that.base.toast("退出成功", 1500, function() {
setTimeout(() => {
uni.removeStorageSync('lifeData')
uni.redirectTo({
url: '/package_sub/login/login'
})
}, 1500)
})
})
}
}
})
},
onChooseAvatar(e) {
console.log(e)
console.log(e);
let a = uni.uploadFile({
url: baseUrl + "/api/nurse/upload-file",
filePath: e.detail.avatarUrl,
name: 'file',
header: {
['Authorization']: `Bearer ${this.vuex_token}`
},
success: (res) => {
uni.showToast({
title: '上传成功',
duration: 1000,
icon: 'none'
})
console.log("res", res)
let data = JSON.parse(res.data)
this.form.avatar = data.id
}
})
},
async saveInfo() {
let that = this
if (this.base.isNull(this.form.avatar)) {
this.base.toast("请上传头像")
return
}
const res = await this.$u.api.saveUser({
avatar: that.form.avatar
})
that.base.toast('更新成功', 1000, function() {
setTimeout(function() {
that.showMyInfo = false
that.getUserInfo()
}, 1000)
})
},
async getUserInfo() {
const user = await this.$u.api.getUser()
this.form.avatar = user.avatar ? user.avatar : ''
this.avatar_img = user.avatar_detail ? user.avatar_detail.url : ''
this.$u.vuex('vuex_user', user)
}
},
}
</script>
<style lang="scss">
.container {
min-height: 100vh;
position: relative;
background: #f5f5f5;
font-size: 32rpx;
.bkg {
width: 100vw;
z-index: 0;
height: 686rpx;
position: absolute;
top: 0;
left: 0;
}
.b-border {
width: 100%;
height: 30rpx;
border-radius: 0 0 120rpx 120rpx;
background-color: #1479ff;
}
.top {
display: flex;
align-items: center;
position: relative;
background: #fff;
border-radius: 20rpx;
margin: 30rpx;
box-shadow: 0 4rpx 16rpx #e6eaf1;
padding: 30rpx;
.avatar {
width: 100rpx;
height: 100rpx;
border-radius: 80rpx;
}
.info {
padding-left: 40rpx;
&-name {
line-height: 2;
font-weight: 600;
}
}
}
.panel {
position: relative;
background: #fff;
border-radius: 10rpx;
margin: 40rpx 25rpx 0;
padding: 28rpx 25rpx;
}
.panel2 {
.row {
display: flex;
padding: 20rpx 10rpx;
border-bottom: 2rpx #dee2e6 solid;
&__icon {
margin-right: 20rpx;
color: $uni-color-primary;
font-size: 36rpx;
}
}
}
.form-wrapper {
margin: 20rpx auto 20rpx auto;
padding: 0 40rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
.btn-normal {
display: block;
margin: 0;
padding: 0;
line-height: normal;
background: none;
border-radius: 0;
box-shadow: none;
border: none;
font-size: unset;
text-align: unset;
overflow: visible;
color: inherit;
image {
width: 120rpx;
height: 120rpx;
border-radius: 100%;
border: 2px solid #fff;
margin-right: 30rpx;
}
}
.btn-normal::after {
border: none
}
}
.footer {
margin-top: 80rpx;
margin-bottom: 40rpx;
.btn-wrapper {
height: 100%;
// display: flex;
// align-items: center;
padding: 0 20rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 86rpx;
color: #fff;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
}
.btn-item-main {
background: #d61b24;
color: #fff;
}
}
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@ -1,392 +0,0 @@
# 介绍
`uQRCode`是一款基于`Javascript`环境开发的二维码生成插件,适用所有`Javascript`运行环境的前端应用和`Node.js`应用。
`uQRCode`可扩展性高,它支持自定义渲染二维码,可通过`uQRCode API`得到二维码绘制关键信息后,使用`canvas`、`svg`或`js`操作`dom`的方式绘制二维码图案。还可自定义二维码样式,如随机颜色、圆点、方块、块与块之间的间距等。
欢迎加入群聊【uQRCode交流群】[695070434](https://jq.qq.com/?_wv=1027&k=JRjzDqiw)。
# 设计器
uQRCode发布了配套的可视化设计器可根据自己喜好在设计器中设计二维码样式一键生成配置代码复制到项目中详情请在微信小程序搜索“柚子二维码”或扫描下方小程序码体验。
![uQRCode设计器](https://uqrcode.cn/mp_weixin_code.jpg)
## 设计器模板示例
![uQRCode设计器](https://uqrcode.cn/yz_1.png)
![uQRCode设计器](https://uqrcode.cn/yz_2.png)
![uQRCode设计器](https://uqrcode.cn/yz_3.png)
![uQRCode设计器](https://uqrcode.cn/yz_4.png)
![uQRCode设计器](https://uqrcode.cn/yz_5.png)
![uQRCode设计器](https://uqrcode.cn/yz_6.png)
![uQRCode设计器](https://uqrcode.cn/yz_7.png)
![uQRCode设计器](https://uqrcode.cn/yz_8.png)
![uQRCode设计器](https://uqrcode.cn/yz_9.png)
# 快速上手
> 在`uni-app`中,我们更推荐使用组件方式来生成二维码,组件方式大大提高了页面的可读性以及避开了一些平台容易出问题的地方,当组件无法满足需求的时候,再考虑切换成原生方式。
官方文档:[https://uqrcode.cn/doc](https://uqrcode.cn/doc)。
github地址[https://github.com/Sansnn/uQRCode](https://github.com/Sansnn/uQRCode)。
npm地址[https://www.npmjs.com/package/uqrcodejs](https://www.npmjs.com/package/uqrcodejs)。
uni-app插件市场地址[https://ext.dcloud.net.cn/plugin?id=1287](https://ext.dcloud.net.cn/plugin?id=1287)。
## 原生方式
原生方式仅需要获取`uqrcode.js`文件便可使用。详细配置请移步到:文档 > [原生](https://uqrcode.cn/doc/document/native.html)。
### 安装
1. 通过`npm`安装,成功后即可使用`import`或`require`进行引用。
``` bash
# npm安装
npm install uqrcodejs
# 或者
npm install @uqrcode/js
```
2. 通过项目开源地址获取`uqrcode.js`,下载`uqrcode.js`后,将其复制到您项目指定目录,在页面中引入`uqrcode.js`文件即可开始使用。
### 引入
- 通过`import`引入。
``` javascript
// npm安装
import UQRCode from 'uqrcodejs'; // npm install uqrcodejs
// 或者
import UQRCode from '@uqrcode/js'; // npm install @uqrcode/js
```
- `Node.js`通过`require`引入。
``` javascript
// npm安装
const UQRCode = require('uqrcodejs'); // npm install uqrcodejs
// 或者
const UQRCode = require('@uqrcode/js'); // npm install @uqrcode/js
```
- 原生浏览器环境在js脚本加载时添加到`window`。
``` html
<script type="text/javascript" src="uqrcode.js"></script>
<script>
var UQRCode = window.UQRCode;
</script>
```
### 简单用法
`uQRCode`基于`Canvas API`封装了一套方法,建议开发者使用`canvas`生成,一键调用,非常方便。以下是示例:
- HTML示例
- DOM部分
``` html
<canvas id="qrcode" width="200" height="200"></canvas>
```
- JS部分
``` javascript
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小必须与canvas设置的宽高一致
qr.size = 200;
// 调用制作二维码方法
qr.make();
// 获取canvas元素
var canvas = document.getElementById("qrcode");
// 获取canvas上下文
var canvasContext = canvas.getContext("2d");
// 设置uQRCode实例的canvas上下文
qr.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
qr.drawCanvas();
```
- uni-app示例
- Template部分
``` html
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;"></canvas>
```
- JS部分
``` javascript
onReady() {
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小必须与canvas设置的宽高一致
qr.size = 200;
// 调用制作二维码方法
qr.make();
// 获取canvas上下文
var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件this必须传入
// 设置uQRCode实例的canvas上下文
qr.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
qr.drawCanvas();
}
```
- 微信小程序推荐使用Canvas 2D关于Canvas 2D的使用请参考微信开放文档。
### 高级用法
考虑到部分平台可能不支持`canvas`,所以`uQRCode`并没有强制要求和`canvas`一起使用,您还可以选择其他方式来生成二维码,例如使用`js`操作`dom`进行绘制或是使用`svg`绘制等。以下是示例:
- uni-app v-for+view
```html
<template>
<view>
<view class="qrcode">
<view v-for="(row, rowI) in modules" :key="rowI" style="display: flex;flex-direction: row;">
<view v-for="(col, colI) in row" :key="colI">
<view v-if="col.isBlack" style="width: 10px;height: 10px;background-color: black;">
<!-- 黑色码点 -->
</view>
<view v-else style="width: 10px;height: 10px;background-color: white;">
<!-- 白色码点 -->
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import UQRCode from '../../uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
export default {
data() {
return {
modules: []
}
},
onLoad() {
const qr = new UQRCode();
qr.data = 'uQRCode';
qr.make();
this.modules = qr.modules;
},
methods: {
}
}
</script>
```
- js操作dom
``` html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>uQRCode二维码生成</title>
</head>
<body>
<div id="qrcode" style="position: relative;"></div>
<script type="text/javascript" src="uqrcode.js"></script>
<script>
// 引入uQRCode
var UQRCode = window.UQRCode;
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小必须与canvas设置的宽高一致
qr.size = 200;
// 设置二维码前景图,可以是路径
qr.foregroundImageSrc =
'data:image/png;base64,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';
// 调用制作二维码方法
qr.make();
var drawModules = qr.getDrawModules();
// 遍历drawModules创建dom元素
var qrHtml = '';
for (var i = 0; i < drawModules.length; i++) {
var drawModule = drawModules[i];
switch (drawModule.type) {
case 'tile':
/* 绘制小块 */
qrHtml += `<div style="position: absolute;left: ${drawModule.x}px;top: ${drawModule.y}px;width: ${drawModule.width}px;height: ${drawModule.height}px;background: ${drawModule.color};"></div>`;
break;
case 'image':
/* 绘制图像 */
qrHtml += `<img style="position: absolute;left: ${drawModule.x}px;top: ${drawModule.y}px;width: ${drawModule.width}px;height: ${drawModule.height}px;" src="${drawModule.imageSrc}" />`;
break;
}
}
document.getElementById('qrcode').innerHTML = qrHtml;
</script>
</body>
</html>
```
- svg
``` html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>uQRCode二维码生成</title>
</head>
<body>
<svg id="qrcode" width="200" height="200" xmlns="http://www.w3.org/2000/svg" version="1.1"></svg>
<script type="text/javascript" src="uqrcode.js"></script>
<script>
// 引入uQRCode
var UQRCode = window.UQRCode;
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小必须与canvas设置的宽高一致
qr.size = 200;
// 设置二维码前景图,可以是路径
qr.foregroundImageSrc =
'data:image/png;base64,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';
// 调用制作二维码方法
qr.make();
var drawModules = qr.getDrawModules();
// 遍历drawModules创建svg元素
var qrHtml = '';
for (var i = 0; i < drawModules.length; i++) {
var drawModule = drawModules[i];
switch (drawModule.type) {
case 'tile':
/* 绘制小块 */
qrHtml += `<rect x="${drawModule.x}" y="${drawModule.y}" width="${drawModule.width}" height="${drawModule.height}" style="fill: ${drawModule.color};" />`;
break;
case 'image':
/* 绘制图像 */
qrHtml += `<image href="${drawModule.imageSrc}" x="${drawModule.x}" y="${drawModule.y}" width="${drawModule.width}" height="${drawModule.height}" />`;
break;
}
}
document.getElementById('qrcode').innerHTML = qrHtml;
</script>
</body>
</html>
```
> 更多用法大家自行探索咯,期待分享哟~
### 导出临时文件路径
原生方式基于`Canvas`的,请自行参阅各平台`Canvas`的导出方式。以下是部分示例:
- uni-app
```javascript
// 通过uni.createCanvasContext方式创建绘制上下文的对应导出API为uni.canvasToTempFilePath
// 调用完ctx.draw()方法后不能第一时间导出,否则会异常,需要有一定的延时
setTimeout(() => {
uni.canvasToTempFilePath(
{
canvasId: this.canvasId,
fileType: this.fileType,
width: this.canvasWidth,
height: this.canvasHeight,
success: res => {
console.log(res);
},
fail: err => {
console.log(err);
}
},
// this // 组件内使用必传当前实例
);
}, 300);
```
- Canvas2D
```javascript
// 得到base64
console.log(canvas.toDataURL());
// 得到buffer
console.log(canvas.toBuffer());
```
### 保存二维码到本地相册
必须在导出临时文件路径成功后再执行保存。uni-app通用保存方式H5除外
```javascript
uni.saveImageToPhotosAlbum({
filePath: tempFilePath,
success: res => {
console.log(res);
},
fail: err => {
console.log(err);
}
});
```
H5可以通过设置`<a>`标签`href`属性的方式进行保存:
```javascript
const aEle = document.createElement('a');
aEle.download = 'uQRCode'; // 设置下载的文件名,默认是'下载'
aEle.href = tempFilePath;
document.body.appendChild(aEle);
aEle.click();
aEle.remove(); // 下载之后把创建的元素删除
```
经过测试PC端浏览器可以下载部分安卓自带或第三方浏览器可以下载安卓微信浏览器不适用移动端iOS所有浏览器均不适用差异较大还是推荐各位导出文件给图片组件显示然后提示用户通过长按图片进行保存这种方式。
## uni-app组件方式
### 安装
通过uni-app插件市场地址安装[https://ext.dcloud.net.cn/plugin?id=1287](https://ext.dcloud.net.cn/plugin?id=1287)。详细配置请移步到:文档 > [uni-app组件](https://uqrcode.cn/doc/document/uni-app.html)。
### 引入
uni-app默认为easycom模式可直接键入`<uqrcode>`标签。
### 简单用法
安装`uqrcode`组件后,在`template`中键入`<uqrcode/>`。设置`ref`属性可使用组件内部方法,`canvas-id`属性为组件内部的canvas组件标识`value`属性为二维码生成对应内容,`options`为配置选项可配置二维码样式绘制Logo等详见[options](https://uqrcode.cn/doc/document/uni-app.html#options) 。
``` html
<uqrcode ref="uqrcode" canvas-id="qrcode" value="https://uqrcode.cn/doc" :options="{ margin: 10 }"></uqrcode>
```
### 导出临时文件路径
为了保证方法调用成功,请在 [complete](https://uqrcode.cn/doc/document/uni-app.html#complete) 事件返回`success=true`后调用。
```javascript
// uqrcode为组件的ref名称
this.$refs.uqrcode.toTempFilePath({
success: res => {
console.log(res);
}
});
```
### 保存二维码到本地相册
为了保证方法调用成功,请在 [complete](https://uqrcode.cn/doc/document/uni-app.html#complete) 事件返回`success=true`后调用。
```javascript
// uqrcode为组件的ref名称
this.$refs.uqrcode.save({
success: () => {
uni.showToast({
icon: 'success',
title: '保存成功'
});
}
});
```
## 更多使用说明请前往官方文档查看:[https://uqrcode.cn/doc](https://uqrcode.cn/doc)。

@ -1,12 +0,0 @@
## 4.0.62022-12-12
修复`getDrawModules`,第一次获取结果正常,后续获取`tile`模块不存在的问题;
修复安卓type:normal因Canvas API使用了小数或为0的参数导致生成异常的问题安卓非2d Canvas部分API参数不支持携带小数部分API参数必须大于0
## 4.0.12022-11-28
优化组件loading属性的表现
新增组件type选项normal以便于在某些条件编译初始为type=2d时还可以选择使用非2d组件类型
修复组件条件编译在其他编辑器语法提示报错;
修复原生对es5的支持。
## 4.0.02022-11-21
v4版本源代码全面开放开源地址[https://github.com/Sansnn/uQRCode](https://github.com/Sansnn/uQRCode)
升级说明v4为大版本更新虽然已尽可能兼容上一代版本但不可避免的还是存在一些细节差异若更新后出现问题请参考对照[v3 文档](https://uqrcode.cn/doc/v3)[v4 文档](https://uqrcode.cn/doc)进行修改。

@ -1 +0,0 @@
export const cacheImageList = [];

@ -1,41 +0,0 @@
function Queue() {
let waitingQueue = this.waitingQueue = [];
let isRunning = this.isRunning = false; // 记录是否有未完成的任务
function execute(task, resolve, reject) {
task()
.then((data) => {
resolve(data);
})
.catch((e) => {
reject(e);
})
.finally(() => {
// 等待任务队列中如果有任务则触发它否则设置isRunning = false,表示无任务状态
if (waitingQueue.length) {
const next = waitingQueue.shift();
execute(next.task, next.resolve, next.reject);
} else {
isRunning = false;
}
});
}
this.exec = function(task) {
return new Promise((resolve, reject) => {
if (isRunning) {
waitingQueue.push({
task,
resolve,
reject
});
} else {
isRunning = true;
execute(task, resolve, reject);
}
});
}
}
/* 队列实例某些平台一起使用多个组件时需要通过队列逐一绘制否则部分绘制方法异常nvue端的iOS gcanvas尤其明显在不通过队列绘制时会出现图片丢失的情况 */
export const queueDraw = new Queue();
export const queueLoadImage = new Queue();

@ -1,3 +0,0 @@
declare module '*/common/cache' {
export const cacheImageList: Array;
}

@ -1,4 +0,0 @@
declare module '*/common/queue' {
export const queueDraw: any;
export const queueLoadImage: any;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,241 +0,0 @@
const isWeex = typeof WXEnvironment !== 'undefined';
const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform);
const isWeexAndroid = isWeex && !isWeexIOS;
import GLmethod from '../context-webgl/GLmethod';
const GCanvasModule =
(typeof weex !== 'undefined' && weex.requireModule) ? (weex.requireModule('gcanvas')) :
(typeof __weex_require__ !== 'undefined') ? (__weex_require__('@weex-module/gcanvas')) : {};
let isDebugging = false;
let isComboDisabled = false;
const logCommand = (function () {
const methodQuery = [];
Object.keys(GLmethod).forEach(key => {
methodQuery[GLmethod[key]] = key;
})
const queryMethod = (id) => {
return methodQuery[parseInt(id)] || 'NotFoundMethod';
}
const logCommand = (id, cmds) => {
const mId = cmds.split(',')[0];
const mName = queryMethod(mId);
console.log(`=== callNative - componentId:${id}; method: ${mName}; cmds: ${cmds}`);
}
return logCommand;
})();
function joinArray(arr, sep) {
let res = '';
for (let i = 0; i < arr.length; i++) {
if (i !== 0) {
res += sep;
}
res += arr[i];
}
return res;
}
const commandsCache = {}
const GBridge = {
callEnable: (ref, configArray) => {
commandsCache[ref] = [];
return GCanvasModule.enable({
componentId: ref,
config: configArray
});
},
callEnableDebug: () => {
isDebugging = true;
},
callEnableDisableCombo: () => {
isComboDisabled = true;
},
callSetContextType: function (componentId, context_type) {
GCanvasModule.setContextType(context_type, componentId);
},
callReset: function(id){
GCanvasModule.resetComponent && canvasModule.resetComponent(componentId);
},
render: isWeexIOS ? function (componentId) {
return GCanvasModule.extendCallNative({
contextId: componentId,
type: 0x60000001
});
} : function (componentId) {
return callGCanvasLinkNative(componentId, 0x60000001, 'render');
},
render2d: isWeexIOS ? function (componentId, commands, callback) {
if (isDebugging) {
console.log('>>> >>> render2d ===');
console.log('>>> commands: ' + commands);
}
GCanvasModule.render([commands, callback?true:false], componentId, callback);
} : function (componentId, commands,callback) {
if (isDebugging) {
console.log('>>> >>> render2d ===');
console.log('>>> commands: ' + commands);
}
callGCanvasLinkNative(componentId, 0x20000001, commands);
if(callback){
callback();
}
},
callExtendCallNative: isWeexIOS ? function (componentId, cmdArgs) {
throw 'should not be here anymore ' + cmdArgs;
} : function (componentId, cmdArgs) {
throw 'should not be here anymore ' + cmdArgs;
},
flushNative: isWeexIOS ? function (componentId) {
const cmdArgs = joinArray(commandsCache[componentId], ';');
commandsCache[componentId] = [];
if (isDebugging) {
console.log('>>> >>> flush native ===');
console.log('>>> commands: ' + cmdArgs);
}
const result = GCanvasModule.extendCallNative({
"contextId": componentId,
"type": 0x60000000,
"args": cmdArgs
});
const res = result && result.result;
if (isDebugging) {
console.log('>>> result: ' + res);
}
return res;
} : function (componentId) {
const cmdArgs = joinArray(commandsCache[componentId], ';');
commandsCache[componentId] = [];
if (isDebugging) {
console.log('>>> >>> flush native ===');
console.log('>>> commands: ' + cmdArgs);
}
const result = callGCanvasLinkNative(componentId, 0x60000000, cmdArgs);
if (isDebugging) {
console.log('>>> result: ' + result);
}
return result;
},
callNative: function (componentId, cmdArgs, cache) {
if (isDebugging) {
logCommand(componentId, cmdArgs);
}
commandsCache[componentId].push(cmdArgs);
if (!cache || isComboDisabled) {
return GBridge.flushNative(componentId);
} else {
return undefined;
}
},
texImage2D(componentId, ...args) {
if (isWeexIOS) {
if (args.length === 6) {
const [target, level, internalformat, format, type, image] = args;
GBridge.callNative(
componentId,
GLmethod.texImage2D + ',' + 6 + ',' + target + ',' + level + ',' + internalformat + ',' + format + ',' + type + ',' + image.src
)
} else if (args.length === 9) {
const [target, level, internalformat, width, height, border, format, type, image] = args;
GBridge.callNative(
componentId,
GLmethod.texImage2D + ',' + 9 + ',' + target + ',' + level + ',' + internalformat + ',' + width + ',' + height + ',' + border + ',' +
+ format + ',' + type + ',' + (image ? image.src : 0)
)
}
} else if (isWeexAndroid) {
if (args.length === 6) {
const [target, level, internalformat, format, type, image] = args;
GCanvasModule.texImage2D(componentId, target, level, internalformat, format, type, image.src);
} else if (args.length === 9) {
const [target, level, internalformat, width, height, border, format, type, image] = args;
GCanvasModule.texImage2D(componentId, target, level, internalformat, width, height, border, format, type, (image ? image.src : 0));
}
}
},
texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image) {
if (isWeexIOS) {
if (arguments.length === 8) {
GBridge.callNative(
componentId,
GLmethod.texSubImage2D + ',' + 6 + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset, + ',' + format + ',' + type + ',' + image.src
)
}
} else if (isWeexAndroid) {
GCanvasModule.texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image.src);
}
},
bindImageTexture(componentId, src, imageId) {
GCanvasModule.bindImageTexture([src, imageId], componentId);
},
perloadImage([url, id], callback) {
GCanvasModule.preLoadImage([url, id], function (image) {
image.url = url;
image.id = id;
callback(image);
});
},
measureText(text, fontStyle, componentId) {
return GCanvasModule.measureText([text, fontStyle], componentId);
},
getImageData (componentId, x, y, w, h, callback) {
GCanvasModule.getImageData([x, y,w,h],componentId,callback);
},
putImageData (componentId, data, x, y, w, h, callback) {
GCanvasModule.putImageData([x, y,w,h,data],componentId,callback);
},
toTempFilePath(componentId, x, y, width, height, destWidth, destHeight, fileType, quality, callback){
GCanvasModule.toTempFilePath([x, y, width,height, destWidth, destHeight, fileType, quality], componentId, callback);
}
}
export default GBridge;

@ -1,18 +0,0 @@
class FillStyleLinearGradient {
constructor(x0, y0, x1, y1) {
this._start_pos = { _x: x0, _y: y0 };
this._end_pos = { _x: x1, _y: y1 };
this._stop_count = 0;
this._stops = [0, 0, 0, 0, 0];
}
addColorStop = function (pos, color) {
if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
this._stops[this._stop_count] = { _pos: pos, _color: color };
this._stop_count++;
}
}
}
export default FillStyleLinearGradient;

@ -1,8 +0,0 @@
class FillStylePattern {
constructor(img, pattern) {
this._style = pattern;
this._img = img;
}
}
export default FillStylePattern;

@ -1,17 +0,0 @@
class FillStyleRadialGradient {
constructor(x0, y0, r0, x1, y1, r1) {
this._start_pos = { _x: x0, _y: y0, _r: r0 };
this._end_pos = { _x: x1, _y: y1, _r: r1 };
this._stop_count = 0;
this._stops = [0, 0, 0, 0, 0];
}
addColorStop(pos, color) {
if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
this._stops[this._stop_count] = { _pos: pos, _color: color };
this._stop_count++;
}
}
}
export default FillStyleRadialGradient;

@ -1,666 +0,0 @@
import FillStylePattern from './FillStylePattern';
import FillStyleLinearGradient from './FillStyleLinearGradient';
import FillStyleRadialGradient from './FillStyleRadialGradient';
import GImage from '../env/image.js';
import {
ArrayBufferToBase64,
Base64ToUint8ClampedArray
} from '../env/tool.js';
export default class CanvasRenderingContext2D {
_drawCommands = '';
_globalAlpha = 1.0;
_fillStyle = 'rgb(0,0,0)';
_strokeStyle = 'rgb(0,0,0)';
_lineWidth = 1;
_lineCap = 'butt';
_lineJoin = 'miter';
_miterLimit = 10;
_globalCompositeOperation = 'source-over';
_textAlign = 'start';
_textBaseline = 'alphabetic';
_font = '10px sans-serif';
_savedGlobalAlpha = [];
timer = null;
componentId = null;
_notCommitDrawImageCache = [];
_needRedrawImageCache = [];
_redrawCommands = '';
_autoSaveContext = true;
// _imageMap = new GHashMap();
// _textureMap = new GHashMap();
constructor() {
this.className = 'CanvasRenderingContext2D';
//this.save()
}
setFillStyle(value) {
this.fillStyle = value;
}
set fillStyle(value) {
this._fillStyle = value;
if (typeof(value) == 'string') {
this._drawCommands = this._drawCommands.concat("F" + value + ";");
} else if (value instanceof FillStylePattern) {
const image = value._img;
if (!image.complete) {
image.onload = () => {
var index = this._needRedrawImageCache.indexOf(image);
if (index > -1) {
this._needRedrawImageCache.splice(index, 1);
CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
this._redrawflush(true);
}
}
this._notCommitDrawImageCache.push(image);
} else {
CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
}
//CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";");
} else if (value instanceof FillStyleLinearGradient) {
var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," +
value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," +
value._stop_count;
for (var i = 0; i < value._stop_count; ++i) {
command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
}
this._drawCommands = this._drawCommands.concat(command + ";");
} else if (value instanceof FillStyleRadialGradient) {
var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r
.toFixed(2) + "," +
value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r.toFixed(2) + "," +
value._stop_count;
for (var i = 0; i < value._stop_count; ++i) {
command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
}
this._drawCommands = this._drawCommands.concat(command + ";");
}
}
get fillStyle() {
return this._fillStyle;
}
get globalAlpha() {
return this._globalAlpha;
}
setGlobalAlpha(value) {
this.globalAlpha = value;
}
set globalAlpha(value) {
this._globalAlpha = value;
this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2) + ";");
}
get strokeStyle() {
return this._strokeStyle;
}
setStrokeStyle(value) {
this.strokeStyle = value;
}
set strokeStyle(value) {
this._strokeStyle = value;
if (typeof(value) == 'string') {
this._drawCommands = this._drawCommands.concat("S" + value + ";");
} else if (value instanceof FillStylePattern) {
CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";");
} else if (value instanceof FillStyleLinearGradient) {
var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," +
value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," +
value._stop_count;
for (var i = 0; i < value._stop_count; ++i) {
command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
}
this._drawCommands = this._drawCommands.concat(command + ";");
} else if (value instanceof FillStyleRadialGradient) {
var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r
.toFixed(2) + "," +
value._end_pos._x.toFixed(2) + "," + value._end_pos._y + ",".toFixed(2) + value._end_pos._r.toFixed(2) + "," +
value._stop_count;
for (var i = 0; i < value._stop_count; ++i) {
command += ("," + value._stops[i]._pos + "," + value._stops[i]._color);
}
this._drawCommands = this._drawCommands.concat(command + ";");
}
}
get lineWidth() {
return this._lineWidth;
}
setLineWidth(value) {
this.lineWidth = value;
}
set lineWidth(value) {
this._lineWidth = value;
this._drawCommands = this._drawCommands.concat("W" + value + ";");
}
get lineCap() {
return this._lineCap;
}
setLineCap(value) {
this.lineCap = value;
}
set lineCap(value) {
this._lineCap = value;
this._drawCommands = this._drawCommands.concat("C" + value + ";");
}
get lineJoin() {
return this._lineJoin;
}
setLineJoin(value) {
this.lineJoin = value
}
set lineJoin(value) {
this._lineJoin = value;
this._drawCommands = this._drawCommands.concat("J" + value + ";");
}
get miterLimit() {
return this._miterLimit;
}
setMiterLimit(value) {
this.miterLimit = value
}
set miterLimit(value) {
this._miterLimit = value;
this._drawCommands = this._drawCommands.concat("M" + value + ";");
}
get globalCompositeOperation() {
return this._globalCompositeOperation;
}
set globalCompositeOperation(value) {
this._globalCompositeOperation = value;
let mode = 0;
switch (value) {
case "source-over":
mode = 0;
break;
case "source-atop":
mode = 5;
break;
case "source-in":
mode = 0;
break;
case "source-out":
mode = 2;
break;
case "destination-over":
mode = 4;
break;
case "destination-atop":
mode = 4;
break;
case "destination-in":
mode = 4;
break;
case "destination-out":
mode = 3;
break;
case "lighter":
mode = 1;
break;
case "copy":
mode = 2;
break;
case "xor":
mode = 6;
break;
default:
mode = 0;
}
this._drawCommands = this._drawCommands.concat("B" + mode + ";");
}
get textAlign() {
return this._textAlign;
}
setTextAlign(value) {
this.textAlign = value
}
set textAlign(value) {
this._textAlign = value;
let Align = 0;
switch (value) {
case "start":
Align = 0;
break;
case "end":
Align = 1;
break;
case "left":
Align = 2;
break;
case "center":
Align = 3;
break;
case "right":
Align = 4;
break;
default:
Align = 0;
}
this._drawCommands = this._drawCommands.concat("A" + Align + ";");
}
get textBaseline() {
return this._textBaseline;
}
setTextBaseline(value) {
this.textBaseline = value
}
set textBaseline(value) {
this._textBaseline = value;
let baseline = 0;
switch (value) {
case "alphabetic":
baseline = 0;
break;
case "middle":
baseline = 1;
break;
case "top":
baseline = 2;
break;
case "hanging":
baseline = 3;
break;
case "bottom":
baseline = 4;
break;
case "ideographic":
baseline = 5;
break;
default:
baseline = 0;
break;
}
this._drawCommands = this._drawCommands.concat("E" + baseline + ";");
}
get font() {
return this._font;
}
setFontSize(size) {
var str = this._font;
var strs = str.trim().split(/\s+/);
for (var i = 0; i < strs.length; i++) {
var values = ["normal", "italic", "oblique", "normal", "small-caps", "normal", "bold",
"bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900",
"normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed",
"semi-expanded", "expanded", "extra-expanded", "ultra-expanded"
];
if (-1 == values.indexOf(strs[i].trim())) {
if (typeof size === 'string') {
strs[i] = size;
} else if (typeof size === 'number') {
strs[i] = String(size) + 'px';
}
break;
}
}
this.font = strs.join(" ");
}
set font(value) {
this._font = value;
this._drawCommands = this._drawCommands.concat("j" + value + ";");
}
setTransform(a, b, c, d, tx, ty) {
this._drawCommands = this._drawCommands.concat("t" +
(a === 1 ? "1" : a.toFixed(2)) + "," +
(b === 0 ? "0" : b.toFixed(2)) + "," +
(c === 0 ? "0" : c.toFixed(2)) + "," +
(d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
}
transform(a, b, c, d, tx, ty) {
this._drawCommands = this._drawCommands.concat("f" +
(a === 1 ? "1" : a.toFixed(2)) + "," +
(b === 0 ? "0" : b.toFixed(2)) + "," +
(c === 0 ? "0" : c.toFixed(2)) + "," +
(d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";");
}
resetTransform() {
this._drawCommands = this._drawCommands.concat("m;");
}
scale(a, d) {
this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + "," +
d.toFixed(2) + ";");
}
rotate(angle) {
this._drawCommands = this._drawCommands
.concat("r" + angle.toFixed(6) + ";");
}
translate(tx, ty) {
this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";");
}
save() {
this._savedGlobalAlpha.push(this._globalAlpha);
this._drawCommands = this._drawCommands.concat("v;");
}
restore() {
this._drawCommands = this._drawCommands.concat("e;");
this._globalAlpha = this._savedGlobalAlpha.pop();
}
createPattern(img, pattern) {
if (typeof img === 'string') {
var imgObj = new GImage();
imgObj.src = img;
img = imgObj;
}
return new FillStylePattern(img, pattern);
}
createLinearGradient(x0, y0, x1, y1) {
return new FillStyleLinearGradient(x0, y0, x1, y1);
}
createRadialGradient = function(x0, y0, r0, x1, y1, r1) {
return new FillStyleRadialGradient(x0, y0, r0, x1, y1, r1);
};
createCircularGradient = function(x0, y0, r0) {
return new FillStyleRadialGradient(x0, y0, 0, x0, y0, r0);
};
strokeRect(x, y, w, h) {
this._drawCommands = this._drawCommands.concat("s" + x + "," + y + "," + w + "," + h + ";");
}
clearRect(x, y, w, h) {
this._drawCommands = this._drawCommands.concat("c" + x + "," + y + "," + w +
"," + h + ";");
}
clip() {
this._drawCommands = this._drawCommands.concat("p;");
}
resetClip() {
this._drawCommands = this._drawCommands.concat("q;");
}
closePath() {
this._drawCommands = this._drawCommands.concat("o;");
}
moveTo(x, y) {
this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + "," + y.toFixed(2) + ";");
}
lineTo(x, y) {
this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + "," + y.toFixed(2) + ";");
}
quadraticCurveTo = function(cpx, cpy, x, y) {
this._drawCommands = this._drawCommands.concat("u" + cpx + "," + cpy + "," + x + "," + y + ";");
}
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, ) {
this._drawCommands = this._drawCommands.concat(
"z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2) + "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," +
x.toFixed(2) + "," + y.toFixed(2) + ";");
}
arcTo(x1, y1, x2, y2, radius) {
this._drawCommands = this._drawCommands.concat("h" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + radius + ";");
}
beginPath() {
this._drawCommands = this._drawCommands.concat("b;");
}
fillRect(x, y, w, h) {
this._drawCommands = this._drawCommands.concat("n" + x + "," + y + "," + w +
"," + h + ";");
}
rect(x, y, w, h) {
this._drawCommands = this._drawCommands.concat("w" + x + "," + y + "," + w + "," + h + ";");
}
fill() {
this._drawCommands = this._drawCommands.concat("L;");
}
stroke(path) {
this._drawCommands = this._drawCommands.concat("x;");
}
arc(x, y, radius, startAngle, endAngle, anticlockwise) {
let ianticlockwise = 0;
if (anticlockwise) {
ianticlockwise = 1;
}
this._drawCommands = this._drawCommands.concat(
"y" + x.toFixed(2) + "," + y.toFixed(2) + "," +
radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise +
";"
);
}
fillText(text, x, y) {
let tmptext = text.replace(/!/g, "!!");
tmptext = tmptext.replace(/,/g, "!,");
tmptext = tmptext.replace(/;/g, "!;");
this._drawCommands = this._drawCommands.concat("T" + tmptext + "," + x + "," + y + ",0.0;");
}
strokeText = function(text, x, y) {
let tmptext = text.replace(/!/g, "!!");
tmptext = tmptext.replace(/,/g, "!,");
tmptext = tmptext.replace(/;/g, "!;");
this._drawCommands = this._drawCommands.concat("U" + tmptext + "," + x + "," + y + ",0.0;");
}
measureText(text) {
return CanvasRenderingContext2D.GBridge.measureText(text, this.font, this.componentId);
}
isPointInPath = function(x, y) {
throw new Error('GCanvas not supported yet');
}
drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
if (typeof image === 'string') {
var imgObj = new GImage();
imgObj.src = image;
image = imgObj;
}
if (image instanceof GImage) {
if (!image.complete) {
imgObj.onload = () => {
var index = this._needRedrawImageCache.indexOf(image);
if (index > -1) {
this._needRedrawImageCache.splice(index, 1);
CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
this._redrawflush(true);
}
}
this._notCommitDrawImageCache.push(image);
} else {
CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id);
}
var srcArgs = [image, sx, sy, sw, sh, dx, dy, dw, dh];
var args = [];
for (var arg in srcArgs) {
if (typeof(srcArgs[arg]) != 'undefined') {
args.push(srcArgs[arg]);
}
}
this.__drawImage.apply(this, args);
//this.__drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh);
}
}
__drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) {
const numArgs = arguments.length;
function drawImageCommands() {
if (numArgs === 3) {
const x = parseFloat(sx) || 0.0;
const y = parseFloat(sy) || 0.0;
return ("d" + image._id + ",0,0," +
image.width + "," + image.height + "," +
x + "," + y + "," + image.width + "," + image.height + ";");
} else if (numArgs === 5) {
const x = parseFloat(sx) || 0.0;
const y = parseFloat(sy) || 0.0;
const width = parseInt(sw) || image.width;
const height = parseInt(sh) || image.height;
return ("d" + image._id + ",0,0," +
image.width + "," + image.height + "," +
x + "," + y + "," + width + "," + height + ";");
} else if (numArgs === 9) {
sx = parseFloat(sx) || 0.0;
sy = parseFloat(sy) || 0.0;
sw = parseInt(sw) || image.width;
sh = parseInt(sh) || image.height;
dx = parseFloat(dx) || 0.0;
dy = parseFloat(dy) || 0.0;
dw = parseInt(dw) || image.width;
dh = parseInt(dh) || image.height;
return ("d" + image._id + "," +
sx + "," + sy + "," + sw + "," + sh + "," +
dx + "," + dy + "," + dw + "," + dh + ";");
}
}
this._drawCommands += drawImageCommands();
}
_flush(reserve, callback) {
const commands = this._drawCommands;
this._drawCommands = '';
CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback);
this._needRender = false;
}
_redrawflush(reserve, callback) {
const commands = this._redrawCommands;
CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback);
if (this._needRedrawImageCache.length == 0) {
this._redrawCommands = '';
}
}
draw(reserve, callback) {
if (!reserve) {
this._globalAlpha = this._savedGlobalAlpha.pop();
this._savedGlobalAlpha.push(this._globalAlpha);
this._redrawCommands = this._drawCommands;
this._needRedrawImageCache = this._notCommitDrawImageCache;
if (this._autoSaveContext) {
this._drawCommands = ("v;" + this._drawCommands);
this._autoSaveContext = false;
} else {
this._drawCommands = ("e;X;v;" + this._drawCommands);
}
} else {
this._needRedrawImageCache = this._needRedrawImageCache.concat(this._notCommitDrawImageCache);
this._redrawCommands += this._drawCommands;
if (this._autoSaveContext) {
this._drawCommands = ("v;" + this._drawCommands);
this._autoSaveContext = false;
}
}
this._notCommitDrawImageCache = [];
if (this._flush) {
this._flush(reserve, callback);
}
}
getImageData(x, y, w, h, callback) {
CanvasRenderingContext2D.GBridge.getImageData(this.componentId, x, y, w, h, function(res) {
res.data = Base64ToUint8ClampedArray(res.data);
if (typeof(callback) == 'function') {
callback(res);
}
});
}
putImageData(data, x, y, w, h, callback) {
if (data instanceof Uint8ClampedArray) {
data = ArrayBufferToBase64(data);
CanvasRenderingContext2D.GBridge.putImageData(this.componentId, data, x, y, w, h, function(res) {
if (typeof(callback) == 'function') {
callback(res);
}
});
}
}
toTempFilePath(x, y, width, height, destWidth, destHeight, fileType, quality, callback) {
CanvasRenderingContext2D.GBridge.toTempFilePath(this.componentId, x, y, width, height, destWidth, destHeight,
fileType, quality,
function(res) {
if (typeof(callback) == 'function') {
callback(res);
}
});
}
}

@ -1,11 +0,0 @@
export default class WebGLActiveInfo {
className = 'WebGLActiveInfo';
constructor({
type, name, size
}) {
this.type = type;
this.name = name;
this.size = size;
}
}

@ -1,21 +0,0 @@
import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLBuffer';
function uuid(id) {
return getTransferedObjectUUID(name, id);
}
export default class WebGLBuffer {
className = name;
constructor(id) {
this.id = id;
}
static uuid = uuid;
uuid() {
return uuid(this.id);
}
}

@ -1,21 +0,0 @@
import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLFrameBuffer';
function uuid(id) {
return getTransferedObjectUUID(name, id);
}
export default class WebGLFramebuffer {
className = name;
constructor(id) {
this.id = id;
}
static uuid = uuid;
uuid() {
return uuid(this.id);
}
}

@ -1,298 +0,0 @@
export default {
"DEPTH_BUFFER_BIT": 256,
"STENCIL_BUFFER_BIT": 1024,
"COLOR_BUFFER_BIT": 16384,
"POINTS": 0,
"LINES": 1,
"LINE_LOOP": 2,
"LINE_STRIP": 3,
"TRIANGLES": 4,
"TRIANGLE_STRIP": 5,
"TRIANGLE_FAN": 6,
"ZERO": 0,
"ONE": 1,
"SRC_COLOR": 768,
"ONE_MINUS_SRC_COLOR": 769,
"SRC_ALPHA": 770,
"ONE_MINUS_SRC_ALPHA": 771,
"DST_ALPHA": 772,
"ONE_MINUS_DST_ALPHA": 773,
"DST_COLOR": 774,
"ONE_MINUS_DST_COLOR": 775,
"SRC_ALPHA_SATURATE": 776,
"FUNC_ADD": 32774,
"BLEND_EQUATION": 32777,
"BLEND_EQUATION_RGB": 32777,
"BLEND_EQUATION_ALPHA": 34877,
"FUNC_SUBTRACT": 32778,
"FUNC_REVERSE_SUBTRACT": 32779,
"BLEND_DST_RGB": 32968,
"BLEND_SRC_RGB": 32969,
"BLEND_DST_ALPHA": 32970,
"BLEND_SRC_ALPHA": 32971,
"CONSTANT_COLOR": 32769,
"ONE_MINUS_CONSTANT_COLOR": 32770,
"CONSTANT_ALPHA": 32771,
"ONE_MINUS_CONSTANT_ALPHA": 32772,
"BLEND_COLOR": 32773,
"ARRAY_BUFFER": 34962,
"ELEMENT_ARRAY_BUFFER": 34963,
"ARRAY_BUFFER_BINDING": 34964,
"ELEMENT_ARRAY_BUFFER_BINDING": 34965,
"STREAM_DRAW": 35040,
"STATIC_DRAW": 35044,
"DYNAMIC_DRAW": 35048,
"BUFFER_SIZE": 34660,
"BUFFER_USAGE": 34661,
"CURRENT_VERTEX_ATTRIB": 34342,
"FRONT": 1028,
"BACK": 1029,
"FRONT_AND_BACK": 1032,
"TEXTURE_2D": 3553,
"CULL_FACE": 2884,
"BLEND": 3042,
"DITHER": 3024,
"STENCIL_TEST": 2960,
"DEPTH_TEST": 2929,
"SCISSOR_TEST": 3089,
"POLYGON_OFFSET_FILL": 32823,
"SAMPLE_ALPHA_TO_COVERAGE": 32926,
"SAMPLE_COVERAGE": 32928,
"NO_ERROR": 0,
"INVALID_ENUM": 1280,
"INVALID_VALUE": 1281,
"INVALID_OPERATION": 1282,
"OUT_OF_MEMORY": 1285,
"CW": 2304,
"CCW": 2305,
"LINE_WIDTH": 2849,
"ALIASED_POINT_SIZE_RANGE": 33901,
"ALIASED_LINE_WIDTH_RANGE": 33902,
"CULL_FACE_MODE": 2885,
"FRONT_FACE": 2886,
"DEPTH_RANGE": 2928,
"DEPTH_WRITEMASK": 2930,
"DEPTH_CLEAR_VALUE": 2931,
"DEPTH_FUNC": 2932,
"STENCIL_CLEAR_VALUE": 2961,
"STENCIL_FUNC": 2962,
"STENCIL_FAIL": 2964,
"STENCIL_PASS_DEPTH_FAIL": 2965,
"STENCIL_PASS_DEPTH_PASS": 2966,
"STENCIL_REF": 2967,
"STENCIL_VALUE_MASK": 2963,
"STENCIL_WRITEMASK": 2968,
"STENCIL_BACK_FUNC": 34816,
"STENCIL_BACK_FAIL": 34817,
"STENCIL_BACK_PASS_DEPTH_FAIL": 34818,
"STENCIL_BACK_PASS_DEPTH_PASS": 34819,
"STENCIL_BACK_REF": 36003,
"STENCIL_BACK_VALUE_MASK": 36004,
"STENCIL_BACK_WRITEMASK": 36005,
"VIEWPORT": 2978,
"SCISSOR_BOX": 3088,
"COLOR_CLEAR_VALUE": 3106,
"COLOR_WRITEMASK": 3107,
"UNPACK_ALIGNMENT": 3317,
"PACK_ALIGNMENT": 3333,
"MAX_TEXTURE_SIZE": 3379,
"MAX_VIEWPORT_DIMS": 3386,
"SUBPIXEL_BITS": 3408,
"RED_BITS": 3410,
"GREEN_BITS": 3411,
"BLUE_BITS": 3412,
"ALPHA_BITS": 3413,
"DEPTH_BITS": 3414,
"STENCIL_BITS": 3415,
"POLYGON_OFFSET_UNITS": 10752,
"POLYGON_OFFSET_FACTOR": 32824,
"TEXTURE_BINDING_2D": 32873,
"SAMPLE_BUFFERS": 32936,
"SAMPLES": 32937,
"SAMPLE_COVERAGE_VALUE": 32938,
"SAMPLE_COVERAGE_INVERT": 32939,
"COMPRESSED_TEXTURE_FORMATS": 34467,
"DONT_CARE": 4352,
"FASTEST": 4353,
"NICEST": 4354,
"GENERATE_MIPMAP_HINT": 33170,
"BYTE": 5120,
"UNSIGNED_BYTE": 5121,
"SHORT": 5122,
"UNSIGNED_SHORT": 5123,
"INT": 5124,
"UNSIGNED_INT": 5125,
"FLOAT": 5126,
"DEPTH_COMPONENT": 6402,
"ALPHA": 6406,
"RGB": 6407,
"RGBA": 6408,
"LUMINANCE": 6409,
"LUMINANCE_ALPHA": 6410,
"UNSIGNED_SHORT_4_4_4_4": 32819,
"UNSIGNED_SHORT_5_5_5_1": 32820,
"UNSIGNED_SHORT_5_6_5": 33635,
"FRAGMENT_SHADER": 35632,
"VERTEX_SHADER": 35633,
"MAX_VERTEX_ATTRIBS": 34921,
"MAX_VERTEX_UNIFORM_VECTORS": 36347,
"MAX_VARYING_VECTORS": 36348,
"MAX_COMBINED_TEXTURE_IMAGE_UNITS": 35661,
"MAX_VERTEX_TEXTURE_IMAGE_UNITS": 35660,
"MAX_TEXTURE_IMAGE_UNITS": 34930,
"MAX_FRAGMENT_UNIFORM_VECTORS": 36349,
"SHADER_TYPE": 35663,
"DELETE_STATUS": 35712,
"LINK_STATUS": 35714,
"VALIDATE_STATUS": 35715,
"ATTACHED_SHADERS": 35717,
"ACTIVE_UNIFORMS": 35718,
"ACTIVE_ATTRIBUTES": 35721,
"SHADING_LANGUAGE_VERSION": 35724,
"CURRENT_PROGRAM": 35725,
"NEVER": 512,
"LESS": 513,
"EQUAL": 514,
"LEQUAL": 515,
"GREATER": 516,
"NOTEQUAL": 517,
"GEQUAL": 518,
"ALWAYS": 519,
"KEEP": 7680,
"REPLACE": 7681,
"INCR": 7682,
"DECR": 7683,
"INVERT": 5386,
"INCR_WRAP": 34055,
"DECR_WRAP": 34056,
"VENDOR": 7936,
"RENDERER": 7937,
"VERSION": 7938,
"NEAREST": 9728,
"LINEAR": 9729,
"NEAREST_MIPMAP_NEAREST": 9984,
"LINEAR_MIPMAP_NEAREST": 9985,
"NEAREST_MIPMAP_LINEAR": 9986,
"LINEAR_MIPMAP_LINEAR": 9987,
"TEXTURE_MAG_FILTER": 10240,
"TEXTURE_MIN_FILTER": 10241,
"TEXTURE_WRAP_S": 10242,
"TEXTURE_WRAP_T": 10243,
"TEXTURE": 5890,
"TEXTURE_CUBE_MAP": 34067,
"TEXTURE_BINDING_CUBE_MAP": 34068,
"TEXTURE_CUBE_MAP_POSITIVE_X": 34069,
"TEXTURE_CUBE_MAP_NEGATIVE_X": 34070,
"TEXTURE_CUBE_MAP_POSITIVE_Y": 34071,
"TEXTURE_CUBE_MAP_NEGATIVE_Y": 34072,
"TEXTURE_CUBE_MAP_POSITIVE_Z": 34073,
"TEXTURE_CUBE_MAP_NEGATIVE_Z": 34074,
"MAX_CUBE_MAP_TEXTURE_SIZE": 34076,
"TEXTURE0": 33984,
"TEXTURE1": 33985,
"TEXTURE2": 33986,
"TEXTURE3": 33987,
"TEXTURE4": 33988,
"TEXTURE5": 33989,
"TEXTURE6": 33990,
"TEXTURE7": 33991,
"TEXTURE8": 33992,
"TEXTURE9": 33993,
"TEXTURE10": 33994,
"TEXTURE11": 33995,
"TEXTURE12": 33996,
"TEXTURE13": 33997,
"TEXTURE14": 33998,
"TEXTURE15": 33999,
"TEXTURE16": 34000,
"TEXTURE17": 34001,
"TEXTURE18": 34002,
"TEXTURE19": 34003,
"TEXTURE20": 34004,
"TEXTURE21": 34005,
"TEXTURE22": 34006,
"TEXTURE23": 34007,
"TEXTURE24": 34008,
"TEXTURE25": 34009,
"TEXTURE26": 34010,
"TEXTURE27": 34011,
"TEXTURE28": 34012,
"TEXTURE29": 34013,
"TEXTURE30": 34014,
"TEXTURE31": 34015,
"ACTIVE_TEXTURE": 34016,
"REPEAT": 10497,
"CLAMP_TO_EDGE": 33071,
"MIRRORED_REPEAT": 33648,
"FLOAT_VEC2": 35664,
"FLOAT_VEC3": 35665,
"FLOAT_VEC4": 35666,
"INT_VEC2": 35667,
"INT_VEC3": 35668,
"INT_VEC4": 35669,
"BOOL": 35670,
"BOOL_VEC2": 35671,
"BOOL_VEC3": 35672,
"BOOL_VEC4": 35673,
"FLOAT_MAT2": 35674,
"FLOAT_MAT3": 35675,
"FLOAT_MAT4": 35676,
"SAMPLER_2D": 35678,
"SAMPLER_CUBE": 35680,
"VERTEX_ATTRIB_ARRAY_ENABLED": 34338,
"VERTEX_ATTRIB_ARRAY_SIZE": 34339,
"VERTEX_ATTRIB_ARRAY_STRIDE": 34340,
"VERTEX_ATTRIB_ARRAY_TYPE": 34341,
"VERTEX_ATTRIB_ARRAY_NORMALIZED": 34922,
"VERTEX_ATTRIB_ARRAY_POINTER": 34373,
"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING": 34975,
"IMPLEMENTATION_COLOR_READ_TYPE": 35738,
"IMPLEMENTATION_COLOR_READ_FORMAT": 35739,
"COMPILE_STATUS": 35713,
"LOW_FLOAT": 36336,
"MEDIUM_FLOAT": 36337,
"HIGH_FLOAT": 36338,
"LOW_INT": 36339,
"MEDIUM_INT": 36340,
"HIGH_INT": 36341,
"FRAMEBUFFER": 36160,
"RENDERBUFFER": 36161,
"RGBA4": 32854,
"RGB5_A1": 32855,
"RGB565": 36194,
"DEPTH_COMPONENT16": 33189,
"STENCIL_INDEX8": 36168,
"DEPTH_STENCIL": 34041,
"RENDERBUFFER_WIDTH": 36162,
"RENDERBUFFER_HEIGHT": 36163,
"RENDERBUFFER_INTERNAL_FORMAT": 36164,
"RENDERBUFFER_RED_SIZE": 36176,
"RENDERBUFFER_GREEN_SIZE": 36177,
"RENDERBUFFER_BLUE_SIZE": 36178,
"RENDERBUFFER_ALPHA_SIZE": 36179,
"RENDERBUFFER_DEPTH_SIZE": 36180,
"RENDERBUFFER_STENCIL_SIZE": 36181,
"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE": 36048,
"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME": 36049,
"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL": 36050,
"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE": 36051,
"COLOR_ATTACHMENT0": 36064,
"DEPTH_ATTACHMENT": 36096,
"STENCIL_ATTACHMENT": 36128,
"DEPTH_STENCIL_ATTACHMENT": 33306,
"NONE": 0,
"FRAMEBUFFER_COMPLETE": 36053,
"FRAMEBUFFER_INCOMPLETE_ATTACHMENT": 36054,
"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT": 36055,
"FRAMEBUFFER_INCOMPLETE_DIMENSIONS": 36057,
"FRAMEBUFFER_UNSUPPORTED": 36061,
"FRAMEBUFFER_BINDING": 36006,
"RENDERBUFFER_BINDING": 36007,
"MAX_RENDERBUFFER_SIZE": 34024,
"INVALID_FRAMEBUFFER_OPERATION": 1286,
"UNPACK_FLIP_Y_WEBGL": 37440,
"UNPACK_PREMULTIPLY_ALPHA_WEBGL": 37441,
"CONTEXT_LOST_WEBGL": 37442,
"UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443,
"BROWSER_DEFAULT_WEBGL": 37444
};

@ -1,142 +0,0 @@
let i = 1;
const GLmethod = {};
GLmethod.activeTexture = i++; //1
GLmethod.attachShader = i++;
GLmethod.bindAttribLocation = i++;
GLmethod.bindBuffer = i++;
GLmethod.bindFramebuffer = i++;
GLmethod.bindRenderbuffer = i++;
GLmethod.bindTexture = i++;
GLmethod.blendColor = i++;
GLmethod.blendEquation = i++;
GLmethod.blendEquationSeparate = i++; //10
GLmethod.blendFunc = i++;
GLmethod.blendFuncSeparate = i++;
GLmethod.bufferData = i++;
GLmethod.bufferSubData = i++;
GLmethod.checkFramebufferStatus = i++;
GLmethod.clear = i++;
GLmethod.clearColor = i++;
GLmethod.clearDepth = i++;
GLmethod.clearStencil = i++;
GLmethod.colorMask = i++; //20
GLmethod.compileShader = i++;
GLmethod.compressedTexImage2D = i++;
GLmethod.compressedTexSubImage2D = i++;
GLmethod.copyTexImage2D = i++;
GLmethod.copyTexSubImage2D = i++;
GLmethod.createBuffer = i++;
GLmethod.createFramebuffer = i++;
GLmethod.createProgram = i++;
GLmethod.createRenderbuffer = i++;
GLmethod.createShader = i++; //30
GLmethod.createTexture = i++;
GLmethod.cullFace = i++;
GLmethod.deleteBuffer = i++;
GLmethod.deleteFramebuffer = i++;
GLmethod.deleteProgram = i++;
GLmethod.deleteRenderbuffer = i++;
GLmethod.deleteShader = i++;
GLmethod.deleteTexture = i++;
GLmethod.depthFunc = i++;
GLmethod.depthMask = i++; //40
GLmethod.depthRange = i++;
GLmethod.detachShader = i++;
GLmethod.disable = i++;
GLmethod.disableVertexAttribArray = i++;
GLmethod.drawArrays = i++;
GLmethod.drawArraysInstancedANGLE = i++;
GLmethod.drawElements = i++;
GLmethod.drawElementsInstancedANGLE = i++;
GLmethod.enable = i++;
GLmethod.enableVertexAttribArray = i++; //50
GLmethod.flush = i++;
GLmethod.framebufferRenderbuffer = i++;
GLmethod.framebufferTexture2D = i++;
GLmethod.frontFace = i++;
GLmethod.generateMipmap = i++;
GLmethod.getActiveAttrib = i++;
GLmethod.getActiveUniform = i++;
GLmethod.getAttachedShaders = i++;
GLmethod.getAttribLocation = i++;
GLmethod.getBufferParameter = i++; //60
GLmethod.getContextAttributes = i++;
GLmethod.getError = i++;
GLmethod.getExtension = i++;
GLmethod.getFramebufferAttachmentParameter = i++;
GLmethod.getParameter = i++;
GLmethod.getProgramInfoLog = i++;
GLmethod.getProgramParameter = i++;
GLmethod.getRenderbufferParameter = i++;
GLmethod.getShaderInfoLog = i++;
GLmethod.getShaderParameter = i++; //70
GLmethod.getShaderPrecisionFormat = i++;
GLmethod.getShaderSource = i++;
GLmethod.getSupportedExtensions = i++;
GLmethod.getTexParameter = i++;
GLmethod.getUniform = i++;
GLmethod.getUniformLocation = i++;
GLmethod.getVertexAttrib = i++;
GLmethod.getVertexAttribOffset = i++;
GLmethod.isBuffer = i++;
GLmethod.isContextLost = i++; //80
GLmethod.isEnabled = i++;
GLmethod.isFramebuffer = i++;
GLmethod.isProgram = i++;
GLmethod.isRenderbuffer = i++;
GLmethod.isShader = i++;
GLmethod.isTexture = i++;
GLmethod.lineWidth = i++;
GLmethod.linkProgram = i++;
GLmethod.pixelStorei = i++;
GLmethod.polygonOffset = i++; //90
GLmethod.readPixels = i++;
GLmethod.renderbufferStorage = i++;
GLmethod.sampleCoverage = i++;
GLmethod.scissor = i++;
GLmethod.shaderSource = i++;
GLmethod.stencilFunc = i++;
GLmethod.stencilFuncSeparate = i++;
GLmethod.stencilMask = i++;
GLmethod.stencilMaskSeparate = i++;
GLmethod.stencilOp = i++; //100
GLmethod.stencilOpSeparate = i++;
GLmethod.texImage2D = i++;
GLmethod.texParameterf = i++;
GLmethod.texParameteri = i++;
GLmethod.texSubImage2D = i++;
GLmethod.uniform1f = i++;
GLmethod.uniform1fv = i++;
GLmethod.uniform1i = i++;
GLmethod.uniform1iv = i++;
GLmethod.uniform2f = i++; //110
GLmethod.uniform2fv = i++;
GLmethod.uniform2i = i++;
GLmethod.uniform2iv = i++;
GLmethod.uniform3f = i++;
GLmethod.uniform3fv = i++;
GLmethod.uniform3i = i++;
GLmethod.uniform3iv = i++;
GLmethod.uniform4f = i++;
GLmethod.uniform4fv = i++;
GLmethod.uniform4i = i++; //120
GLmethod.uniform4iv = i++;
GLmethod.uniformMatrix2fv = i++;
GLmethod.uniformMatrix3fv = i++;
GLmethod.uniformMatrix4fv = i++;
GLmethod.useProgram = i++;
GLmethod.validateProgram = i++;
GLmethod.vertexAttrib1f = i++; //new
GLmethod.vertexAttrib2f = i++; //new
GLmethod.vertexAttrib3f = i++; //new
GLmethod.vertexAttrib4f = i++; //new //130
GLmethod.vertexAttrib1fv = i++; //new
GLmethod.vertexAttrib2fv = i++; //new
GLmethod.vertexAttrib3fv = i++; //new
GLmethod.vertexAttrib4fv = i++; //new
GLmethod.vertexAttribPointer = i++;
GLmethod.viewport = i++;
export default GLmethod;

@ -1,23 +0,0 @@
const GLtype = {};
[
"GLbitfield",
"GLboolean",
"GLbyte",
"GLclampf",
"GLenum",
"GLfloat",
"GLint",
"GLintptr",
"GLsizei",
"GLsizeiptr",
"GLshort",
"GLubyte",
"GLuint",
"GLushort"
].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1));
export default GLtype;

@ -1,21 +0,0 @@
import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLProgram';
function uuid(id) {
return getTransferedObjectUUID(name, id);
}
export default class WebGLProgram {
className = name;
constructor(id) {
this.id = id;
}
static uuid = uuid;
uuid() {
return uuid(this.id);
}
}

@ -1,21 +0,0 @@
import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLRenderBuffer';
function uuid(id) {
return getTransferedObjectUUID(name, id);
}
export default class WebGLRenderbuffer {
className = name;
constructor(id) {
this.id = id;
}
static uuid = uuid;
uuid() {
return uuid(this.id);
}
}

@ -1,22 +0,0 @@
import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLShader';
function uuid(id) {
return getTransferedObjectUUID(name, id);
}
export default class WebGLShader {
className = name;
constructor(id, type) {
this.id = id;
this.type = type;
}
static uuid = uuid;
uuid() {
return uuid(this.id);
}
}

@ -1,11 +0,0 @@
export default class WebGLShaderPrecisionFormat {
className = 'WebGLShaderPrecisionFormat';
constructor({
rangeMin, rangeMax, precision
}) {
this.rangeMin = rangeMin;
this.rangeMax = rangeMax;
this.precision = precision;
}
}

@ -1,22 +0,0 @@
import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLTexture';
function uuid(id) {
return getTransferedObjectUUID(name, id);
}
export default class WebGLTexture {
className = name;
constructor(id, type) {
this.id = id;
this.type = type;
}
static uuid = uuid;
uuid() {
return uuid(this.id);
}
}

@ -1,22 +0,0 @@
import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLUniformLocation';
function uuid(id) {
return getTransferedObjectUUID(name, id);
}
export default class WebGLUniformLocation {
className = name;
constructor(id, type) {
this.id = id;
this.type = type;
}
static uuid = uuid;
uuid() {
return uuid(this.id);
}
}

@ -1,3 +0,0 @@
export function getTransferedObjectUUID(name, id) {
return `${name.toLowerCase()}-${id}`;
}

@ -1,74 +0,0 @@
import GContext2D from '../context-2d/RenderingContext';
import GContextWebGL from '../context-webgl/RenderingContext';
export default class GCanvas {
// static GBridge = null;
id = null;
_needRender = true;
constructor(id, { disableAutoSwap }) {
this.id = id;
this._disableAutoSwap = disableAutoSwap;
if (disableAutoSwap) {
this._swapBuffers = () => {
GCanvas.GBridge.render(this.id);
}
}
}
getContext(type) {
let context = null;
if (type.match(/webgl/i)) {
context = new GContextWebGL(this);
context.componentId = this.id;
if (!this._disableAutoSwap) {
const render = () => {
if (this._needRender) {
GCanvas.GBridge.render(this.id);
this._needRender = false;
}
}
setInterval(render, 16);
}
GCanvas.GBridge.callSetContextType(this.id, 1); // 0 for 2d; 1 for webgl
} else if (type.match(/2d/i)) {
context = new GContext2D(this);
context.componentId = this.id;
// const render = ( callback ) => {
//
// const commands = context._drawCommands;
// context._drawCommands = '';
//
// GCanvas.GBridge.render2d(this.id, commands, callback);
// this._needRender = false;
// }
// //draw方法触发
// context._flush = render;
// //setInterval(render, 16);
GCanvas.GBridge.callSetContextType(this.id, 0);
} else {
throw new Error('not supported context ' + type);
}
return context;
}
reset() {
GCanvas.GBridge.callReset(this.id);
}
}

@ -1,96 +0,0 @@
let incId = 1;
const noop = function () { };
class GImage {
static GBridge = null;
constructor() {
this._id = incId++;
this._width = 0;
this._height = 0;
this._src = undefined;
this._onload = noop;
this._onerror = noop;
this.complete = false;
}
get width() {
return this._width;
}
set width(v) {
this._width = v;
}
get height() {
return this._height;
}
set height(v) {
this._height = v;
}
get src() {
return this._src;
}
set src(v) {
if (v.startsWith('//')) {
v = 'http:' + v;
}
this._src = v;
GImage.GBridge.perloadImage([this._src, this._id], (data) => {
if (typeof data === 'string') {
data = JSON.parse(data);
}
if (data.error) {
var evt = { type: 'error', target: this };
this.onerror(evt);
} else {
this.complete = true;
this.width = typeof data.width === 'number' ? data.width : 0;
this.height = typeof data.height === 'number' ? data.height : 0;
var evt = { type: 'load', target: this };
this.onload(evt);
}
});
}
addEventListener(name, listener) {
if (name === 'load') {
this.onload = listener;
} else if (name === 'error') {
this.onerror = listener;
}
}
removeEventListener(name, listener) {
if (name === 'load') {
this.onload = noop;
} else if (name === 'error') {
this.onerror = noop;
}
}
get onload() {
return this._onload;
}
set onload(v) {
this._onload = v;
}
get onerror() {
return this._onerror;
}
set onerror(v) {
this._onerror = v;
}
}
export default GImage;

@ -1,24 +0,0 @@
export function ArrayBufferToBase64 (buffer) {
var binary = '';
var bytes = new Uint8ClampedArray(buffer);
for (var len = bytes.byteLength, i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return btoa(binary);
}
export function Base64ToUint8ClampedArray(base64String) {
const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/');
const rawData = atob(base64);
const outputArray = new Uint8ClampedArray(rawData.length);
for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}

@ -1,39 +0,0 @@
import GCanvas from './env/canvas';
import GImage from './env/image';
import GWebGLRenderingContext from './context-webgl/RenderingContext';
import GContext2D from './context-2d/RenderingContext';
import GBridgeWeex from './bridge/bridge-weex';
export let Image = GImage;
export let WeexBridge = GBridgeWeex;
export function enable(el, { bridge, debug, disableAutoSwap, disableComboCommands } = {}) {
const GBridge = GImage.GBridge = GCanvas.GBridge = GWebGLRenderingContext.GBridge = GContext2D.GBridge = bridge;
GBridge.callEnable(el.ref, [
0, // renderMode: 0--RENDERMODE_WHEN_DIRTY, 1--RENDERMODE_CONTINUOUSLY
-1, // hybridLayerType: 0--LAYER_TYPE_NONE 1--LAYER_TYPE_SOFTWARE 2--LAYER_TYPE_HARDWARE
false, // supportScroll
false, // newCanvasMode
1, // compatible
'white',// clearColor
false // sameLevel: newCanvasMode = true && true => GCanvasView and Webview is same level
]);
if (debug === true) {
GBridge.callEnableDebug();
}
if (disableComboCommands) {
GBridge.callEnableDisableCombo();
}
var canvas = new GCanvas(el.ref, { disableAutoSwap });
canvas.width = el.style.width;
canvas.height = el.style.height;
return canvas;
};

File diff suppressed because one or more lines are too long

@ -1,79 +0,0 @@
{
"id": "Sansnn-uQRCode",
"displayName": "uQRCode 全端二维码生成插件 支持nvue 支持nodejs服务端",
"version": "4.0.6",
"description": "uQRCode是一款基于Javascript环境开发的二维码生成插件适用所有Javascript运行环境的前端应用和Node.js。",
"keywords": [
"二维码",
"uQRCode",
"qrcode",
"qr"
],
"repository": "https://github.com/Sansnn/uQRCode",
"engines": {
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/uqrcodejs",
"type": "sdk-js"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,4 +0,0 @@
require('./common/runtime.js')
require('./common/vendor.js')
require('./common/main.js')

@ -1,45 +0,0 @@
{
"pages": [
"pages/index/index",
"pages/me/index"
],
"subPackages": [
{
"root": "package_sub",
"pages": [
"login/login",
"order/order",
"order/orderDetail",
"order/editPrice"
]
}
],
"window": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "医康养-护工端",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#686868",
"selectedColor": "#686868",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/home.png",
"selectedIconPath": "static/home-active.png",
"text": "首页"
},
{
"pagePath": "pages/me/index",
"iconPath": "static/user.png",
"selectedIconPath": "static/user-active.png",
"text": "我的"
}
]
},
"preloadRule": {},
"usingComponents": {}
}

@ -1,3 +0,0 @@
@import './common/main.wxss';
[data-custom-hidden="true"],[bind-data-custom-hidden="true"]{display: none !important;}

@ -1,2 +0,0 @@
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["common/main"],{0:function(e,t,n){"use strict";(function(e,t){var r=n(4),u=r(n(11));n(26);var o=r(n(27)),a=r(n(25)),c=r(n(36)),i=r(n(38)),f=n(64),l=r(n(206)),s=r(n(207)),p=r(n(65));function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){(0,u.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}e.__webpack_require_UNI_MP_PLUGIN__=n,a.default.use(i.default);var b=n(208);a.default.mixin(b),a.default.config.productionTip=!1,o.default.mpType="app";var O=new a.default(v({store:c.default},o.default));a.default.prototype.base=f.base,a.default.use(l.default,O),a.default.use(s.default,O),a.default.prototype.$moment=p.default,t(O).$mount()}).call(this,n(1)["default"],n(2)["createApp"])},27:function(e,t,n){"use strict";n.r(t);var r=n(28);for(var u in r)["default"].indexOf(u)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(u);n(33);var o,a,c,i,f=n(35),l=Object(f["default"])(r["default"],o,a,!1,null,null,null,!1,c,i);l.options.__file="App.vue",t["default"]=l.exports},28:function(e,t,n){"use strict";n.r(t);var r=n(29),u=n.n(r);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);t["default"]=u.a},29:function(e,t,n){"use strict";(function(e){var r=n(4);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var u=r(n(30)),o=r(n(32)),a={onLaunch:function(){var t=(0,o.default)(u.default.mark((function t(){var n;return u.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(t.prev=0,!this.base.isNull(this.vuex_token)){t.next=5;break}e.redirectTo({url:"/package_sub/login/login"}),t.next=10;break;case 5:return t.next=7,this.$u.api.getUser();case 7:n=t.sent,console.log("user",n),this.$u.vuex("vuex_user",n);case 10:t.next=15;break;case 12:t.prev=12,t.t0=t["catch"](0),console.error(t.t0);case 15:case"end":return t.stop()}}),t,this,[[0,12]])})));function n(){return t.apply(this,arguments)}return n}(),onShow:function(){},onHide:function(){console.log("App Hide")}};t.default=a}).call(this,n(2)["default"])},33:function(e,t,n){"use strict";n.r(t);var r=n(34),u=n.n(r);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);t["default"]=u.a},34:function(e,t,n){}},[[0,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/main.js.map

File diff suppressed because it is too large Load Diff

@ -1,5 +0,0 @@
!function(){try{var a=Function("return this")();a&&!a.Math&&(Object.assign(a,{isFinite:isFinite,Array:Array,Date:Date,Error:Error,Function:Function,Math:Math,Object:Object,RegExp:RegExp,String:String,TypeError:TypeError,setTimeout:setTimeout,clearTimeout:clearTimeout,setInterval:setInterval,clearInterval:clearInterval}),"undefined"!=typeof Reflect&&(a.Reflect=Reflect))}catch(a){}}();
(function(e){function u(u){for(var o,t,c=u[0],p=u[1],a=u[2],m=0,s=[];m<c.length;m++)t=c[m],Object.prototype.hasOwnProperty.call(i,t)&&i[t]&&s.push(i[t][0]),i[t]=0;for(o in p)Object.prototype.hasOwnProperty.call(p,o)&&(e[o]=p[o]);l&&l(u);while(s.length)s.shift()();return r.push.apply(r,a||[]),n()}function n(){for(var e,u=0;u<r.length;u++){for(var n=r[u],o=!0,t=1;t<n.length;t++){var c=n[t];0!==i[c]&&(o=!1)}o&&(r.splice(u--,1),e=p(p.s=n[0]))}return e}var o={},t={"common/runtime":0},i={"common/runtime":0},r=[];function c(e){return p.p+""+e+".js"}function p(u){if(o[u])return o[u].exports;var n=o[u]={i:u,l:!1,exports:{}};return e[u].call(n.exports,n,n.exports,p),n.l=!0,n.exports}p.e=function(e){var u=[],n={"uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode":1,"uview-ui/components/u-button/u-button":1,"uview-ui/components/u-empty/u-empty":1,"uview-ui/components/u-loadmore/u-loadmore":1,"uview-ui/components/u-navbar/u-navbar":1,"uview-ui/components/u-popup/u-popup":1,"uview-ui/components/u-form-item/u-form-item":1,"uview-ui/components/u-form/u-form":1,"uview-ui/components/u-icon/u-icon":1,"uview-ui/components/u-input/u-input":1,"uview-ui/components/u-select/u-select":1,"uview-ui/components/u-line/u-line":1,"uview-ui/components/u-loading/u-loading":1,"uview-ui/components/u-mask/u-mask":1};t[e]?u.push(t[e]):0!==t[e]&&n[e]&&u.push(t[e]=new Promise((function(u,n){for(var o=({"uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode":"uni_modules/Sansnn-uQRCode/components/uqrcode/uqrcode","uview-ui/components/u-button/u-button":"uview-ui/components/u-button/u-button","uview-ui/components/u-empty/u-empty":"uview-ui/components/u-empty/u-empty","uview-ui/components/u-loadmore/u-loadmore":"uview-ui/components/u-loadmore/u-loadmore","uview-ui/components/u-navbar/u-navbar":"uview-ui/components/u-navbar/u-navbar","uview-ui/components/u-popup/u-popup":"uview-ui/components/u-popup/u-popup","uview-ui/components/u-form-item/u-form-item":"uview-ui/components/u-form-item/u-form-item","uview-ui/components/u-form/u-form":"uview-ui/components/u-form/u-form","uview-ui/components/u-icon/u-icon":"uview-ui/components/u-icon/u-icon","uview-ui/components/u-input/u-input":"uview-ui/components/u-input/u-input","uview-ui/components/u-select/u-select":"uview-ui/components/u-select/u-select","uview-ui/components/u-line/u-line":"uview-ui/components/u-line/u-line","uview-ui/components/u-loading/u-loading":"uview-ui/components/u-loading/u-loading","uview-ui/components/u-mask/u-mask":"uview-ui/components/u-mask/u-mask"}[e]||e)+".wxss",i=p.p+o,r=document.getElementsByTagName("link"),c=0;c<r.length;c++){var a=r[c],m=a.getAttribute("data-href")||a.getAttribute("href");if("stylesheet"===a.rel&&(m===o||m===i))return u()}var s=document.getElementsByTagName("style");for(c=0;c<s.length;c++){a=s[c],m=a.getAttribute("data-href");if(m===o||m===i)return u()}var l=document.createElement("link");l.rel="stylesheet",l.type="text/css",l.onload=u,l.onerror=function(u){var o=u&&u.target&&u.target.src||i,r=new Error("Loading CSS chunk "+e+" failed.\n("+o+")");r.code="CSS_CHUNK_LOAD_FAILED",r.request=o,delete t[e],l.parentNode.removeChild(l),n(r)},l.href=i;var v=document.getElementsByTagName("head")[0];v.appendChild(l)})).then((function(){t[e]=0})));var o=i[e];if(0!==o)if(o)u.push(o[2]);else{var r=new Promise((function(u,n){o=i[e]=[u,n]}));u.push(o[2]=r);var a,m=document.createElement("script");m.charset="utf-8",m.timeout=120,p.nc&&m.setAttribute("nonce",p.nc),m.src=c(e);var s=new Error;a=function(u){m.onerror=m.onload=null,clearTimeout(l);var n=i[e];if(0!==n){if(n){var o=u&&("load"===u.type?"missing":u.type),t=u&&u.target&&u.target.src;s.message="Loading chunk "+e+" failed.\n("+o+": "+t+")",s.name="ChunkLoadError",s.type=o,s.request=t,n[1](s)}i[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:m})}),12e4);m.onerror=m.onload=a,document.head.appendChild(m)}return Promise.all(u)},p.m=e,p.c=o,p.d=function(e,u,n){p.o(e,u)||Object.defineProperty(e,u,{enumerable:!0,get:n})},p.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.t=function(e,u){if(1&u&&(e=p(e)),8&u)return e;if(4&u&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(p.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&u&&"string"!=typeof e)for(var o in e)p.d(n,o,function(u){return e[u]}.bind(null,o));return n},p.n=function(e){var u=e&&e.__esModule?function(){return e["default"]}:function(){return e};return p.d(u,"a",u),u},p.o=function(e,u){return Object.prototype.hasOwnProperty.call(e,u)},p.p="/",p.oe=function(e){throw console.error(e),e};var a=global["webpackJsonp"]=global["webpackJsonp"]||[],m=a.push.bind(a);a.push=u,a=a.slice();for(var s=0;s<a.length;s++)u(a[s]);var l=m;n()})([]);
//# sourceMappingURL=../../.sourcemap/mp-weixin/common/runtime.js.map

File diff suppressed because one or more lines are too long

@ -1,2 +0,0 @@
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["package_sub/login/login"],{225:function(e,n,t){"use strict";(function(e,n){var r=t(4);t(26);r(t(25));var o=r(t(226));e.__webpack_require_UNI_MP_PLUGIN__=t,n(o.default)}).call(this,t(1)["default"],t(2)["createPage"])},226:function(e,n,t){"use strict";t.r(n);var r=t(227),o=t(229);for(var u in o)["default"].indexOf(u)<0&&function(e){t.d(n,e,(function(){return o[e]}))}(u);t(231);var i,c=t(35),s=Object(c["default"])(o["default"],r["render"],r["staticRenderFns"],!1,null,"6126915d",null,!1,r["components"],i);s.options.__file="package_sub/login/login.vue",n["default"]=s.exports},227:function(e,n,t){"use strict";t.r(n);var r=t(228);t.d(n,"render",(function(){return r["render"]})),t.d(n,"staticRenderFns",(function(){return r["staticRenderFns"]})),t.d(n,"recyclableRender",(function(){return r["recyclableRender"]})),t.d(n,"components",(function(){return r["components"]}))},228:function(e,n,t){"use strict";var r;t.r(n),t.d(n,"render",(function(){return o})),t.d(n,"staticRenderFns",(function(){return i})),t.d(n,"recyclableRender",(function(){return u})),t.d(n,"components",(function(){return r}));try{r={uInput:function(){return Promise.all([t.e("common/vendor"),t.e("uview-ui/components/u-input/u-input")]).then(t.bind(null,318))}}}catch(c){if(-1===c.message.indexOf("Cannot find module")||-1===c.message.indexOf(".vue"))throw c;console.error(c.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范文档https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var o=function(){var e=this,n=e.$createElement;e._self._c},u=!1,i=[];o._withStripped=!0},229:function(e,n,t){"use strict";t.r(n);var r=t(230),o=t.n(r);for(var u in r)["default"].indexOf(u)<0&&function(e){t.d(n,e,(function(){return r[e]}))}(u);n["default"]=o.a},230:function(e,n,t){"use strict";(function(e){var r=t(4);Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=r(t(11));function u(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?u(Object(t),!0).forEach((function(n){(0,o.default)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var c={data:function(){return{form:{username:"",password:""}}},onReady:function(){},methods:{login:function(){var n=this;this.base.isNull(this.form.username)?this.base.toast("请输入用户名"):this.base.isNull(this.form.password)?this.base.toast("请输入密码"):this.$u.api.login(i({},this.form)).then((function(t){console.log("res1",t),n.base.toast("登录成功",1500,(function(){n.$u.vuex("vuex_token",t.token),setTimeout((function(){e.switchTab({url:"/pages/index/index"})}),1500)}))}))}}};n.default=c}).call(this,t(2)["default"])},231:function(e,n,t){"use strict";t.r(n);var r=t(232),o=t.n(r);for(var u in r)["default"].indexOf(u)<0&&function(e){t.d(n,e,(function(){return r[e]}))}(u);n["default"]=o.a},232:function(e,n,t){}},[[225,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/package_sub/login/login.js.map

@ -1,7 +0,0 @@
{
"navigationBarTitleText": "登录",
"navigationStyle": "custom",
"usingComponents": {
"u-input": "/uview-ui/components/u-input/u-input"
}
}

@ -1 +0,0 @@
<view class="container data-v-6126915d"><image class="bkg data-v-6126915d" mode="aspectFill" src="../static/login-bg.png"></image><view class="login data-v-6126915d"><view class="login-title data-v-6126915d"><view class="data-v-6126915d">Hello</view><view class="data-v-6126915d">欢迎登录护工端</view></view><view class="login-form data-v-6126915d"><view class="data-v-6126915d"><u-input bind:input="__e" vue-id="78a7c96e-1" border-color="#f5f5f5" placeholder="请输入用户名" value="{{form.username}}" data-event-opts="{{[['^input',[['__set_model',['$0','username','$event',[]],['form']]]]]}}" class="data-v-6126915d" bind:__l="__l"></u-input></view><view class="data-v-6126915d"><u-input bind:input="__e" vue-id="78a7c96e-2" border-color="#f5f5f5" type="password" placeholder="请输入密码" value="{{form.password}}" data-event-opts="{{[['^input',[['__set_model',['$0','password','$event',[]],['form']]]]]}}" class="data-v-6126915d" bind:__l="__l"></u-input></view></view><view class="login-btn data-v-6126915d"><view data-event-opts="{{[['tap',[['login',['$event']]]]]}}" bindtap="__e" class="data-v-6126915d">立即登录</view></view></view></view>

@ -1,67 +0,0 @@
@charset "UTF-8";
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
/* uni.scss */
.container.data-v-6126915d {
width: 100vw;
height: 100vh;
background-color: #fff;
font-size: 32rpx;
}
.container .bkg.data-v-6126915d {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
}
.container .login.data-v-6126915d {
position: absolute;
top: 0;
left: 0;
padding-top: 150rpx;
width: 100%;
}
.container .login-title.data-v-6126915d {
font-size: 50rpx;
color: #fff;
text-align: left;
}
.container .login-title > view.data-v-6126915d {
width: 50%;
margin: 0 auto;
}
.container .login-form.data-v-6126915d {
padding: 400rpx 65rpx 100rpx 65rpx;
}
.container .login-form > view.data-v-6126915d {
background-color: #f5f5f5;
border-radius: 60rpx;
padding: 10rpx 30rpx;
margin-bottom: 35rpx;
}
.container .login-btn.data-v-6126915d {
padding: 0 65rpx;
}
.container .login-btn > view.data-v-6126915d {
font-size: 33rpx;
border-radius: 60rpx;
margin-bottom: 35rpx;
height: 90rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
background: linear-gradient(-90deg, #e26165 0%, #c10d12 94%, #c10d12 100%);
box-shadow: 1rpx 1rpx 10rpx #c10d12;
}

@ -1,2 +0,0 @@
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["package_sub/order/editPrice"],{250:function(e,n,r){"use strict";(function(e,n){var t=r(4);r(26);t(r(25));var o=t(r(251));e.__webpack_require_UNI_MP_PLUGIN__=r,n(o.default)}).call(this,r(1)["default"],r(2)["createPage"])},251:function(e,n,r){"use strict";r.r(n);var t=r(252),o=r(254);for(var u in o)["default"].indexOf(u)<0&&function(e){r.d(n,e,(function(){return o[e]}))}(u);r(256);var a,i=r(35),c=Object(i["default"])(o["default"],t["render"],t["staticRenderFns"],!1,null,"3ca55578",null,!1,t["components"],a);c.options.__file="package_sub/order/editPrice.vue",n["default"]=c.exports},252:function(e,n,r){"use strict";r.r(n);var t=r(253);r.d(n,"render",(function(){return t["render"]})),r.d(n,"staticRenderFns",(function(){return t["staticRenderFns"]})),r.d(n,"recyclableRender",(function(){return t["recyclableRender"]})),r.d(n,"components",(function(){return t["components"]}))},253:function(e,n,r){"use strict";var t;r.r(n),r.d(n,"render",(function(){return o})),r.d(n,"staticRenderFns",(function(){return a})),r.d(n,"recyclableRender",(function(){return u})),r.d(n,"components",(function(){return t}));try{t={uNavbar:function(){return r.e("uview-ui/components/u-navbar/u-navbar").then(r.bind(null,258))},uInput:function(){return Promise.all([r.e("common/vendor"),r.e("uview-ui/components/u-input/u-input")]).then(r.bind(null,318))},uIcon:function(){return r.e("uview-ui/components/u-icon/u-icon").then(r.bind(null,293))},uButton:function(){return r.e("uview-ui/components/u-button/u-button").then(r.bind(null,265))}}}catch(i){if(-1===i.message.indexOf("Cannot find module")||-1===i.message.indexOf(".vue"))throw i;console.error(i.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范文档https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var o=function(){var e=this,n=e.$createElement,r=(e._self._c,{background:"#1479ff"});e.$mp.data=Object.assign({},{$root:{a0:r}})},u=!1,a=[];o._withStripped=!0},254:function(e,n,r){"use strict";r.r(n);var t=r(255),o=r.n(t);for(var u in t)["default"].indexOf(u)<0&&function(e){r.d(n,e,(function(){return t[e]}))}(u);n["default"]=o.a},255:function(e,n,r){"use strict";(function(e){var t=r(4);Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=t(r(30)),u=t(r(32)),a={data:function(){return{orderId:"",orderInfo:{},form:{update_price_reason:"",price:""},normalStyle:{background:"#969da7",color:"#fff","font-size":"28rpx",padding:"0 30rpx","margin-left":"15rpx"},parStyle:{background:"linear-gradient(to right, #476de4, #7bb9f7)",color:"#fff","font-size":"28rpx",padding:"10rpx 30rpx","margin-left":"15rpx"}}},onLoad:function(e){e.id&&(this.orderId=e.id,this.getOrderInfo(e.id))},methods:{getOrderInfo:function(e){var n=this;return(0,u.default)(o.default.mark((function r(){var t;return o.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,n.$u.api.orderDetail({id:e});case 2:t=r.sent,n.orderInfo=t;case 4:case"end":return r.stop()}}),r)})))()},cancel:function(){e.navigateBack()},confirm:function(){var n=this;return(0,u.default)(o.default.mark((function r(){var t;return o.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(n.form.price){r.next=3;break}return e.showToast({title:"请输入修改金额",icon:"none"}),r.abrupt("return");case 3:if(!(parseFloat(n.form.price)<parseFloat(n.orderInfo.price))){r.next=6;break}return e.showToast({title:"修改总金额小于原价",icon:"none"}),r.abrupt("return");case 6:if(n.form.update_price_reason){r.next=9;break}return e.showToast({title:"请输入修改原因",icon:"none"}),r.abrupt("return");case 9:t=n,t.$u.api.saveOrder({id:t.orderId,price:t.form.price,update_price_reason:t.form.update_price_reason,status:3}).then((function(n){t.base.toast("修改成功",1500,(function(){setTimeout((function(){e.switchTab({url:"/pages/index/index"})}),1500)}))}));case 11:case"end":return r.stop()}}),r)})))()}}};n.default=a}).call(this,r(2)["default"])},256:function(e,n,r){"use strict";r.r(n);var t=r(257),o=r.n(t);for(var u in t)["default"].indexOf(u)<0&&function(e){r.d(n,e,(function(){return t[e]}))}(u);n["default"]=o.a},257:function(e,n,r){}},[[250,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/package_sub/order/editPrice.js.map

@ -1,9 +0,0 @@
{
"navigationStyle": "custom",
"usingComponents": {
"u-navbar": "/uview-ui/components/u-navbar/u-navbar",
"u-input": "/uview-ui/components/u-input/u-input",
"u-icon": "/uview-ui/components/u-icon/u-icon",
"u-button": "/uview-ui/components/u-button/u-button"
}
}

@ -1 +0,0 @@
<view class="modify-page data-v-3ca55578"><u-navbar vue-id="5805da8e-1" title="修改订单" is-back="{{true}}" back-icon-color="#fff" background="{{$root.a0}}" title-color="#fff" border-bottom="{{false}}" class="data-v-3ca55578" bind:__l="__l"></u-navbar><view class="b-border data-v-3ca55578"></view><view class="modify-form data-v-3ca55578"><view class="form-card data-v-3ca55578"><view class="card-title data-v-3ca55578">修改总金额</view><view class="amount-input data-v-3ca55578"><text class="symbol data-v-3ca55578">¥</text><u-input bind:input="__e" vue-id="5805da8e-2" placeholder="请输入修改后的总金额" type="number" border="{{false}}" font-size="40" value="{{form.price}}" data-event-opts="{{[['^input',[['__set_model',['$0','price','$event',[]],['form']]]]]}}" class="data-v-3ca55578" bind:__l="__l"></u-input><u-icon vue-id="5805da8e-3" name="pan" class="data-v-3ca55578" bind:__l="__l"></u-icon></view><view class="original-price data-v-3ca55578">{{"原价格 ¥"+orderInfo.from_price}}</view></view><view class="form-card data-v-3ca55578"><view class="card-title data-v-3ca55578">修改原因</view><u-input bind:input="__e" vue-id="5805da8e-4" placeholder="请输入修改原因" height="200" border="{{false}}" type="textarea" value="{{form.update_price_reason}}" data-event-opts="{{[['^input',[['__set_model',['$0','update_price_reason','$event',[]],['form']]]]]}}" class="data-v-3ca55578" bind:__l="__l"></u-input></view><view class="bottom-btns data-v-3ca55578"><u-button vue-id="5805da8e-5" size="mini" shape="circle" type="primary" custom-style="{{normalStyle}}" data-event-opts="{{[['^click',[['cancel']]]]}}" bind:click="__e" class="data-v-3ca55578" bind:__l="__l" vue-slots="{{['default']}}">取消</u-button><u-button vue-id="5805da8e-6" type="primary" size="mini" shape="circle" custom-style="{{parStyle}}" throttle-time="{{2000}}" data-event-opts="{{[['^click',[['confirm']]]]}}" bind:click="__e" class="data-v-3ca55578" bind:__l="__l" vue-slots="{{['default']}}">确认修改</u-button></view></view></view>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save