Commit ed6b9c04 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 1e9638e6
......@@ -6,7 +6,7 @@
margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content">
<button class="button1" type="default" size="default" @click="tapMakePhoneCall">客服电话</button>
<button class="button2" open-type="im" data-im-id="dy1d1fub8mqd">客服在线</button>
<button v-if="false" class="button2" open-type="im" data-im-id="dy1d1fub8mqd">客服在线</button>
</view>
</view>
</uni-popup>
......
......@@ -169,6 +169,14 @@
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "cdkey/cdkey",
"style": {
"navigationStyle": "default",
"navigationBarTitleText": "兑换会员",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}]
}],
// 分包预载配置
......
......@@ -46,7 +46,8 @@
data() {
return {
imgUri: '',
tempUri: '',
tempUri: '',
tempPath: '',
userBean: {},
type: '',
ocrUrl: '',
......@@ -114,7 +115,8 @@
tt.compressImage({
src: that.tempUri,
quality: 80,
success: res => {
success: res => {
console.log('compressImage22223333',res)
that.uploadImg(res.tempFilePath)
},
fail: err => {
......@@ -132,8 +134,10 @@
this.ocr(this.ocrUrl)
}
},
ocr(imgUrl) {
if (this.scantype == ScanTypeBean.fanyi) {
ocr(imgUrl) {
if (this.scantype == ScanTypeBean.scan_pdf) {
this.generatePDF([this.tempPath])
}else if (this.scantype == ScanTypeBean.fanyi) {
this.fanyi(ScanTypeBean.zh, ScanTypeBean.en, imgUrl)
} else if (this.scantype == ScanTypeBean.fanyi) {
this.fanyi(ScanTypeBean.en, ScanTypeBean.zh, imgUrl)
......@@ -192,12 +196,8 @@
}
});
},
uploadImg(tempFilePath) {
if (this.scantype == ScanTypeBean.scan_pdf) {
// 图片转pdf
this.generatePDF([tempFilePath])
return
}
uploadImg(tempFilePath) {
this.tempPath=tempFilePath
let that = this;
......@@ -234,8 +234,17 @@
showLoading: true,
success: ({
data
}) => {
that.imgUri = that.tempUri
}) => {
that.imgUri = that.tempUri
if (that.scantype == ScanTypeBean.scan_pdf) {
if (that.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
return
}
that.generatePDF([that.tempPath])
}
},
fail: () => {
uni.hideLoading()
......@@ -299,7 +308,8 @@
filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() + '.pdf',
data: resl.docBase64,
encoding: "base64",
success: resx => {
success: resx => {
tt.openDocument({
filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() +
'.pdf',
......
<template>
<view class="body">
<view style="position:relative;width:100%;height:70%;">
<camera v-if="showCamera" id="camera" resolution="high" device-position="back" flash="off" @error="error"
@initdone="initdone" style="width:100%;height:100%;">
</camera>
</view>
<view class="hint" v-if="current==0">请保持水平清晰</view>
<view class="card" v-if="current==1" @click="showPop">
<text>{{currentCard}}</text>
......@@ -53,16 +53,16 @@
imageCompress
} from "@/utils/utils.js"
import {
openSetting,
} from '@/utils/utils.js';
import {
navigateTo,
navigateBack,
reLaunch
} from '@/utils/fun';
import {
openSetting,
} from '@/utils/utils.js';
const app = getApp();
export default {
......@@ -114,7 +114,6 @@
uni.showLoading({
title: '加载中...'
})
let that = this
// #ifdef MP-TOUTIAO
let cameraContext = tt.createCameraContext('camera');
......@@ -139,7 +138,7 @@
let that = this
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sizeType: ['compressed'],
sourceType: ["album"],
success: (res) => {
navigateTo(`/pagesC/edit/edit`, {
......@@ -149,6 +148,7 @@
})
},
fail: (res) => {
// 拒绝授权
if (res.errNo == 10200) {
setTimeout(() => {
that.goAuthSetting()
......@@ -158,12 +158,11 @@
});
},
error(e) {
console.log(e.detail);
if (e.errNo == 10200) {
this.showCamera = false
this.goAuthSetting()
}
console.log(e.detail);
},
goAuthSetting() {
tt.showModal({
......@@ -209,7 +208,6 @@
this.cardType = ScanTypeBean.idcard_back
}
this.currentCard = this.list[e]
}
}
......
<template>
<view class="body">
<view class="search-head">
<view class="search-bar">
<input class="inputkeyword" type="text" placeholder="请输入兑换码" @input="showChangePrompt"
:value="keyword" />
<image v-if="keyword!=''" @click="clearWord" style="width: 36rpx; height: 36rpx"
src="@/static/video/close.png"></image>
</view>
<text class="searchbutton" @click="addByCDK">去兑换</text>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
navigateBack,
message,
alert,
} from '@/utils/fun.js';
import {
openUrl
} from '@/utils/app+.js';
const app = getApp();
export default {
name: 'index',
mixins: [common],
data() {
return {
keyword: '',
};
},
methods: {
showChangePrompt(e) {
this.keyword = e.detail.value
},
addByCDK() {
if (this.keyword == '') {
message.notify('请输入兑换码')
return
}
this.post({
url: '/vip/addByCDK',
showLoading: false,
data: {
cdk: this.keyword
},
success: ({
data
}) => {
message.notify('恭喜您,成功兑换会员!')
setTimeout(() => {
navigateBack()
}, 1000)
}
});
}
}
};
</script>
<style lang="scss">
@import '@/scss/uni.scss';
.body {
background-color: whitesmoke;
}
.search-head {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 8%;
}
.search-bar {
border-radius: 60rpx;
margin: 10rpx 15rpx;
padding: 15rpx 30rpx;
width: 80%;
background-color: white;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between
}
.inputkeyword {
flex: 1;
margin-left: 30rpx;
}
.searchbutton {
text-align: center;
color: #000000;
font-size: 30rpx;
width: 20%;
margin-right: 10rpx;
}
</style>
\ No newline at end of file
......@@ -21,6 +21,10 @@
如何找到我
<view class="item_bd ellipsis" style="margin-left: 58rpx;color:black"></view>
</view>
<view class="item arrow" @click="handleCdk">
兑换会员
<view class="item_bd ellipsis" style="margin-left: 58rpx;color:black"></view>
</view>
</view>
<view v-if="false" style="display: flex;justify-content: center;margin-top: 50rpx;font-size: 26rpx;color: gray;">
当前版本:{{ versionName }}
......@@ -72,6 +76,9 @@
},
handleFind(){
this.showMask = true
},
handleCdk(){
navigateTo(`/pagesD/cdkey/cdkey`)
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment