Commit 2dec7783 authored by 李俊赕's avatar 李俊赕

preview-photo

parent 8134a94e
...@@ -62,6 +62,12 @@ ...@@ -62,6 +62,12 @@
"navigationBarTitleText": "选择品牌" "navigationBarTitleText": "选择品牌"
} }
}, },
{
"path": "pages/photo/take",
"style": {
"navigationBarTitleText": "拍照-ljd"
}
},
...@@ -89,13 +95,13 @@ ...@@ -89,13 +95,13 @@
{ // {
"path": "pages/take/index", // "path": "pages/take/try",
"style": { // "style": {
"navigationBarTitleText": "接单", // "navigationBarTitleText": "接单",
"enablePullDownRefresh": true // "enablePullDownRefresh": true
} // }
}, // },
...@@ -180,9 +186,16 @@ ...@@ -180,9 +186,16 @@
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8", "navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8" "backgroundColor": "#F8F8F8"
},
"condition": { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
"list": [{
"name": "拍照小工具", //模式名称
"path": "pages/photo/try", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
}]
} }
} }
<template> <template>
<view>
<image class="pic" :src="images[0]" mode="aspectFill"></image>
</view>
</template> </template>
<script> <script>
...@@ -10,10 +12,20 @@ ...@@ -10,10 +12,20 @@
} }
}, },
onLoad(e) { onLoad(e) {
console.log(e,'e')
if(e.img){
this.images = [e.img]
}
}, },
methods: { methods: {
showPreviewFn(img) {
uni.previewImage({
current: 0,
urls: this.images
});
},
//拨打客服 点击 //拨打客服 点击
phoneCallClick: function (phone) { phoneCallClick: function (phone) {
uni.makePhoneCall({ uni.makePhoneCall({
...@@ -28,4 +40,9 @@ ...@@ -28,4 +40,9 @@
</script> </script>
<style> <style>
.pic{
display: block;
width:100%;
height:auto;
}
</style> </style>
<template>
<!--template>
<view class="container">
<camera device-position="back" flash="off" style='width:100%; height:100vh;'>
<view> <cover-view class="locationView">
<cover-view class="{{scale=='4_3'?'nav__scale-4-3':scale=='16_9'?'nav__scale-16-9':'nav__scale-full'}}" style="height:{{navHeight}}rpx;"> <cover-view class="locationText u-m-l-20 u-m-t-30">{{longitude}}</cover-view>
<cover-image @click="changeScale" class="nav-scaleIcon" mode="aspectFit" src="/image/{{scale}}_{{iconColor}}.png"></cover-image> <cover-view class="locationText u-m-l-20 u-m-t-10">{{latitude}}</cover-view>
<cover-image @click="changeDevicePosition" class="nav-switchIcon" mode="aspectFit" src="/image/switch_{{iconColor}}.png"></cover-image> <cover-view class="locationText u-m-l-20 u-m-t-10">{{address}}</cover-view>
<cover-image @click="changeLight" class="nav-lightIcon" mode="aspectFit" src="/image/light_{{light}}_{{iconColor}}.png"></cover-image> <cover-view class="locationText u-m-l-20 u-m-t-10">{{date}}</cover-view>
</cover-view>
<camera binderror="binderror" bindinitdone="bindinitdone" bindstop="bindstop" class="camera" devicePosition="{{devicePosition}}" flash="{{light}}" resolution="high" style="height:{{cameraHeight}}rpx;top:{{scale=='4_3'?navHeight:0}}rpx">
<cover-view class="watermark-box" style="color:{{watermarkFontColor}}; {{watermarkStyle}}">
<cover-view class="watermark-box__item" v-if="{{lonLat}}">经度:{{longitudeValue?longitudeValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{lonLat}}">纬度:{{latitudeValue?latitudeValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{address}}">地址:{{addressValue?addressValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{time}}">时间:{{timeValue?timeValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{altitude}}">海拔:{{altitudeValue?altitudeValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{weather}}">天气:{{weatherValue?weatherValue:'正在获取...'}}</cover-view>
<cover-view class="weui-flex" v-if="{{remarkArr.length>0}}">
<cover-view>备注:</cover-view>
<cover-view class="weui-flex__item" style="margin-top:1rpx;">
<cover-view v-for="{{remarkArr}}">{{item}}</cover-view>
</cover-view>
</cover-view> </cover-view>
</cover-view> <cover-image class="liveWatermarkNormal" mode="aspectFit" :src="liveWaterMarkImage"></cover-image>
<cover-image class="{{direction=='normal'?'logoNormal':direction=='left'?'logoLeft':'logoRight'}}" mode="heightFix" src="{{logo}}" style="opacity:{{1-logoTransparency*5/100}};" v-if="{{logoEnable}}"></cover-image>
<cover-image class="{{direction=='normal'?'liveWatermarkNormal':direction=='left'?'liveWatermarkLeft':'liveWatermarkRight'}}" mode="aspectFit" src="{{liveWatermarkValue}}" v-if="{{liveWatermark}}"></cover-image>
<cover-image class="{{direction=='normal'?'handWritingNormal':direction=='left'?'handWritingLeft':'handWritingRight'}}" mode="aspectFit" src="{{handWriting}}"></cover-image>
</camera> </camera>
<cover-view class="camera-photoalbumIconBox {{tempImagePath?'':'1hidden'}}"> <cover-view class="bottomView">
<cover-image @click="bindPhotoalbum" class="camera-photoalbumIcon" mode="aspectFill" src="{{tempImagePath}}"></cover-image> <!--cover-image class='switchIcon' :src='icon_switch_white' @click="switchClick()"> </cover-image-->
<cover-image class='takeIcon' :src='icon_take' @click="takePhoto()"> </cover-image>
<cover-image class="backIcon" :src="icon_arrow_down" mode="" @click="backClick"></cover-image>
<!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image-->
</cover-view> </cover-view>
<cover-image @click="bindTakePhoto" class="camera-takeIcon" id="take" mode="aspectFit" src="/image/take.png"></cover-image> <canvas class="showCanvas" canvas-id="photoCanvas" id="photoCanvas" :style="{width:canvas.sWidth + 'px',height:canvas.sHeight+ 'px'}"></canvas>
<cover-image @click="bindSetting" class="camera-settingIcon" mode="aspectFit" src="/image/setting_white.png"></cover-image>
</view> </view>
<canvas class="photoCanvas" id="photoCanvas" style="height:{{canvasHeight}}rpx;width:{{canvasWidth}}rpx;" type="2d"></canvas>
</template> </template>
<script> <script>
export default {
// import mp_dialog from '/miniprogram_npm/weui-miniprogram/dialog/dialog';
// import mp_con from '/miniprogram_npm/weui-miniprogram/icon/icon';
// import mp_form_page from '/miniprogram_npm/weui-miniprogram/form-page/form-page';
// import mp_form from '/miniprogram_npm/weui-miniprogram/form/form';
// import mp_cell from '/miniprogram_npm/weui-miniprogram/cell/cell';
// import mp_cells from '/miniprogram_npm/weui-miniprogram/cells/cells';
// import mp_slideview from '/miniprogram_npm/weui-miniprogram/slideview/slideview';
// import mp_toptips from '/miniprogram_npm/weui-miniprogram/toptips/toptips';
// import mp_actionSheet from '/miniprogram_npm/weui-miniprogram/actionsheet/actionsheet';
// import mp_halfScreenDialog from '/miniprogram_npm/weui-miniprogram/half-screen-dialog/half-screen-dialog';
// import mp_msg from '/miniprogram_npm/weui-miniprogram/msg/msg';
// import color_picker from '/miniprogram_npm/mini-color-picker/color-picker';
// export default {
// components: {
// "mp-dialog":mp_dialog,
// "mp-icon":mp_con,
// "mp-form-page":mp_form_page,
// "mp-form":mp_form,
// "mp-cell":mp_cell,
// "mp-cells":mp_cells,
// "mp-slideview":mp_slideview,
// "mp-toptips":mp_toptips,
// "mp-actionSheet":mp_actionSheet,
// "mp-halfScreenDialog":mp_halfScreenDialog,
// "mp-msg":mp_msg,
// "color-picker":color_picker
// },
data() { data() {
return { return {
navHeight: o.globalData.navHeight, title: '',
ctx: null,
path: "",
image: "",
showImage: false,
canvas: null,
longitude: '经度:正在获取中...',
latitude: '纬度:正在获取中...',
address: '地址:正在获取中...',
date: '时间:正在获取中...',
icon_location: 'https://qn-static.banshouhui.com/take_order/icon/location.png',
scale: "4_3", scale: "4_3",
iconColor: "white", icon_take: 'https://qn-static.banshouhui.com/take.png',
devicePosition: "back", icon_switch_white: 'https://qn-static.banshouhui.com/switch_white.png',
light: "off", icon_light_on_white: 'https://qn-static.banshouhui.com/light_on_white.png',
canvasWidth: 750, liveWaterMarkImage: require('@/static/live_mark.png'),
canvasHeight: 1e3, icon_arrow_down: 'https://qn-static.banshouhui.com/arrow_down.png',
cameraHeight: 1e3, icon_live_mark: 'https://qn-static.banshouhui.com/live_mark.png',
watermarkStyle: "bottom:20rpx;left:20rpx;", canvas: {
direction: "normal", ctx: null,
liveWatermarkValue: "/image/live_mark.png", sWidth: 750,
baiduLocationTimer: null, sHeight: 0,
wxLocationTimer: null,
netTimeTimer: null,
localTimeTimer: null,
takePhotoTimer: 0,
originalWeather: !1,
a:'',
t:'',
i:'',
o:'',
n:'',
r:'',
l:'',
s:'',
h:''
}
}, },
// var a waterMarkerTemp:''
// t = require("../../@babel/runtime/helpers/interopRequireDefault"), }
// e = t(require("../../@babel/runtime/regenerator")),
// i = t(require("../../@babel/runtime/helpers/asyncToGenerator")),
// o = getApp(), n = wx.getRealtimeLogManager(),
// r = require("../../libs/bmap-wx.min.js"), l = require("../../utils/util.js"),
// s = !0,
// h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG"
// });
onLoad: function(a) {
this.listeningDeviceMotion(), this.originalWeather = o.globalData.weather, o.globalData.weather && this.baiduWeather(),
setTimeout(function() {
s = !1;
}, 2e3);
this.initabcde()
},
onReady: function() {},
onShow: function() {
wx.startDeviceMotionListening();
var a = o.globalData.remark, t = this.formatRemark(a);
o.globalData.remarkArr = t, this.setData({
lonLat: o.globalData.lonLat,
address: o.globalData.address,
time: o.globalData.time,
altitude: o.globalData.altitude,
weather: o.globalData.weather,
liveWatermark: o.globalData.liveWatermark,
remarkArr: o.globalData.remarkArr,
handWriting: o.globalData.handWriting,
logoEnable: o.globalData.logoEnable,
logo: o.globalData.logo,
latLonFormat: o.globalData.latLonFormat,
watermarkFont: o.globalData.watermarkFont,
watermarkFontColor: o.globalData.watermarkFontColor,
logoTransparency: o.globalData.logoTransparency
}), (o.globalData.lonLat || o.globalData.altitude) && (this.wxLocation(), wx.startLocationUpdate()),
o.globalData.address && this.baiduLocation(), o.globalData.time && this.netTime(),
o.globalData.weather && this.originalWeather != o.globalData.weather && this.baiduWeather(),
this.initWatermarkBoxHeightAndWidth();
},
onHide: function() {
wx.stopDeviceMotionListening().catch(function(a) {
console.log(a);
}), (o.globalData.lonLat || o.globalData.altitude) && wx.stopLocationUpdate().catch(function(a) {
console.log(a);
}), clearInterval(this.baiduLocationTimer), clearInterval(this.wxLocationTimer),
clearInterval(this.netTimeTimer), clearInterval(this.localTimeTimer);
}, },
onUnload: function() { onLoad(e) {
wx.stopDeviceMotionListening(); this.ctx = uni.createCameraContext();
this.date = '时间:' + this.getTime()
this.getLocation()
this.getSystemInfo()
uni.setNavigationBarColor({
frontColor: '#FFFFFF',
backgroundColor: '#333333',
})
this.downloadImageH5(this.liveWaterMarkImage)
//this.address = ''
}, },
onPullDownRefresh: function() {},
onReachBottom: function() {},
onShareAppMessage: function() {},
bindinitdone: function(a) {},
bindstop: function(a) {},
binderror: function(a) {},
methods: { methods: {
initabcde: function() { //切换前后
var a switchClick() {
t = require("../../@babel/runtime/helpers/interopRequireDefault"),
e = t(require("../../@babel/runtime/regenerator")),
i = t(require("../../@babel/runtime/helpers/asyncToGenerator")),
o = getApp(),
n = wx.getRealtimeLogManager(),
r = require("../../libs/bmap-wx.min.js"),
l = require("../../utils/util.js"),
s = !0,
h = new r.BMapWX({
ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG"
});
},
initWatermarkBoxHeightAndWidth: function() {
var a = this;
wx.nextTick(function() {
wx.createSelectorQuery().select(".watermark-box").boundingClientRect(function(t) {
a.watermarkBoxHeight = t.height, a.watermarkBoxWidth = t.width, a.changeWatermark();
}).exec();
});
}, },
listeningDeviceMotion: function() {
var a = this; //返回 点击
wx.onDeviceMotionChange(function(t) { backClick: function() {
if ("ios" == o.globalData.platform) { uni.navigateBack({
var e = parseFloat(t.alpha);
a.direction = e > 45 && e < 136 ? "left" : e > 225 && e < 316 ? "right" : "normal"; })
} else t.gamma < -40 && t.gamma > -130 ? a.direction = "right" : t.gamma > 40 && t.gamma < 130 ? a.direction = "left" : a.direction = "normal";
a.direction != a.lastDirection && (a.setData({
direction: a.direction
}), a.changeCanvas(), a.changeWatermark()), a.lastDirection = a.direction;
});
},
changeCanvas: function() {
var a = this, t = this.direction, e = this.data.canvasWidth, i = this.data.canvasHeight;
"normal" == t ? this.setData({
canvasHeight: Math.max(i, e),
canvasWidth: Math.min(i, e)
}) : this.setData({
canvasHeight: Math.min(i, e),
canvasWidth: Math.max(i, e)
}), wx.createSelectorQuery().select("#photoCanvas").fields({
node: !0,
size: !0
}).exec(function(t) {
a.canvas = t[0].node;
var e = t[0].width, i = t[0].height, n = o.globalData.pixelRatio;
a.canvas.width = e * n, a.canvas.height = i * n, a.canvas.getContext("2d").scale(n, n);
});
},
changeScale: function() {
var a, t = this, e = this.data.scale, i = this.direction, n = this.data.canvasWidth, r = this.data.canvasHeight;
"4_3" == e ? (this.setData({
scale: "16_9",
iconColor: "white",
cameraHeight: 16 / 9 * 750
}), a = 16 / 9 * 750) : "16_9" == e ? (this.setData({
scale: "full",
iconColor: "white",
cameraHeight: o.globalData.rpxScreenHeight
}), a = o.globalData.rpxScreenHeight) : (this.setData({
scale: "4_3",
iconColor: "white",
cameraHeight: 1e3
}), a = 1e3), "normal" == i ? this.setData({
canvasHeight: a,
canvasWidth: Math.min(r, n)
}) : this.setData({
canvasWidth: a,
canvasHeight: Math.min(r, n)
}), wx.nextTick(function() {
t.changeCanvas(), setTimeout(function() {
t.changeWatermark();
}, 500);
});
},
changeWatermark: function() {
var a, t = this.data.direction, e = Math.min(this.watermarkBoxWidth, this.watermarkBoxHeight), i = Math.max(this.watermarkBoxWidth, this.watermarkBoxHeight);
a = "left" == t ? [ "top:" + (20 - 2 * e + 10) + "rpx", "left:20rpx", "transform-origin: left bottom", "transform: rotate(90deg)" ].join(";") : "right" == t ? [ "bottom:" + 2 * i + "rpx", "right:20rpx", "transform-origin: right bottom", "transform: rotate(-90deg)" ].join(";") : [ "bottom:20rpx", "left:20rpx" ].join(";"),
this.setData({
watermarkStyle: a
});
},
formatRemark: function(a) {
for (var t = [], e = 0, i = 15; i < a.length; i += 15) t.push(a.substring(15 * e, i)),
e++;
return a.length % 15 != 0 && t.push(a.substring(15 * e, 15 * e + a.length % 15)),
t;
},
changeDevicePosition: function() {
"back" == this.data.devicePosition ? this.setData({
devicePosition: "front"
}) : this.setData({
devicePosition: "back"
});
},
changeLight: function() {
var a = this.data.light;
"torch" == a ? this.setData({
light: "off"
}) : "off" == a ? this.setData({
light: "on"
}) : "on" == a ? this.setData({
light: "auto"
}) : this.setData({
light: "torch"
});
},
bindPhotoalbum: function(a) {
wx.navigateTo({
url: "/pages/photoalbum/photoalbum?photoPath=" + this.data.tempImagePath
});
},
bindSetting: function() {
wx.navigateTo({
url: "/pages/settings/settings"
});
},
bindTakePhoto: function() {
var a = this;
if (!s && 0 == this.takePhotoTimer) {
this.takePhotoTimer = 1, setTimeout(function() {
a.takePhotoTimer = 0;
}, 1500), this.takePhotoAnimate();
wx.createCameraContext().takePhoto({
quality: "high"
}).then(function(t) {
a.drawPhoto(t.tempImagePath);
}).catch(function(a) {
n.error(a), console.log(a);
});
}
}, },
drawPhoto: (a = (0, i.default)(e.default.mark(function a(t) {
var i, n, r, l, s, h, c, g, u, d, m = this;
return e.default.wrap(function(a) {
for (;;) switch (a.prev = a.next) {
case 0:
return i = this.canvas.getContext("2d"), n = o.globalData.screenHeight / o.globalData.rpxScreenHeight,
r = this.data.canvasWidth * n, l = this.data.canvasHeight * n, a.next = 6, new Promise(function(a) {
var e = m.canvas.createImage();
e.onload = function() {
var t = r, o = l, n = m.data.direction;
"left" == n ? (i.translate(0, o), i.rotate(-Math.PI / 2), i.drawImage(e, 0, 0, o, t),
i.rotate(Math.PI / 2), i.translate(0, -o)) : "right" == n ? (i.translate(t, 0),
i.rotate(Math.PI / 2), i.drawImage(e, 0, 0, o, t), i.rotate(-Math.PI / 2), i.translate(-t, 0)) : i.drawImage(e, 0, 0, t, o),
console.log("已画照片"), a("已画照片");
}, e.onerror = function() {
console.log("照片加载失败"), a();
}, e.src = t;
});
case 6: //获取位置
if (!this.data.liveWatermark || !this.data.liveWatermarkValue || "" == this.data.liveWatermarkValue) { getLocation() {
a.next = 9; let that = this
break; uni.getLocation({
type: 'wgs84',
success: function(res) {
that.longitude = '经度:' + res.longitude
that.latitude = '纬度:' + res.latitude
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
console.log('当前位置的地址:' + res.address);
} }
return a.next = 9, new Promise(function(a) {
var t = m.canvas.createImage();
t.onload = function() {
var e = 360 * n, o = 90 * n, s = r / 2 - e / 2, h = l / 2 - o / 2;
i.drawImage(t, s, h, e, o), console.log("已画现场水印"), a("已画现场水印");
}, t.onerror = function() {
console.log("现场水印加载失败"), a();
}, t.src = m.data.liveWatermarkValue;
}); });
},
case 9: //拍照
if (!this.data.handWriting || "" == this.data.handWriting) { takePhoto() {
a.next = 12; this.ctx.takePhoto({
break; quality: 'high',
success: (res) => {
console.log('拍照成功')
console.log(res)
this.imageChange(res)
//this.getImageInfo(res.tempImagePath)
//this.saveToLocal(res.tempImagePath)
} }
return a.next = 12, new Promise(function(a) {
var t = m.canvas.createImage();
t.onload = function() {
var e = 150 * n, o = 150 * n, s = r - e - 10, h = l - 10;
i.translate(s, h), i.rotate(-Math.PI / 2), i.drawImage(t, 0, 0, e, o), i.rotate(Math.PI / 2),
i.translate(-s, -h), console.log("已画手写签名水印"), a("已画手写签名水印");
}, t.onerror = function() {
console.log("手写签名水印加载失败"), a();
}, t.src = m.data.handWriting;
}); });
},
case 12: //获取图片信息
if (!this.data.logoEnable || !this.data.logo || "" == this.data.logo) { getImageInfo(tempImagePath) {
a.next = 16; let that = this
break;
}
return console.log("画水印LOGO"), a.next = 16, new Promise(function(a) {
var t = m.canvas.createImage();
t.onload = function() {
var e = 150 * n, l = 150 * n, s = r - e - 10, h = 1 - 5 * o.globalData.logoTransparency / 100;
i.globalAlpha = h, i.drawImage(t, s, 10, e, l), i.globalAlpha = 1, console.log("已画水印LOGO"),
a("已画水印LOGO");
}, t.onerror = function() {
console.log("水印LOGO加载失败"), a();
}, t.src = m.data.logo;
});
case 16: uni.getImageInfo({
if (console.log("画水印信息"), i.font = "14px", i.fillStyle = this.data.watermarkFontColor, src: tempImagePath,
s = l - 14, h = 0, (c = this.data.remarkArr) && c.length > 0) { success(res) {
for (g = c.length - 1; g >= 1; g--) u = c[g], i.fillText(u, 52, s - 18 * h++); //that.saveToLocal(res.)
d = c[0], i.fillText("备注:" + d, 10, s - 18 * h++);
} }
this.data.weather && this.data.weatherValue && i.fillText("天气:" + this.data.weatherValue, 10, s - 18 * h++), })
this.data.altitude && this.data.altitudeValue && i.fillText("海拔:" + this.data.altitudeValue, 10, s - 18 * h++),
this.data.time && this.data.timeValue && i.fillText("时间:" + this.data.timeValue, 10, s - 18 * h++),
this.data.address && this.data.addressValue && i.fillText("地址:" + this.data.addressValue, 10, s - 18 * h++),
this.data.lonLat && this.data.latitudeValue && this.data.longitudeValue && (i.fillText("纬度:" + this.data.latitudeValue, 10, s - 18 * h++),
i.fillText("经度:" + this.data.longitudeValue, 10, s - 18 * h++)), this.savaToTempFile();
case 31:
case "end":
return a.stop();
}
}, a, this);
})), function(t) {
return a.apply(this, arguments);
}),
savaToTempFile: function() {
var a = this;
wx.canvasToTempFilePath({
canvas: this.canvas
}).then(function(t) {
console.log(t), a.setData({
tempImagePath: t.tempFilePath
}), a.saveToPhotosAlbum(t.tempFilePath);
}).catch(function(a) {
n.error(a), console.log(a);
});
}, },
saveToPhotosAlbum: function(a) {
wx.getSetting({ //保存到本地相册
success: function(t) { saveToLocal(tempImagePath) {
t.authSetting["scope.writePhotosAlbum"] ? wx.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: a filePath: tempImagePath,
}) : wx.authorize({ success() {
scope: "scope.writePhotosAlbum", console.log('保存本地相册 成功')
success: function() {
wx.saveImageToPhotosAlbum({
filePath: a
});
}, },
fail: function() { fail() {
n.error("已拒绝保存照片到本地相册授权"), console.log("已拒绝保存照片到本地相册授权"); console.log('保存本地相册 失败')
} }
}); })
}
});
}, },
takePhotoAnimate: function() { getSystemInfo() {
this.animate("#take", [ { // 获取设备信息
scale: [ 1, 1 ] try {
}, { const res = uni.getSystemInfoSync();
scale: [ .95, .95 ] this.canvas.sWidth = res.windowWidth
}, { this.canvas.sHeight = res.windowHeight
scale: [ 1, 1 ] console.log(res.windowWidth, 'res.windowWidth', res.windowHeight, 'res.windowHeight')
} ], 300, function() { } catch (e) {
this.clearAnimation("#take"); // error
}.bind(this)); }
},
baiduWeather: function() {
var a = this;
h.weather({
success: function(t) {
var e = t.currentWeather[0];
console.log("当前天气", e);
var i = e.temperature + " " + e.weatherDesc + " " + e.wind;
a.setData({
weatherValue: i
}), a.initWatermarkBoxHeightAndWidth();
}, },
fail: function(a) {
n.error(a), console.log(a); downloadImageH5(image) {
let self = this
console.log('downloadImageH5',image)
// 图片下载本地
uni.downloadFile({
url: image, //仅为示例,并非真实的资源
success: (res) => {
console.log(res,'res-水印图片')
if (res.statusCode === 200) {
self.waterMarkerTemp = res.tempFilePath
}
} }
}); });
}, },
baiduLocation: function() { canvasImage() {
var a = this, t = function() { let self = this
var t = { this.canvas.ctx.draw(false, setTimeout(() => {
success: function(t) { setTimeout(() => {
var e = t.wxMarkerData[0]; uni.canvasToTempFilePath({
console.log("当前定位", e); x: 0,
var i = e.address; y: 0,
a.setData({ width: Number(this.canvas.sWidth),
addressValue: i height: Number(this.canvas.sHeight),
}), o.globalData.addressValue = i, a.initWatermarkBoxHeightAndWidth(); canvasId: 'photoCanvas',
success: (res) => {
// this.$emit('canvasImage', res.tempFilePath);
// if (this.showPreview) {
self.showPreviewFn(res.tempFilePath);
// }
}, },
fail: function(a) { fail: (res) => {
n.error(a), console.log(a); console.log(res);
} },
}; complete: () => {
if ((o.globalData.lonLat || o.globalData.altitude) && a.latitude && a.longitude) { uni.hideLoading();
var e = a.latitude + "," + a.longitude;
t.location = e;
} }
h.regeocoding(t); }, this);
}; }, 500);
t(), clearInterval(this.baiduLocationTimer), this.baiduLocationTimer = setInterval(t, 6e4); }));
}, },
wxLocation: function() { showPreviewFn (img) {
var a = this; uni.previewImage({
wx.onLocationChange(function(t) { current: 0,
a.latitude = t.latitude, a.longitude = t.longitude; urls: [img]
var e = l.formatLonLat(t.latitude, o.globalData.latLonFormat), i = l.formatLonLat(t.longitude, o.globalData.latLonFormat), n = "0米";
t.altitude && (n = t.altitude.toFixed(2) + "米"), a.setData({
latitudeValue: e,
longitudeValue: i,
altitudeValue: n
}), o.globalData.latitudeValue = e, o.globalData.longitudeValue = i, o.globalData.altitudeValue = n;
}); });
}, },
netTime: function() { //照片处理
var a = this, t = function() { imageChange(options) {
wx.request({ let self = this
url: "https://www.baidu.com", // let ctx = uni.createCanvasContext("photoCanvas") // canvas绘制对象
success: function(t) { let ctx = uni.createCanvasContext('photoCanvas', this);
var e = new Date(t.header.Date); let sWidth = this.canvas.sWidth //绘图宽度
o.globalData.timestampValue = e.getTime(); let sHeight = this.canvas.sHeight // 绘图高度
var i = l.formatTime(e); this.canvas.ctx = ctx
a.setData({ ctx.setStrokeStyle("#00ff00")
timeValue: i ctx.setLineWidth(5)
}), o.globalData.timeValue = i, a.initWatermarkBoxHeightAndWidth(); ctx.rect(0, 0, sWidth, sHeight)
} ctx.drawImage(options.tempImagePath, 0, 0, sWidth, sHeight)
ctx.setFontSize(20)
ctx.fillText('Hello', 20, 20)
ctx.fillText('MINA', 100, 100)
// if(this.waterMarkerTemp){
// ctx.drawImage(this.waterMarkerTemp, sWidth/2 - 100, sHeight/2 - 20, 200, 40)
// }
ctx.drawImage(options.tempImagePath, sWidth/2 - 100, sHeight/2 - 20, 200, 40);
self.canvasImage()
// self.path = options.tempImagePath
return
// uni.getImageInfo({
// src: that.path,
// success: function(res) {
// }
// })
var that = this
//原图片信息
var _width = options.width
var _height = options.height
that.path = options.tempImagePath
console.log('原照片信息')
console.log('宽:' + options.width)
console.log('高:' + options.height)
console.log('路径:' + options.tempImagePath)
//需要的图片信息
var image_x = parseInt(_width * 0.1);
var image_y = parseInt(_height * 0.09);
var image_width = parseInt(_width * 0.8);
var image_height = parseInt(_height * 0.87);
console.log('需要的图片信息')
console.log('x:' + image_x)
console.log('y:' + image_y)
console.log('宽:' + image_width)
console.log('高:' + image_height)
uni.getImageInfo({
src: that.path,
success: function(res) {
that.showImage = true
//将原图画到canvas上面
that.canvas = uni.createCanvasContext("canvas", that)
//that.canvas.drawImage(that.path, 0, 0, _width, _height)
that.canvas.drawImage(that.path, 0, 0, res.width * 3, res.height * 3)
/*
//-----------------------------
// let ctx = uni.createCanvasContext('firstCanvas'); // 创建画布
// //将图片src放到cancas内,宽高为图片大小
// ctx.drawImage(res.tempFilePaths[0], 0, 0, ress.width / 3, ress.height / 3)
that.canvas.setFontSize(18)
// that.canvas.setFillStyle('#8a2929')
// that.canvas.rotate(-Math.PI / 2);
let textToWidth = res.width / 3 * 0.5;
let textToHeight = res.height / 3 * 0.3;
that.canvas.fillText('我是水印', 10, 90)
//. 除了上面的文字水印,这里也可以加入图片水印
// ctx.drawImage('/static/watermark.png', 0, 0, res.width / 3, ress.height / 3)
that.canvas.drawImage('/static/live_mark.png', 0, 0, 200, 200)
//-----------------------------
*/
that.canvas.draw()
uni.showLoading({
title: '数据处理中...',
icon: 'loading',
duration: 10000
})
that.canvas.draw()
setTimeout(function() {
//导出自己需要的图片
uni.canvasToTempFilePath({
canvasId: "canvas",
x: image_x,
y: image_y,
width: image_width,
height: image_height,
destWidth: image_width,
destHeight: image_height,
success: function(ress) {
that.image = ress.tempFilePath //处理好的图片
uni.hideLoading()
console.log('处理图片 成功:')
console.log(ress.tempFilePath)
uni.showToast({
icon: 'none',
title: '处理成功'
})
setTimeout(function() {
that.saveToLocal(ress.tempFilePath)
uni.previewImage({
urls: [ress.tempFilePath],
current: 0
}); });
}; // uni.navigateTo({
t(), clearInterval(this.netTimeTimer), clearInterval(this.localTimeTimer), this.netTimeTimer = setInterval(t, 6e4), // url:'/pages/photo/preview'+'?path=' + res.tempFilePath
this.localTimeTimer = setInterval(function() { // })
if (o.globalData.timestampValue) { }, 1000);
o.globalData.timestampValue += 1e3;
var t = l.formatTime(new Date(o.globalData.timestampValue));
a.setData({
timeValue: t
}), o.globalData.timeValue = t;
}
}, 1e3);
}
//TODO........
},
fail: function(e) {
uni.hideLoading()
uni.showToast({
title: '出错啦...',
icon: 'loading'
})
console.log('处理图片 失败:')
console.log(e)
} }
});
}, 1000);
} }
</script> })
},
<style>
.hidden {
display: none;
}
.camera { //获取当前时间
width: 100%; getTime: function() {
height: 100vh;
z-index: 1; var date = new Date(),
position: absolute; year = date.getFullYear(),
} month = date.getMonth() + 1,
day = date.getDate(),
hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
month >= 1 && month <= 9 ? (month = "0" + month) : "";
day >= 0 && day <= 9 ? (day = "0" + day) : "";
var timer = year + '/' + month + '/' + day + ' ' + hour + ':' + minute + ':' + second;
return timer;
},
.nav__scale-4-3 {
background-color: #000;
}
.nav__scale-4-3,.nav__scale-16-9 {
z-index: 5;
position: fixed;
top: 0;
left: 0;
right: 0;
}
.nav__scale-16-9 {
background-color: transparent;
}
.nav__scale-full {
z-index: 5;
position: fixed;
top: 0;
left: 0;
right: 0;
}
.nav-scaleIcon {
left: 5rpx;
}
.nav-scaleIcon,.nav-switchIcon {
z-index: 5;
width: 50rpx;
height: 50rpx;
position: absolute;
bottom: 0;
margin: 20rpx;
}
.nav-switchIcon {
left: 120rpx;
}
.nav-lightIcon {
left: 220rpx;
} }
}
</script>
.nav-lightIcon,.nav-moreIcon { <style>
.bottomView {
background-color: #000000;
z-index: 5; z-index: 5;
width: 50rpx; width: 100%;
height: 50rpx; height: 200rpx;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
margin: 20rpx; display: flex;
} flex-direction: row;
align-items: center;
.nav-moreIcon { justify-content: center;
left: 320rpx;
}
.camera-photoalbumIconBox {
z-index: 5;
width: 80rpx;
height: 80rpx;
position: absolute;
bottom: 60rpx;
left: 25%;
margin-left: -80rpx;
background-color: hsla(0,0%,100%,0);
border: 1rpx solid #fff;
border-radius: 50%;
} }
.camera-photoalbumIcon { .switchIcon {
z-index: 5; background-color: #000000;
width: 50rpx;
height: 50rpx;
} }
.camera-takeIcon { .takeIcon {
z-index: 5; background-color: #000000;
width: 150rpx; width: 150rpx;
height: 150rpx; height: 150rpx;
position: absolute;
bottom: 25rpx;
left: 50%;
margin-left: -75rpx;
} }
.camera-settingIcon { .flashIcon {
z-index: 5; background-color: #000000;
width: 80rpx; width: 50rpx;
height: 80rpx; height: 50rpx;
position: absolute; margin-left: 100rpx;
bottom: 60rpx;
left: 75%;
} }
.photoCanvas { .locationView {
z-index: -1; /* z-index: 5;
width: 300rpx;
position: absolute; position: absolute;
left: 9999px; left: 0;
} bottom: 200rpx;
display: flex;
.watermark-box { flex-direction: column;
padding-bottom: 20rpx;
padding-right: 20rpx; */
bottom: 200rpx;
padding-bottom: 20rpx;
padding-right: 20rpx;
z-index: 4; z-index: 4;
position: absolute; position: absolute;
font-size: 14px; font-size: 14px;
...@@ -632,7 +408,10 @@ ...@@ -632,7 +408,10 @@
color: #fff; color: #fff;
} }
.watermark-box__item { .locationText {
/* font-size: 24rpx;
color: #999999;
width: 260rpx; */
margin: 2px 0; margin: 2px 0;
} }
...@@ -641,87 +420,32 @@ ...@@ -641,87 +420,32 @@
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%; top: 50%;
transform: translate(-50%,-50%); transform: translate(-50%, -50%);
width: 360rpx;
height: 90rpx;
z-index: 6;
}
.liveWatermarkRight {
transform-origin: 50% 50%;
transform: rotate(-90deg);
}
.liveWatermarkLeft,.liveWatermarkRight {
z-index: 3;
position: absolute;
left: 25%;
top: calc(50% - 45rpx);
width: 360rpx; width: 360rpx;
height: 90rpx; height: 90rpx;
z-index: 6; z-index: 6;
} }
.liveWatermarkLeft { .backIcon {
transform-origin: 50% 50%; background-color: #FFFFFF;
transform: rotate(90deg); width: 54rpx;
} height: 54rpx;
border-radius: 27rpx;
.handWritingNormal { position: fixed;
transform-origin: 50% 50%; left: 60rpx;
transform: rotate(-90deg); bottom: 50rpx;
right: 20rpx;
}
.handWritingLeft,.handWritingNormal {
z-index: 3;
position: absolute;
width: 150rpx;
height: 150rpx;
bottom: 20rpx;
}
.handWritingLeft {
transform-origin: 50% 50%;
left: 20rpx;
}
.handWritingRight {
transform-origin: 50% 50%;
transform: rotate(180deg);
}
.handWritingRight,.logoNormal {
z-index: 3;
position: absolute;
width: 150rpx;
height: 150rpx;
top: 20rpx;
right: 20rpx;
}
.logoNormal {
transform-origin: 50% 50%;
} }
.logoLeft { .container {
transform-origin: 50% 50%; position: relative;
transform: rotate(90deg);
bottom: 20rpx;
right: 20rpx;
} }
.logoLeft,.logoRight { .showCanvas {
z-index: 3;
position: absolute; position: absolute;
width: 150rpx; left: 0;
height: 150rpx; /* top: 0; */
} z-index: -1;
opacity: 0;
.logoRight { background-color: #007AFF;
transform-origin: 50% 50%;
transform: rotate(-90deg);
top: 20rpx;
left: 20rpx;
} }
</style> </style>
<template> <template>
<view class=""> <view class="">
<camera device-position="back" flash="off" style='width:100%; height:100vh;'> <camera device-position="back" flash="off" style='width:100%; height:100vh;'>
<cover-view class="locationView"> <cover-view class="locationView">
<cover-view class="locationText u-m-l-20 u-m-t-30">{{longitude}}</cover-view> <cover-view class="locationText u-m-l-20 u-m-t-30">{{longitude}}</cover-view>
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
<cover-view class="bottomView"> <cover-view class="bottomView">
<!--cover-image class='switchIcon' :src='icon_switch_white' @click="switchClick()"> </cover-image--> <!--cover-image class='switchIcon' :src='icon_switch_white' @click="switchClick()"> </cover-image-->
<cover-image class='takeIcon' :src='icon_take' @click="takePhoto()"> </cover-image> <cover-image class='takeIcon' :src='icon_take' @click="takePhoto()"> </cover-image>
<cover-image class="backIcon" :src="icon_arrow_down" mode="" @click="backClick"></cover-image> <cover-image class="backIcon" v-if="restultImage" :src="restultImage" mode="" @click="goPage"></cover-image>
<!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image--> <!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image-->
</cover-view> </cover-view>
<canvas v-show='showImage' canvas-id="canvas" :style="{'width':width,'height': height}"></canvas> <canvas v-show='showImage' canvas-id="canvas" :style="{'width':canvasWidth+'px','height': canvasHeight + 'px'}"></canvas>
</view> </view>
...@@ -33,22 +33,25 @@ ...@@ -33,22 +33,25 @@
path: "", path: "",
image: "", image: "",
showImage: false, showImage: false,
canvas:null, canvas: null,
longitude:'经度:正在获取中...', longitude: '经度:正在获取中...',
latitude:'纬度:正在获取中...', latitude: '纬度:正在获取中...',
address:'地址:正在获取中...', address: '地址:正在获取中...',
date:'时间:正在获取中...', date: '时间:正在获取中...',
icon_location:'https://qn-static.banshouhui.com/take_order/icon/location.png', icon_location: 'https://qn-static.banshouhui.com/take_order/icon/location.png',
scale: "4_3", scale: "4_3",
icon_take:'https://qn-static.banshouhui.com/take.png', icon_take: 'https://qn-static.banshouhui.com/take.png',
icon_switch_white:'https://qn-static.banshouhui.com/switch_white.png', icon_switch_white: 'https://qn-static.banshouhui.com/switch_white.png',
icon_light_on_white:'https://qn-static.banshouhui.com/light_on_white.png', icon_light_on_white: 'https://qn-static.banshouhui.com/light_on_white.png',
liveWaterMarkImage:'/static/live_mark.png', liveWaterMarkImage: '/static/live_mark.png',
icon_arrow_down:'https://qn-static.banshouhui.com/arrow_down.png', icon_arrow_down: 'https://qn-static.banshouhui.com/arrow_down.png',
icon_live_mark:'https://qn-static.banshouhui.com/live_mark.png', icon_live_mark: 'https://qn-static.banshouhui.com/live_mark.png',
width:'', width: '',
height:'', height: '',
markPath:'', markPath: '',
canvasWidth:0,
canvasHeight:0,
restuleImage:'',
} }
}, },
onLoad(e) { onLoad(e) {
...@@ -56,30 +59,41 @@ ...@@ -56,30 +59,41 @@
this.date = '时间:' + this.getTime() this.date = '时间:' + this.getTime()
this.getLocation() this.getLocation()
this.getMarkPath() this.getMarkPath()
this.getSystemInfo()
uni.setNavigationBarColor({ uni.setNavigationBarColor({
frontColor:'#FFFFFF', frontColor: '#FFFFFF',
backgroundColor:'#333333', backgroundColor: '#333333',
}) })
//this.address = '' //this.address = ''
}, },
methods: { methods: {
goPage(){
// 进入图片预览页
},
getSystemInfo() {
// 获取设备信息
try {
const res = uni.getSystemInfoSync();
this.canvasWidth = res.windowWidth*2
this.canvasHeight = res.windowHeight*2
console.log(res.windowWidth, 'res.windowWidth', res.windowHeight, 'res.windowHeight')
} catch (e) {
// error
}
},
//返回 点击 //返回 点击
backClick: function () { backClick: function() {
uni.navigateBack({ uni.navigateBack({
}) })
}, },
//获取位置 //获取位置
getLocation(){ getLocation() {
let that = this let that = this
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
success: function (res) { success: function(res) {
that.longitude = '经度:' + res.longitude that.longitude = '经度:' + res.longitude
that.latitude = '纬度:' + res.latitude that.latitude = '纬度:' + res.latitude
console.log('当前位置的经度:' + res.longitude); console.log('当前位置的经度:' + res.longitude);
...@@ -90,7 +104,7 @@ ...@@ -90,7 +104,7 @@
}, },
//获取 水印 本地缓存路径 //获取 水印 本地缓存路径
getMarkPath: function (){ getMarkPath: function() {
let that = this let that = this
uni.downloadFile({ uni.downloadFile({
url: this.icon_live_mark, //仅为示例,并非真实的资源 url: this.icon_live_mark, //仅为示例,并非真实的资源
...@@ -98,7 +112,7 @@ ...@@ -98,7 +112,7 @@
if (res.statusCode === 200) { if (res.statusCode === 200) {
console.log('水印图片 下载成功') console.log('水印图片 下载成功')
that.markPath = res.tempFilePath that.markPath = res.tempFilePath
console.log('markPath:'+ that.markPath) console.log('markPath:' + that.markPath)
} }
}, },
fail() { fail() {
...@@ -109,7 +123,7 @@ ...@@ -109,7 +123,7 @@
}, },
//第一步: 拍照 //第一步: 拍照
takePhoto(){ takePhoto() {
let that = this let that = this
this.ctx.takePhoto({ this.ctx.takePhoto({
quality: 'high', quality: 'high',
...@@ -119,6 +133,7 @@ ...@@ -119,6 +133,7 @@
//this.imageChange(res) //this.imageChange(res)
this.getImageInfo(res.tempImagePath) this.getImageInfo(res.tempImagePath)
this.restultImage = res.tempImagePath
//this.saveToLocal(res.tempImagePath) //this.saveToLocal(res.tempImagePath)
} }
}); });
...@@ -131,53 +146,97 @@ ...@@ -131,53 +146,97 @@
let that = this let that = this
uni.getImageInfo({ uni.getImageInfo({
src:tempImagePath, src: tempImagePath,
success(res) { success(res) {
console.log('获取图片信息成功') console.log('获取图片信息成功')
//that.saveToLocal(res.) that.width = res.width + 'px';
that.width = res.width+'px'; that.height = res.height + 'px';
that.height = res.height+'px';
that.drawCanvas(tempImagePath,res) that.drawCanvas(tempImagePath, res)
} }
}) })
}, },
//第三步: 绘制画布 //第三步: 绘制画布
drawCanvas: function (tempImagePath,res){ drawCanvas: function(tempImagePath, res) {
console.log('绘制画布') console.log('绘制画布')
let canvasWidth = this.canvasWidth
let canvasHeight = this.canvasHeight
console.log(canvasWidth,'canvasWidth',canvasHeight,'canvasHeight')
this.showImage = true this.showImage = true
//将原图画到canvas上面 //将原图画到canvas上面
this.canvas = uni.createCanvasContext("canvas", this) this.canvas = uni.createCanvasContext("canvas", this)
this.canvas.drawImage(tempImagePath, 0, 0, res.width , res.height) this.canvas.rect(0, 0, canvasWidth, canvasHeight)
this.canvas.draw() this.canvas.drawImage(tempImagePath, 0, 0, canvasWidth, canvasHeight)
// this.canvas.draw()
//加入 水印文字 //加入 水印文字
this.canvas.setFontSize(18) this.canvas.setFontSize(28)
this.canvas.setFillStyle('#8a2929') this.canvas.setFillStyle('#f2f2f2')
//this.canvas.rotate(30 * Math.PI / 180); //this.canvas.rotate(30 * Math.PI / 180);
let textToWidth = res.width * 0.5; // let textToWidth = res.width * 0.5;
let textToHeight = res.height * 0.3; // let textToHeight = res.height * 0.3;
this.canvas.fillText('我是水印', 100, 100) let h = 1
let txtHeight=36
this.canvas.fillText('经度' + this.longitude, 20, canvasHeight - txtHeight * h++);
this.canvas.fillText('维度' + this.latitude, 20, canvasHeight - txtHeight * h++);
this.canvas.fillText('地址' + this.address, 20, canvasHeight - txtHeight * h++);
this.canvas.fillText('时间' + this.date, 20, canvasHeight - txtHeight * h++);
//加入 水印图片 //加入 水印图片
this.canvas.drawImage(this.markPath, 0, 0, res.width / 3, res.height / 3) this.canvas.drawImage(this.markPath, canvasWidth/2-200, canvasHeight/2 - 50, 400, 100)
this.canvas.draw()
uni.showLoading({ uni.showLoading({
title: '数据处理中...', title: '数据处理中...',
icon: 'loading' icon: 'loading'
}) })
this.canvasImage()
// this.canvas.draw()
this.exportCanvasTempFilePath(res.width,res.height) // uni.showLoading({
// title: '数据处理中...',
// icon: 'loading'
// })
// this.exportCanvasTempFilePath(res.width,res.height)
},
},
canvasImage() {
let self = this
this.canvas.draw(false, setTimeout(() => {
setTimeout(() => {
uni.canvasToTempFilePath({
// x: 0,
// y: 0,
width: Number(this.canvasWidth),
height: Number(this.canvasHeight),
canvasId: 'canvas',
success: (res) => {
that.saveToLocal(res.tempFilePath)
console.log(res.tempFilePath, 'res.tempFilePath-canvasImage')
// this.$emit('canvasImage', res.tempFilePath);
// if (this.showPreview) {
self.showPreviewFn(res.tempFilePath);
// }
},
fail: (res) => {
console.log(res);
},
complete: () => {
uni.hideLoading();
}
}, this);
}, 500);
}));
},
showPreviewFn(img) {
uni.previewImage({
current: 0,
urls: [img]
});
},
//第四步: 导出画布 //第四步: 导出画布
exportCanvasTempFilePath : function (width,height){ exportCanvasTempFilePath: function(width, height) {
console.log('导出画布') console.log('导出画布')
console.log('width:' + width) console.log('width:' + width)
console.log('height:' + height) console.log('height:' + height)
...@@ -192,8 +251,8 @@ ...@@ -192,8 +251,8 @@
console.log('处理图片 成功:') console.log('处理图片 成功:')
console.log(ress.tempFilePath) console.log(ress.tempFilePath)
uni.showToast({ uni.showToast({
icon:'none', icon: 'none',
title:'处理成功' title: '处理成功'
}) })
setTimeout(function() { setTimeout(function() {
...@@ -201,7 +260,7 @@ ...@@ -201,7 +260,7 @@
that.saveToLocal(ress.tempFilePath) that.saveToLocal(ress.tempFilePath)
uni.previewImage({ uni.previewImage({
urls: [ress.tempFilePath], urls: [ress.tempFilePath],
current:0 current: 0
}); });
...@@ -229,7 +288,7 @@ ...@@ -229,7 +288,7 @@
//第五步: 保存到本地相册 //第五步: 保存到本地相册
saveToLocal(tempImagePath) { saveToLocal(tempImagePath) {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath:tempImagePath, filePath: tempImagePath,
success() { success() {
console.log('保存本地相册 成功') console.log('保存本地相册 成功')
}, },
...@@ -240,12 +299,12 @@ ...@@ -240,12 +299,12 @@
}, },
//第六步 返回上层界面 //第六步 返回上层界面
goBack: function(){ goBack: function() {
}, },
//获取当前时间 //获取当前时间
getTime:function(){ getTime: function() {
var date = new Date(), var date = new Date(),
year = date.getFullYear(), year = date.getFullYear(),
...@@ -276,10 +335,7 @@ ...@@ -276,10 +335,7 @@
</script> </script>
<style> <style>
.bottomView {
.bottomView{
background-color: #000000; background-color: #000000;
z-index: 5; z-index: 5;
width: 100%; width: 100%;
...@@ -293,26 +349,26 @@ ...@@ -293,26 +349,26 @@
} }
.switchIcon{ .switchIcon {
background-color: #000000; background-color: #000000;
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
} }
.takeIcon{ .takeIcon {
background-color: #000000; background-color: #000000;
width: 150rpx; width: 150rpx;
height: 150rpx; height: 150rpx;
} }
.flashIcon{ .flashIcon {
background-color: #000000; background-color: #000000;
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
margin-left: 100rpx; margin-left: 100rpx;
} }
.locationView{ .locationView {
/* z-index: 5; /* z-index: 5;
width: 300rpx; width: 300rpx;
position: absolute; position: absolute;
...@@ -332,7 +388,7 @@ ...@@ -332,7 +388,7 @@
color: #fff; color: #fff;
} }
.locationText{ .locationText {
/* font-size: 24rpx; /* font-size: 24rpx;
color: #999999; color: #999999;
width: 260rpx; */ width: 260rpx; */
...@@ -344,13 +400,13 @@ ...@@ -344,13 +400,13 @@
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%; top: 50%;
transform: translate(-50%,-50%); transform: translate(-50%, -50%);
width: 360rpx; width: 360rpx;
height: 90rpx; height: 90rpx;
z-index: 6; z-index: 6;
} }
.backIcon{ .backIcon {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 54rpx; width: 54rpx;
height: 54rpx; height: 54rpx;
...@@ -360,10 +416,9 @@ ...@@ -360,10 +416,9 @@
bottom: 50rpx; bottom: 50rpx;
} }
.showCanvas{ .showCanvas {
background-color: #007AFF; background-color: #007AFF;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
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