Commit ed6b9c04 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 1e9638e6
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image> margin-bottom: 30rpx;" src="https://mints-web.oss-cn-beijing.aliyuncs.com/images/ic_close_white.png"></image>
<view class="content"> <view class="content">
<button class="button1" type="default" size="default" @click="tapMakePhoneCall">客服电话</button> <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>
</view> </view>
</uni-popup> </uni-popup>
......
...@@ -169,6 +169,14 @@ ...@@ -169,6 +169,14 @@
"navigationBarBackgroundColor": "#ffffff", "navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }
}, {
"path": "cdkey/cdkey",
"style": {
"navigationStyle": "default",
"navigationBarTitleText": "兑换会员",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}] }]
}], }],
// 分包预载配置 // 分包预载配置
......
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
data() { data() {
return { return {
imgUri: '', imgUri: '',
tempUri: '', tempUri: '',
tempPath: '',
userBean: {}, userBean: {},
type: '', type: '',
ocrUrl: '', ocrUrl: '',
...@@ -114,7 +115,8 @@ ...@@ -114,7 +115,8 @@
tt.compressImage({ tt.compressImage({
src: that.tempUri, src: that.tempUri,
quality: 80, quality: 80,
success: res => { success: res => {
console.log('compressImage22223333',res)
that.uploadImg(res.tempFilePath) that.uploadImg(res.tempFilePath)
}, },
fail: err => { fail: err => {
...@@ -132,8 +134,10 @@ ...@@ -132,8 +134,10 @@
this.ocr(this.ocrUrl) this.ocr(this.ocrUrl)
} }
}, },
ocr(imgUrl) { ocr(imgUrl) {
if (this.scantype == ScanTypeBean.fanyi) { if (this.scantype == ScanTypeBean.scan_pdf) {
this.generatePDF([this.tempPath])
}else if (this.scantype == ScanTypeBean.fanyi) {
this.fanyi(ScanTypeBean.zh, ScanTypeBean.en, imgUrl) this.fanyi(ScanTypeBean.zh, ScanTypeBean.en, imgUrl)
} else if (this.scantype == ScanTypeBean.fanyi) { } else if (this.scantype == ScanTypeBean.fanyi) {
this.fanyi(ScanTypeBean.en, ScanTypeBean.zh, imgUrl) this.fanyi(ScanTypeBean.en, ScanTypeBean.zh, imgUrl)
...@@ -192,12 +196,8 @@ ...@@ -192,12 +196,8 @@
} }
}); });
}, },
uploadImg(tempFilePath) { uploadImg(tempFilePath) {
if (this.scantype == ScanTypeBean.scan_pdf) { this.tempPath=tempFilePath
// 图片转pdf
this.generatePDF([tempFilePath])
return
}
let that = this; let that = this;
...@@ -234,8 +234,17 @@ ...@@ -234,8 +234,17 @@
showLoading: true, showLoading: true,
success: ({ success: ({
data 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: () => { fail: () => {
uni.hideLoading() uni.hideLoading()
...@@ -299,7 +308,8 @@ ...@@ -299,7 +308,8 @@
filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() + '.pdf', filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() + '.pdf',
data: resl.docBase64, data: resl.docBase64,
encoding: "base64", encoding: "base64",
success: resx => { success: resx => {
tt.openDocument({ tt.openDocument({
filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() + filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() +
'.pdf', '.pdf',
......
<template> <template>
<view class="body"> <view class="body">
<view style="position:relative;width:100%;height:70%;"> <view style="position:relative;width:100%;height:70%;">
<camera v-if="showCamera" id="camera" resolution="high" device-position="back" flash="off" @error="error" <camera v-if="showCamera" id="camera" resolution="high" device-position="back" flash="off" @error="error"
@initdone="initdone" style="width:100%;height:100%;"> @initdone="initdone" style="width:100%;height:100%;">
</camera> </camera>
</view> </view>
<view class="hint" v-if="current==0">请保持水平清晰</view> <view class="hint" v-if="current==0">请保持水平清晰</view>
<view class="card" v-if="current==1" @click="showPop"> <view class="card" v-if="current==1" @click="showPop">
<text>{{currentCard}}</text> <text>{{currentCard}}</text>
...@@ -53,16 +53,16 @@ ...@@ -53,16 +53,16 @@
imageCompress imageCompress
} from "@/utils/utils.js" } from "@/utils/utils.js"
import {
openSetting,
} from '@/utils/utils.js';
import { import {
navigateTo, navigateTo,
navigateBack, navigateBack,
reLaunch reLaunch
} from '@/utils/fun'; } from '@/utils/fun';
import {
openSetting,
} from '@/utils/utils.js';
const app = getApp(); const app = getApp();
export default { export default {
...@@ -114,7 +114,6 @@ ...@@ -114,7 +114,6 @@
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
let that = this let that = this
// #ifdef MP-TOUTIAO // #ifdef MP-TOUTIAO
let cameraContext = tt.createCameraContext('camera'); let cameraContext = tt.createCameraContext('camera');
...@@ -139,7 +138,7 @@ ...@@ -139,7 +138,7 @@
let that = this let that = this
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
sizeType: ['original', 'compressed'], sizeType: ['compressed'],
sourceType: ["album"], sourceType: ["album"],
success: (res) => { success: (res) => {
navigateTo(`/pagesC/edit/edit`, { navigateTo(`/pagesC/edit/edit`, {
...@@ -149,6 +148,7 @@ ...@@ -149,6 +148,7 @@
}) })
}, },
fail: (res) => { fail: (res) => {
// 拒绝授权
if (res.errNo == 10200) { if (res.errNo == 10200) {
setTimeout(() => { setTimeout(() => {
that.goAuthSetting() that.goAuthSetting()
...@@ -158,12 +158,11 @@ ...@@ -158,12 +158,11 @@
}); });
}, },
error(e) { error(e) {
console.log(e.detail);
if (e.errNo == 10200) { if (e.errNo == 10200) {
this.showCamera = false this.showCamera = false
this.goAuthSetting() this.goAuthSetting()
} }
console.log(e.detail);
}, },
goAuthSetting() { goAuthSetting() {
tt.showModal({ tt.showModal({
...@@ -209,7 +208,6 @@ ...@@ -209,7 +208,6 @@
this.cardType = ScanTypeBean.idcard_back this.cardType = ScanTypeBean.idcard_back
} }
this.currentCard = this.list[e] 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 @@ ...@@ -21,6 +21,10 @@
如何找到我 如何找到我
<view class="item_bd ellipsis" style="margin-left: 58rpx;color:black"></view> <view class="item_bd ellipsis" style="margin-left: 58rpx;color:black"></view>
</view> </view>
<view class="item arrow" @click="handleCdk">
兑换会员
<view class="item_bd ellipsis" style="margin-left: 58rpx;color:black"></view>
</view>
</view> </view>
<view v-if="false" style="display: flex;justify-content: center;margin-top: 50rpx;font-size: 26rpx;color: gray;"> <view v-if="false" style="display: flex;justify-content: center;margin-top: 50rpx;font-size: 26rpx;color: gray;">
当前版本:{{ versionName }} 当前版本:{{ versionName }}
...@@ -72,6 +76,9 @@ ...@@ -72,6 +76,9 @@
}, },
handleFind(){ handleFind(){
this.showMask = true 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