Compare commits

..

No commits in common. "7856f31273bc301e96b867c5065d3439f61528a8" and "16d2ea2cbd6b8b4361f5d8cc26a67f1591a2157a" have entirely different histories.

21 changed files with 829 additions and 2167 deletions

View File

@ -11,18 +11,18 @@
<image v-if="type=='ios'" src="/static/image/call/iosSearchRight.png" mode=""></image> <image v-if="type=='ios'" src="/static/image/call/iosSearchRight.png" mode=""></image>
</view> </view>
<view class="selectType" v-if="type=='huawei'"> <view class="selectType" v-if="type=='huawei'">
<view class="btn " :class="{'active':active}" @click.stop="setActive(true)"> <view class="btn active">
全部来电 全部来电
</view> </view>
<view class="btn" :class="{'active':!active}" @click.stop="setActive(false)"> <view class="btn">
未接来电 未接来电
</view> </view>
</view> </view>
<view class="selectTypeVivo" v-if="type=='vivo'"> <view class="selectTypeVivo" v-if="type=='vivo'">
<view class="btn " :class="{'active':active}" @click.stop="setActive(true)"> <view class="btn active">
全部 全部
</view> </view>
<view class="btn" :class="{'active':!active}" @click.stop="setActive(false)"> <view class="btn">
未接 未接
</view> </view>
</view> </view>
@ -53,7 +53,6 @@
}) })
const data = reactive({ const data = reactive({
active:true,
statusBarHeight: 0, statusBarHeight: 0,
showTipLayer: true, showTipLayer: true,
title:'最近通话', title:'最近通话',
@ -68,7 +67,6 @@
}) })
let { let {
active,
searchTitle, searchTitle,
title, title,
list, list,
@ -79,7 +77,7 @@
if(props.type=='xiaomi'){ if(props.type=='xiaomi'){
searchTitle.value="搜索联系人" searchTitle.value="搜索联系人"
title.value="通话" title.value="通话"
// console.log('aaaaaaaaaaa') console.log('aaaaaaaaaaa')
}else if(props.type=='oppo'){ }else if(props.type=='oppo'){
title.value="通话" title.value="通话"
}else if(props.type=='huawei'){ }else if(props.type=='huawei'){
@ -87,11 +85,6 @@
} }
}) })
function setActive(status){
active.value=status
uni.$emit('setActive',status)
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
<template> <template>
<uni-nav-bar :backgroundColor="navBgColor" class="nav-bar" :border="false" :title="title" fixed="true" statusBar="true"> <uni-nav-bar :backgroundColor="navBgColor" class="nav-bar" :border="false" :title="title" fixed="true">
<template v-slot:left> <template v-slot:left>
<slot name="left"> <slot name="left">
<view :class="[type+'LeftTitle']" :style="{opacity:(type!='huawei'&&type!='oppo'?1: navOpacity)}"> <view :class="[type+'LeftTitle']" :style="{opacity:(type!='huawei'&&type!='oppo'?1: navOpacity)}">
@ -11,18 +11,18 @@
<view class="nav-bar-title " :class="['nav-bar-title-'+type]"> <view class="nav-bar-title " :class="['nav-bar-title-'+type]">
<slot> <slot>
<view class="iosBox" v-if="type=='ios'"> <view class="iosBox" v-if="type=='ios'">
<view class="btn " :class="{'active':active}" @click.stop="setActive(true)"> <view class="btn active">
全部来电 全部来电
</view> </view>
<view class="btn" :class="{'active':!active}" @click.stop="setActive(false)"> <view class="btn">
未接来电 未接来电
</view> </view>
</view> </view>
<view class="oppoBox" v-if="type=='oppo'" :style="{opacity: navOpacity?1-navOpacity:1}"> <view class="oppoBox" v-if="type=='oppo'" :style="{opacity: navOpacity?1-navOpacity:1}">
<view class="btn " :class="{'active':active}" @click.stop="setActive(true)"> <view class="btn active">
全部 全部
</view> </view>
<view class="btn" :class="{'active':!active}" @click.stop="setActive(false)"> <view class="btn">
未接 未接
</view> </view>
</view> </view>
@ -80,7 +80,6 @@
}) })
const data = reactive({ const data = reactive({
active:true,
statusBarHeight: 0, statusBarHeight: 0,
LeftTitle:'', LeftTitle:'',
showTipLayer: true, showTipLayer: true,
@ -89,7 +88,6 @@
}) })
let { let {
active,
LeftTitle, LeftTitle,
showTipLayer, showTipLayer,
navOpacity, navOpacity,
@ -98,7 +96,7 @@
// scrollTop // scrollTop
watch(() => props.scrollTop, (newValue, oldValue) => { watch(() => props.scrollTop, (newValue, oldValue) => {
// console.log('scrollTop changed:', newValue); console.log('scrollTop changed:', newValue);
// scrollTop // scrollTop
if (newValue > 0) { if (newValue > 0) {
// scrollTop 0 // scrollTop 0
@ -125,15 +123,11 @@
LeftTitle.value='' LeftTitle.value=''
} }
}) })
function setActive(status){
active.value=status
uni.$emit('setActive',status)
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .uni-navbar__header-btns { ::v-deep .uni-navbar__header-btns {
width: 27vw !important; width: 25vw !important;
} }
.iosLeftTitle { .iosLeftTitle {
@ -252,7 +246,6 @@
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.1);
border-radius: 6px 6px 6px 6px; border-radius: 6px 6px 6px 6px;
margin: 0 2px;
} }
} }
} }

View File

