Commit 2344c9be by 张立顺

第二轮bug修复

1 parent e5b21305
<!-- packageEquity/pages/carEquity/components/GLForm/GLForm.wxml -->
<view wx:for="{{formDataList}}" wx:key="index">
<gl-cell border="{{!item.noBorder}}" class="{{item.name}}" haveArrow="{{item.haveArrow || false}}" valueAlign="right" label="{{item.label}}" labelWidth="{{labelWidth}}" placeholder="{{item.placeholder || ''}}" bindclick="handleCellClick" data-target="{{item}}" data-idx="{{index}}" cellHeight="{{!item.noCellHeight}}">
<!-- input / textarea -->
<van-field wx:if="{{item.type == 'input'}}" class="textarea" value="{{formData[item.name]}}" input-align="{{itme.inputAlign || 'right'}}" rows="1" autosize type="{{item.fieldType || 'text'}}" placeholder="{{item.placeholder || '请输入'}}" maxlength="{{item.maxlength || 140}}" disabled="{{item.disabled}}" readonly="{{item.readonly}}" data-attr="{{item.name}}" bindinput="handleInput" />
<!-- picker -->
<picker wx:if="{{item.type == 'select'}}" bindchange="handlePickerChange" data-target="{{item}}" value="{{index}}" range="{{item.optionList}}" range-key="{{item.optionLabel}}">
<view class="picker">
<image class="arrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.labelName]}}">
{{formData[item.labelName]}}
</view>
<text class="placeholder" wx:else>请选择</text>
</view>
</picker>
<!-- 时间选择器 -->
<picker wx:if="{{item.type == 'pickerTime'}}" mode="date" value="{{formData[name]}}" start="{{item.start || ''}}" end="{{item.end || ''}}" bindchange="handleTimeChange" data-target="{{item}}">
<view class="picker">
<image class="arrow" src="../../../components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.name]}}">{{formData[item.name]}}</view>
<text class="placeholder" wx:else>请选择</text>
</view>
</picker>
<!-- 品牌车型 -->
<view wx:if="{{item.type == 'brand' && formData.vehicleBrandId}}">{{formData.vehicleBrandName}}/{{formData.vehicleSubBrandName}}/{{formData.vehicleSeriesName}}/{{formData.vehicleShapeName}}</view>
</gl-cell>
</view>
\ No newline at end of file
<gl-cell
border="{{!item.noBorder}}"
class="{{item.name}}"
haveArrow="{{item.haveArrow || false}}"
valueAlign="right"
label="{{item.label}}"
labelWidth="{{labelWidth}}"
placeholder="{{item.placeholder || ''}}"
bindclick="handleCellClick"
data-target="{{item}}"
data-idx="{{index}}"
cellHeight="{{!item.noCellHeight}}">
<!-- input / textarea -->
<van-field
border="{{false}}"
wx:if="{{item.type == 'input'}}"
class="textarea"
value="{{formData[item.name]}}"
input-align="{{itme.inputAlign || 'right'}}"
rows="1"
autosize
type="{{item.fieldType || 'text'}}"
placeholder="{{item.placeholder || '请输入'}}"
maxlength="{{item.maxlength || 140}}"
disabled="{{item.disabled}}"
readonly="{{item.readonly}}"
data-attr="{{item.name}}"
bindinput="handleInput" />
<!-- picker -->
<picker
wx:if="{{item.type == 'select'}}"
bindchange="handlePickerChange"
data-target="{{item}}"
value="{{index}}"
range="{{item.optionList}}"
range-key="{{item.optionLabel}}">
<view class="picker">
<image class="arrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.labelName]}}">
{{formData[item.labelName]}}
</view>
<text class="placeholder" wx:else>请选择</text>
</view>
</picker>
<!-- 时间选择器 -->
<picker
wx:if="{{item.type == 'pickerTime'}}"
mode="date"
value="{{formData[name]}}"
start="{{item.start || ''}}"
end="{{item.end || ''}}"
bindchange="handleTimeChange"
data-target="{{item}}">
<view class="picker">
<image class="arrow" src="../../../components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{formData[item.name]}}">{{formData[item.name]}}</view>
<text class="placeholder" wx:else>请选择</text>
</view>
</picker>
<!-- 品牌车型 -->
<view wx:if="{{item.type == 'brand' && formData.vehicleBrandId}}">
{{formData.vehicleBrandName}}/{{formData.vehicleSubBrandName}}/{{formData.vehicleSeriesName}}/{{formData.vehicleShapeName}}
</view>
</gl-cell>
</view>
......@@ -10,7 +10,7 @@
</view>
<view class="item" wx:if="{{item.orderType!='success'}}">
<view class="label">{{item.labelName}}</view>
<view class="text" style="color:{{orderInfo.payOrder[item.key]==2?'#FF6601':'#4AC18E'}}" wx:if="{{item.key == 'payStatus'}}">
<view class="text" style="color:{{orderInfo.payOrder[item.key]==2?'#4AC18E':'#FF6601'}}" wx:if="{{item.key == 'payStatus'}}">
{{orderInfo.payOrder[item.key]==2?'已支付':'待支付'}}
<!-- test -->
</view>
......
......@@ -14,7 +14,6 @@ const errorObj = {
btnTxt: '重新提单'
}
Page({
/**
* 页面的初始数据
*/
......@@ -36,8 +35,8 @@ Page({
// isSuccessDialog: false,
contractNo: '',
apiObj: {
'detail': 'getEquityDetail',
'handler': 'getEquityHandler'
detail: 'getEquityDetail',
handler: 'getEquityHandler'
},
// 弹窗
isDialogShow: false,
......@@ -140,7 +139,7 @@ Page({
console.log(type, data)
let { serviceInfo } = this.data
if (type == 'vehicleCertificate') {
let { vinNo: vin, limitPassenger: seatesNum, engineType: engineNo, carColor: vehicleColor } = data
let { vinNo: vin, seatingCapacity: seatesNum, engineNo: engineNo, carColor: vehicleColor } = data
serviceInfo = Object.assign(serviceInfo, { vin, seatesNum, engineNo, vehicleColor })
}
if (type == 'idCard') {
......@@ -186,8 +185,8 @@ Page({
confirm(e) {
var typeObj = {
"draft": 0,
'confirm': 1
draft: 0,
confirm: 1
}
let { serviceInfo } = this.data
let type = e.detail?.type || 'draft'
......@@ -295,49 +294,35 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file
onShareAppMessage() {}
})
......@@ -2,7 +2,7 @@
<view class="payInfo">
<view class="payCom">
<view class="title">支付成功</view>
<view class="payPrice">订单支付成功,实付 1000.00 元</view>
<view class="payPrice">订单支付成功,实付 {{orderDetail.totalPrice}} 元</view>
</view>
<view class="tips">
<view class="title">温馨提示</view>
......
......@@ -30,22 +30,17 @@ Page({
wxqrcode: res.data
})
// 轮询订单状态
this.getOrderDetail()
this.getDetail()
})
},
getOrderDetail() {
// console.log(wx.$router, 'wx.$router')
let _this = this
// getOrderDetail() {
// // console.log(wx.$router, 'wx.$router')
// let _this = this
// let { orderCode } = this.data
// _this.getDetail(orderCode)
// },
getDetail() {
let { orderCode } = this.data
_this.getDetail(orderCode)
if (!time) {
time = setInterval(() => {
_this.getDetail(orderCode)
}, 5 * 1000)
}
},
getDetail(orderCode) {
// console.log(orderCode)
let _this = this
getOrderDetail({
......@@ -92,13 +87,14 @@ Page({
}
})
.finally(() => {
if (time) clearInterval(time)
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const url = `${currentPage.route}`
// console.log(url, 'url')
if ('packageEquity/pages/carQuotation/CarQuotationPay/CarQuotationPay' != url) {
if (time) clearInterval(time)
if ('packageEquity/pages/carQuotation/CarQuotationPay/CarQuotationPay' == url) {
time = setInterval(() => {
_this.getDetail(orderCode)
}, 5 * 1000)
}
})
},
......@@ -106,7 +102,7 @@ Page({
let { orderId, orderCode, orderDetail, id } = this.data
updateOrderStatus({ id, orderStatus: 3 })
.then(result => {
wx.$router.go('CarQuotationDetail', { orderId, orderCode, orderDetail, id })
wx.$router.reLaunch('CarQuotationDetail', { orderId, orderCode, orderDetail, id })
})
.catch(err => {})
},
......@@ -156,13 +152,15 @@ Page({
*/
onHide() {
// clearInterval(time)
if (time) clearInterval(time)
// if (time) clearInterval(time)
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
onUnload() {
if (time) clearInterval(time)
},
/**
* 页面相关事件处理函数--监听用户下拉动作
......
......@@ -109,7 +109,7 @@ Component({
getEmployee() {
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
let params = {
merchantId: userInfo.merchantId
merchantId: userInfo.default4SStoreInfo.merchantId
}
carLifeApi.getEmployeeList(params).then(res => {
if (res.code == 0) {
......
......@@ -8,6 +8,9 @@ const formRule = {
}
import fn from '../constant/ruleFn'
Component({
options: {
styleIsolation: 'shared'
},
/**
* 组件的属性列表
*/
......
......@@ -13,14 +13,14 @@
data-attrName="typeName"
placeholder="请输入"
bindinput="handleInput" />
<view class="title">险种方案</view>
<view class="title">险种保额</view>
<van-field
class="inputBox"
border="{{false}}"
value="{{compensation}}"
data-attrType="vehiclesAndVessels"
data-attrName="compensation"
placeholder="请输入险种方案"
placeholder="请输入险种保额"
bindinput="handleInput" />
<view class="title">保费</view>
<van-field
......
......@@ -19,4 +19,9 @@
border-radius: 12rpx;
overflow: hidden;
margin: 16rpx 0;
}
.inputBox .van-field__body {
padding-left: 8rpx;
width: 570rpx;
}
\ No newline at end of file
......@@ -3,6 +3,9 @@ import data from '../constant/stepData'
import fn from '../constant/ruleFn'
const defaultLabelWidth = '140rpx'
Component({
options: {
styleIsolation: 'shared'
},
// behaviors: ['wx://component-export'],
// export() {
// return this.test
......@@ -10,6 +13,14 @@ Component({
/**
* 组件的属性列表
*/
pageLifetimes: {
show: function () {
let that = this
// 调用年份的操作
that.makeYear()
},
hide: function () {}
},
properties: {
serviceInfo: {
type: Object,
......@@ -44,6 +55,16 @@ Component({
*/
data: {
defaultLabelWidth,
showYear: false,
// 选择时间的年份
columns: [],
currentDate: new Date().getTime(),
// 默认当前年份
currentIndex: new Date().getFullYear() - (new Date().getFullYear() - 25),
currentName: new Date().getFullYear() + '年',
popupShow: false,
popupInputShow: false,
// customInput: true,
......@@ -75,6 +96,50 @@ Component({
// let { activeNames } = this.data
// console.log('activeNames', activeNames)
// },
//--------自定义方法----------
// 选择年份的区域,弹出弹窗框
chooseYear() {
console.log('选择年份')
this.setData({
showYear: true
})
},
// 弹出框确认事件
onConfirm(e) {
// console.log(e, 1111)
let thisPage = wx.$router.getPageInstance()
console.log(value, 'value')
thisPage.setData({
// ['orderInfo' + '.' + attrtype + '.' + attrname]: value
['orderInfo.vehiclesAndVessels.compensation']: value + '年'
})
this.setData({
showYear: false
})
},
// 取消选择年份的弹框
onCancel() {
let that = this
that.setData({
showYear: false
})
},
// 对选择时间进行单独的处理
makeYear() {
let year = []
let currentDate = new Date()
console.log(currentDate.getFullYear())
for (let j = currentDate.getFullYear() - 25; j < currentDate.getFullYear(); j++) {
year.push(j)
}
for (let i = currentDate.getFullYear(); i <= currentDate.getFullYear() + 25; i++) {
year.push(i)
}
this.setData({
columns: year
})
},
handlePopupShow(e) {
// console.log(e)
// let { attrtype, attrname, typename } = e.target.dataset
......@@ -125,7 +190,12 @@ Component({
this.triggerEvent('editSave')
}
},
onchange() {},
onChange(event) {
console.log(event, 'event')
this.setData({
activeNames: event.detail
})
},
handleInput(e) {
let value = e.detail
......@@ -136,7 +206,7 @@ Component({
console.log(attrtype)
if (attrtype == 'modifyEquityQuotation') {
let { orderInfo } = this.data
let showError = orderInfo.modifyEquityQuotation.minEquityPrice < value ? false : true
let showError = orderInfo.modifyEquityQuotation.minEquityPrice <= value ? false : true
this.setData({
showError
})
......
......@@ -7,6 +7,9 @@
"van-collapse-item": "@vant/weapp/collapse-item/index",
"van-checkbox": "@vant/weapp/checkbox/index",
"popup-select": "../PopupSelect/PopupSelect",
"popup-input": "../PopupInput/PopupInput"
"popup-input": "../PopupInput/PopupInput",
"van-popup": "@vant/weapp/popup/index",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-picker": "@vant/weapp/picker/index"
}
}
......@@ -136,9 +136,16 @@
border-radius: 12rpx;
overflow: hidden;
margin: 16rpx 0;
.van-field__body {
padding-left: 8rpx;
width: 570rpx;
}
}
}
.incrementInfo {
box-sizing: border-box;
width: 100%;
......@@ -211,4 +218,8 @@
padding-left: 20rpx;
font-size: 28rpx;
color: #EB4E4E;
}
.placeHolder {
color: #B6B6B8;
}
\ No newline at end of file
......@@ -8,11 +8,14 @@
catchtap="handlePopupShow">
<view class="label">保险公司</view>
<view class="right">
<view class="Company">{{orderInfo.business.company}}</view>
<view class="Company" wx:if="{{orderInfo.business.company}}">
{{orderInfo.business.company}}
</view>
<view class="Company placeHolder" wx:else>请选择</view>
<image class="arrow" src="/components/images/arrow-x.png" />
</view>
</view>
<van-collapse value="{{activeNames}}">
<van-collapse value="{{activeNames}}" bind:change="onChange">
<view class="collapse">
<van-collapse-item name="1">
<view slot="title">
......@@ -29,6 +32,7 @@
value="{{orderInfo.business.base}}"
data-attrName="base"
data-type='number'
placeholder="请输入保费"
data-attrType="business"
bindinput="handleInput">
<view slot="left-icon">
......@@ -53,6 +57,7 @@
<van-field
class="inputBox"
border="{{false}}"
placeholder="请输入保费"
value="{{orderInfo.business.threePremium}}"
data-type='number'
data-attrType="business"
......@@ -80,6 +85,7 @@
<van-field
class="inputBox"
border="{{false}}"
placeholder="请输入保费"
data-type='number'
value="{{orderInfo.business.carInsidePremium}}"
data-attrType="business"
......@@ -107,6 +113,7 @@
<van-field
class="inputBox"
border="{{false}}"
placeholder="请输入保费"
data-type='number'
value="{{orderInfo.business.passengerPremium}}"
data-attrType="business"
......@@ -186,6 +193,7 @@
<van-field
class="inputBox"
border="{{false}}"
placeholder="请输入"
value="{{orderInfo.mutualStrength.compensation}}"
data-attrType="mutualStrength"
data-attrName="compensation"
......@@ -193,6 +201,7 @@
<van-field
class="inputBox"
border="{{false}}"
placeholder="请输入保费"
data-type='number'
value="{{orderInfo.mutualStrength.payPrice}}"
data-attrType="mutualStrength"
......@@ -203,16 +212,27 @@
</view>
</van-field>
<view class="title">车船税</view>
<van-field
<view bind:tap="chooseYear" class="selectItem" catchtap="handlePopupShow">
{{orderInfo.vehiclesAndVessels.compensation}}
<image
class="arrow"
src="/components/images/arrow-x.png"
mode="widthFix"
binderror=""
bindload="" />
</view>
<!-- <van-field
class="inputBox"
border="{{false}}"
placeholder="请输入"
value="{{orderInfo.vehiclesAndVessels.compensation}}"
data-attrType="vehiclesAndVessels"
data-attrName="compensation"
bindinput="handleInput" />
bindinput="handleInput" /> -->
<van-field
class="inputBox"
border="{{false}}"
placeholder="请输入保费"
data-type='number'
value="{{orderInfo.vehiclesAndVessels.payPrice}}"
data-attrType="vehiclesAndVessels"
......@@ -245,7 +265,9 @@
<text>包含</text>
<!-- {{orderInfo.quotationGoodsInfo.quotationGoodsServiceItemsRelationDTOList.length==index?'':'、'}} -->
<block wx:key="index" wx:for="{{orderInfo.quotationGoodsInfo.quotationGoodsServiceItemsRelationDTOList}}">
<text>{{item.serviceName}}{{orderInfo.quotationGoodsInfo.quotationGoodsServiceItemsRelationDTOList.length==index?'':'、'}}</text>
<text>
{{item.serviceName}}{{orderInfo.quotationGoodsInfo.quotationGoodsServiceItemsRelationDTOList.length==index?'':'、'}}
</text>
</block>
</view>
</view>
......
......@@ -12,10 +12,11 @@ const formRule = {
}
],
certificateNo: [
{ required: false, message: '证件号码不能为空' },
{
validator: (rule, value) => {
return value.length != 18 ? { message: '请输入正确的18位证件号' } : null
if (value) {
return value.length != 18 ? { message: '请输入正确的18位证件号' } : null
}
}
}
],
......@@ -28,7 +29,14 @@ const formRule = {
}
],
seat: [{ required: true, message: '座位数不能为空' }],
price: [{ required: true, message: '车辆发票价不能为空' }]
price: [
{ required: true, message: '车辆发票价不能为空' },
{
validator: (rule, value) => {
return value > 2000000 ? { message: '车辆发票价最高不能超过200万' } : null
}
}
]
// engineNo: [{ required: true, message: '发动机号不能为空' }],
// vehicleColor: [{ required: true, message: '车身颜色不能为空' }],
......
......@@ -30,11 +30,14 @@ Page({
driver: '1万',
passenger: '1万'
},
// ['orderInfo.vehiclesAndVessels.compensation']: value + '年'
// currentName: new Date().getFullYear() + '年',
mutualStrength: {
type: 1
},
vehiclesAndVessels: {
type: 2
type: 2,
compensation: new Date().getFullYear() + '年'
},
valueAddedVehicleLoss: {
type: 3
......@@ -43,15 +46,15 @@ Page({
},
// 页面存放表单对象的对象名
dataAttrName: 'owner',
step: 'first',
// step: 'second',
// step: 'first',
step: 'second',
needChangeList: ['price', 'base', 'threePremium', 'carInsidePremium', 'passengerPremium', 'payPrice']
},
reWrite(type, data) {
console.log(type, data)
let { owner } = this.data
if (type == 'vehicleCertificate') {
let { vinNo: carVin, limitPassenger: seat, engineType: engineNumber, carColor } = data
let { vinNo: carVin, seatingCapacity: seat, engineNo: engineNumber, carColor } = data
owner = Object.assign(owner, { carVin, seat, engineNumber, carColor })
}
if (type == 'idCard') {
......@@ -130,6 +133,7 @@ Page({
// this.setData({ orderInfo })
let result = await this.handleSecondConfirmCheck()
let { code, data: id, message } = result
console.log(id)
if (id) {
// 校验生成告知书是否成功
......@@ -140,6 +144,8 @@ Page({
// let
// status && this.navigatorNext(id)
} else {
console.log(message)
wx.$util.showToast(message || '报价失败')
}
......@@ -149,6 +155,7 @@ Page({
let { orderInfo, owner } = this.data
const insurance = ['business', 'mutualStrength', 'vehiclesAndVessels', 'valueAddedVehicleLoss', 'otherInsuranceList']
orderInfo = wx.$util.deepClone(orderInfo)
owner = wx.$util.deepClone(owner)
let { default4SStoreInfo } = wx.$util.getUserInfo()
orderInfo.owner = owner
orderInfo.owner.price = this.multipliedByHundred(orderInfo.owner?.price) || ''
......@@ -347,9 +354,9 @@ Page({
if (options.id) {
// 修改权益报价
let { modifyEquityQuotation } = options
let minEquityPrice = this.divideByHundred(modifyEquityQuotation.minEquityPrice)
let quotedPriceUpdate = this.divideByHundred(modifyEquityQuotation.quotedPriceUpdate)
if (modifyEquityQuotation) {
let minEquityPrice = this.divideByHundred(modifyEquityQuotation.minEquityPrice)
let quotedPriceUpdate = this.divideByHundred(modifyEquityQuotation.quotedPriceUpdate)
this.setData({
['orderInfo.modifyEquityQuotation']: {
minEquityPrice,
......
......@@ -174,7 +174,7 @@ Page({
wx.$util.showLoading('上传中...')
uploadImg({
file: `${type}@${_res.data}`
}).then(img => {
}).then(res => {
// _this.saveToHttp(img)
let { data } = res
_this.saveToHttp(data)
......@@ -196,7 +196,7 @@ Page({
quotationUpgrade(para).then(res => {
wx.$util.hideLoading()
let { code, data } = res
code == 0 && wx.$router.go('CarQuotationPay', { data, id })
code == 0 && wx.$router.relaunch('CarQuotationPay', { data, id })
})
}
})
......@@ -49,7 +49,7 @@ Page({
console.log(name)
if (name == 'confirm') {
// this.triggerEvent('confirm')
wx.$router.go('signature', { id })
wx.$router.reLaunch('signature', { id })
} else if (name == 'edit') {
// this.triggerEvent('editSave')
this.backEdit()
......
......@@ -215,7 +215,7 @@ Page({
wx.$util.hideLoading()
console.log(res, 'res')
let { code, data } = res
code == 0 && wx.$router.go('CarQuotationPay', { data, id })
code == 0 && wx.$router.relaunch('CarQuotationPay', { data, id })
})
}
})
<view class="signature-wrap">
<view class="descprion_wrap bgcw">
<view class="descTextTitle">尊敬的客户,您好!</view>
<view class="h3 descText">
本人自愿店方购买保险。新车投保项目我司进行了说明,本人完全理解保险公司在理赔上赔付差额或不赔付问题。本告知书对条款进行了简要介绍,作为投保参考,具体约定以保单及条款为准。
</view>
<view class="h3 descText">本人自愿在门店购买保险。门店已就新车投保项目及服务进行了说明,本人完全理解相关项目的服务流程及细则。</view>
<!-- <view class="h3 descText">
为进一步提高权益服务质量,您申请的{{serviceItemStr}}已被受理,请确认您的爱车(车架号:{{carInfo.vin}},车型:{{carInfo.vehicleBrandName || ''}}{{carInfo.vehicleSeriesName || ''}}{{carInfo.vehicleShapeName || ''}}),是否已到{{carInfo.merchantName}}进行服务。
</view>
......
......@@ -59,9 +59,10 @@ Page({
initImg(imgUrl) {
let that = this
let { canvas, ctx, windowWidth, windowHeight, iPath } = this.data
windowWidth = windowWidth
windowHeight = windowHeight
console.log(windowWidth, windowHeight)
// windowWidth = parseInt(windowWidth)
// windowHeight = parseInt(windowHeight)
canvas.width = windowWidth
canvas.height = windowHeight
......@@ -260,89 +261,6 @@ Page({
}
})
})
// wx.getSetting({
// success: res => {
// console.log(res)
// if (res.authSetting['scope.camera']) {
// // 用户已经授权
// console.log('用户已经授权')
// _this.setData({
// isAuth: true
// // isNeedSettingButton: false
// })
// } else {
// // 用户还没有授权,向用户发起授权请求
// wx.authorize({
// scope: 'scope.camera',
// success() {
// console.log('用户同意授权')
// // 用户同意授权
// _this.setData({
// isAuth: true
// // isNeedSettingButton: false
// })
// },
// fail() {
// // 用户不同意授权
// wx.showModal({
// title: '提示',
// content: '如需正常使用此小程序功能,请您按确定并在设置页面授权用户信息',
// cancelText: '不授权',
// cancelColor: '#999',
// confirmText: '授权',
// // confirmColor: '#f94218',
// success(res) {
// if (res.confirm) {
// wx.openSetting({
// success(res) {
// if (res.authSetting['scope.camera']) {
// //设置允许获取摄像头
// console.log('设置允许获取摄像头')
// wx.showToast({
// title: '授权成功',
// icon: 'success',
// duration: 1000
// })
// _this.setData({
// isAuth: true
// })
// } else {
// //不允许
// wx.showToast({
// title: '授权失败',
// icon: 'none',
// duration: 1000
// })
// wx.$router.back()
// }
// }
// })
// } else if (res.cancel) {
// console.log('用户点击取消')
// wx.showToast({
// title: '授权失败',
// icon: 'none',
// duration: 1000
// })
// wx.$router.back()
// }
// }
// })
// }
// })
// }
// },
// fail: res => {
// console.log('获取用户授权信息失败')
// wx.showToast({
// title: '获取用户授权信息失败',
// icon: 'none',
// duration: 3000
// })
// wx.$router.back()
// }
// })
},
// 获取存图片授权
......@@ -412,90 +330,6 @@ Page({
})
}
})
// })
// wx.getSetting({
// success: res => {
// console.log(res)
// if (res.authSetting['scope.camera']) {
// // 用户已经授权
// console.log('用户已经授权')
// _this.setData({
// isAuth: true
// // isNeedSettingButton: false
// })
// } else {
// // 用户还没有授权,向用户发起授权请求
// wx.authorize({
// scope: 'scope.camera',
// success() {
// console.log('用户同意授权')
// // 用户同意授权
// _this.setData({
// isAuth: true
// // isNeedSettingButton: false
// })
// },
// fail() {
// // 用户不同意授权
// wx.showModal({
// title: '提示',
// content: '如需正常使用此小程序功能,请您按确定并在设置页面授权用户信息',
// cancelText: '不授权',
// cancelColor: '#999',
// confirmText: '授权',
// // confirmColor: '#f94218',
// success(res) {
// if (res.confirm) {
// wx.openSetting({
// success(res) {
// if (res.authSetting['scope.camera']) {
// //设置允许获取摄像头
// console.log('设置允许获取摄像头')
// wx.showToast({
// title: '授权成功',
// icon: 'success',
// duration: 1000
// })
// _this.setData({
// isAuth: true
// })
// } else {
// //不允许
// wx.showToast({
// title: '授权失败',
// icon: 'none',
// duration: 1000
// })
// wx.$router.back()
// }
// }
// })
// } else if (res.cancel) {
// console.log('用户点击取消')
// wx.showToast({
// title: '授权失败',
// icon: 'none',
// duration: 1000
// })
// wx.$router.back()
// }
// }
// })
// }
// })
// }
// },
// fail: res => {
// console.log('获取用户授权信息失败')
// wx.showToast({
// title: '获取用户授权信息失败',
// icon: 'none',
// duration: 3000
// })
// wx.$router.back()
// }
// })
},
onShow: function (data) {
......@@ -531,17 +365,27 @@ Page({
that.ctx = wx.createCameraContext()
let { windowWidth, windowHeight } = wx.getSystemInfoSync()
this.setData({ windowWidth, windowHeight })
setTimeout(() => {
that.initCanvas()
}, 100)
},
initCanvas() {
console.log('onReady')
try {
const query = wx.createSelectorQuery()
query
.select('#image-canvas')
.fields({ node: true, size: true })
.exec(res => {
const canvas = res[0].node
const ctx = canvas.getContext('2d')
console.log(canvas, ctx, 'canvas, ctx')
this.setData({ canvas, ctx })
})
} catch (error) {
console.log(error)
}
},
// 在页面首次渲染实现生命周期获取操作canvas的上下文对象
onReady() {
const query = wx.createSelectorQuery()
query
.select('#image-canvas')
.fields({ node: true, size: true })
.exec(res => {
const canvas = res[0].node
const ctx = canvas.getContext('2d')
this.setData({ canvas, ctx })
})
}
onReady() {}
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!