Browse Source

修改ios签滚动问题

master
unknown 1 month ago
parent
commit
fa7cf1ec29
  1. 2
      config/api.js
  2. 3
      config/site.config.js
  3. 9
      manifest.json
  4. 15
      pages.json
  5. 6
      pages/carEntry/signature/signature.vue
  6. 1
      pages/indexEntry/enroll/payment/payh5.vue
  7. 1
      pages/indexEntry/enroll/payment/payment.vue
  8. 12
      pages/indexEntry/findShcool/findShcool.vue
  9. 6
      pages/indexEntry/findShcool/screen/screen.vue
  10. 20
      pages/mineEntry/myOrder/detail/comp/refundInfo.vue
  11. 7
      pages/mineEntry/myOrder/detail/detail.vue
  12. 74
      pages/mineEntry/personaInfo/personaInfo.vue
  13. 9
      pages/mineEntry/refund/comp/myform.vue
  14. 16
      pages/mineEntry/refund/refund.vue
  15. 285
      pages/mineEntry/uAvatarCropper/uAvatarCropper - 副本.vue
  16. 260
      pages/mineEntry/uAvatarCropper/uAvatarCropper.vue
  17. 709
      pages/mineEntry/uAvatarCropper/weCropper.js
  18. 2
      pages/tabbar/index/comp/coachItem.vue
  19. 26
      pages/tabbar/index/index.vue
  20. 10
      pages/tabbar/mine/index.vue
  21. 7
      store/modules/user.js

2
config/api.js