@ -27,7 +27,7 @@ export function createApp() {
const systemInfo = uni.getStorageSync('systemInfo') || {} const systemInfo = uni.getStorageSync('systemInfo') || {}
app.config.globalProperties.$system = systemInfo.platform == 'ios' ? 'iOS' : 'Android' app.config.globalProperties.$system = systemInfo.platform == 'ios' ? 'iOS' : 'Android'
app.config.globalProperties.$systemInfo = systemInfo app.config.globalProperties.$systemInfo = systemInfo
uni.setStorageSync('version', '1.0.3.sp4') uni.setStorageSync('version', '1.0.3.sp3')
app.config.globalProperties.$version = uni.getStorageSync('version') app.config.globalProperties.$version = uni.getStorageSync('version')
app.use(globalMethods); app.use(globalMethods);

View File

@ -201,14 +201,6 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "qf-image/qf-image",
"style": {
"navigationBarTitleText": "图片裁剪",
"navigationStyle": "custom"
}
},
{ {
"path": "train-tickets/ctrip-train-tickets/ctrip-train-tickets", "path": "train-tickets/ctrip-train-tickets/ctrip-train-tickets",
"style": { "style": {

View File

@ -1,18 +1,10 @@
<template> <template>
<!-- 水印 -->
<view v-if="$isVip()">
<watermark dark="light" />
<liu-drag-button :canDocking="false" @clickBtn="$goRechargePage('watermark')">
<c-lottie ref="cLottieRef" :src='$watermark()' width="94px" height='74px' :loop="true"></c-lottie>
</liu-drag-button>
</view>
<view class="container"> <view class="container">
<!-- 自定义头部导航栏 --> <!-- 自定义头部导航栏 -->
<ZdyNavbar :type="data.type" :scrollTop="data.scrollTop" @click="open"/> <ZdyNavbar :type="data.type" :scrollTop="data.scrollTop"/>
<ZdyHeader :type="data.type" /> <ZdyHeader :type="data.type" />
<callList :type="data.type" ref="callLogList"></callList> <callList :type="data.type"></callList>
<tabbar :type="data.type" /> <tabbar :type="data.type" />
<image v-if="data.type!='ios'" :src="`/static/image/call/${data.type}BtnImg.png`" mode="" class="btnImg" :class="['btnImg_'+data.type]"></image>
</view> </view>
</template> </template>
@ -21,7 +13,7 @@
import ZdyHeader from "@/components/call-log/header/header.vue" import ZdyHeader from "@/components/call-log/header/header.vue"
import callList from "@/components/call-log/list/list.vue" import callList from "@/components/call-log/list/list.vue"
import tabbar from "@/components/call-log/tabbar/tabbar.vue" import tabbar from "@/components/call-log/tabbar/tabbar.vue"
import {util} from"@/utils/common.js"
import { ref, reactive, watch, nextTick, getCurrentInstance } from "vue"; import { ref, reactive, watch, nextTick, getCurrentInstance } from "vue";
import { onLoad, onShow, onReady, onPageScroll, onReachBottom } from "@dcloudio/uni-app"; import { onLoad, onShow, onReady, onPageScroll, onReachBottom } from "@dcloudio/uni-app";
@ -30,77 +22,24 @@
type: 'vivo', type: 'vivo',
scrollTop:0 scrollTop:0
}) })
let callLogList = ref();
onLoad((option) => {
data.type=option.type
onLoad((option) => {
}) })
onReady(() => { onReady(() => {
}) })
onShow(() => { onShow(() => {})
try {
if (plus.os.name === 'Android') {
let colorTabbar="#FAFAFA"
if(data.type=='xiaomi'||data.type=='oppo'){
colorTabbar="#FFFFFF"
}
console.log(colorTabbar);
util.setAndroidSystemBarColor(colorTabbar)
setTimeout(() => {
plus.navigator.setStatusBarStyle("dark");
}, 500)
}
} catch (error) {
console.log("修改导航条颜色失败", error);
}
})
onPageScroll((e) => { onPageScroll((e) => {
// console.log(e) console.log(e)
data.scrollTop=e.scrollTop data.scrollTop=e.scrollTop
}) })
onReachBottom(() => { onReachBottom(() => {
}) })
function open(){
console.log(callLogList.value)
callLogList.value.openAddModal()
}
</script> </script>
<style lang="scss" > <style lang="scss" scoped>
page{
background-color: #fff;
}
.btnImg{
position: fixed;
}
.btnImg_vivo{
width: 80px;
height: 96px;
left: 40px;
bottom: 130px;
}
.btnImg_huawei{
width: 54px;
height: 54px;
left: calc(50% - 27px);
bottom: 65px;
}
.btnImg_oppo{
width: 58px;
height: 58px;
right: 20px;
bottom: 100px;
}
.btnImg_xiaomi{
width: 55px;
height: 55px;
right: 34px;
bottom: 100px;
}
</style> </style>

View File

@ -20,8 +20,7 @@
import NavBar from '@/components/nav-bar/nav-bar.vue' import NavBar from '@/components/nav-bar/nav-bar.vue'
import { import {
ref, ref,
reactive, reactive
getCurrentInstance
} from 'vue' } from 'vue'
import { import {
onLoad onLoad
@ -30,7 +29,6 @@ import {
util util
} from '@/utils/common.js'; } from '@/utils/common.js';
const { appContext, proxy } = getCurrentInstance();
// //
const source = ref([{ const source = ref([{
name: '苹果', name: '苹果',
@ -41,7 +39,7 @@ const source = ref([{
}, },
icon: 'iphone', icon: 'iphone',
messageUrl: "/pages/message/list-index?phone=iphone", messageUrl: "/pages/message/list-index?phone=iphone",
callUrl: "/pages/call-log/call?type=ios" callUrl: ""
}, },
{ {
name: '华为', name: '华为',
@ -52,7 +50,7 @@ const source = ref([{
}, },
icon: 'huawei', icon: 'huawei',
messageUrl: "/pages/message/list-index?phone=huawei", messageUrl: "/pages/message/list-index?phone=huawei",
callUrl: "/pages/call-log/call?type=huawei" callUrl: ""
}, },
{ {
name: '小米', name: '小米',
@ -63,7 +61,7 @@ const source = ref([{
}, },
icon: 'mi', icon: 'mi',
messageUrl: "/pages/message/list-index?phone=mi", messageUrl: "/pages/message/list-index?phone=mi",
callUrl: "/pages/call-log/call?type=xiaomi" callUrl: ""
}, },
{ {
name: 'oppo', name: 'oppo',
@ -74,7 +72,7 @@ const source = ref([{
}, },
icon: 'oppo', icon: 'oppo',
messageUrl: "/pages/message/list-index?phone=oppo", messageUrl: "/pages/message/list-index?phone=oppo",
callUrl: "/pages/call-log/call?type=oppo" callUrl: ""
}, { }, {
name: 'vivo', name: 'vivo',
color: { color: {
@ -84,7 +82,7 @@ const source = ref([{
}, },
icon: 'vivo', icon: 'vivo',
messageUrl: "/pages/message/list-index?phone=vivo", messageUrl: "/pages/message/list-index?phone=vivo",
callUrl: "/pages/call-log/call?type=vivo" callUrl: ""
}, },
]) ])
@ -103,14 +101,7 @@ onLoad((options) => {
}) })
function goPage(url) { function goPage(url) {
if (url) { if (url) {
proxy.$apiUserEvent('all', {
type: 'event',
key: data.type=='message'?'message':'call-log',
prefix: '.uni.other.',
value: data.type=='message'?'短信':"通话"
})
util.goPage(url) util.goPage(url)
} else { } else {
uni.showToast({ uni.showToast({
@ -157,9 +148,8 @@ function goPage(url) {
border-radius: 16rpx; border-radius: 16rpx;
color: #ffffff; color: #ffffff;
font-size: 28rpx; font-size: 28rpx;
display: flex; line-height: 64rpx;
align-items: center; text-align: center;
justify-content: center;
} }
} }

View File

@ -256,15 +256,10 @@ const otherList = [{
path: "/pages/other/card/card" path: "/pages/other/card/card"
}, },
{ {
icon: "/static/image/index/qita/message.png", icon: "/static/image/index/qita/msg.png",
name: "短信", name: "短信",
path: "/pages/common/call-and-message-entry/call-and-message-entry?type=message" path: "/pages/common/call-and-message-entry/call-and-message-entry?type=message"
}, },
{
icon: "/static/image/index/qita/call.png",
name: "通话",
path: "/pages/common/call-and-message-entry/call-and-message-entry?type=call"
},
] ]
const data = reactive({ const data = reactive({

View File

@ -8,51 +8,45 @@
<view class="button-container"> <view class="button-container">
<button class="btn-save-image" @click="saveImage">保存图片</button> <button class="btn-save-image" @click="saveImage">保存图片</button>
</view> </view>
<view style="width: 0px;height: 0;overflow: hidden;" v-if="data.shuaxing"> <l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" hidden
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" :css="`width:${data.width}px;height:${data.height }px;background-color:#fff;`">
:css="`width:${data.width}px;height:${data.height }px;background-color:#fff;`"> <l-painter-view
<l-painter-view :css="`margin-top:116px;margin-left:75px;position: relative;width:650px;height:360px;background-image: url('/static/image/other/card/cardBGImg.png');background-size:650px 360px;`">
:css="`margin-top:109px;margin-left:75px;position: relative;width:666px;height:406px;background-image: url('/static/image/other/card/cardBGImg.png');background-size:6660px 406px;`"> <!-- 头部年月 -->
<!-- 头部年月 --> <l-painter-view :css="`position: absolute;left:122px;top:28px;`">
<l-painter-view :css="`position: absolute;left:122px;top:50px;`"> <l-painter-text :css="data.textCss+data.textCssLeft" :text="data.form.name" />
<l-painter-text :css="data.textCss+data.textCssLeft" :text="data.form.name" /> </l-painter-view>
</l-painter-view> <l-painter-view :css="`position: absolute;left:122px;top:78px;`">
<l-painter-view :css="`position: absolute;left:122px;top:100px;`"> <l-painter-text :css="data.textCss2+data.textCssLeft" :text="data.form.gender" />
<l-painter-text :css="data.textCss2+data.textCssLeft" :text="data.form.gender" /> </l-painter-view>
</l-painter-view> <l-painter-view :css="`position: absolute;left:254px;top:78px;`">
<l-painter-view :css="`position: absolute;left:262px;top:100px;`"> <l-painter-text :css="data.textCss2+data.textCssLeft" :text="data.form.nation" />
<l-painter-text :css="data.textCss2+data.textCssLeft" :text="data.form.nation" /> </l-painter-view>
</l-painter-view> <l-painter-view :css="`position: absolute;left:122px;top:126px;`">
<l-painter-view :css="`position: absolute;left:122px;top:150px;`"> <l-painter-text v-for="(item,index) in data.form.year.toString()" :css="data.textCss3+data.textCssLeft" :text="item" :key="index" />
<l-painter-text v-for="(item,index) in data.form.year.toString()" :css="data.textCss3+data.textCssLeft" </l-painter-view>
:text="item" :key="index" /> <l-painter-view :css="`position: absolute;left:184px;top:126px;`">
</l-painter-view> <l-painter-text :css="data.textCss2+data.textCssCenter" :text="data.form.month.toString()" />
<l-painter-view :css="`position: absolute;left:190px;top:150px;`"> </l-painter-view>
<l-painter-text :css="data.textCss2+data.textCssCenter" :text="data.form.month.toString()" /> <l-painter-view :css="`position: absolute;left:244px;top:126px;`">
</l-painter-view> <l-painter-text :css="data.textCss2+data.textCssCenter" :text="data.form.day.toString()" />
<l-painter-view :css="`position: absolute;left:250px;top:150px;`"> </l-painter-view>
<l-painter-text :css="data.textCss2+data.textCssCenter" :text="data.form.day.toString()" /> <l-painter-view :css="`position: absolute;left:122px;top:177px;width:274px;`">
</l-painter-view> <l-painter-text v-for="(item,index) in data.form.address" :css="data.textCss3+data.textCssLeft" :text="item" :key="index"/>
<l-painter-view :css="`position: absolute;left:122px;top:198px;width:274px;`"> </l-painter-view>
<l-painter-text v-for="(item,index) in data.form.address" :css="data.textCss3+data.textCssLeft" :text="item" <l-painter-view :css="`position: absolute;left:223px;top:300px;`">
:key="index" /> <l-painter-text v-for="(item,index) in data.form.idNumber" :css="data.textCss4+data.textCssLeft" :text="item" :key="index"/>
</l-painter-view> </l-painter-view>
<l-painter-view :css="`position: absolute;left:223px;top:320px;`"> <l-painter-view :css="`position: absolute;right:48px;top:55px;`">
<l-painter-text v-for="(item,index) in data.form.idNumber" :css="data.textCss4+data.textCssLeft" :text="item" <l-painter-image v-if="data.form.photo" :src="data.form.photo" css="width: 196px; height: 230px;"/>
:key="index" /> <l-painter-view v-else css="width: 196px; height: 230px;background-color:#fff;">
</l-painter-view>
<l-painter-view :css="`position: absolute;right:48px;top:62px;`">
<l-painter-image v-if="data.form.photo" :src="data.form.photo" css="width: 196px; height: 230px;" />
<l-painter-view v-else css="width: 196px; height: 230px;background-color:#fff;">
</l-painter-view>
</l-painter-view>
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:535px;bottom:-78px;`">
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 170px;height: 50px;" />
</l-painter-view> </l-painter-view>
</l-painter-view> </l-painter-view>
</l-painter> <l-painter-view v-if="$isVip()" :css="`position: absolute;left:535px;bottom:-78px;`">
</view> <l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 170px;height: 50px;" />
</l-painter-view>
</l-painter-view>
</l-painter>
<!-- 编辑弹窗 --> <!-- 编辑弹窗 -->
<view v-if="showEditPopup" class="popup-overlay"> <view v-if="showEditPopup" class="popup-overlay">
@ -110,335 +104,280 @@
</template> </template>
<script setup> <script setup>
// //
import ZdyNavbar from "@/components/nav-bar/nav-bar.vue" import ZdyNavbar from "@/components/nav-bar/nav-bar.vue"
import { import {
ref, ref,
reactive, reactive,
watch, watch,
nextTick, nextTick,
getCurrentInstance getCurrentInstance
} from "vue"; } from "vue";
import { import {
onLoad, onLoad,
onShow, onShow,
onUnload, onReady,
onReady, onPullDownRefresh,
onPullDownRefresh, onReachBottom
onReachBottom } from "@dcloudio/uni-app";
} from "@dcloudio/uni-app"; const {
const { appContext,
appContext, proxy
proxy } = getCurrentInstance();
} = getCurrentInstance(); const data = reactive({
const data = reactive({ navbar: {
shuaxing:true, title: "身份证",
navbar: { bgColor: '#EDEDED',
title: "身份证", },
bgColor: '#EDEDED', width: 800,
}, height: 600,
width: 800, code: '',
height: 600, form: {
code: '', name: '李某',
form: { gender: '男',
name: '某某', nation: '汉',
gender: '男', year: 2025,
nation: '汉', month: 2,
year: 2000, day: 1,
month: 1, address: '翻斗大街翻斗花园二号楼1001室',
day: 1, idNumber: '500000000000000000',
address: '翻斗大街翻斗花园二号楼1001室', photo: '',
idNumber: '110000200001010000', },
photo: '', textCss: 'font-family: "SimHei", "Microsoft YaHei", sans-serif;width:100px;color:#3D3D3D;font-size:24px; mix-blend-mode: overlay;',
}, textCss2: 'font-family: "SimHei", "Microsoft YaHei", sans-serif;width:100px;text-align: left;color:#3D3D3D;font-size:22px;mix-blend-mode: overlay;',
textCss: 'word-spacing: 20px;font-family: "SimHei", "Microsoft YaHei", sans-serif;width:100px;color:#3D3D3D;font-size:24px; mix-blend-mode: overlay;', textCss3: 'word-spacing: 10px;letter-spacing: 10px;margin-right:2px;font-family: "SimHei", "Microsoft YaHei", sans-serif;text-align: left;color:#3D3D3D;font-size:22px;mix-blend-mode: overlay;',
textCss2: 'word-spacing: 20px;font-family: "SimHei", "Microsoft YaHei", sans-serif;width:100px;text-align: left;color:#3D3D3D;font-size:22px;mix-blend-mode: overlay;', textCss4: 'word-spacing: 10px;margin-right:3px;letter-spacing: 10px;font-family: "card", "Microsoft YaHei", sans-serif;text-align: left;color:#1a1a1a;font-size:28px;mix-blend-mode: overlay;display:flex;',
textCss3: 'word-spacing: 20px;letter-spacing: 10px;margin-right:2px;font-family: "SimHei", "Microsoft YaHei", sans-serif;text-align: left;color:#3D3D3D;font-size:22px;mix-blend-mode: overlay;',
textCss4: 'word-spacing: 20px;margin-right:3px;letter-spacing: 10px;font-family: "card", "Microsoft YaHei", sans-serif;text-align: left;color:#1a1a1a;font-size:28px;mix-blend-mode: overlay;display:flex;',
textCssLeft: 'text-align: left;', textCssLeft:'text-align: left;',
textCssCenter: 'text-align: center;' textCssCenter:'text-align: center;'
}) })
// //
const showEditPopup = ref(false); const showEditPopup = ref(false);
const editForm = ref({}); const editForm = ref({});
onLoad((option) => { //
function successImage(e){
data.code=e
}
function progress(e){
if(e<0.03){
uni.showLoading({ uni.showLoading({
title: "生成中" title:"生成中"
}) })
// }
proxy.$apiUserEvent('all', { if(e==1){
type: 'event',
key: 'idcard',
prefix: '.uni.other.',
value: "身份证"
})
let formdata=uni.getStorageSync("cardForm")
if(formdata){
data.form=formdata
}
uni.$on("editFormPhoto",(info)=>{
data.code = ""
editForm.value.photo = info;
data.form.photo = info;
})
})
onUnload(() => {
uni.$off('editFormPhoto')
})
onReady(() => {
})
onShow(() => {})
onPullDownRefresh(() => {
setTimeout(() => {
uni.stopPullDownRefresh();
}, 1000);
})
onReachBottom(() => {
})
function successImage(e) {
data.code = e
uni.hideLoading() uni.hideLoading()
} }
console.log(e)
}
//
function edit() {
console.log(data.form)
//
editForm.value = JSON.parse(JSON.stringify(data.form));
//
showEditPopup.value = true;
}
function progress(e) { //
// console.log(e) function closeEditPopup() {
showEditPopup.value = false;
}
} //
// function saveEditForm() {
function edit() { //
console.log(data.form) data.form = JSON.parse(JSON.stringify(editForm.value));
// //
editForm.value = JSON.parse(JSON.stringify(data.form)); showEditPopup.value = false;
// }
showEditPopup.value = true;
}
// //
function closeEditPopup() { function chooseImage() {
showEditPopup.value = false; uni.chooseImage({
} count: 1,
sizeType: ['original', 'compressed'],
// sourceType: ['album', 'camera'],
function saveEditForm() { success: (res) => {
uni.showLoading({ editForm.value.photo = res.tempFilePaths[0];
title: "生成中" },
}) fail: (err) => {
data.shuaxing=false console.log('选择图片失败', err);
//
data.form = editForm.value
data.form.photo=editForm.value.photo
setTimeout(()=>{
data.shuaxing=true
},100)
uni.setStorageSync("cardForm",data.form)
//
showEditPopup.value = false;
}
//
function chooseImage() {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
// crop:{
// width:'196px',
// height:"230px"
// },
success: (res) => {
uni.navigateTo({
url:'/pages/other/qf-image/qf-image?src='+res.tempFilePaths[0]
})
},
fail: (err) => {
console.log('选择图片失败', err);
}
});
}
/**
* 将本地图片路径通过 Canvas 转换为 File 对象
* @param {string} localPath - 本地图片路径如从 uni.chooseImage 获取的 tempFilePath
* @param {Object} options - 可选参数
* @param {string} options.format - 输出格式 'image/png' 'image/jpeg'默认 'image/png'
* @param {number} options.quality - 图片质量 jpeg 有效0~1默认 0.92
* @param {number} options.maxWidth - 最大宽度等比缩放不填则使用原图尺寸
* @param {number} options.maxHeight - 最大高度等比缩放不填则使用原图尺寸
* @returns {Promise<File>} 返回一个 Promiseresolve File 对象
*/
function convertLocalImageToFile(localPath) {
return new Promise((resolve, reject) => {
// 1. Base64 Image
plus.io.resolveLocalFileSystemURL(localPath, (entry) => {
entry.file((file) => {
const reader = new plus.io.FileReader();
reader.onload = (e) => {
const base64Data = e.target.result; // data:image/jpeg;base64,/9j/...
resolve(e.target.result)
};
reader.onerror = (err) => reject(err);
reader.readAsDataURL(file); // DataURL
}, reject);
}, reject);
});
}
//
function previewImage() {
if (data.code) {
uni.previewImage({
urls: [data.code],
current: 0
});
} }
} });
}
// //
function saveImage() { function previewImage() {
if (data.code) { if (data.code) {
console.log(data.code) uni.previewImage({
uni.showLoading({ urls: [data.code],
title: '保存中...' current: 0
}); });
try { }
// base64 }
if (data.code.startsWith('data:image')) {
// base64 //
console.log('开始处理base64图片'); function saveImage() {
uni.base64ToTempFile({ if (data.code) {
base64: data.code.split(',')[1], // base64 console.log(data.code)
success: (res) => { uni.showLoading({
console.log('base64转换成功', res); title: '保存中...'
if (res.tempFilePath) { });
uni.saveImageToPhotosAlbum({ try {
filePath: res.tempFilePath, // base64
success: () => { if (data.code.startsWith('data:image')) {
console.log('保存图片成功'); // base64
uni.hideLoading(); console.log('开始处理base64图片');
uni.showToast({ uni.base64ToTempFile({
title: '保存成功', base64: data.code.split(',')[1], // base64
icon: 'success' success: (res) => {
}); console.log('base64转换成功', res);
}, if (res.tempFilePath) {
fail: (err) => { uni.saveImageToPhotosAlbum({
console.log('保存图片失败', err); filePath: res.tempFilePath,
uni.hideLoading(); success: () => {
uni.showToast({ console.log('保存图片成功');
title: '保存失败', uni.hideLoading();
icon: 'none' uni.showToast({
}); title: '保存成功',
} icon: 'success'
}); });
} else { },
console.log('base64转换失败无临时文件路径'); fail: (err) => {
uni.hideLoading(); console.log('保存图片失败', err);
uni.showToast({ uni.hideLoading();
title: '转换失败', uni.showToast({
icon: 'none' title: '保存失败',
}); icon: 'none'
} });
}, }
fail: (err) => { });
console.log('base64转换失败', err); } else {
console.log('base64转换失败无临时文件路径');
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: '转换失败', title: '转换失败',
icon: 'none' icon: 'none'
}); });
} }
}); },
} else if (data.code.startsWith('_') || data.code.includes('temp') || data.code.includes('cache') || data fail: (err) => {
.code.includes('_doc') || data.code.includes('_tmp')) { console.log('base64转换失败', err);
// uni.hideLoading();
console.log('开始处理本地临时文件'); uni.showToast({
uni.saveImageToPhotosAlbum({ title: '转换失败',
filePath: data.code, icon: 'none'
success: () => { });
console.log('保存本地文件成功'); }
uni.hideLoading(); });
uni.showToast({ } else if (data.code.startsWith('_') || data.code.includes('temp') || data.code.includes('cache') || data
title: '保存成功', .code.includes('_doc') || data.code.includes('_tmp')) {
icon: 'success' //
console.log('开始处理本地临时文件');
uni.saveImageToPhotosAlbum({
filePath: data.code,
success: () => {
console.log('保存本地文件成功');
uni.hideLoading();
uni.showToast({
title: '保存成功',
icon: 'success'
});
},
fail: (err) => {
console.log('保存本地文件失败', err);
uni.hideLoading();
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});
} else {
//
console.log('开始处理网络图片');
uni.downloadFile({
url: data.code,
success: (res) => {
console.log('下载图片成功', res);
if (res.statusCode === 200 && res.tempFilePath) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
console.log('保存图片成功');
uni.hideLoading();
uni.showToast({
title: '保存成功',
icon: 'success'
});
},
fail: (err) => {
console.log('保存图片失败', err);
uni.hideLoading();
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
}); });
}, } else {
fail: (err) => { console.log('下载图片失败,状态码:', res.statusCode);
console.log('保存本地文件失败', err);
uni.hideLoading();
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});
} else {
//
console.log('开始处理网络图片');
uni.downloadFile({
url: data.code,
success: (res) => {
console.log('下载图片成功', res);
if (res.statusCode === 200 && res.tempFilePath) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
console.log('保存图片成功');
uni.hideLoading();
uni.showToast({
title: '保存成功',
icon: 'success'
});
},
fail: (err) => {
console.log('保存图片失败', err);
uni.hideLoading();
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});
} else {
console.log('下载图片失败,状态码:', res.statusCode);
uni.hideLoading();
uni.showToast({
title: '下载失败',
icon: 'none'
});
}
},
fail: (err) => {
console.log('下载图片失败', err);
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: '下载失败', title: '下载失败',
icon: 'none' icon: 'none'
}); });
} }
}); },
} fail: (err) => {
} catch (error) { console.log('下载图片失败', err);
console.log('保存图片异常', error); uni.hideLoading();
uni.hideLoading(); uni.showToast({
uni.showToast({ title: '下载失败',
title: '保存失败', icon: 'none'
icon: 'none' });
}
}); });
} }
} else { } catch (error) {
console.log('保存图片异常', error);
uni.hideLoading();
uni.showToast({ uni.showToast({
title: '暂无图片可保存', title: '保存失败',
icon: 'none' icon: 'none'
}); });
} }
} else {
uni.showToast({
title: '暂无图片可保存',
icon: 'none'
});
} }
}
onLoad((option) => {
//
proxy.$apiUserEvent('all', {
type: 'event',
key: 'idcard',
prefix: '.uni.other.',
value: "身份证"
})
})
onReady(() => {
})
onShow(() => { })
onPullDownRefresh(() => {
setTimeout(() => {
uni.stopPullDownRefresh();
}, 1000);
})
onReachBottom(() => {
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -447,113 +386,113 @@
src: url("/static/font/card.ttf"); src: url("/static/font/card.ttf");
} }
* { * {
box-sizing: content-box; box-sizing: content-box;
} }
.aadadad { .aadadad {
text-align: center; text-align: center;
} }
.heiti { .heiti {
font-family: "SimHei", "Microsoft YaHei", sans-serif; font-family: "SimHei", "Microsoft YaHei", sans-serif;
} }
/* 弹窗样式 */ /* 弹窗样式 */
.popup-overlay { .popup-overlay {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
z-index: 9999; z-index: 9999;
} }
.popup-content { .popup-content {
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
width: 90%; width: 90%;
max-width: 500px; max-width: 500px;
max-height: 80vh; max-height: 80vh;
overflow-y: auto; overflow-y: auto;
} }
.popup-header { .popup-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 20rpx; padding: 20rpx;
border-bottom: 1rpx solid #eee; border-bottom: 1rpx solid #eee;
} }
.popup-title { .popup-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
} }
.popup-close { .popup-close {
font-size: 48rpx; font-size: 48rpx;
color: #999; color: #999;
cursor: pointer; cursor: pointer;
} }
.popup-body { .popup-body {
padding: 20rpx; padding: 20rpx;
} }
.form-section { .form-section {
margin-bottom: 30rpx; margin-bottom: 30rpx;
padding: 20rpx; padding: 20rpx;
background-color: #f5f5f5; background-color: #f5f5f5;
border-radius: 8rpx; border-radius: 8rpx;
} }
.section-title { .section-title {
font-size: 28rpx; font-size: 28rpx;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
margin-bottom: 20rpx; margin-bottom: 20rpx;
display: block; display: block;
} }
.form-row { .form-row {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.form-label { .form-label {
width: 200rpx; width: 200rpx;
font-size: 26rpx; font-size: 26rpx;
color: #333; color: #333;
} }
.form-input { .form-input {
flex: 1; flex: 1;
padding: 15rpx; padding: 15rpx;
border: 1rpx solid #ddd; border: 1rpx solid #ddd;
border-radius: 4rpx; border-radius: 4rpx;
font-size: 26rpx; font-size: 26rpx;
} }
.form-separator { .form-separator {
margin: 0 10rpx; margin: 0 10rpx;
font-size: 26rpx; font-size: 26rpx;
color: #333; color: #333;
} }
.form-total { .form-total {
margin-top: 10rpx; margin-top: 10rpx;
padding-top: 10rpx; padding-top: 10rpx;
border-top: 1rpx dashed #ddd; border-top: 1rpx dashed #ddd;
} }
.form-total-input { .form-total-input {
background-color: #f9f9f9; background-color: #f9f9f9;
color: #ff6b35; color: #ff6b35;
font-weight: bold; font-weight: bold;
@ -568,8 +507,8 @@
.upload-btn { .upload-btn {
width: 120rpx; width: 120rpx;
height: 160rpx; height: 160rpx;
border-radius: 8rpx;
border: 1rpx dashed #ddd; border: 1rpx dashed #ddd;
border-radius: 8rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -583,68 +522,67 @@
} }
.upload-image { .upload-image {
width: 98rpx; width: 120rpx;
height: 115rpx; height: 160rpx;
border-radius: 1rpx; border-radius: 8rpx;
object-fit: cover; object-fit: cover;
border: 1px dashed #ddd;
} }
.popup-footer { .popup-footer {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20rpx; padding: 20rpx;
border-top: 1rpx solid #eee; border-top: 1rpx solid #eee;
} }
.btn-cancel, .btn-cancel,
.btn-save { .btn-save {
width: 48%; width: 48%;
padding: 20rpx; padding: 20rpx;
border-radius: 4rpx; border-radius: 4rpx;
font-size: 28rpx; font-size: 28rpx;
} }
.btn-cancel { .btn-cancel {
background-color: #f5f5f5; background-color: #f5f5f5;
color: #333; color: #333;
border: 1rpx solid #ddd; border: 1rpx solid #ddd;
} }
.btn-save { .btn-save {
background-color: #187AFF; background-color: #ff6b35;
color: #fff; color: #fff;
border: none; border: none;
} }
/* 保存图片按钮 */ /* 保存图片按钮 */
.button-container { .button-container {
display: flex; display: flex;
justify-content: center; justify-content: center;
padding: 30rpx 0; padding: 30rpx 0;
} }
.btn-save-image { .btn-save-image {
background: linear-gradient(90deg, #187AFF 0%, #3295FC 100%); background: linear-gradient(90deg, #187AFF 0%, #3295FC 100%);
color: #fff; color: #fff;
border: none; border: none;
padding: 18rpx 60rpx; padding: 18rpx 60rpx;
border-radius: 40rpx; border-radius: 40rpx;
font-size: 26rpx; font-size: 26rpx;
font-weight: bold; font-weight: bold;
box-shadow: 0 3rpx 10rpx rgba(7, 66, 193, 0.3); box-shadow: 0 3rpx 10rpx rgba(7, 66, 193, 0.3);
transition: all 0.3s ease; transition: all 0.3s ease;
text-align: center; text-align: center;
min-width: 160rpx; min-width: 160rpx;
} }
.btn-save-image:hover { .btn-save-image:hover {
transform: translateY(-2rpx); transform: translateY(-2rpx);
box-shadow: 0 4rpx 12rpx rgba(7, 72, 193, 0.4); box-shadow: 0 4rpx 12rpx rgba(7, 72, 193, 0.4);
} }
.btn-save-image:active { .btn-save-image:active {
transform: translateY(0); transform: translateY(0);
box-shadow: 0 2rpx 6rpx rgba(7, 140, 193, 0.3); box-shadow: 0 2rpx 6rpx rgba(7, 140, 193, 0.3);
} }
</style> </style>

View File

@ -1,92 +0,0 @@
<template>
<view>
<qf-image-cropper :src="data.src" :width="196" :height="230" :radius="0" @crop="handleCrop"
:reverseRotatable="true"></qf-image-cropper>
</view>
</template>
<script setup>
import {
ref,
reactive,
watch,
nextTick,
getCurrentInstance
} from "vue";
import {
onLoad,
onShow,
onReady,
onPullDownRefresh,
onReachBottom
} from "@dcloudio/uni-app";
const {
appContext,
proxy
} = getCurrentInstance();
const data = reactive({
src: ""
})
onLoad((option) => {
console.log(option)
data.src = option.src
})
function handleCrop(e) {
uni.showLoading({
title:"抠图中"
})
convertLocalImageToFile(e.tempFilePath).then(file => {
proxy.$imageUpload(file.split(',', 2)[1]).then(resimage => {
uni.hideLoading()
// editForm.value.photo = decodeURI(resimage.data);
uni.$emit("editFormPhoto", decodeURI(resimage.data))
uni.navigateBack()
}).catch(err => {
uni.hideLoading()
console.log(err.data.message)
uni.showToast({
icon: "none",
title: "图片不是人像或者过大"
})
})
}).catch(err => {
uni.hideLoading()
})
// uni.saveFile({
// tempFilePath: e.tempFilePath,
// success: function(res) {
// console.log(res)
// // res.avatar = res.savedFilePath
// }
// });
}
/**
* 将本地图片路径通过 Canvas 转换为 File 对象
* @param {string} localPath - 本地图片路径如从 uni.chooseImage 获取的 tempFilePath
* @param {Object} options - 可选参数
* @param {string} options.format - 输出格式 'image/png' 'image/jpeg'默认 'image/png'
* @param {number} options.quality - 图片质量 jpeg 有效0~1默认 0.92
* @param {number} options.maxWidth - 最大宽度等比缩放不填则使用原图尺寸
* @param {number} options.maxHeight - 最大高度等比缩放不填则使用原图尺寸
* @returns {Promise<File>} 返回一个 Promiseresolve File 对象
*/
function convertLocalImageToFile(localPath) {
return new Promise((resolve, reject) => {
// 1. Base64 Image
plus.io.resolveLocalFileSystemURL(localPath, (entry) => {
entry.file((file) => {
const reader = new plus.io.FileReader();
reader.onload = (e) => {
const base64Data = e.target.result; // data:image/jpeg;base64,/9j/...
resolve(e.target.result)
};
reader.onerror = (err) => reject(err);
reader.readAsDataURL(file); // DataURL
}, reject);
}, reject);
});
}
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 KiB

After

Width:  |  Height:  |  Size: 214 KiB

176
test.js

File diff suppressed because one or more lines are too long

View File

@ -4,9 +4,6 @@ import {
postJson postJson
} from "@/utils/requests.js" } from "@/utils/requests.js"
import pageData from "@/static/json/page.json" import pageData from "@/static/json/page.json"
import {
jsonString
} from "../uni_modules/uv-ui-tools/libs/function/test";
export default { export default {
install(app, options) { install(app, options) {
@ -151,7 +148,7 @@ export default {
temp += "&" + CryptoJS.MD5(key).toString(); temp += "&" + CryptoJS.MD5(key).toString();
config.data.signature = CryptoJS.MD5(temp).toString(); config.data.signature = CryptoJS.MD5(temp).toString();
} }
console.log("config:", config) // console.log("config:", config)
return config return config
}; };
@ -172,14 +169,11 @@ export default {
const sortedKeys = Object.keys(data.data).sort(); const sortedKeys = Object.keys(data.data).sort();
let str = '' let str = ''
for (const key of sortedKeys) { for (const key of sortedKeys) {
if(!(data.url=='api/image/segment/base64'&&key=='file')){ str += '&' + key + '=' + encodeURIComponent(data.data[key]);
str += '&' + key + '=' + encodeURIComponent(data.data[key]);
}
} }
str = str.replace('&', '?') str = str.replace('&', '?')
host=host+str // 拼接URL
console.log(host) host = host + str
console.log(data)
const response = await new Promise((resolve, reject) => { const response = await new Promise((resolve, reject) => {
uni.request({ uni.request({
url: host, url: host,
@ -187,17 +181,15 @@ export default {
data: data.data, data: data.data,
header, header,
success: res => { success: res => {
console.log(res)
try { try {
if (isCode) { if (isCode) {
res.data = deCode(res.data.data) res.data = deCode(res.data.data)
console.log(res.data)
} else { } else {
res.data = res.data.data res.data = res.data.data
} }
} catch (err) { } catch (err) {
console.log(err);
} }
resolve(res.data); resolve(res.data);
}, },
@ -209,6 +201,8 @@ export default {
return response; return response;
}; };
app.config.globalProperties.$getUserInfo = async () => { app.config.globalProperties.$getUserInfo = async () => {
try { try {
let user = await app.config.globalProperties.$requestPromise({ let user = await app.config.globalProperties.$requestPromise({
@ -220,69 +214,22 @@ export default {
if (user.code == 0) { if (user.code == 0) {
uni.setStorageSync('AppUser', user.data) uni.setStorageSync('AppUser', user.data)
uni.setStorageSync('userInfo', user.data) uni.setStorageSync('userInfo', user.data)
// uni.showModal({
// title: '提示',
// content: JSON.stringify(user.data),
// success: function (res) {
// if (res.confirm) {
// console.log('用户点击确定');
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// });
} }
} catch (error) { } catch (error) {
//TODO handle the exception //TODO handle the exception
} }
} }
// 上传图片
app.config.globalProperties.$uploadImage = async (filePath) => {
//头部header
let header = uni.getStorageSync('header')
//请求地址
let host = uni.getStorageSync('host') + 'api/image/segment'
header['content-type'] = "multipart/form-data"
// // 排序
let data={
method:'POST',
data:{},
url:'api/image/segment'
}
data = sign(data)
const sortedKeys = Object.keys(data.data).sort();
let str = ''
for (const key of sortedKeys) {
str += '&' + key + '=' + encodeURIComponent(data.data[key]);
}
str = str.replace('&', '?')
// 拼接URL
host = host + str
console.log(host);
console.log(data);
uni.uploadFile({
url: host, // 完整URL
filePath: filePath,
name: 'file',
method:"POST",
header: header,
formData:{
...data.data
},
success: (res) => {
console.log('1.上传成功:',JSON.stringify(res));
},
fail: (err) => {
console.error('2. 错误详情:', JSON.stringify(err));
},
complete: (res) => {
console.log('3. 上传完成');
}
});
};
app.config.globalProperties.$imageUpload = async (imagePath) => {
return new Promise((resolve, reject) => {
postJson('a', 'api/image/segment/base64', {
file:imagePath
}).then(res=>{
resolve(res)
}).catch(err=>{
reject(err)
})
})
};
} }
}; };

View File

@ -185,7 +185,6 @@ const request = (method = 'GET', serverUrl, domainUrl, params, dataType = "json"
console.log("传参详情", data) console.log("传参详情", data)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request(data).then(res => { uni.request(data).then(res => {
console.log(deCode(res.data.data))
if (res.statusCode == 200) { if (res.statusCode == 200) {
if (res.data.encrypt) { if (res.data.encrypt) {
if (q != 'test') { if (q != 'test') {