@ -228,6 +228,8 @@ export const periodConfirm = (data) => http.post('app/student-process/periodConf
export const order_info = (data) => http.post('pay/ysb/order_info', data) export const order_info = (data) => http.post('pay/ysb/order_info', data)
// 退学申请 // 退学申请
export const refuse_apply = (data) => http.post('pay/ysb/refuse_apply', data) export const refuse_apply = (data) => http.post('pay/ysb/refuse_apply', data)
// 获取退款申请的金额
export const refund_amount = (data) => http.post('pay/ysb/refund_amount', data)

3
config/site.config.js

@ -8,7 +8,7 @@ module.exports = {
imgUrl: 'https://jiangxijiakao-1.oss-cn-hangzhou.aliyuncs.com/defaultImages/app/bigImg/', imgUrl: 'https://jiangxijiakao-1.oss-cn-hangzhou.aliyuncs.com/defaultImages/app/bigImg/',
// 支付测试地址 // 支付测试地址
// preUrl: 'https://u8wbs.zyebank.cn/cem_ysb_u6/index.html', // preUrl: 'https://u8wbs.zyebank.cn/cem_ysb_u6/index.html',
// const preUrl = 'https://u8wbs.zyebank.cn/cem_ysb_u8/index.html'
// preUrl: 'https://u8wbs.zyebank.cn/cem_ysb_u8/index.html',
// 生产地址 // 生产地址
preUrl: 'https://zmcht.zybank.com.cn/cem_ysb/index.html', preUrl: 'https://zmcht.zybank.com.cn/cem_ysb/index.html',
}; };
@ -17,3 +17,4 @@ module.exports = {
// http://123.6.232.1:8099/测试地址 // http://123.6.232.1:8099/测试地址
// http://192.168.1.43:8318/本地地址 // http://192.168.1.43:8318/本地地址
//http://www.lyjppt.com/正式地址 //http://www.lyjppt.com/正式地址

9
manifest.json

@ -2,8 +2,8 @@
"name" : "洛阳学车", "name" : "洛阳学车",
"appid" : "__UNI__3347C6E", "appid" : "__UNI__3347C6E",
"description" : "", "description" : "",
"versionName" : "1.3.7",
"versionCode" : 137,
"versionName" : "1.4.0",
"versionCode" : 140,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
@ -77,13 +77,14 @@
"applinks:static-mp-87b9fa27-0273-48d3-a586-bd058cd2ce3d.next.bspapp.com" "applinks:static-mp-87b9fa27-0273-48d3-a586-bd058cd2ce3d.next.bspapp.com"
] ]
} }
}
},
"idfa" : false
}, },
/* SDK */ /* SDK */
"sdkConfigs" : { "sdkConfigs" : {
"share" : { "share" : {
"weixin" : { "weixin" : {
"appid" : "wx6cf612192cd6927c",
"appid" : "wxa6a7ba6856767880",
"UniversalLinks" : "https://static-mp-87b9fa27-0273-48d3-a586-bd058cd2ce3d.next.bspapp.com/uni-universallinks/__UNI__3347C6E/" "UniversalLinks" : "https://static-mp-87b9fa27-0273-48d3-a586-bd058cd2ce3d.next.bspapp.com/uni-universallinks/__UNI__3347C6E/"
} }
}, },

15
pages.json

@ -66,7 +66,7 @@
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
// "navigationStyle": "custom",
"navigationStyle": "custom",
// "navigationBarLoading": false, // "navigationBarLoading": false,
"backgroundTextStyle": "dark" "backgroundTextStyle": "dark"
} }
@ -356,7 +356,10 @@
"style": { "style": {
"navigationBarTitleText": "签名", "navigationBarTitleText": "签名",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"backgroundTextStyle": "dark"
"backgroundTextStyle": "dark",
"app-plus": {//app
"bounce": "none"//
}
} }
} }
] ]
@ -373,6 +376,14 @@
} }
}, },
{ {
"path": "uAvatarCropper/uAvatarCropper",
"style": {
"navigationBarTitleText": "修改头像",
"enablePullDownRefresh": false,
"backgroundTextStyle": "dark"
}
},
{
"path": "aboutUs/aboutUs", "path": "aboutUs/aboutUs",
"style": { "style": {
"navigationBarTitleText": "关于我们", "navigationBarTitleText": "关于我们",

6
pages/carEntry/signature/signature.vue

@ -45,6 +45,7 @@
subject: 1, subject: 1,
}; };
}, },
onLoad(options) { onLoad(options) {
this.subject = options.subject this.subject = options.subject
}, },
@ -189,6 +190,9 @@
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
page {
overflow: hidden;
}
.signature-box { .signature-box {
padding: 0 32rpx; padding: 0 32rpx;
display: flex; display: flex;
@ -197,6 +201,8 @@
// height: 98%; // height: 98%;
height: calc(100vh - 50rpx); height: calc(100vh - 50rpx);
background: #fff; background: #fff;
overflow: hidden;
position: fixed;
.topTps { .topTps {
width: 100%; width: 100%;
border-radius: 8rpx; border-radius: 8rpx;

1
pages/indexEntry/enroll/payment/payh5.vue

@ -18,6 +18,7 @@
color: '#3877ff' color: '#3877ff'
}, },
}, },
sweixin: null
} }
}, },
onLoad(options) { onLoad(options) {

1
pages/indexEntry/enroll/payment/payment.vue

@ -52,7 +52,6 @@
// this.getYSBLink() // this.getYSBLink()
this.course_infoFn() this.course_infoFn()
this.initWx() this.initWx()
alert(preUrl)
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.course_infoFn() this.course_infoFn()

12
pages/indexEntry/findShcool/findShcool.vue

@ -9,11 +9,11 @@
</view> </view>
<view class="pad"> <view class="pad">
<view class="navBox"> <view class="navBox">
<view class="tab" v-for="(item,index) in tabData" :key="index" :class="{active: (params.sercheType==item.id&&!(params.businessScope||params.district))}" @click="tabClick(item)">
<view class="tab" v-for="(item,index) in tabData" :key="index" :class="{active: (params.sercheType==item.id&&!(params.businessScope||params.districts))}" @click="tabClick(item)">
{{ item.text }}</view> {{ item.text }}</view>
<view class="screen" @click="goScreen" :class="{active: (params.businessScope||params.district)}">
<view class="screen" @click="goScreen" :class="{active: (params.businessScope||params.districts)}">
<view class="txt">筛选</view> <view class="txt">筛选</view>
<u-icon name="arrow-down-fill" :color="(params.businessScope||params.district)?'#fff':'#999'" size="8"></u-icon>
<u-icon name="arrow-down-fill" :color="(params.businessScope||params.districts)?'#fff':'#999'" size="8"></u-icon>
</view> </view>
</view> </view>
@ -62,7 +62,7 @@
lng: '', lng: '',
sercheType: 1, sercheType: 1,
businessScope: '', businessScope: '',
district: '',
districts: '',
name: '' name: ''
}, },
total: 20, total: 20,
@ -98,7 +98,7 @@
this.listInit() this.listInit()
}, },
goScreen() { goScreen() {
let url = `/pages/indexEntry/findShcool/screen/screen?businessScope=${this.params.businessScope}&district=${this.params.district}`
let url = `/pages/indexEntry/findShcool/screen/screen?businessScope=${this.params.businessScope}&districts=${this.params.districts}`
this.$goPage(url) this.$goPage(url)
}, },
goPage(item) { goPage(item) {
@ -107,7 +107,7 @@
tabClick(item) { tabClick(item) {
this.params.sercheType = item.id this.params.sercheType = item.id
this.params.businessScope = '' this.params.businessScope = ''
this.params.district = ''
this.params.districts = ''
this.listInit() this.listInit()
}, },
async listInit() { async listInit() {

6
pages/indexEntry/findShcool/screen/screen.vue

@ -39,8 +39,8 @@
if(options.businessScope) { if(options.businessScope) {
this.driverTypeArr = options.businessScope.split(',') this.driverTypeArr = options.businessScope.split(',')
} }
if(options.district) {
this.areTypeArr = options.district.split(',').map(item=>item*1)
if(options.districts) {
this.areTypeArr = options.districts.split(',').map(item=>item*1)
} }
this.licenseTypeFn() this.licenseTypeFn()
this.nachangListFn() this.nachangListFn()
@ -78,7 +78,7 @@
screenConfirm() { screenConfirm() {
let obj = { let obj = {
businessScope: this.driverTypeArr.join(','), businessScope: this.driverTypeArr.join(','),
district: this.areTypeArr.join(',')
districts: this.areTypeArr.join(',')
} }
uni.$emit('screenConfirm', obj) uni.$emit('screenConfirm', obj)
uni.navigateBack() uni.navigateBack()

20
pages/mineEntry/myOrder/detail/comp/refundInfo.vue

@ -10,6 +10,18 @@
<view class="lab">退款金额</view> <view class="lab">退款金额</view>
<view class="val">{{$u.utils.priceTo(info.amount)}}</view> <view class="val">{{$u.utils.priceTo(info.amount)}}</view>
</view> </view>
<view class="row">
<view class="lab">退款状态</view>
<view class="val">{{refundStatusTxt[info.refundStatus]}}</view>
</view>
<view class="row" v-if="info.schoolFailReason">
<view class="lab">审核失败原因</view>
<view class="val">{{ info.schoolFailReason }}</view>
</view>
<view class="row" v-if="info.refundFailReason">
<view class="lab">退款失败原因</view>
<view class="val">{{ info.refundFailReason }}</view>
</view>
<view class="border_bottom"> <view class="border_bottom">
<view class="date" v-if="info.createTime">申请时间{{ $u.timeFormat(info.createTime, 'yyyy-mm-dd hh:MM:ss')}}</view> <view class="date" v-if="info.createTime">申请时间{{ $u.timeFormat(info.createTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
<view class="date" v-if="info.refundTime">退款完成时间{{ $u.timeFormat(info.refundTime, 'yyyy-mm-dd hh:MM:ss')}}</view> <view class="date" v-if="info.refundTime">退款完成时间{{ $u.timeFormat(info.refundTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
@ -44,8 +56,14 @@
<script> <script>
export default { export default {
props: ['info']
props: ['info'],
data() {
return {
refundStatusTxt: ['退款中', '退款成功', '退款失败'],//退0退-11退2退
} }
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

7
pages/mineEntry/myOrder/detail/detail.vue

@ -78,10 +78,7 @@
<view class="label">培训费</view> <view class="label">培训费</view>
<view class="value">{{$u.utils.priceTo(info.totalAmount)}}</view> <view class="value">{{$u.utils.priceTo(info.totalAmount)}}</view>
</view> </view>
<!-- <view class="rows">
<view class="label hui">学驾培训费</view>
<view class="value hui">{{$u.utils.priceTo(info.totalAmount)}}</view>
</view> -->
</view> </view>
<view class="border_bottom"> <view class="border_bottom">
<!-- <view class="rows"> <!-- <view class="rows">
@ -98,7 +95,7 @@
</view> --> </view> -->
<view class="btn_row"> <view class="btn_row">
<view class="" style="min-width: 120rpx;"> <view class="" style="min-width: 120rpx;">
<view class="refundBtn" @click="goFund" v-if="!info.refundId">申请退款</view>
<view class="refundBtn" @click="goFund" v-if="refundData.refundStatus==2||!info.refundId">申请退款</view>
</view> </view>
<view class="rightBtn"> <view class="rightBtn">
<view class="btnBorder" @click="downloadImage">下载凭证</view> <view class="btnBorder" @click="downloadImage">下载凭证</view>

74
pages/mineEntry/personaInfo/personaInfo.vue

@ -1,14 +1,15 @@
<template> <template>
<view class="pageBg"> <view class="pageBg">
<view class="pad"> <view class="pad">
<!-- <view class="avatarBox" @click="uploadTap">
<!-- <view class="avatarBox" @click="editAvatar">
<view class="avatar"> <view class="avatar">
<image :src="avatarLink" mode=""></image>
</view>
<view class="phoneIcon">
<image src="@/static/images/mineIcon/camera.png" mode=""></image>
<image :src="avatarBase64?avatarBase64:avatarLink" mode=""></image>
<view class="imgMask" v-if="avatarBase64">审核中</view>
</view> </view>
<view class="editBtn">修改头像</view>
</view> --> </view> -->
<view class="card"> <view class="card">
<view class="row"> <view class="row">
<view class="lab">手机号</view> <view class="lab">手机号</view>
@ -76,7 +77,8 @@
export default { export default {
data() { data() {
return { return {
avatarLink: ''
avatarLink: '',
avatarBase64: ''
} }
}, },
onLoad() { onLoad() {
@ -84,7 +86,30 @@
this.avatarLink = res this.avatarLink = res
}) })
}, },
onShow() {
if(uni.getStorageSync('avatarBase64')) this.avatarBase64 = uni.getStorageSync('avatarBase64')
},
methods: { methods: {
//
editAvatar() {
this.uploadTapFn()
},
uploadTapFn() {
const _this = this;
uni.chooseImage({
count: 1, // 9
sizeType: ['original', 'compressed'], //
sourceType: ['album', 'camera'], //
success: (res) => {
let url = res.tempFilePaths[0];
// datasrc
console.log('跳转到哪了?')
uni.navigateTo({
url: '/pages/mineEntry/uAvatarCropper/uAvatarCropper?src=' + encodeURIComponent(url)
})
}
});
},
AccountCanceFn() { AccountCanceFn() {
this.$goPage('/pages/mineEntry/personaInfo/AccountCance') this.$goPage('/pages/mineEntry/personaInfo/AccountCance')
}, },
@ -134,6 +159,15 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.editBtn {
padding: 10rpx 20rpx ;
border: 1rpx solid #ebedf0;
font-size: 28rpx;
color: #333;
border-radius: 10rpx;
margin: 10rpx 0 30rpx 0;
background-color: #fff;
}
.card { .card {
padding: 6rpx; padding: 6rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
@ -142,16 +176,33 @@
overflow: hidden; overflow: hidden;
} }
.avatarBox { .avatarBox {
width: 175rpx;
height: 175rpx;
margin: 50rpx auto 50rpx auto;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative; position: relative;
.avatar { .avatar {
width: 100%;
height: 100%;
width: 175rpx;
height: 175rpx;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
background-color: #E8E9EC; background-color: #E8E9EC;
position: relative;
.imgMask {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(0,0,0,1);
// background-color: rgba(0,0,0,0.4);
font-size: 24rpx;
// color: rgba(255,255,255,0.8);
color: #fff;
opacity: 0.4;
line-height: 104rpx;
text-align: center;
}
} }
.phoneIcon { .phoneIcon {
width: 46rpx; width: 46rpx;
@ -161,6 +212,7 @@
bottom: 0; bottom: 0;
z-index: 9; z-index: 9;
} }
} }
.row { .row {
display: flex; display: flex;

9
pages/mineEntry/refund/comp/myform.vue

@ -12,10 +12,11 @@
<view class="row"> <view class="row">
<view class="lab">退款金额</view> <view class="lab">退款金额</view>
<view class="val"> <view class="val">
<u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.amount" @blur="changePrice"></u--input>
¥ {{ balanceAmount}}
<!-- <u--input placeholder="请输入" border="none" clearable type="number" maxlength="11" v-model="FormData.amount" @blur="changePrice"></u--input> -->
</view> </view>
</view> </view>
<!-- <view class="tpsHui">退款金额不可超过¥ {{$u.utils.priceTo(info.totalAmount)}}</view> -->
<!-- <view class="tpsHui" v-if="balanceAmount">退款金额不可超过¥ {{ balanceAmount }}</view> -->
</view> </view>
<view class="card"> <view class="card">
<view class="h1"><text class="active">收款信息</text></view> <view class="h1"><text class="active">收款信息</text></view>
@ -76,7 +77,7 @@
import { chooseImages } from '@/config/utils.js' import { chooseImages } from '@/config/utils.js'
const _url = H5_API + WX_API + httpPrefix + 'app/apply-order/scanningBanks.do'; const _url = H5_API + WX_API + httpPrefix + 'app/apply-order/scanningBanks.do';
export default { export default {
props: ['info', 'orderId'],
props: ['info', 'orderId', 'balanceAmount'],
data() { data() {
return { return {
FormData: { FormData: {
@ -135,7 +136,7 @@
// obj.orderId = this.orderId // obj.orderId = this.orderId
// obj.feeType = this.info.orderType // obj.feeType = this.info.orderType
let obj = { let obj = {
refundAmount: this.FormData.amount,
refundAmount: this.balanceAmount,
refundReasonType: this.FormData.reasonType, refundReasonType: this.FormData.reasonType,
bankCardName: this.FormData.bankName, bankCardName: this.FormData.bankName,
bankCardNo: this.FormData.idCard, bankCardNo: this.FormData.idCard,

16
pages/mineEntry/refund/refund.vue

@ -2,30 +2,33 @@
<view class="pageBg"> <view class="pageBg">
<view class="pad"> <view class="pad">
<view class="tps">请与教练协商确认达成一致后填写协商好的退款金额</view> <view class="tps">请与教练协商确认达成一致后填写协商好的退款金额</view>
<myform :info="info" :orderId="orderId"></myform>
<myform :info="info" :orderId="orderId" :balanceAmount="balanceAmount"></myform>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import myform from './comp/myform' import myform from './comp/myform'
import { applyOrderGet, applyOnlineFund } from '@/config/api.js'
import { applyOrderGet, applyOnlineFund, refund_amount } from '@/config/api.js'
export default { export default {
components: { myform }, components: { myform },
data() { data() {
return { return {
orderId: '', orderId: '',
info: {}, info: {},
title: '退款申请'
title: '退款申请',
balanceAmount: 0
} }
}, },
onLoad(options) { onLoad(options) {
if(!options.orderId) return if(!options.orderId) return
this.orderId = options.orderId this.orderId = options.orderId
this.applyOrderGetFn() this.applyOrderGetFn()
this.refund_amountFn()
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.applyOrderGetFn() this.applyOrderGetFn()
this.refund_amountFn()
}, },
methods: { methods: {
async applyOrderGetFn() { async applyOrderGetFn() {
@ -33,6 +36,13 @@
this.info = res this.info = res
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
async refund_amountFn() {
const {data: res} = await refund_amount()
if(res) {
this.balanceAmount = res.balanceAmount
}
console.log(res)
}
} }
} }
</script> </script>

285
pages/mineEntry/uAvatarCropper/uAvatarCropper - 副本.vue

@ -0,0 +1,285 @@
<template>
<view class="content">
<view class="cropper-wrapper" :style="{ height: cropperOpt.height + 'px' }">
<canvas
class="cropper"
:disable-scroll="true"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
:style="{ width: cropperOpt.width, height: cropperOpt.height, backgroundColor: 'rgba(0, 0, 0, 0.8)' }"
canvas-id="cropper"
id="cropper"
></canvas>
<canvas
class="cropper"
:disable-scroll="true"
:style="{
position: 'fixed',
top: `-${cropperOpt.width * cropperOpt.pixelRatio}px`,
left: `-${cropperOpt.height * cropperOpt.pixelRatio}px`,
width: `${cropperOpt.width * cropperOpt.pixelRatio}px`,
height: `${cropperOpt.height * cropperOpt.pixelRatio}`
}"
canvas-id="targetId"
id="targetId"
></canvas>
</view>
<view class="cropper-buttons safe-area-padding" :style="{ height: bottomNavHeight + 'px' }">
<view class="upload" @click="uploadTap">取消</view>
<view class="getCropperImage" @click="getCropperImage(false)">完成</view>
</view>
</view>
</template>
<script>
import WeCropper from './weCropper.js';
export default {
props: {
// lineWidth-(rpx)color:
// mask-rgba"rgba(0, 0, 0, 0.35)"
boundStyle: {
type: Object,
default() {
return {
lineWidth: 4,
borderColor: 'rgb(245, 245, 245)',
mask: 'rgba(0, 0, 0, 0.35)'
};
}
},
avatarSrc: {
type: String,
default: ''
}
// // rpx
// rectWidth: {
// type: [String, Number],
// default: 400
// },
// // rpx
// rectHeight: {
// type: [String, Number],
// default: 400
// },
// // rpx
// destWidth: {
// type: [String, Number],
// default: 400
// },
// // rpx
// destHeight: {
// type: [String, Number],
// default: 400
// },
// // "png""jpg"
// fileType: {
// type: String,
// default: 'jpg',
// },
// //
// // H5使
// quality: {
// type: [Number, String],
// default: 1
// }
},
data() {
return {
//
bottomNavHeight: 50,
originWidth: 200,
width: 0,
height: 0,
cropperOpt: {
id: 'cropper',
targetId: 'targetCropper',
pixelRatio: 1,
width: 0,
height: 0,
scale: 2.5,
zoom: 8,
cut: {
x: (this.width - this.originWidth) / 2,
y: (this.height - this.originWidth) / 2,
width: this.originWidth,
height: this.originWidth
},
boundStyle: {
lineWidth: uni.upx2px(this.boundStyle.lineWidth),
mask: this.boundStyle.mask,
color: this.boundStyle.borderColor
}
},
//
// px
destWidth: 200,
// px
rectWidth: 350,
// 'png'"jpg"
fileType: 'png',
src: '', //
};
},
onLoad(options) {
let rectInfo = uni.getSystemInfoSync();
this.width = rectInfo.windowWidth;
this.height = rectInfo.windowHeight - this.bottomNavHeight;
this.cropperOpt.width = this.width;
this.cropperOpt.height = this.height;
this.cropperOpt.pixelRatio = rectInfo.pixelRatio;
if (this.destWidth) this.destWidth = this.destWidth;
if (this.rectWidth) {
let rectWidth = Number(this.rectWidth);
this.cropperOpt.cut = {
x: (this.width - rectWidth) / 2,
y: (this.height - rectWidth) / 2,
width: rectWidth,
height: rectWidth
};
}
this.rectWidth = this.rectWidth;
if (this.fileType) this.fileType = this.fileType;
//
this.cropper = new WeCropper(this.cropperOpt)
.on('ready', ctx => {
// wecropper is ready for work!
})
.on('beforeImageLoad', ctx => {
// before picture loaded, i can do something
})
.on('imageLoad', ctx => {
// picture loaded
})
.on('beforeDraw', (ctx, instance) => {
// before canvas draw,i can do something
});
// page.json
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#000000'
});
this.src = encodeURI(options.url)
// datasrc
this.cropper.pushOrign(this.src);
},
methods: {
touchStart(e) {
this.cropper.touchStart(e);
},
touchMove(e) {
this.cropper.touchMove(e);
},
touchEnd(e) {
this.cropper.touchEnd(e);
},
getCropperImage(isPre = false) {
if(!this.src) return this.$u.toast('请先选择图片再裁剪');
let cropper_opt = {
destHeight: Number(this.destWidth), // uni.canvasToTempFilePath
destWidth: Number(this.destWidth),
fileType: this.fileType
};
this.cropper.getCropperImage(cropper_opt, (path, err) => {
if (err) {
uni.showModal({
title: '温馨提示',
content: err.message
});
} else {
if (isPre) {
uni.previewImage({
current: '', // http
urls: [path] // http
});
} else {
uni.$emit('uAvatarCropper', path);
uni.navigateBack()
}
}
});
},
uploadTap() {
uni.navigateBack()
return
const self = this;
uni.chooseImage({
count: 1, // 9
sizeType: ['original', 'compressed'], //
sourceType: ['album', 'camera'], //
success: (res) => {
self.src = res.tempFilePaths[0];
// datasrc
self.cropper.pushOrign(this.src);
}
});
}
}
};
</script>
<style scoped lang="scss">
// @import '@/node_modules/uview-ui/libs/css/style.components.scss';
.content {
background: rgba(255, 255, 255, 1);
}
.cropper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 11;
}
.cropper-buttons {
background-color: #000000;
color: #eee;
}
.cropper-wrapper {
position: relative;
// @include vue-flex;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
background-color: #000;
}
.cropper-buttons {
width: 100vw;
// @include vue-flex;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
position: fixed;
bottom: 0;
left: 0;
font-size: 28rpx;
}
.cropper-buttons .upload,
.cropper-buttons .getCropperImage {
width: 50%;
text-align: center;
}
.cropper-buttons .upload {
text-align: left;
padding-left: 50rpx;
}
.cropper-buttons .getCropperImage {
text-align: right;
padding-right: 50rpx;
}
</style>

260
pages/mineEntry/uAvatarCropper/uAvatarCropper.vue

@ -0,0 +1,260 @@
<template>
<view class="content">
<view class="cropper-wrapper" style="height:617px">
<canvas
class="cropper"
disable-scroll="true"
@touchstart="touchStart"
@touchmove="touchMove"
@touchend="touchEnd"
:style="{ width: cropperOpt.width, height: cropperOpt.height }"
canvas-id="cropper"
></canvas>
</view>
<view class="cropper-buttons">
<view class="upload" @tap="uploadTap">重新选择</view>
<view class="getCropperImage" @tap="getCropperImage">确定</view>
</view>
</view>
</template>
<script>
import weCropper from './weCropper';
const device = uni.getSystemInfoSync();
const width = device.windowWidth;
const height = device.windowHeight - 50;
console.log(device);
import { uploadImgApi } from '@/config/utils.js'
export default {
data() {
return {
cropperOpt: {
id: 'cropper',
width: width,
height: height,
scale: 2.5,
zoom: 8,
cut: {
x: (width - 240) / 2,
y: (height - 320) / 2,
width: 240,
height: 320
}
},
weCropper: ''
};
},
methods: {
back() {
uni.redirectTo({
url: '../infoDetail/infoDetail'
});
},
touchStart(e) {
this.weCropper.touchStart(e);
},
touchMove(e) {
this.weCropper.touchMove(e);
},
touchEnd(e) {
this.weCropper.touchEnd(e);
},
convertBase64UrlToBlob(dataURI, type) {
var binary = atob(dataURI.split(',')[1]);
var array = [];
for (var i = 0; i < binary.length; i++) {
array.push(binary.charCodeAt(i));
}
return new Blob([new Uint8Array(array)], { type: type }, { filename: '1111.jpg' });
},
blobToDataURL(blob) {
var a = new FileReader();
a.readAsDataURL(blob); //result
a.onload = function(e) {
var getRes = e.target.result; //result
console.log(getRes);
};
},
getCropperImage() {
console.log('点击了确定')
let _this = this;
//let pathurl = url + '/user/upload';
this.weCropper.getCropperImage(avatar => {
console.log('有图片吗?')
console.log(avatar)
if (avatar) {
//
//
uploadImgApi(avatar, 'avatar').then((res)=>{
console.log(res)
uni.setStorageSync('avatarBase64', res)
uni.navigateBack()
}).catch(()=>{
_this.$u.toast('上传失败,请重试')
})
//
// uni.uploadFile({
// url: pathurl,
// filePath: avatar,
// name: 'file',
// formData: { token: token, userId: userId},
// success: res => {
// console.log('uploadImage success, res is:', res);
// uni.showToast({
// title: '',
// icon: 'success',
// duration: 1000
// });
// },
// ail: err => {
// console.log('uploadImage fail', err);
// uni.showModal({
// content: err.errMsg,
// showCancel: false
// });
// uni.hideLoading();
// },
// complete: () => {
// console.log('complate');
// }
// });
} else {
console.log('获取图片失败,请稍后重试');
}
});
},
uploadTap() {
const self = this;
uni.chooseImage({
count: 1, // 9
sizeType: ['compressed'], //
sourceType: ['album', 'camera'], //
success(res) {
let src = res.tempFilePaths[0];
// datasrc
self.weCropper.pushOrign(src);
}
});
}
},
onLoad(option) {
// do something
const cropperOpt = this.cropperOpt;
const src = option.src;
if (src) {
Object.assign(cropperOpt, {
src
});
this.weCropper = new weCropper(cropperOpt)
.on('ready', function(ctx) {})
.on('beforeImageLoad', ctx => {
uni.showToast({
title: '上传中',
icon: 'loading',
duration: 3000
});
})
.on('imageLoad', ctx => {
uni.hideToast();
});
}
}
};
</script>
<style>
.content {
background: rgba(255, 255, 255, 1);
}
.head-list {
height: 43px;
width: 100%;
background: #ffffff;
justify-content: center;
align-items: center;
display: flex;
border-bottom: 1px solid rgba(244, 244, 244, 1);
}
.head-info {
text-align: center;
font-size: 18px;
color: #000000;
font-weight: bold;
}
.save-box {
position: absolute;
right: 0px;
width: 50px;
height: 43px;
line-height: 43px;
}
.save {
color: rgba(98, 111, 252, 1);
font-size: 16px;
font-weight: 400;
}
.icon-back {
margin-top: 11px;
width: 10px;
height: 18px;
color: #000000;
margin-left: 6px;
}
.icon-back-box {
display: block;
position: absolute;
left: 6px;
height: 43px;
width: 30px;
align-items: center;
}
.cropper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.cropper-buttons {
background-color: rgba(0, 0, 0, 0.95);
color: #04b00f;
}
.cropper-wrapper {
position: relative;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
background-color: #F0F0F0;
}
.cropper-buttons {
width: 100vw;
height: 50px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
position: fixed;
bottom: 0;
left: 0;
line-height: 50px;
}
.cropper-buttons .upload,
.cropper-buttons .getCropperImage {
width: 50%;
text-align: center;
}
</style>

709
pages/mineEntry/uAvatarCropper/weCropper.js

@ -0,0 +1,709 @@
(function(global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.weCropper = factory());
}(this, (function() {
'use strict';
/**
* Created by sail on 2017/6/11.
*/
var device = void 0;
var TOUCH_STATE = ['touchstarted', 'touchmoved', 'touchended'];
function firstLetterUpper(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
function setTouchState(instance) {
for (var _len = arguments.length, arg = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
arg[_key - 1] = arguments[_key];
}
TOUCH_STATE.forEach(function(key, i) {
if (arg[i] !== undefined) {
instance[key] = arg[i];
}
});
}
function validator(instance, o) {
Object.defineProperties(instance, o);
}
function getDevice() {
if (!device) {
device = wx.getSystemInfoSync();
}
return device;
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
return typeof obj;
} : function(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var classCallCheck = function(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function() {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function(Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var slicedToArray = function() {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return function(arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
var tmp = {};
var DEFAULT = {
id: {
default: 'cropper',
get: function get$$1() {
return tmp.id;
},
set: function set$$1(value) {
if (typeof value !== 'string') {}
tmp.id = value;
}
},
width: {
default: 750,
get: function get$$1() {
return tmp.width;
},
set: function set$$1(value) {
tmp.width = value;
}
},
height: {
default: 750,
get: function get$$1() {
return tmp.height;
},
set: function set$$1(value) {
tmp.height = value;
}
},
scale: {
default: 2.5,
get: function get$$1() {
return tmp.scale;
},
set: function set$$1(value) {
tmp.scale = value;
}
},
zoom: {
default: 5,
get: function get$$1() {
return tmp.zoom;
},
set: function set$$1(value) {
tmp.zoom = value;
}
},
src: {
default: 'cropper',
get: function get$$1() {
return tmp.src;
},
set: function set$$1(value) {
tmp.src = value;
}
},
cut: {
default: {},
get: function get$$1() {
return tmp.cut;
},
set: function set$$1(value) {
tmp.cut = value;
}
},
onReady: {
default: null,
get: function get$$1() {
return tmp.ready;
},
set: function set$$1(value) {
tmp.ready = value;
}
},
onBeforeImageLoad: {
default: null,
get: function get$$1() {
return tmp.beforeImageLoad;
},
set: function set$$1(value) {
tmp.beforeImageLoad = value;
}
},
onImageLoad: {
default: null,
get: function get$$1() {
return tmp.imageLoad;
},
set: function set$$1(value) {
tmp.imageLoad = value;
}
},
onBeforeDraw: {
default: null,
get: function get$$1() {
return tmp.beforeDraw;
},
set: function set$$1(value) {
tmp.beforeDraw = value;
}
}
};
/**
* Created by sail on 2017/6/11.
*/
function prepare() {
var self = this;
var _getDevice = getDevice(),
windowWidth = _getDevice.windowWidth;
self.attachPage = function() {
var pages = getCurrentPages
// 获取到当前page上下文
();
var pageContext = pages[pages.length - 1];
// 把this依附在Page上下文的wecropper属性上,便于在page钩子函数中访问
pageContext.wecropper = self;
};
self.createCtx = function() {
var id = self.id;
if (id) {
self.ctx = wx.createCanvasContext(id);
}
};
self.deviceRadio = windowWidth / 750;
self.deviceRadio=self.deviceRadio.toFixed(2)
}
/**
*
*/
function observer() {
var self = this;
var EVENT_TYPE = ['ready', 'beforeImageLoad', 'beforeDraw', 'imageLoad'];
self.on = function(event, fn) {
if (EVENT_TYPE.indexOf(event) > -1) {
if (typeof fn === 'function') {
event === 'ready' ? fn(self) : self['on' + firstLetterUpper(event)] = fn;
}
}
return self;
};
}
/**
* Created by sail on 2017/6/11.
*/
function methods() {
var self = this;
var deviceRadio = self.deviceRadio;
console.log(JSON.stringify(self));
var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度
var boundHeight = self.height; // 裁剪框默认高度,即整个画布高度
var _self$cut = self.cut,
_self$cut$x = _self$cut.x,
x = _self$cut$x === undefined ? 0 : _self$cut$x,
_self$cut$y = _self$cut.y,
y = _self$cut$y === undefined ? 0 : _self$cut$y,
_self$cut$width = _self$cut.width,
width = _self$cut$width === undefined ? boundWidth : _self$cut$width,
_self$cut$height = _self$cut.height,
height = _self$cut$height === undefined ? boundHeight : _self$cut$height;
self.updateCanvas = function() {
if (self.croperTarget) {
// 画布绘制图片
self.ctx.drawImage(self.croperTarget, self.imgLeft, self.imgTop, self.scaleWidth, self.scaleHeight);
}
typeof self.onBeforeDraw === 'function' && self.onBeforeDraw(self.ctx, self);
self.setBoundStyle // 设置边界样式
();
self.ctx.draw();
return self;
};
self.pushOrign = function(src) {
self.src = src;
typeof self.onBeforeImageLoad === 'function' && self.onBeforeImageLoad(self.ctx, self);
uni.getImageInfo({
src: src,
success: function success(res) {
var innerAspectRadio = res.width / res.height;
self.croperTarget = res.path||src;
if (innerAspectRadio < width / height) {
self.rectX = x;
self.baseWidth = width;
self.baseHeight = width / innerAspectRadio;
self.rectY = y - Math.abs((height - self.baseHeight) / 2);
} else {
self.rectY = y;
self.baseWidth = height * innerAspectRadio;
self.baseHeight = height;
self.rectX = x - Math.abs((width - self.baseWidth) / 2);
}
self.imgLeft = self.rectX;
self.imgTop = self.rectY;
self.scaleWidth = self.baseWidth;
self.scaleHeight = self.baseHeight;
self.updateCanvas();
typeof self.onImageLoad === 'function' && self.onImageLoad(self.ctx, self);
}
});
self.update();
return self;
};
self.getCropperImage = function() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var id = self.id;
var ARG_TYPE = toString.call(args[0]);
switch (ARG_TYPE) {
case '[object Object]':
var _args$0$quality = args[0].quality,
quality = _args$0$quality === undefined ? 10 : _args$0$quality;
console.log("quality--"+quality);
uni.canvasToTempFilePath({
canvasId: id,
x: x,
y: y,
width: width,
height: height,
destWidth: width * quality / (deviceRadio * 10),
destHeight: height * quality / (deviceRadio * 10),
success: function success(res) {
console.log(res);
typeof args[args.length - 1] === 'function' && args[args.length - 1](res.tempFilePath);
}
});
break;
case '[object Function]':
uni.canvasToTempFilePath({
canvasId: id,
x: x,
y: y,
fileType:"jpg",
width: width,
height: height,
destWidth: width ,
destHeight: height,
success: function success(res) {
typeof args[args.length - 1] === 'function' && args[args.length - 1](res.tempFilePath);
}
});
break;
}
return self;
};
}
/**
* Created by sail on 2017/6/11.
*/
function update() {
var self = this;
if (!self.src) return;
self.__oneTouchStart = function(touch) {
self.touchX0 = touch.x;
self.touchY0 = touch.y;
};
self.__oneTouchMove = function(touch) {
var xMove = void 0,
yMove = void 0;
//计算单指移动的距离
if (self.touchended) {
return self.updateCanvas();
}
xMove = touch.x - self.touchX0;
yMove = touch.y - self.touchY0;
var imgLeft = self.rectX + xMove;
var imgTop = self.rectY + yMove;
self.outsideBound(imgLeft, imgTop);
self.updateCanvas();
};
self.__twoTouchStart = function(touch0, touch1) {
var xMove = void 0,
yMove = void 0,
oldDistance = void 0;
self.touchX1 = self.rectX + self.scaleWidth / 2;
self.touchY1 = self.rectY + self.scaleHeight / 2;
//计算两指距离
xMove = touch1.x - touch0.x;
yMove = touch1.y - touch0.y;
oldDistance = Math.sqrt(xMove * xMove + yMove * yMove);
self.oldDistance = oldDistance;
};
self.__twoTouchMove = function(touch0, touch1) {
var xMove = void 0,
yMove = void 0,
newDistance = void 0;
var scale = self.scale,
zoom = self.zoom;
// 计算二指最新距离
xMove = touch1.x - touch0.x;
yMove = touch1.y - touch0.y;
newDistance = Math.sqrt(xMove * xMove + yMove * yMove
// 使用0.005的缩放倍数具有良好的缩放体验
);
self.newScale = self.oldScale + 0.001 * zoom * (newDistance - self.oldDistance);
// 设定缩放范围
self.newScale <= 1 && (self.newScale = 1);
self.newScale >= scale && (self.newScale = scale);
self.scaleWidth = self.newScale * self.baseWidth;
self.scaleHeight = self.newScale * self.baseHeight;
var imgLeft = self.touchX1 - self.scaleWidth / 2;
var imgTop = self.touchY1 - self.scaleHeight / 2;
self.outsideBound(imgLeft, imgTop);
self.updateCanvas();
};
self.__xtouchEnd = function() {
self.oldScale = self.newScale;
self.rectX = self.imgLeft;
self.rectY = self.imgTop;
};
}
/**
* Created by sail on 2017/6/11.
*/
var handle = {
// 图片手势初始监测
touchStart: function touchStart(e) {
var self = this;
var _e$touches = slicedToArray(e.touches, 2),
touch0 = _e$touches[0],
touch1 = _e$touches[1];
console.log(JSON.stringify(touch1));
if(!touch0.x){
touch0.x=touch0.clientX;
touch0.y=touch0.clientY;
if(touch1){
touch1.x=touch1.clientX;
touch1.y=touch1.clientY;
}
}
setTouchState(self, true, null, null
//计算第一个触摸点的位置,并参照改点进行缩放
);
self.__oneTouchStart(touch0
// 两指手势触发
);
if (e.touches.length >= 2) {
self.__twoTouchStart(touch0, touch1);
}
},
// 图片手势动态缩放
touchMove: function touchMove(e) {
var self = this;
var _e$touches2 = slicedToArray(e.touches, 2),
touch0 = _e$touches2[0],
touch1 = _e$touches2[1];
if(!touch0.x){
touch0.x=touch0.clientX;
touch0.y=touch0.clientY;
if(touch1){
touch1.x=touch1.clientX;
touch1.y=touch1.clientY;
}
}
setTouchState(self, null, true
// 单指手势时触发
);
if (e.touches.length === 1) {
self.__oneTouchMove(touch0);
}
// 两指手势触发
if (e.touches.length >= 2) {
self.__twoTouchMove(touch0, touch1);
}
},
touchEnd: function touchEnd(e) {
var self = this;
setTouchState(self, false, false, true);
self.__xtouchEnd();
}
};
/**
* Created by sail on 1017/6/12.
*/
function cut() {
var self = this;
var deviceRadio = self.deviceRadio;
var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度
var boundHeight = self.height;
// 裁剪框默认高度,即整个画布高度
var _self$cut = self.cut,
_self$cut$x = _self$cut.x,
x = _self$cut$x === undefined ? 0 : _self$cut$x,
_self$cut$y = _self$cut.y,
y = _self$cut$y === undefined ? 0 : _self$cut$y,
_self$cut$width = _self$cut.width,
width = _self$cut$width === undefined ? boundWidth : _self$cut$width,
_self$cut$height = _self$cut.height,
height = _self$cut$height === undefined ? boundHeight : _self$cut$height;
/**
* 设置边界
* @param imgLeft 图片左上角横坐标值
* @param imgTop 图片左上角纵坐标值
*/
self.outsideBound = function(imgLeft, imgTop) {
self.imgLeft = imgLeft >= x ? x : self.scaleWidth + imgLeft - x <= width ? x + width - self.scaleWidth : imgLeft;
self.imgTop = imgTop >= y ? y : self.scaleHeight + imgTop - y <= height ? y + height - self.scaleHeight : imgTop;
};
/**
* 设置边界样式
* @param color 边界颜色
*/
self.setBoundStyle = function() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$color = _ref.color,
color = _ref$color === undefined ? '#04b00f' : _ref$color,
_ref$mask = _ref.mask,
mask = _ref$mask === undefined ? 'rgba(0, 0, 0, 0.3)' : _ref$mask,
_ref$lineWidth = _ref.lineWidth,
lineWidth = _ref$lineWidth === undefined ? 1 : _ref$lineWidth;
// 绘制半透明层
self.ctx.beginPath();
self.ctx.setFillStyle(mask);
self.ctx.fillRect(0, 0, x, boundHeight);
self.ctx.fillRect(x, 0, width, y);
self.ctx.fillRect(x, y + height, width, boundHeight - y - height);
self.ctx.fillRect(x + width, 0, boundWidth - x - width, boundHeight);
self.ctx.fill
// 设置边界左上角样式
// 为使边界样式处于边界外边缘,此时x、y均要减少lineWidth
();
self.ctx.beginPath();
self.ctx.setStrokeStyle(color);
self.ctx.setLineWidth(lineWidth);
self.ctx.moveTo(x - lineWidth, y + 10 - lineWidth);
self.ctx.lineTo(x - lineWidth, y - lineWidth);
self.ctx.lineTo(x + 10 - lineWidth, y - lineWidth);
self.ctx.stroke
// 设置边界左下角样式
// 为使边界样式处于边界外边缘,此时x要减少lineWidth、y要增加lineWidth
();
self.ctx.beginPath();
self.ctx.setStrokeStyle(color);
self.ctx.setLineWidth(lineWidth);
self.ctx.moveTo(x - lineWidth, y + height - 10 + lineWidth);
self.ctx.lineTo(x - lineWidth, y + height + lineWidth);
self.ctx.lineTo(x + 10 - lineWidth, y + height + lineWidth);
self.ctx.stroke
// 设置边界右上角样式
// 为使边界样式处于边界外边缘,此时x要增加lineWidth、y要减少lineWidth
();
self.ctx.beginPath();
self.ctx.setStrokeStyle(color);
self.ctx.setLineWidth(lineWidth);
self.ctx.moveTo(x + width - 10 + lineWidth, y - lineWidth);
self.ctx.lineTo(x + width + lineWidth, y - lineWidth);
self.ctx.lineTo(x + width + lineWidth, y + 10 - lineWidth);
self.ctx.stroke
// 设置边界右下角样式
// 为使边界样式处于边界外边缘,此时x、y均要增加lineWidth
();
self.ctx.beginPath();
self.ctx.setStrokeStyle(color);
self.ctx.setLineWidth(lineWidth);
self.ctx.moveTo(x + width + lineWidth, y + height - 10 + lineWidth);
self.ctx.lineTo(x + width + lineWidth, y + height + lineWidth);
self.ctx.lineTo(x + width - 10 + lineWidth, y + height + lineWidth);
self.ctx.stroke();
};
}
var __version__ = '1.1.4';
var weCropper = function() {
function weCropper(params) {
classCallCheck(this, weCropper);
var self = this;
var _default = {};
validator(self, DEFAULT);
Object.keys(DEFAULT).forEach(function(key) {
_default[key] = DEFAULT[key].default;
});
Object.assign(self, _default, params);
self.prepare();
self.attachPage();
self.createCtx();
self.observer();
self.cutt();
self.methods();
self.init();
self.update();
return self;
}
createClass(weCropper, [{
key: 'init',
value: function init() {
var self = this;
var src = self.src;
self.version = __version__;
typeof self.onReady === 'function' && self.onReady(self.ctx, self);
if (src) {
self.pushOrign(src);
}
setTouchState(self, false, false, false);
self.oldScale = 1;
self.newScale = 1;
return self;
}
}]);
return weCropper;
}();
Object.assign(weCropper.prototype, handle);
weCropper.prototype.prepare = prepare;
weCropper.prototype.observer = observer;
weCropper.prototype.methods = methods;
weCropper.prototype.cutt = cut;
weCropper.prototype.update = update;
return weCropper;
})));

2
pages/tabbar/index/comp/coachItem.vue

@ -7,7 +7,7 @@
<image src="@/static/images/index/avatar.png" mode="" v-else></image> <image src="@/static/images/index/avatar.png" mode="" v-else></image>
</view> </view>
<view class="name">{{ item.name}}</view> <view class="name">{{ item.name}}</view>
<view class="schoolName">{{ item.schoolName }}</view>
<view class="schoolName towRowText">{{ item.schoolName }}</view>
</view> </view>
<!-- <view class="tags"> <!-- <view class="tags">
<view class="tag" v-for="(item2,index) in 3" :key="index">没有字段</view> <view class="tag" v-for="(item2,index) in 3" :key="index">没有字段</view>

26
pages/tabbar/index/index.vue

@ -33,7 +33,7 @@
<swiper-item v-for="(item, index) in swiperInfo" :key="index" @click="bannerClick(item)" > <swiper-item v-for="(item, index) in swiperInfo" :key="index" @click="bannerClick(item)" >
<view class="swiper-item" :class="'swiper-item' + index"> <view class="swiper-item" :class="'swiper-item' + index">
<view class="imgBox"> <view class="imgBox">
<image :src="item.imgUrl" mode="widthFix"></image>
<image :src="item.imgUrl" mode=""></image>
</view> </view>
</view> </view>
</swiper-item> </swiper-item>
@ -57,7 +57,7 @@
<!-- 优质驾校 --> <!-- 优质驾校 -->
<view class="schoolCon card" v-if="recommendSchool.length"> <view class="schoolCon card" v-if="recommendSchool.length">
<view class="h1_row"> <view class="h1_row">
<view class="h1" ><text class="active">优质驾校</text></view>
<view class="h1" ><text class="active">风采驾校</text></view>
<moreRight text="查看全部" @click.native="$goPage('/pages/indexEntry/findShcool/findShcool')"/> <moreRight text="查看全部" @click.native="$goPage('/pages/indexEntry/findShcool/findShcool')"/>
</view> </view>
<view class="li" v-for="(item,index) in recommendSchool" :key="index" @click="$goPage('/pages/indexEntry/findShcool/shcoolDetail/shcoolDetail?schoolId='+ item.id)"> <view class="li" v-for="(item,index) in recommendSchool" :key="index" @click="$goPage('/pages/indexEntry/findShcool/shcoolDetail/shcoolDetail?schoolId='+ item.id)">
@ -188,6 +188,7 @@
informa: 1, informa: 1,
coachList: [],// coachList: [],//
recommendSchool: [],// recommendSchool: [],//
sweixin:null
} }
}, },
async onLoad() { async onLoad() {
@ -230,6 +231,7 @@
}, },
methods: { methods: {
async getLatLngFn() { async getLatLngFn() {
await this.$store.dispatch('getCity') await this.$store.dispatch('getCity')
this.recommendSchoolList() this.recommendSchoolList()
@ -328,15 +330,7 @@
url: '/pages/userCenter/login/loginByPhone' url: '/pages/userCenter/login/loginByPhone'
}) })
}, },
initFn() {
uni.requestSubscribeMessage({
tmplIds: ['0yaIdyI9NlHvGYwb3IIaIQq6uBhulYGN-rGVnJk4hZ4'],
success(res) {
console.log('消息是否有权限呢')
console.log(res)
}
})
}
} }
} }
</script> </script>
@ -489,4 +483,14 @@
display: flex; display: flex;
margin: 20rpx 0; margin: 20rpx 0;
} }
.swiper-box {
.swiper-item {
.imgBox {
width: 100%;
height: 300rpx;
display: block;
}
}
}
</style> </style>

10
pages/tabbar/mine/index.vue

@ -23,7 +23,6 @@
<view class="phone" v-if="vuex_userInfo.name">{{ vuex_userInfo.phone }}</view> <view class="phone" v-if="vuex_userInfo.name">{{ vuex_userInfo.phone }}</view>
</view> </view>
</view> </view>
<view class="pad"> <view class="pad">
<view class="ul"> <view class="ul">
<view class="li" v-for="(item,index) in ulData" :key="index" @click="goPage(item)"> <view class="li" v-for="(item,index) in ulData" :key="index" @click="goPage(item)">
@ -47,6 +46,8 @@
</view> </view>
</view> </view>
<!-- <view @click="gotk" text="去题库">去题库</view> -->
<u-popup :show="show" mode="center" @close="show=false" :closeable="true"> <u-popup :show="show" mode="center" @close="show=false" :closeable="true">
<view style="width: 90vw;"> <view style="width: 90vw;">
<image :src="vuex_userInfo.photoPath" mode="widthFix" ></image> <image :src="vuex_userInfo.photoPath" mode="widthFix" ></image>
@ -83,7 +84,12 @@
if(this.show) this.show = false if(this.show) this.show = false
}, },
methods: { methods: {
gotk() {
this.$store.commit('updateWebVeiwUrl', 'http://192.168.1.94:1314/h5#/pages/exercises/brushQuestions/brushQuestions')
uni.navigateTo({
url: '/pages/indexEntry/webView/webView'
})
},
topClick() { topClick() {
if(!this.vuex_userInfo.phone) { if(!this.vuex_userInfo.phone) {
this.$goPage('/pages/userCenter/login/login') this.$goPage('/pages/userCenter/login/login')

7
store/modules/user.js

@ -95,12 +95,7 @@ const user = {
const http = uni.$u.http const http = uni.$u.http
let config = { custom: { auth: false }, header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'} } let config = { custom: { auth: false }, header: {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'} }
const res = await http.get('app/student-record/get') const res = await http.get('app/student-record/get')
// if(res.tenantId) {
// uni.$u.http.setConfig((config) => {
// config.header['tenant-id'] = res.tenantId
// return config
// })
// }
if(!res) return
commit('update_vuex_userInfo',res.data) commit('update_vuex_userInfo',res.data)
}, },
// 刷新token // 刷新token

Loading…
Cancel
Save