Commit 780731be authored by zhengzy's avatar zhengzy

我的合同

parents 386939b0 902493b1
...@@ -74,6 +74,11 @@ let orderApiFun = function(vm){ ...@@ -74,6 +74,11 @@ let orderApiFun = function(vm){
* 获取师傅水印 or 默认水印 * 获取师傅水印 or 默认水印
*/ */
let getWatermark = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/photo/watermark', params); let getWatermark = async (params = {}) => await vm.$u.get(prefix + vm.vuex_token + '/photo/watermark', params);
/**
* 保存师傅水印
*/
let saveWatermark = async (params = {}) => await vm.$u.post(prefix + vm.vuex_token + '/photo/watermark', params);
/** /**
* 获取师傅开放可选时间段 * 获取师傅开放可选时间段
...@@ -144,6 +149,7 @@ let orderApiFun = function(vm){ ...@@ -144,6 +149,7 @@ let orderApiFun = function(vm){
orderStandard, orderStandard,
saveImage, saveImage,
getWatermark, getWatermark,
saveWatermark,
openTimerange, openTimerange,
contactTime, contactTime,
checkRejectable, checkRejectable,
......
...@@ -16,11 +16,11 @@ const install = (Vue, vm) => { ...@@ -16,11 +16,11 @@ const install = (Vue, vm) => {
function toLoginPage(){ function toLoginPage(){
const app = getApp() const app = getApp()
let jumpLoginStatus = app && app.globalData && app.globalData.jumpLoginStatus let curpath = vm.$Route.path
if(!jumpLoginStatus){ if(curpath == '/pages/login/index') {
return // 如果已经在登录页,无需再次跳转
return false
} }
app.globalData.jumpLoginStatus = false
vm.$u.route('/pages/login/index'); vm.$u.route('/pages/login/index');
} }
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
......
...@@ -72,7 +72,13 @@ ...@@ -72,7 +72,13 @@
} }
}, },
methods: { methods: {
selectUpload(){ selectUpload(){
if (this.imgList.length === 10) {
return this.$refs.uToast.show({
title: '图片已超出最大数量',
type: 'error',
})
}
// 弹窗展示 // 弹窗展示
this.maskShow = true this.maskShow = true
}, },
...@@ -104,14 +110,14 @@ ...@@ -104,14 +110,14 @@
setValue() { setValue() {
const dataValue = [] const dataValue = []
this.imgList.map(item=>{ this.imgList.map(item=>{
dataValue.push(item.src) dataValue.push(item.path)
}) })
this.valueChange(dataValue) this.valueChange(dataValue)
}, },
closeTake(val) { closeTake(val) {
if(val && val.length > 0){ if(val && val.length > 0){
val.forEach((item,index,array)=>{ val.forEach((item,index,array)=>{
item.path = item.src item.path = item.key
this.imgList.push(item) this.imgList.push(item)
}) })
this.setValue() this.setValue()
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
photo.currentItemLength = 10 photo.currentItemLength = 10
this.continuePhoto() this.continuePhoto()
// 完成本项 // 完成本项
this.$emit('finish') //this.$emit('finish')
}, },
// 确认图片 // 确认图片
continuePhoto() { continuePhoto() {
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
}, },
submitFile() { submitFile() {
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1 if (photo.currentItemLength < 10) photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading() uni.hideLoading()
// 当前项的图片显示 // 当前项的图片显示
// 拍照项张数目增加 等于10张 // 拍照项张数目增加 等于10张
......
<template> <template>
<view class="backView"> <view class="backView">
<u-navbar title="设置" :title-size="26" title-color="#000" :custom-back="backTake"></u-navbar> <u-navbar title="设置" :title-size="26" title-color="#000" :custom-back="backTake"></u-navbar>
<view class="shadowBackView" style="background-color: transparent;z-index: 1" v-if="loading"> <view class="shadowBackView" style="background-color: transparent;z-index: 1" v-if="loading">
<u-loading style="position: fixed;top: 50%;" :show="loading" size="36" mode="flower"></u-loading> <u-loading style="position: fixed;top: 50%;" :show="loading" size="36" mode="flower"></u-loading>
</view> </view>
<view class="itemView firstItem"> <view class="itemView firstItem">
<view class="itemTitleView"> <view class="itemTitleView">
<text class="itemTitle">保存原图</text> <text class="itemTitle">保存原图</text>
<text class="itemNotice">拍照后另保存一张无水印的图片</text> <text class="itemNotice">拍照后另保存一张无水印的图片</text>
</view> </view>
<switch class="itemSwitch" :checked="result['has_origin']" @change="handleOrigineChange" color="#007AFF" /> <switch class="itemSwitch" :checked="result['hasOrigin']" @change="handleOrigineChange" color="#007AFF" />
</view> </view>
<view class="itemView" v-if="showTitleSwitch"> <view class="itemView" v-if="showTitleSwitch">
<view class="itemTitleView" @click="itemClick({},-1)"> <view class="itemTitleView" @click="itemClick({},-1)">
<text class="itemTitle">水印标题</text> <text class="itemTitle">水印标题</text>
<text class="itemNotice">{{result['lower_right']['title_text'] || '点击可编辑更改'}}</text> <text class="itemNotice">{{result['lowerLeft']['title'] || '点击可编辑更改'}}</text>
</view> </view>
<switch class="itemSwitch" disabled :checked="result['lower_right']['title_text'] != ''" <switch class="itemSwitch" disabled :checked="result['lowerLeft']['title'] != ''"
@click="handleClickTitleSwitch" color="#007AFF" /> @click="handleClickTitleSwitch" color="#007AFF" />
</view> </view>
<view class="itemView" v-for="(item,ikey) in itemList" :key="ikey"> <view class="itemView" v-for="(item,ikey) in itemList" :key="ikey">
<view class="itemTitleView" @click="itemClick(item,ikey)"> <view class="itemTitleView" @click="itemClick(item,ikey)">
<text class="itemTitle">{{item['watemark_text'] || '自定义' + (ikey + 1)}}</text> <text class="itemTitle">{{item['watemarkText'] || '自定义' + (ikey + 1)}}</text>
<text class="itemNotice">{{item['watemark_value'] || '点击可编辑更改'}}</text> <text class="itemNotice">{{item['watemarkValue'] || '点击可编辑更改'}}</text>
</view> </view>
<switch class="itemSwitch" :checked="item['enable']" @change="itemChange(item, ikey)" color="#007AFF" /> <switch class="itemSwitch" :checked="item['enable']" @change="itemChange(item, ikey)" color="#007AFF" />
</view> </view>
<u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom :mask-close-able="false" mode="center" <u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom :mask-close-able="false" mode="center"
width="690rpx" height="600rpx" @close="handlePopClose"> width="690rpx" height="600rpx" @close="handlePopClose">
<view class="popCenterView"> <view class="popCenterView">
<text class="popTitle">设置自定义项</text> <text class="popTitle">设置自定义项</text>
<view class="inputBackView"> <view class="inputBackView">
<view class="ph-pop-left-view"> <view class="ph-pop-left-view">
<view class="leftInputView"> <view class="leftInputView">
<input class="leftInput" type="text" v-model="currenItem['watemark_text']" <input class="leftInput" type="text" v-model="currenItem['watemarkText']"
@input="leftInput()" :disabled="currenItem.type === 'title_text'" placeholder="请输入" @input="leftInput()" :disabled="currenItem.type === '备注'" placeholder="请输入"
maxlength="10" /> maxlength="10" />
</view> </view>
<view class="ph-pop-tip-view" v-if="showTipLeft">*必填项</view> <view class="ph-pop-tip-view" v-if="showTipLeft">*必填项</view>
</view> </view>
<view class="ph-pop-mid-view">:</view> <view class="ph-pop-mid-view">:</view>
<view> <view>
<view class="rightInputView"> <view class="rightInputView">
<input class="rightInput" type="text" v-model="currenItem['watemark_value']" <input class="rightInput" type="text" v-model="currenItem['watemarkValue']"
@input="rightInput()" placeholder="请输入内容" maxlength="30" /> @input="rightInput()" placeholder="请输入内容" maxlength="30" />
</view> </view>
<view class="ph-pop-tip-view" v-if="showTipRight">*必填项</view> <view class="ph-pop-tip-view" v-if="showTipRight">*必填项</view>
</view> </view>
</view> </view>
<text class="popNoticeText u-m-t-20">示例:</text> <text class="popNoticeText u-m-t-20">示例:</text>
<text class="popNoticeText">工程队名称:蓝天工程队</text> <text class="popNoticeText">工程队名称:蓝天工程队</text>
<view class="popBtnView"> <view class="popBtnView">
<u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary" @click="popCancelClick()"> <u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary" @click="popCancelClick()">
取消 取消
</u-button> </u-button>
<u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="popSaveClick()"> <u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="popSaveClick()">
保存 保存
</u-button> </u-button>
</view> </view>
</view> </view>
</u-popup> </u-popup>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
systemId: '', systemId: '',
isSaveOrigine: true, isSaveOrigine: true,
isPopShow: false, isPopShow: false,
icon_close_new: '', icon_close_new: '',
result: { result: {
has_origin: true, hasOrigin: true,
lower_right: { lowerLeft: {
body: [] body: []
} }
}, },
currenItem: { currenItem: {
'watemark_text': '', 'watemarkText': '',
'watemark_value': '' 'watemarkValue': ''
}, },
editingItem: {}, editingItem: {},
showTipLeft: false, showTipLeft: false,
showTipRight: false, showTipRight: false,
loading: true loading: true
} }
}, },
computed: { computed: {
itemList() { itemList() {
if (this.result['lower_right']) { console.log(this.result)
var arr = this.result['lower_right']['body'] if (this.result['lowerLeft']) {
return arr.filter((item) => { var arr = this.result['lowerLeft']['body']
return item.watemark_type === '备注' return arr.filter((item) => {
}) return item.watemarkType === '备注'
} else { })
return [] } else {
} return []
}
},
showTitleSwitch() { },
return this.result['lower_right'].hasOwnProperty('title_text') showTitleSwitch() {
}, return this.result['lowerLeft'].hasOwnProperty('title')
customStyleCancel() { },
return { customStyleCancel() {
'background-color': '#D1D4D4', return {
'width': '280rpx', 'background-color': '#D1D4D4',
'height': '96rpx' 'width': '280rpx',
} 'height': '96rpx'
}, }
customStyleSave() { },
return { customStyleSave() {
'background-color': '##2272FF', return {
'width': '280rpx', 'background-color': '##2272FF',
'height': '96rpx', 'width': '280rpx',
'margin-left': '50rpx' 'height': '96rpx',
} 'margin-left': '50rpx'
} }
}, }
created(e) { },
getApp().trackPage('水印设置页') created(e) {
const globalData = getApp().globalData getApp().trackPage('水印设置页')
this.icon_close_new = globalData.icon_close_new const globalData = getApp().globalData
this.systemId = globalData.photo.currentItem.systemId this.icon_close_new = globalData.icon_close_new
this.getItemList() this.systemId = globalData.photo.currentItem.partnerCompanyId
}, this.getItemList()
methods: { },
methods: {
getItemList: function() { getItemList: function() {
// this.systemId = '79550af260555cc20afb34156c94b32c' // 测试数据
this.loading = true this.loading = true
this.$u.api.getUserWatermark({ this.$u.api.getWatermark({partnerCompanyId:this.systemId}).then(res => {
'token': this.vuex_token, if (res.code == 200) {
'system_id': this.systemId this.result = res.data
}).then(res => { } else {
if (res && res.result) { uni.showToast({title: res.data.message})
if(res.result.error_code){ }
uni.showToast({title: res.result.error_msg}) this.loading = false
}else{ })
this.result = res.result },
} saveUserWatermark: function() {
}else{ this.loading = true
uni.showToast({title: '网络异常'}) this.$u.api.saveWatermark(this.result).then(res=>{
} if(res.code === 200){
this.loading = false uni.showToast({title:'保存成功'})
}) getApp().globalData.photo.waterSetting = this.result
}, this.$emit("changeWatermark", this.result);
saveUserWatermark: function() { }else{
this.loading = true uni.showToast({title: res.message})
this.$u.api.saveUserWatermark({ }
'token': this.vuex_token, this.loading = false
'watermark': this.result })
}).then(res => { },
if (res.result.code == true) {
const photo = getApp().globalData.photo //保存原图 开关
photo.waterSetting = this.result handleOrigineChange: function(e) {
}else{ this.result['hasOrigin'] = !this.result['hasOrigin']
uni.showToast({title: res.result.msg}) this.saveUserWatermark()
} },
this.loading = false handleClickTitleSwitch: function(e) {
}) var string = this.result['lowerLeft']['title'] ? '水印标题不可关闭' : '请先编辑该自定义项'
}, uni.showToast({
icon: 'none',
//保存原图 开关 title: string
handleOrigineChange: function(e) { })
this.result['has_origin'] = !this.result['has_origin'] },
this.saveUserWatermark()
}, //自定义 开关
itemChange: function(item, ikey) {
handleClickTitleSwitch: function(e) { if (item['watemarkValue']) {
var string = this.result['lower_right']['title_text'] ? '水印标题不可关闭' : '请先编辑该自定义项' // 修改
uni.showToast({ item['enable'] = !item['enable']
icon: 'none', this.saveUserWatermark()
title: string } else {
}) uni.showToast({
}, icon: 'none',
title: '请先编辑该自定义项'
//自定义 开关 })
itemChange: function(item, ikey) { }
if (item['watemark_value']) { },
// 修改
item['enable'] = !item['enable'] //自定义 点击
this.saveUserWatermark() itemClick: function(item, ikey) {
} else { if (ikey === -1) {
uni.showToast({ this.currenItem = {
icon: 'none', 'watemarkText': '水印标题',
title: '请先编辑该自定义项' 'watemarkValue': this.result['lowerLeft']['title'],
}) 'type': '备注'
} }
}, } else {
this.editingItem = item
//自定义 点击 this.currenItem = {
itemClick: function(item, ikey) { ...item
if (ikey === -1) { }
this.currenItem = { }
'watemark_text': '水印标题',
'watemark_value': this.result['lower_right']['title_text'], this.isPopShow = true
'type': 'title_text' },
}
} else { //左侧输入框
this.editingItem = item leftInput: function(e) {
this.currenItem = { if (this.currenItem['watemarkText']) {
...item this.showTipLeft = false
} }
}
},
this.isPopShow = true
}, //右侧输入框
rightInput: function(e) {
//左侧输入框 if (this.currenItem['watemarkValue']) {
leftInput: function(e) { this.showTipRight = false
if (this.currenItem['watemark_text']) { }
this.showTipLeft = false },
}
//自定义弹窗 关闭
}, popCancelClick: function() {
this.isPopShow = false
//右侧输入框 this.currenItem = {
rightInput: function(e) { 'watemarkText': '',
if (this.currenItem['watemark_value']) { 'watemarkValue': ''
this.showTipRight = false }
} },
},
handlePopClose() {
//自定义弹窗 关闭 this.showTipLeft = false,
popCancelClick: function() { this.showTipRight = false
this.isPopShow = false },
this.currenItem = {
'watemark_text': '',
'watemark_value': ''
}
},
handlePopClose() {
this.showTipLeft = false,
this.showTipRight = false
},
backTake() { backTake() {
this.$emit('changeType', 1) this.$emit('changeType', 1)
}, },
//自定义弹窗 保存 //自定义弹窗 保存
popSaveClick: function() { popSaveClick: function() {
if (this.currenItem['watemark_text'] && this.currenItem['watemark_value']) { if (this.currenItem['watemarkText'] && this.currenItem['watemarkValue']) {
this.isPopShow = false this.isPopShow = false
if (this.currenItem.type === 'title_text') { if (this.currenItem.type === '备注') {
this.result['lower_right']['title_text'] = this.currenItem['watemark_value'] this.result['lowerLeft']['title'] = this.currenItem['watemarkValue']
} else { } else {
this.editingItem['watemark_text'] = this.currenItem['watemark_text'] this.editingItem['watemarkText'] = this.currenItem['watemarkText']
this.editingItem['watemark_value'] = this.currenItem['watemark_value'] this.editingItem['watemarkValue'] = this.currenItem['watemarkValue']
this.editingItem['enable'] = true this.editingItem['enable'] = true
} }
this.saveUserWatermark() this.saveUserWatermark()
} else { } else {
// 提示 // 提示
if (!this.currenItem['watemark_text']) { if (!this.currenItem['watemarkText']) {
this.showTipLeft = true this.showTipLeft = true
} }
if (!this.currenItem['watemark_value']) { if (!this.currenItem['watemarkValue']) {
this.showTipRight = true this.showTipRight = true
} }
} }
} }
} }
} }
</script> </script>
<style> <style>
.backView { .backView {
background-color: #FAFAFA; background-color: #FAFAFA;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
/* /*
.firstItemView{ .firstItemView{
background-color: #FFFFFF; background-color: #FFFFFF;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding-top: 80rpx; padding-top: 80rpx;
padding-bottom: 80rpx; padding-bottom: 80rpx;
border-bottom: 2rpx solid #F4F5F7; border-bottom: 2rpx solid #F4F5F7;
} */ } */
.itemView { .itemView {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding-top: 54rpx; padding-top: 54rpx;
padding-bottom: 54rpx; padding-bottom: 54rpx;
} }
.itemView.firstItem { .itemView.firstItem {
border-bottom: 2rpx solid #F4F5F7; border-bottom: 2rpx solid #F4F5F7;
} }
.itemTitleView { .itemTitleView {
background-color: #FFFFFF; background-color: #FFFFFF;
width: 80%; width: 80%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-left: 30rpx; padding-left: 30rpx;
} }
.itemTitle { .itemTitle {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
} }
.itemNotice { .itemNotice {
font-size: 26rpx; font-size: 26rpx;
color: #666666; color: #666666;
margin-top: 4rpx; margin-top: 4rpx;
} }
.itemSwitch { .itemSwitch {
margin-right: 30rpx; margin-right: 30rpx;
transform: scale(0.78, 0.75); transform: scale(0.78, 0.75);
} }
.shadowBackView { .shadowBackView {
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
.popCenterView { .popCenterView {
background-color: #FFFFFF; background-color: #FFFFFF;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.popTitle { .popTitle {
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
margin-top: 50rpx; margin-top: 50rpx;
padding-left: 30rpx; padding-left: 30rpx;
} }
.inputBackView { .inputBackView {
margin-top: 52rpx; margin-top: 52rpx;
width: 100%; width: 100%;
height: 90rpx; height: 90rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
} }
.leftInputView { .leftInputView {
width: 220rpx; width: 220rpx;
height: 72rpx; height: 72rpx;
border: 2rpx solid #666666; border: 2rpx solid #666666;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.leftInput { .leftInput {
width: 180rpx; width: 180rpx;
height: 32rpx; height: 32rpx;
} }
.ph-pop-left-view { .ph-pop-left-view {
margin-left: 30rpx; margin-left: 30rpx;
} }
.ph-pop-tip-view { .ph-pop-tip-view {
color: #F56C6C; color: #F56C6C;
} }
.ph-pop-mid-view { .ph-pop-mid-view {
margin-top: 20rpx; margin-top: 20rpx;
} }
.rightInputView { .rightInputView {
width: 360rpx; width: 360rpx;
height: 72rpx; height: 72rpx;
border: 2rpx solid #666666; border: 2rpx solid #666666;
margin-right: 30rpx; margin-right: 30rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.rightInput { .rightInput {
width: 320rpx; width: 320rpx;
height: 32rpx; height: 32rpx;
} }
.popNoticeText { .popNoticeText {
font-size: 26rpx; font-size: 26rpx;
color: #666666; color: #666666;
padding-left: 30rpx; padding-left: 30rpx;
} }
.popBtnView { .popBtnView {
margin-top: 110rpx; margin-top: 110rpx;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
/* .popCancelBtn { /* .popCancelBtn {
background-color: #D1D4D4; background-color: #D1D4D4;
width: 280rpx; width: 280rpx;
height: 96rpx; height: 96rpx;
border-radius: 48rpx; border-radius: 48rpx;
margin-left: 40rpx; margin-left: 40rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} */ } */
/* .popSaveBtn { /* .popSaveBtn {
background-color: #2272FF; background-color: #2272FF;
width: 280rpx; width: 280rpx;
height: 96rpx; height: 96rpx;
border-radius: 48rpx; border-radius: 48rpx;
margin-right: 40rpx; margin-right: 40rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} */ } */
/* .popBtnText { /* .popBtnText {
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #FFFFFF;
font-weight: 600; font-weight: 600;
} */ } */
</style> </style>
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
<view class="wrap"> <view class="wrap">
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" <swiper class="swiper-box" :current="swiperCurrent" @transition="transition"
@animationfinish="animationfinish"> @animationfinish="animationfinish">
<swiper-item class="swiper-item" v-if="currentItem.main_point && currentItem.main_point.length > 0"> <swiper-item class="swiper-item" v-if="currentItem.mainPoint && currentItem.mainPoint.length > 0">
<view class="inner txt-inner" :style="{'background-image':'url(/static/photo/shadow-bg.png)'}"> <view class="inner txt-inner" :style="{'background-image':'url(/static/photo/shadow-bg.png)'}">
<view class="title"> <view class="title">
拍照要求 拍照要求
</view> </view>
<view class="txt-box" > <view class="txt-box" >
<view class="txt" v-for="(txt,index) in currentItem.main_point" :key="index"> <view class="txt" v-for="(txt,index) in currentItem.mainPoint" :key="index">
{{index+1}}. {{txt}} {{index+1}}. {{txt}}
</view> </view>
<view class="txt tips" v-if="currentItem.note"> <view class="txt tips" v-if="currentItem.note">
......
<template> <template>
<view class="camera"> <view class="camera">
<view class="camera-container" v-if="showType === 1"> <view class="camera-container" v-if="showType === 1">
<cover-view class="header-box" :style="{'height':navHeight/2 + 'px'}"> <cover-view class="header-box" :style="{'height':navHeight/2 + 'px'}">
<cover-view class="inner"> <cover-view class="inner">
<cover-image @click="setCameraInfo('devicePosition')" class="icon" mode="aspectFit" <cover-image @click="setCameraInfo('devicePosition')" class="icon" mode="aspectFit"
src="/static/photo/icon-switch.png"></cover-image> src="/static/photo/icon-switch.png"></cover-image>
<cover-image @click="setCameraInfo('flash')" class="icon" mode="aspectFit" <cover-image @click="setCameraInfo('flash')" class="icon" mode="aspectFit"
:src="'/static/photo/icon-light-' + cameraInfo.flash +'.png'"></cover-image> :src="'/static/photo/icon-light-' + cameraInfo.flash +'.png'"></cover-image>
<cover-image v-if="currentItem.system_id" @click="changeType(3)" class="icon" mode="aspectFit" <cover-image v-if="currentItem.partnerCompanyId" @click="changeType(3)" class="icon" mode="aspectFit"
src="/static/photo/icon-setting.png"></cover-image> src="/static/photo/icon-setting.png"></cover-image>
</cover-view> </cover-view>
</cover-view> </cover-view>
<camera class="camera-box" v-if="cameraChange&&!standardShow" :device-position="cameraInfo.devicePosition" <camera class="camera-box" v-if="cameraChange&&!standardShow" :device-position="cameraInfo.devicePosition"
:flash="cameraInfo.flash" :style="{'height':cameraHeight/2 + 'px','top':parseInt(navHeight/2) + 'px'}" :flash="cameraInfo.flash" :style="{'height':cameraHeight/2 + 'px','top':parseInt(navHeight/2) + 'px'}"
@error="cameraError"> @error="cameraError">
<cover-view class="mark-box"> <cover-view class="mark-box">
<cover-view class="txt big" v-if="titleTxt">{{titleTxt}}</cover-view> <cover-view class="txt big" v-if="titleTxt">{{titleTxt}}</cover-view>
<cover-view class="txt" v-for="(txt,index) in settingTxtArr" :key="index">{{txt || '获取中'}}</cover-view> <cover-view class="txt" v-for="(txt,index) in settingTxtArr" :key="index">{{txt || '获取中'}}</cover-view>
<!-- <cover-view class="txt u-m-t-10">维度:{{waterInfo.latitude || '正在获取中...'}}</cover-view> <!-- <cover-view class="txt u-m-t-10">维度:{{waterInfo.latitude || '正在获取中...'}}</cover-view>
<cover-view class="txt u-m-t-10">地址:{{waterInfo.address || '正在获取中...'}}</cover-view> <cover-view class="txt u-m-t-10">地址:{{waterInfo.address || '正在获取中...'}}</cover-view>
<cover-view class="txt u-m-t-10">时间:{{waterInfo.date || '正在获取中...'}}</cover-view> --> <cover-view class="txt u-m-t-10">时间:{{waterInfo.date || '正在获取中...'}}</cover-view> -->
</cover-view> </cover-view>
<cover-image class="mark-water" mode="aspectFit" :src="waterInfo.markImage"></cover-image> <cover-image class="mark-water" mode="aspectFit" :src="waterInfo.markImage"></cover-image>
</camera> </camera>
<cover-view class="bottom-box" v-if="!standardShow"> <cover-view class="bottom-box" v-if="!standardShow">
<cover-image class="icon" src='/static/photo/icon-back.png' mode="" @click="goBack"></cover-image> <cover-image class="icon" src='/static/photo/icon-back.png' mode="" @click="goBack"></cover-image>
<cover-image class='icon-take icon' src='/static/photo/icon-take.png' @click="$u.debounce(takePhoto, 500)"> </cover-image> <cover-image class='icon-take icon' src='/static/photo/icon-take.png' @click="$u.debounce(takePhoto, 500)"> </cover-image>
<cover-image class='icon' src='/static/photo/icon-standard.png' @click="standardShow = true" v-if="standardStatus"> </cover-image> <cover-image class='icon' src='/static/photo/icon-standard.png' @click="standardShow = true" v-if="standardStatus"> </cover-image>
<view class='icon' v-else></view> <view class='icon' v-else></view>
</cover-view> </cover-view>
<canvas canvas-id="canvas" id="photoCanvas" class="canvas" <canvas canvas-id="canvas" id="photoCanvas" class="canvas"
:style="{'width':750 + 'rpx','height': cameraHeight + 'rpx'}"></canvas> :style="{'width':750 + 'rpx','height': cameraHeight + 'rpx'}"></canvas>
<view v-show="standardShow" class="page-mask" :z-index="10000"> <view v-show="standardShow" class="page-mask" :z-index="10000">
<photo-standard :currentItem="currentItem" /> <photo-standard :currentItem="currentItem" />
<view class="btn-close"> <view class="btn-close">
<image @click="closeShadow" class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png"></image> <image @click="closeShadow" class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png"></image>
</view> </view>
</view> </view>
</view> </view>
<photo-preview v-if="showType === 2" @changeType="changeType" @finish="finish" /> <photo-preview v-if="showType === 2" @changeType="changeType" @finish="finish" />
<photo-setting v-if="showType === 3" @changeType="changeType" /> <photo-setting v-if="showType === 3" @changeType="changeType" @changeWatermark="changeWatermark"/>
</view> </view>
</template> </template>
<script> <script>
let r = require("@/libs/bmap-wx.min.js"); let r = require("@/libs/bmap-wx.min.js");
let h = new r.BMapWX({ let h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG", // ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak: "iXsGdyEcm1iQONoUPyEp0hrBTLCuOaW2" ak: "iXsGdyEcm1iQONoUPyEp0hrBTLCuOaW2"
}); });
import standard from '@/components/photo/standard.vue' import standard from '@/components/photo/standard.vue'
import preview from '@/components/photo/preview.vue' import preview from '@/components/photo/preview.vue'
import setting from '@/components/photo/setting.vue' import setting from '@/components/photo/setting.vue'
export default { export default {
props: { props: {
currentItem: { // 对应的规范item currentItem: { // 对应的规范item
...@@ -66,417 +66,420 @@ ...@@ -66,417 +66,420 @@
} }
} }
} }
}, },
components: { components: {
'photo-standard': standard, 'photo-standard': standard,
'photo-preview': preview, 'photo-preview': preview,
'photo-setting': setting, 'photo-setting': setting,
}, },
data() { data() {
return { return {
showType: 1, showType: 1,
standardShow: false, standardShow: false,
cameraInfo: { cameraInfo: {
devicePosition: 'back', devicePosition: 'back',
flash: 'auto' flash: 'auto'
}, },
waterInfo: { waterInfo: {
longitude: '', // 经度 longitude: '', // 经度
latitude: '', // 维度 latitude: '', // 维度
address: '', //地址 address: '', //地址
date: '', //日期 date: '', //日期
markImage: 'https://qn-static.banshouhui.com/live_mark.png' markImage: 'https://qn-static.banshouhui.com/live_mark.png'
}, },
tempImgs: { tempImgs: {
'markImage': '', // 拍照水印 'markImage': '', // 拍照水印
'origin': '', // 无水印照片 'origin': '', // 无水印照片
'mixWater': '', // 有水印照片 'mixWater': '', // 有水印照片
}, },
authSetting: { authSetting: {
camera: false, // 相机授权 camera: false, // 相机授权
location: false, // 位置授权 location: false, // 位置授权
}, },
navHeight: 130, navHeight: 130,
cameraWidth: 750, cameraWidth: 750,
cameraHeight: 1000, // (4 / 3 * 750) 图片比例4:3 cameraHeight: 1000, // (4 / 3 * 750) 图片比例4:3
ratio: 0, ratio: 0,
cameraChange: false, cameraChange: false,
waterSetting: null, waterSetting: null,
shadowInitShow: false, // 第一次进入页面需显示弹窗 shadowInitShow: false, // 第一次进入页面需显示弹窗
standardStatus: false // 是否显示拍照要求 standardStatus: false // 是否显示拍照要求
} }
}, },
created(e) { created(e) {
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
getApp().trackPage('拍照页') getApp().trackPage('拍照页')
photo.allImages = [] photo.allImages = []
photo.currentItemLength = 0 photo.currentItemLength = 0
// this.ctx = uni.createCameraContext(); // this.ctx = uni.createCameraContext();
this.updateTime() this.updateTime()
this.getLocation() this.getLocation()
this.getMarkPath() this.getMarkPath()
this.initData() this.initData()
photo.currentItem = this.currentItem photo.currentItem = this.currentItem
if (this.currentItem.images.length > 0) { if (this.currentItem.images.length > 0) {
this.shadowInitShow = true this.shadowInitShow = true
this.standardShow = true this.standardShow = true
this.standardStatus = true this.standardStatus = true
} }
}, },
computed: { computed: {
titleTxt() { titleTxt() {
const waterSetting = this.waterSetting const waterSetting = this.waterSetting
let txt = '' let txt = ''
if (!waterSetting || !waterSetting.lower_right) { if (!waterSetting || !waterSetting.lowerLeft) {
return '' return ''
} }
txt = waterSetting.lower_right && waterSetting.lower_right.title_text || '' txt = waterSetting.lowerLeft && waterSetting.lowerLeft.title || ''
return txt return txt
}, },
settingTxtArr() { settingTxtArr() {
let arr = [] let arr = []
// 包含经纬度 // 包含经纬度
const waterInfo = this.waterInfo const waterInfo = this.waterInfo
arr = ['经度:' + waterInfo.longitude, '纬度:' + waterInfo.latitude, '地址:' + waterInfo.address, '时间:' + arr = ['经度:' + waterInfo.longitude, '纬度:' + waterInfo.latitude, '地址:' + waterInfo.address, '时间:' +
waterInfo.date waterInfo.date
] ]
let settingTxtArr = [] let settingTxtArr = []
const typeArr = ['经度', '纬度', '地址', '时间'] const typeArr = ['经度', '纬度', '地址', '时间']
const waterSetting = this.waterSetting const waterSetting = this.waterSetting
if (!waterSetting || !waterSetting.lower_right || !waterSetting.lower_right.body) { if (!waterSetting || !waterSetting.lowerLeft || !waterSetting.lowerLeft.body) {
return arr return arr
} }
const settingArr = waterSetting.lower_right.body const settingArr = waterSetting.lowerLeft.body
settingArr.map(item => { settingArr.map(item => {
const idx = typeArr.indexOf(item.watemark_type) const idx = typeArr.indexOf(item.watemarkType)
if (item.enable && (idx > -1 || (item.watemark_value && item.watemark_text))) { if (item.enable && (idx > -1 || (item.watemarkValue && item.watemarkText))) {
if (idx > -1) { if (idx > -1) {
settingTxtArr.push(arr[idx]) settingTxtArr.push(arr[idx])
} else { } else {
settingTxtArr.push(item.watemark_text + ':' + item.watemark_value) settingTxtArr.push(item.watemarkText + ':' + item.watemarkValue)
} }
} }
}) })
return settingTxtArr return settingTxtArr
} }
}, },
watch: {}, watch: {},
mounted() { mounted() {
// 默认开启弹窗 // 默认开启弹窗
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
this.waterSetting = photo.waterSetting this.waterSetting = photo.waterSetting
this.standardShow = this.shadowInitShow this.standardShow = this.shadowInitShow
this.cameraChange = true this.cameraChange = true
// this.initData() // this.initData()
}, },
destroyed(){ destroyed(){
this.cameraChange = false this.cameraChange = false
}, },
methods: { methods: {
closeShadow() { closeShadow() {
this.shadowInitShow = false this.shadowInitShow = false
this.standardShow = false this.standardShow = false
}, },
goBack() { goBack() {
uni.showTabBar() uni.showTabBar()
this.$emit('close') this.$emit('close')
}, },
finish() { finish() {
uni.showTabBar() uni.showTabBar()
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
this.$emit('close', photo.allImages) this.$emit('close', photo.allImages)
}, },
changeType(type) { changeType(type) {
this.showType = type this.showType = type
}, },
updateTime() { changeWatermark(watermark){
this.waterInfo.date = this.getTime() this.waterSetting = watermark
// let timer = setTimeout(() => { },
// clearTimeout(timer); updateTime() {
// this.updateTime() this.waterInfo.date = this.getTime()
// }, 1000) // let timer = setTimeout(() => {
}, // clearTimeout(timer);
setCameraInfo(type) { // this.updateTime()
// 设置相机前置后置、闪关灯等 // }, 1000)
const cameraInfo = this.cameraInfo },
let val = cameraInfo[type] setCameraInfo(type) {
switch (type) { // 设置相机前置后置、闪关灯等
case 'devicePosition': const cameraInfo = this.cameraInfo
val = val === 'back' ? 'front' : 'back' let val = cameraInfo[type]
break; switch (type) {
case 'flash': case 'devicePosition':
val = val === 'auto' ? 'on' : (val === 'on' ? 'off' : 'auto') val = val === 'back' ? 'front' : 'back'
break; break;
defalut: case 'flash':
val = val === 'auto' ? 'on' : (val === 'on' ? 'off' : 'auto')
break; break;
} defalut:
this.cameraInfo[type] = val
}, break;
initData() { }
const globalData = getApp().globalData this.cameraInfo[type] = val
this.navHeight = globalData.navHeight },
this.cameraHeight = parseInt(globalData.safeHeight*2 - globalData.navHeight - 200) initData() {
this.ratio = globalData.screenHeight / globalData.rpxScreenHeight const globalData = getApp().globalData
this.waterSetting = globalData.photo.waterSetting this.navHeight = globalData.navHeight
}, this.cameraHeight = parseInt(globalData.safeHeight*2 - globalData.navHeight - 200)
baiduLocation() { this.ratio = globalData.screenHeight / globalData.rpxScreenHeight
// 百度sdk解析经纬度 this.waterSetting = globalData.photo.waterSetting
},
baiduLocation() {
// 百度sdk解析经纬度
let waterInfo = this.waterInfo let waterInfo = this.waterInfo
const t = function() { const t = function() {
let t = { let t = {
success: function(res) { success: function(res) {
let e = res.wxMarkerData[0]; let e = res.wxMarkerData[0];
let i = e.address; let i = e.address;
waterInfo.address = i waterInfo.address = i
}, },
fail: function(err) { fail: function(err) {
//console.log(err, 'err') //console.log(err, 'err')
} }
}; };
if (waterInfo.latitude && waterInfo.longitude) { if (waterInfo.latitude && waterInfo.longitude) {
let e = waterInfo.latitude + "," + waterInfo.longitude; let e = waterInfo.latitude + "," + waterInfo.longitude;
t.location = e; t.location = e;
} }
h.regeocoding(t); h.regeocoding(t);
}; };
t() t()
}, },
cameraError(e) { cameraError(e) {
const { const {
errMsg errMsg
} = e.detail } = e.detail
// console.log(e.detail, 'e.detail') // console.log(e.detail, 'e.detail')
if (errMsg !== 'insertCamera:fail auth deny') { if (errMsg !== 'insertCamera:fail auth deny') {
return return
} }
this.showSettingModal('camera') this.showSettingModal('camera')
}, },
//获取位置 //获取位置
getLocation() { getLocation() {
let that = this let that = this
const waterInfo = this.waterInfo
uni.getLocation({
type: 'gcj02',
success: function(res) {
waterInfo.longitude = parseFloat(res.longitude).toFixed(4)
waterInfo.latitude = parseFloat(res.latitude).toFixed(3)
that.baiduLocation()
},
fail(err) {
that.showSettingModal('location')
// that.showLocationAuthModal('')
}
});
},
showSettingModal(type) {
type = type || 'camera'
const self = this
let authSetting = {
'camera': {
content: '将无法进行拍照',
method: ''
},
'location': {
content: '将无法定位当前位置',
method: ''
},
'writePhotosAlbum': {
content: '将无法保存图片到本地',
method: ''
}
}
let content = authSetting[type].content
uni.showModal({
content: '拒绝授权' + content + ',是否去设置打开?',
confirmText: "确认",
cancelText: '取消',
success(res) {
if (res.confirm) {
self.openSetting()
}
},
fail() {}
})
},
openSetting() {
// 打开设置
let self = this
this.cameraChange = false
wx.openSetting({
success(res) {
const authSetting = res.authSetting
self.cameraChange = true
if (authSetting['scope.userLocation']) {
// 位置授权成功
self.authSetting.location = true
self.getLocation()
}
if (res.authSetting['scope.camera']) {
self.authSetting.camera = true
}
if (res.authSetting['scope.writePhotosAlbum']) {
self.authSetting.writePhotosAlbum = true
}
}
})
},
//获取 水印 本地缓存路径
getMarkPath: function() {
uni.downloadFile({
url: this.waterInfo.markImage, //仅为示例,并非真实的资源
success: (res) => {
if (res.statusCode === 200) {
this.tempImgs.markImage = res.tempFilePath
}
},
fail() {
console.log('水印图片 下载失败')
}
})
},
/* ---------------------- 拍照流程 ---------------------- */
// 第一步:拍照
takePhoto() {
wx.createCameraContext().takePhoto({
quality: "high"
}).then(res => {
this.tempImgs.origin = res.tempImagePath
this.drawCanvas(res.tempImagePath)
})
},
// 第二步:绘制画布
drawCanvas: function(tempPath) {
uni.showLoading({
title: '数据处理中...',
icon: 'loading'
})
const waterSetting = this.waterSetting
const globalTempPath = getApp().globalData.photo.tempPath
const ratio = this.ratio
console.log(this.ratio,'this.ratio')
// const ratio = 0.5
let canvasWidth = this.cameraWidth * ratio
let canvasHeight = this.cameraHeight * ratio
const waterInfo = this.waterInfo const waterInfo = this.waterInfo
uni.getLocation({ this.showImage = true
type: 'gcj02', const settingTxtArr = this.settingTxtArr
success: function(res) { //将原图画到canvas上面
waterInfo.longitude = parseFloat(res.longitude).toFixed(4) let canvas = uni.createCanvasContext("canvas", this)
waterInfo.latitude = parseFloat(res.latitude).toFixed(3) canvas.rect(0, 0, canvasWidth, canvasHeight)
that.baiduLocation() canvas.drawImage(tempPath, 0, 0, canvasWidth, canvasHeight)
}, // this.canvas.draw()
fail(err) { let txtHeight = 18
that.showSettingModal('location') let h = 1
// that.showLocationAuthModal('') //加入 水印文字
}
}); for (let i = settingTxtArr.length - 1; i >= 0; i--) {
}, txtHeight = 20
showSettingModal(type) { canvas.setFontSize(15)
type = type || 'camera' canvas.setFillStyle('#f2f2f2')
const self = this let txt = settingTxtArr[i]
let authSetting = { if(txt.indexOf('时间')>=0){
'camera': { canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
content: '将无法进行拍照', }else{
method: '' if(txt.length>22){
}, canvas.fillText(txt.substr(22,22), 10, canvasHeight - txtHeight * h++);
'location': { canvas.fillText(txt.substr(0,22), 10, canvasHeight - txtHeight * h++);
content: '将无法定位当前位置', }else{
method: '' canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
}, }
'writePhotosAlbum': { }
content: '将无法保存图片到本地', // canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
method: '' }
} const title = this.titleTxt
} if (title) {
let content = authSetting[type].content canvas.save()
uni.showModal({ let titleHeight = title.length > 14 ? 60 : 30
content: '拒绝授权' + content + ',是否去设置打开?', let rectWidth = title.length > 14 ? 215 : title.length*10
confirmText: "确认", canvas.setFillStyle('rgba(34, 114, 255, 0.6)')
cancelText: '取消', canvas.fillRect(10, canvasHeight - txtHeight * h - titleHeight, 215, titleHeight)
success(res) { canvas.restore()
if (res.confirm) { canvas.setFontSize(20)
self.openSetting() canvas.setFillStyle('#f2f2f2')
} // canvas.setTextAlign('center')
}, if (title.length > 14) {
fail() {} canvas.fillText(title.substr(14, 14), 10, canvasHeight - txtHeight * h++ + 20);
}) }
}, canvas.fillText(title.substr(0, 14), 10, canvasHeight - txtHeight * h++ - titleHeight / 2 + 10);
openSetting() { }
// 打开设置 if (this.waterSetting && this.waterSetting.mid_text) {
let self = this //加入 水印图片
this.cameraChange = false canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
wx.openSetting({ }
success(res) { // canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
const authSetting = res.authSetting canvas.draw(false,
self.cameraChange = true setTimeout(() => {
if (authSetting['scope.userLocation']) { uni.canvasToTempFilePath({
// 位置授权成功 width: canvasWidth,
self.authSetting.location = true height: canvasHeight,
self.getLocation() canvasId: 'canvas',
} success: (res) => {
if (res.authSetting['scope.camera']) { this.tempImgs.mixWater = res.tempFilePath
self.authSetting.camera = true globalTempPath.origin = this.tempImgs.origin
} globalTempPath.mixWater = res.tempFilePath
if (res.authSetting['scope.writePhotosAlbum']) { let timer = setTimeout(()=>{
self.authSetting.writePhotosAlbum = true
}
}
})
},
//获取 水印 本地缓存路径
getMarkPath: function() {
uni.downloadFile({
url: this.waterInfo.markImage, //仅为示例,并非真实的资源
success: (res) => {
if (res.statusCode === 200) {
this.tempImgs.markImage = res.tempFilePath
}
},
fail() {
console.log('水印图片 下载失败')
}
})
},
/* ---------------------- 拍照流程 ---------------------- */
// 第一步:拍照
takePhoto() {
wx.createCameraContext().takePhoto({
quality: "high"
}).then(res => {
this.tempImgs.origin = res.tempImagePath
this.drawCanvas(res.tempImagePath)
})
},
// 第二步:绘制画布
drawCanvas: function(tempPath) {
uni.showLoading({
title: '数据处理中...',
icon: 'loading'
})
const waterSetting = this.waterSetting
const globalTempPath = getApp().globalData.photo.tempPath
const ratio = this.ratio
console.log(this.ratio,'this.ratio')
// const ratio = 0.5
let canvasWidth = this.cameraWidth * ratio
let canvasHeight = this.cameraHeight * ratio
const waterInfo = this.waterInfo
this.showImage = true
const settingTxtArr = this.settingTxtArr
//将原图画到canvas上面
let canvas = uni.createCanvasContext("canvas", this)
canvas.rect(0, 0, canvasWidth, canvasHeight)
canvas.drawImage(tempPath, 0, 0, canvasWidth, canvasHeight)
// this.canvas.draw()
let txtHeight = 18
let h = 1
//加入 水印文字
for (let i = settingTxtArr.length - 1; i >= 0; i--) {
txtHeight = 20
canvas.setFontSize(15)
canvas.setFillStyle('#f2f2f2')
let txt = settingTxtArr[i]
if(txt.indexOf('时间')>=0){
canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
}else{
if(txt.length>22){
canvas.fillText(txt.substr(22,22), 10, canvasHeight - txtHeight * h++);
canvas.fillText(txt.substr(0,22), 10, canvasHeight - txtHeight * h++);
}else{
canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
}
}
// canvas.fillText(txt, 10, canvasHeight - txtHeight * h++);
}
const title = this.titleTxt
if (title) {
canvas.save()
let titleHeight = title.length > 14 ? 60 : 30
let rectWidth = title.length > 14 ? 215 : title.length*10
canvas.setFillStyle('rgba(34, 114, 255, 0.6)')
canvas.fillRect(10, canvasHeight - txtHeight * h - titleHeight, 215, titleHeight)
canvas.restore()
canvas.setFontSize(20)
canvas.setFillStyle('#f2f2f2')
// canvas.setTextAlign('center')
if (title.length > 14) {
canvas.fillText(title.substr(14, 14), 10, canvasHeight - txtHeight * h++ + 20);
}
canvas.fillText(title.substr(0, 14), 10, canvasHeight - txtHeight * h++ - titleHeight / 2 + 10);
}
if (this.waterSetting && this.waterSetting.mid_text) {
//加入 水印图片
canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
}
// canvas.drawImage(this.tempImgs.markImage, canvasWidth / 2 - 100, canvasHeight / 2 - 25, 200, 50)
canvas.draw(false,
setTimeout(() => {
uni.canvasToTempFilePath({
width: canvasWidth,
height: canvasHeight,
canvasId: 'canvas',
success: (res) => {
this.tempImgs.mixWater = res.tempFilePath
globalTempPath.origin = this.tempImgs.origin
globalTempPath.mixWater = res.tempFilePath
let timer = setTimeout(()=>{
//this.goPage('/pages/photo/preview') //this.goPage('/pages/photo/preview')
this.changeType(2) this.changeType(2)
},0) },0)
// this.saveToLocal(res.tempFilePath) // this.saveToLocal(res.tempFilePath)
}, },
fail: (res) => { fail: (res) => {
console.log(res); console.log(res);
}, },
complete: () => { complete: () => {
uni.hideLoading(); uni.hideLoading();
} }
}, this); }, this);
}, 50)) }, 50))
}, },
// 第三步:保存到本地 // 第三步:保存到本地
saveToLocal(tempImagePath) { saveToLocal(tempImagePath) {
//has_origin //是否保存原图 //has_origin //是否保存原图
let that = this let that = this
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: tempImagePath, filePath: tempImagePath,
success() { success() {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '已将照片保存到本地相册' title: '已将照片保存到本地相册'
}) })
}, },
fail() {} fail() {}
}) })
}, },
showPreviewFn(img) { showPreviewFn(img) {
uni.previewImage({ uni.previewImage({
current: 0, current: 0,
urls: [img] urls: [img]
}); });
}, },
//获取当前时间 //获取当前时间
getTime: function() { getTime: function() {
let d = new Date(); let d = new Date();
let year = d.getFullYear(); let year = d.getFullYear();
let month = d.getMonth() + 1; let month = d.getMonth() + 1;
let date = d.getDate(); let date = d.getDate();
let days = new Array("日", "一", "二", "三", "四", "五", "六"); let days = new Array("日", "一", "二", "三", "四", "五", "六");
let day = d.getDay(); let day = d.getDay();
let hour = (d.getHours() < 10) ? ("0" + d.getHours()) : d.getHours(); let hour = (d.getHours() < 10) ? ("0" + d.getHours()) : d.getHours();
let min = (d.getMinutes() < 10) ? ("0" + d.getMinutes()) : d.getMinutes(); let min = (d.getMinutes() < 10) ? ("0" + d.getMinutes()) : d.getMinutes();
let sec = (d.getSeconds() < 10) ? ("0" + d.getSeconds()) : d.getSeconds(); let sec = (d.getSeconds() < 10) ? ("0" + d.getSeconds()) : d.getSeconds();
let now = year + "年" + month + "月" + date + "日 " + hour + ":" + min + ":" + sec; let now = year + "年" + month + "月" + date + "日 " + hour + ":" + min + ":" + sec;
return now return now
}, },
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.camera { .camera {
position:fixed; position:fixed;
...@@ -487,148 +490,148 @@ ...@@ -487,148 +490,148 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 999999; z-index: 999999;
} }
.camera-container { .camera-container {
// padding-top:var(--status-bar-height); // padding-top:var(--status-bar-height);
min-height: 100vh; min-height: 100vh;
background-color: black; background-color: black;
} }
.header-box { .header-box {
// padding:10rpx 20rpx; // padding:10rpx 20rpx;
position: relative; position: relative;
.inner { .inner {
display: flex; display: flex;
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
} }
.icon { .icon {
margin: 20rpx; margin: 20rpx;
display: block; display: block;
width: 44rpx; width: 44rpx;
height: 44rpx; height: 44rpx;
} }
} }
.camera-box { .camera-box {
position: absolute; position: absolute;
left:0; left:0;
width: 100%; width: 100%;
// height: 100vh; // height: 100vh;
z-index: 1; z-index: 1;
} }
.mark-water { .mark-water {
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;
} }
.mark-box { .mark-box {
position: absolute; position: absolute;
left: 0; left: 0;
bottom: 0; bottom: 0;
padding: 20rpx; padding: 20rpx;
.txt { .txt {
max-width: 500rpx; max-width: 500rpx;
max-height: 80rpx; max-height: 80rpx;
overflow: hidden; overflow: hidden;
margin-top: 5rpx; margin-top: 5rpx;
line-height: 40rpx; line-height: 40rpx;
white-space: normal; white-space: normal;
font-size: 28rpx; font-size: 28rpx;
color: #fff; color: #fff;
&.big { &.big {
padding: 10rpx; padding: 10rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
width: 430rpx; width: 430rpx;
line-height: 40rpx; line-height: 40rpx;
font-size: 32rpx; font-size: 32rpx;
background-color: rgba(34, 114, 255, 0.6); background-color: rgba(34, 114, 255, 0.6);
} }
} }
} }
.bottom-box { .bottom-box {
position: absolute; position: absolute;
left: 0; left: 0;
right: 0; right: 0;
bottom:0; bottom:0;
// bottom: constant(safe-area-inset-bottom); // bottom: constant(safe-area-inset-bottom);
// bottom: env(safe-area-inset-bottom); // bottom: env(safe-area-inset-bottom);
z-index: 5; z-index: 5;
box-sizing: border-box; box-sizing: border-box;
height: 200rpx; height: 200rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20rpx 78rpx; padding: 20rpx 78rpx;
align-items: center; align-items: center;
background-color: black; background-color: black;
.txt { .txt {
white-space: nowrap; white-space: nowrap;
line-height: 60rpx; line-height: 60rpx;
color: #fff; color: #fff;
} }
.icon { .icon {
display: block; display: block;
width: 92rpx; width: 92rpx;
height: 92rpx; height: 92rpx;
&.icon-take { &.icon-take {
width: 144rpx; width: 144rpx;
height: 144rpx; height: 144rpx;
} }
} }
} }
.canvas { .canvas {
position: fixed; position: fixed;
left: -750rpx; left: -750rpx;
top: 0; top: 0;
} }
// 拍照规范 // 拍照规范
.page-mask { .page-mask {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
bottom: constant(safe-area-inset-bottom); bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom); bottom: env(safe-area-inset-bottom);
z-index: 1000; z-index: 1000;
width: 750rpx; width: 750rpx;
height: 100vh; height: 100vh;
// padding: 0 30rpx; // padding: 0 30rpx;
box-sizing: border-box; box-sizing: border-box;
background-color: rgba(0, 0, 0, 0.8); background-color: rgba(0, 0, 0, 0.8);
.icon { .icon {
width: 92rpx; width: 92rpx;
height: 92rpx; height: 92rpx;
} }
.btn-close { .btn-close {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
bottom: constant(safe-area-inset-bottom); bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom); bottom: env(safe-area-inset-bottom);
left: 0; left: 0;
right: 0; right: 0;
height: 200rpx; height: 200rpx;
z-index: 100; z-index: 100;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
} }
</style> </style>
<template>
<u-navbar
:height="40"
:background="background"
:back-icon-color="navbarColor"
:title="title"
:titleColor="navbarColor"
:is-back="isBack"
:is-fixed="isFixed"
:title-bold="true"
:border-bottom="false">
</u-navbar>
</template>
<script>
/**
* navbar 自定义导航栏
* @description 此组件一般用于在特殊情况下,需要自定义导航栏的时候用到,一般建议使用uniapp自带的导航栏。
* @tutorial https://www.uviewui.com/components/navbar.html
* @property {String Number} height 导航栏高度(不包括状态栏高度在内,内部自动加上),注意这里的单位是px(默认40)
* @property {String} navbar-Color 导航栏内容的颜色(默认#333333)
* @property {String} title 导航栏标题,如设置为空字符,将会隐藏标题占位区域
* @property {String Number} title-width 导航栏标题的最大宽度,内容超出会以省略号隐藏,单位rpx(默认250)
* @property {Boolean} is-back 是否显示导航栏左边返回图标和辅助文字(默认true)
* @property {Object} background 导航栏背景设置,见官网说明(默认{ background: '#ffffff' })
* @property {Boolean} is-fixed 导航栏是否固定在顶部(默认true)
* @example <w-navbar title="剑未配妥,出门已是江湖"></w-navbar>
*/
export default {
name:"w-navbar",
props: {
height: {
type: String,
default: "40"
},
background: {
type: Object,
default(){
return {
backgroundColor: 'none'
}
}
},
navbarColor: {
type: String,
default: "#333333"
},
title: {
type: String,
default: ""
},
titleBold: {
type: Boolean,
default: true
},
isBack: {
type: Boolean,
default: true
},
isFixed: {
type: Boolean,
default: true
},
},
data() {
return {
};
}
}
</script>
<style lang="scss">
</style>
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
"path": "pages/index/mine", "path": "pages/index/mine",
"style": { "style": {
"navigationBarTitleText": "我的", "navigationBarTitleText": "我的",
"navigationStyle": "custom" "navigationStyle": "custom" ,
"disableScroll": true
} }
}, },
{ {
...@@ -145,6 +146,24 @@ ...@@ -145,6 +146,24 @@
"enablePullDownRefresh":false, "enablePullDownRefresh":false,
"navigationStyle":"custom"//隐藏系统导航栏 "navigationStyle":"custom"//隐藏系统导航栏
} }
},
{
"path": "address/index",
"style": {
"navigationBarTitleText": "收获地址",
"enablePullDownRefresh": false,
"navigationStyle": "custom", // 隐藏系统导航栏
"disableScroll": true
}
},
{
"path": "address/addSite",
"style": {
"navigationBarTitleText": "修改地址",
"enablePullDownRefresh": false,
"navigationStyle": "custom", // 隐藏系统导航栏
"disableScroll": true
}
} }
] ]
}, },
...@@ -332,7 +351,7 @@ ...@@ -332,7 +351,7 @@
"preloadRule": { "preloadRule": {
"pages/index/index": { "pages/index/index": {
"network": "all", "network": "all",
"packages": ["pages/order", "pages/learn"] "packages": ["pages/order", "pages/learn", "pages/mine"]
} }
}, },
"globalStyle": { "globalStyle": {
......
...@@ -108,7 +108,6 @@ ...@@ -108,7 +108,6 @@
watch: { watch: {
vuex_token(val, oldVal) { vuex_token(val, oldVal) {
// 监听token变化,如果更新则重新加载页面数据 // 监听token变化,如果更新则重新加载页面数据
console.log('', val, oldVal)
val && this.initSettleInfo() val && this.initSettleInfo()
} }
}, },
......
<template> <template>
<view> <view class="mine-view">
<u-navbar v-if="!takeStatus" :is-back="false" :title-size="26" title-color="#000" title="我的"></u-navbar> <image class="header-image" mode="widthFix" :src="wodebeijingImage"></image>
<view v-if="!takeStatus"> <u-navbar :is-back="false" :background="{ background: 'transparent' }" :border-bottom="false">
<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30"> <text class="title-view">我的</text>
<view class="u-m-r-10"> </u-navbar>
<u-avatar :src="pic" size="140"></u-avatar> <view class="mine-content">
<view class="header-view">
<view class="head-image">
<u-avatar :src="headImageUrl" size="142" mode="circle"></u-avatar>
</view> </view>
<view class="u-flex-1"> <view class="header-content">
<view class="u-font-18 u-p-b-20">uView ui</view> <view class="name-view" @click="handleClickName">{{name}}</view>
<view class="u-font-14 u-tips-color">微信号:helang_uView</view> <view :class="['tel-view', {'active': info.tel}]" @click="handleClickTel">
<text>{{telTip}}</text>
<u-icon class="tel-arrow-icon" name="arrow-up-fill"></u-icon>
</view>
</view> </view>
</view> </view>
<view class="u-m-t-20"> <view class="list-view">
<u-cell-group>
<u-cell-item v-for="(item, index) in items" :title="item.title" :value="item.value" :key="index">
<u-icon slot="icon" size="32" name="search"></u-icon>
</u-cell-item>
</u-cell-group>
</view>
<view class="u-m-t-20">
<u-cell-group> <u-cell-group>
<u-cell-item icon="setting" title="设置"></u-cell-item> <view v-for="(item, index) in items" :key="index">
<u-cell-item :value="item.value" :border-bottom="false" @click="handleClick(index)">
<image slot="icon" :src="imageUrl + item.icon" :style="item.imageStyle"></image>
<view slot="title" class="item-title">{{item.title}}</view>
<view slot="value" class="item-value">{{value}}</view>
</u-cell-item>
<view v-if="index == 3" class="line-view"></view>
</view>
</u-cell-group> </u-cell-group>
</view> </view>
<view class="u-m-t-20" @click="take"> <!-- <view class="u-m-t-20" @click="take">
<u-cell-group> <u-cell-group>
<u-cell-item icon="setting" title="相机组件测试"></u-cell-item> <u-cell-item icon="setting" title="相机组件测试"></u-cell-item>
</u-cell-group> </u-cell-group>
</view> </view> -->
</view> </view>
<take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo> <!-- <take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo> -->
</view> </view>
</template> </template>
...@@ -43,52 +48,205 @@ ...@@ -43,52 +48,205 @@
}, },
data() { data() {
return { return {
pic:'https://uviewui.com/common/logo.png', serviceTel: '0755-81773817',
show:true, info: {},
takeStatus: false, // pic: 'https://uviewui.com/common/logo.png',
testData: { // show: true,
_id: '1', // 规格ID // takeStatus: false,
system_id: '2', // 系统ID // testData: {
brand_id: '3', // 品牌ID // _id: '1', // 规格ID
classify_id: '4', // 分类ID // system_id: '2', // 系统ID
images: [ // 拍照要求示意图 // brand_id: '3', // 品牌ID
'https://qn-static.banshouhui.com/live_mark.png', // classify_id: '4', // 分类ID
'https://qn-static.banshouhui.com/live_mark.png', // images: [ // 拍照要求示意图
'https://qn-static.banshouhui.com/live_mark.png' // 'https://qn-static.banshouhui.com/live_mark.png',
], // 'https://qn-static.banshouhui.com/live_mark.png',
main_point: [] // 要点 // 'https://qn-static.banshouhui.com/live_mark.png'
} // ],
// main_point: [] // 要点
// }
} }
}, },
computed: { computed: {
items() { items() {
return [ return [{
{title: '我的钱包', value: '', icon: ''}, title: '我的钱包',
{title: '我的质保金', value: '', icon: ''}, value: '',
{title: '我的合同', value: '', icon: ''}, icon: 'qianbao.png',
{title: '我的证件', value: '', icon: ''}, imageStyle: 'width:34rpx;height:32rpx'
{title: '我的收货地址', value: '', icon: ''}, },
{title: '我的仓库', value: '', icon: ''}, {
{title: '联系客服', value: '6666666', icon: ''}] title: '配件押金',
value: '',
icon: 'yajin.png',
imageStyle: 'width:32rpx;height:32rpx'
},
{
title: '我的合同',
value: '',
icon: 'hetong.png',
imageStyle: 'width:34rpx;height:32rpx'
},
{
title: '我的证件',
value: '',
icon: 'zhengjian.png',
imageStyle: 'width:36rpx;height:28rpx'
},
{
title: '收货地址',
value: '',
icon: 'wddizhi.png',
imageStyle: 'width:32rpx;height:32rpx'
},
{
title: '我的仓库',
value: '',
icon: 'cangku.png',
imageStyle: 'width:36rpx;height:32rpx'
},
{
title: '联系客服',
value: this.serviceTel,
icon: 'lxkefu.png',
imageStyle: 'width:32rpx;height:32rpx'
}
]
},
name() {
return this.info.name || '点击登录'
},
telTip() {
return this.info.tel ? '已绑定手机号' : '绑定手机号'
},
imageUrl() {
return process.uniEnv.qn_base_url
},
pages() {
return ['', '', '', '', 'address', '', '']
},
headImageUrl() {
return this.info.headImage || this.placeholderImage
},
wodebeijingImage() {
return this.imageUrl+ 'wodebeijing.png'
},
placeholderImage() {
return this.imageUrl + 'touxiang.png'
} }
}, },
onLoad() { onLoad() {
}, },
methods: { methods: {
take() { handleClick(index) {
uni.hideTabBar() uni.navigateTo({
this.takeStatus = true url: 'pages/mine/' + this.pages[index]
})
}, },
closeTake(img) { handleClickName() {
console.log(img)
this.takeStatus = false },
} handleClickTel() {
},
// take() {
// uni.hideTabBar()
// this.takeStatus = true
// },
// closeTake(img) {
// console.log(img)
// this.takeStatus = false
// }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.mine-view {
position: relative;
height: 100vh;
overflow: auto;
background-color: #FFFFFF;
.header-image {
position: absolute;
width: 100%;
}
.title-view {
color: #FFFFFF;
font-weight: bold;
font-size: 40rpx;
padding-left: 30rpx;
}
.mine-content {
</style> .header-view {
padding: 30rpx 30rpx 80rpx 30rpx;
display: flex;
align-items: center;
.head-image {
width: 142rpx;
height: 142rpx;
}
.header-content {
color: #FFFFFF;
z-index: 0;
margin-left: 24rpx;
.name-view {
font-size: 44rpx;
font-weight: bold;
margin-bottom: 14rpx;
margin-top: 6rpx;
}
.tel-view {
background-color: #FFFFFF;
border-radius: 26rpx;
color: #2272FF;
width: 164rpx;
height: 52rpx;
font-size: 20rpx;
display: flex;
align-items: center;
justify-content: center;
&.active {
color: #FFFFFF;
border:2rpx solid #FFFFFF;
background-color: #2272FF;
}
.tel-arrow-icon {
transform:rotate(90deg);
margin-left: 6rpx;
}
}
}
}
.list-view {
background-color: #FFFFFF;
border-radius: 16rpx 16rpx 0 0;
overflow: hidden;
.item-title {
font-size: 32rpx;
color: #333333;
margin-left: 16rpx;
line-height: 32rpx;
}
.item-value {
font-size: 26rpx;
color: #999999;
}
.line-view {
height: 2rpx;
background-color: #F4F5F7;
margin: 30rpx;
}
}
}
}
</style>
...@@ -113,9 +113,6 @@ export default { ...@@ -113,9 +113,6 @@ export default {
signupLogin(e) { signupLogin(e) {
var that = this var that = this
console.log(e.detail.errMsg)
console.log(e.detail.iv)
console.log(e.detail.encryptedData)
if (!e || !e.detail || e.detail.errMsg.indexOf('user deny') > -1) { if (!e || !e.detail || e.detail.errMsg.indexOf('user deny') > -1) {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
...@@ -157,22 +154,17 @@ export default { ...@@ -157,22 +154,17 @@ export default {
goBackPage() { goBackPage() {
let pages = getCurrentPages(); let pages = getCurrentPages();
debugger
if(pages.length) { if(pages.length) {
let index = pages.length - 1; let index = pages.length - 1;
if(index) { if(index) {
let prevPage = pages[index]; //上一个页面 let prevPage = pages[index]; //上一个页面
if(prevPage.route == "pages/login/index") { if (prevPage && prevPage.$vm) {
uni.redirectTo({ prevPage.$vm.isRefresh = true;
url:'pages/index/index'
})
} else {
if (prevPage && prevPage.$vm) {
prevPage.$vm.isRefresh = true;
}
uni.navigateBack({
delta: 1
})
} }
uni.navigateBack({
delta: 1
})
} else { } else {
uni.redirectTo({ uni.redirectTo({
url:'pages/index/index' url:'pages/index/index'
......
<template> <template>
<view> <view class="address-wrap">
<view class="item" v-for="(res, index) in siteList" :key="res.id"> <w-navbar title="收货地址"></w-navbar>
<view class="item" v-for="(res, sindex) in siteList" :key="res.id">
<view class="top"> <view class="top">
<view class="name">{{ res.name }}</view> <view class="name">{{ res.name }}</view>
<view class="phone">{{ res.phone }}</view> <view class="phone">{{ res.phone }}</view>
<view class="tag">
<text v-for="(item, index) in res.tag" :key="index" :class="{red:item.tagText=='默认'}">{{ item.tagText }}</text>
</view>
</view> </view>
<view class="bottom"> <view class="bottom">
广东省深圳市宝安区 自由路66号 <view class="address">广东省深圳市宝安区宝城67区留芳路6号庭威产业园3栋10C</view>
<u-icon name="edit-pen" :size="40" color="#999999"></u-icon> <u-icon :name="editPen" :size="32" color="#999999"></u-icon>
</view>
<view class="default" v-show="true">
<u-icon name="checkmark-circle" color="#2272FF" size="32"></u-icon>
<text class="txt">默认地址</text>
</view> </view>
</view> </view>
<view class="addSite" @tap="toAddSite"> <view class="addSite" @tap="toAddSite">
...@@ -25,12 +27,20 @@ ...@@ -25,12 +27,20 @@
export default { export default {
data() { data() {
return { return {
background: {
backgroundColor: 'none'
},
siteList: [] siteList: []
}; };
}, },
onLoad() { onLoad() {
this.getData(); this.getData();
}, },
computed: {
editPen() {
return process.uniEnv.qn_base_url + 'icon/edit-pen.png'
}
},
methods: { methods: {
getData() { getData() {
this.siteList = [ this.siteList = [
...@@ -46,7 +56,7 @@ export default { ...@@ -46,7 +56,7 @@ export default {
tagText: '家' tagText: '家'
} }
], ],
site: '广东省深圳市宝安区 自由路66号' site: '广东省深圳市宝安区宝城67区留芳路6号庭威产业园3栋10C'
}, },
{ {
id: 2, id: 2,
...@@ -70,7 +80,7 @@ export default { ...@@ -70,7 +80,7 @@ export default {
}, },
toAddSite(){ toAddSite(){
uni.navigateTo({ uni.navigateTo({
url: '/pages/template/address/addSite' url: '/pages/mine/address/addSite'
}); });
} }
} }
...@@ -78,42 +88,51 @@ export default { ...@@ -78,42 +88,51 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.address-wrap {
background-color: #F4F5F7;
}
.item { .item {
padding: 40rpx 20rpx; margin: 30rpx;
padding: 50rpx 30rpx 48rpx 30rpx;
background-color: #FFFFFF;
border-radius: 12px;
.top { .top {
display: flex; display: flex;
font-size: 32rpx;
font-weight: bold; font-weight: bold;
font-size: 34rpx; color: #333333;
line-height: 32rpx;
.phone { .phone {
margin-left: 60rpx; margin-left: 20rpx;
} font-size: 28rpx;
.tag { font-weight: 400;
display: flex; color: #666666;
font-weight: normal;
align-items: center;
text {
display: block;
width: 60rpx;
height: 34rpx;
line-height: 34rpx;
color: #ffffff;
font-size: 20rpx;
border-radius: 6rpx;
text-align: center;
margin-left: 30rpx;
background-color:rgb(49, 145, 253);
}
.red{
background-color:red
}
} }
} }
.bottom { .bottom {
display: flex; display: flex;
margin-top: 20rpx; margin-top: 24rpx;
font-size: 28rpx;
justify-content: space-between; justify-content: space-between;
color: #999999; align-items: flex-start;
font-size: 28rpx;
font-weight: 400;
color: #333333;
.address{
max-width: 500rpx;
line-height: 40rpx;
}
}
.default {
border-top: 2rpx solid #F4F5F7;
margin-top: 22rpx;
padding-top: 30rpx;
.txt {
margin-left: 12rpx;
font-size: 28rpx;
font-weight: 400;
color: #333333;
line-height: 28rpx;
}
} }
} }
.addSite { .addSite {
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
<view class="class-item" :key="groupIndex" v-show="current == groupIndex"> <view class="class-item" :key="groupIndex" v-show="current == groupIndex">
<view class="title" v-if="groupItem.name !== '基本信息'">{{groupItem.name}}</view> <view class="title" v-if="groupItem.name !== '基本信息'">{{groupItem.name}}</view>
<view class="class-bd"> <view class="class-bd">
<u-form-item v-for="(item,itemIndex) in groupItem.items" :key="itemIndex" v-if="typeToComponentType(item.fieldsType)!=='location'" <u-form-item v-for="(item,itemIndex) in groupItem.items" :key="itemIndex" label-position="top"
label-position="top" :prop="item.fieldsName" :border-bottom="false" v-show="item.fieldsId != 200 || show200"> :prop="item.fieldsName" :border-bottom="false" v-show="item.fieldsId != 200 || show200">
<view :class="[{'label-bold': groupItem.name === '基本信息'}, 'label']"> <view :class="[{'label-bold': groupItem.name === '基本信息'}, 'label']" v-if="typeToComponentType(item.fieldsType)!=='location'">
<image class="item-image" :src="mixingImage" v-if="item.required"></image> <image class="item-image" :src="mixingImage" v-if="item.required"></image>
{{item.fieldsTitle}} {{item.fieldsTitle}}
</view> </view>
...@@ -239,6 +239,9 @@ ...@@ -239,6 +239,9 @@
'font-size': '32rpx', 'font-size': '32rpx',
} }
}, },
show200() {
return this.form.paymentMethodsType != '03'
}
}, },
methods: { methods: {
getCompleteData() {//获取工单配置的完工项目 getCompleteData() {//获取工单配置的完工项目
...@@ -256,7 +259,8 @@ ...@@ -256,7 +259,8 @@
}, },
saveComplete(){// 保存完工信息 saveComplete(){// 保存完工信息
let self = this let self = this
let param = {} let param = {}
self.list.forEach((panel)=>{ self.list.forEach((panel)=>{
param[panel.panelFieldsName] = [] param[panel.panelFieldsName] = []
panel.items.forEach((group) =>{ panel.items.forEach((group) =>{
...@@ -272,15 +276,8 @@ ...@@ -272,15 +276,8 @@
}) })
}) })
}) })
if (!param.base[0].fieldsValue) {
return this.$refs.uToast.show({
title: '请先选择产品规格',
type: 'error',
})
}
self.$u.api.saveCompleteData(param,self.orderId).then((res)=>{ self.$u.api.saveCompleteData(param,self.orderId).then((res)=>{
if (res.code == 200) { if (res.code == 200) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '保存成功', title: '保存成功',
...@@ -288,7 +285,7 @@ ...@@ -288,7 +285,7 @@
}) })
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.message, title: res.data,
type: 'error', type: 'error',
}) })
} }
...@@ -310,7 +307,8 @@ ...@@ -310,7 +307,8 @@
panelResult.submitted++ panelResult.submitted++
}else if(value&&Array.isArray(value)&&value.length > 0){ }else if(value&&Array.isArray(value)&&value.length > 0){
panelResult.submitted++ panelResult.submitted++
}else if(first){// 记录第一个 为空 并且需要必填的项 用于定位 }else if(first){// 记录第一个 为空 并且需要必填的项 用于定位
console.log(ele)
first = false first = false
self.waitHandlerPanelIndex = panelIndex self.waitHandlerPanelIndex = panelIndex
self.waitHandlerGroupIndex = groupIndex self.waitHandlerGroupIndex = groupIndex
...@@ -394,7 +392,16 @@ ...@@ -394,7 +392,16 @@
}else{ }else{
this.$set(this.form,innerItem.fieldsName,data.value) this.$set(this.form,innerItem.fieldsName,data.value)
} }
this.show200 = innerItem.fieldsId != 199 || data.value != '03' if (innerItem.fieldsId == 199) { // 选不需要收款的时候,收款金额修改为非必选
for (var item of this.list[0].items) {
for (var i of item.items) {
if (i.fieldsId == 200) {
i.required = data.value !='03'
}
}
}
}
console.log(this.form) console.log(this.form)
}, },
nextStep() { nextStep() {
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<view class="topView"> <view class="topView">
<view :class="['topItemView', {'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)" <view :class="['topItemView', {'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)"
v-for="(item,ikey) in dataList" :key="ikey"> v-for="(item,ikey) in dataList" :key="ikey">
<text :class="['ph-lst-top-index', {'active':activeTop===ikey}]">{{ ikey + 1 }}</text> <text :class="['ph-lst-top-index', {'active':activeTop===ikey}]">{{ ikey + 1 }}</text>
<text class="topItemTitle">{{item.type}}</text> <text class="topItemTitle">{{item.type}}</text>
</view> </view>
</view> </view>
<view class="rightView"> <view class="rightView">
<view class="right-view-title">拍照项有:</view> <view class="right-view-title">拍照项有:</view>
<scroll-view scroll-y="true" class="scroll-y"> <scroll-view scroll-y="true" class="scroll-y">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<!-- <u-button v-if="activeTop + 1 === dataList.length" class="ph-list-button" type="error" shape="circle" <!-- <u-button v-if="activeTop + 1 === dataList.length" class="ph-list-button" type="error" shape="circle"
:disabled="buttonDisabled" :custom-style="buttonStyle" @click="isPopShow = true">一键清空展示图片</u-button> --> :disabled="buttonDisabled" :custom-style="buttonStyle" @click="isPopShow = true">一键清空展示图片</u-button> -->
</view> </view>
<!-- <u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom mode="center" width="690rpx" <!-- <u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom mode="center" width="690rpx"
height="600rpx"> height="600rpx">
<view class="ph-list-pop-title"> <view class="ph-list-pop-title">
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
} }
}) })
}, },
getListDataNew() { getListDataNew() {
this.loading = true this.loading = true
let self = this let self = this
var data = { var data = {
...@@ -177,7 +177,6 @@ ...@@ -177,7 +177,6 @@
self.$u.api.orderStandard(data).then((res) => { self.$u.api.orderStandard(data).then((res) => {
this.loading = false this.loading = false
if (res.code == 200) { if (res.code == 200) {
console.log("===", res.data)
if(res.data && res.data.length > 0){ if(res.data && res.data.length > 0){
let dataList = [] let dataList = []
var flag = false; var flag = false;
...@@ -196,7 +195,7 @@ ...@@ -196,7 +195,7 @@
}else{ }else{
flag = false flag = false
} }
}) })
if(!flag){ if(!flag){
var dataItem = {type:'',list:[]} var dataItem = {type:'',list:[]}
dataItem.type = item.type dataItem.type = item.type
...@@ -205,6 +204,7 @@ ...@@ -205,6 +204,7 @@
} }
} }
}) })
console.log("===", dataList)
this.handleData(dataList) this.handleData(dataList)
} }
} else { } else {
...@@ -217,7 +217,6 @@ ...@@ -217,7 +217,6 @@
this.dataList = result this.dataList = result
if (result.length > 0) { if (result.length > 0) {
var item = result[0] var item = result[0]
getApp().globalData.photo.waterSetting = this.userWatermark
this.rightList = item.list this.rightList = item.list
} }
}, },
...@@ -253,33 +252,35 @@ ...@@ -253,33 +252,35 @@
}) })
}, },
// 清除图片 // 清除图片
handleClickSure: function() { handleClickSure: function() {
this.$u.cloudApi.cleanImage({ this.$u.cloudApi.cleanImage({
'token': this.vuex_token, 'token': this.vuex_token,
}).then(res => { }).then(res => {
this.isPopShow = false this.isPopShow = false
if (res && res.result) { if (res && res.result) {
this.getListData() this.getListData()
} }
}) })
}, },
take(item,ikey) { take(item,ikey) {
this.currentItemDate = item this.currentItemDate = item
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
photo.currentItem = item photo.currentItem = item
photo.itemIndex = ikey photo.itemIndex = ikey
const len = item.orderImages?item.orderImages.length:0 const len = item.orderImages?item.orderImages.length:0
photo.currentItemLength = len > 9 ? 10 : len photo.currentItemLength = len > 9 ? 10 : len
uni.hideTabBar() uni.hideTabBar()
this.takeStatus = true this.takeStatus = true
}, },
closeTake(img) { closeTake(img) {
console.log(img)
if(img !==undefined ){ if(img !==undefined ){
if (!this.currentItemDate.orderImages) this.currentItemDate.orderImages = []
// step1 添加图片 // step1 添加图片
this.currentItemDate.orderImages.push(img[img.length-1].key) img.forEach(v => {
this.currentItemDate.orderImages.push(v.key)
})
// step2 保存图片 // step2 保存图片
var data={ var data={
type : this.currentItemDate.type, type : this.currentItemDate.type,
...@@ -446,7 +447,6 @@ ...@@ -446,7 +447,6 @@
background-color: #FAFAFA; background-color: #FAFAFA;
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
position: fixed;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
z-index: 1; z-index: 1;
...@@ -499,6 +499,6 @@ ...@@ -499,6 +499,6 @@
} }
.scroll-y { .scroll-y {
height: 80vh; height: 73vh;
} }
</style> </style>
...@@ -33,7 +33,9 @@ const store = new Vuex.Store({ ...@@ -33,7 +33,9 @@ const store = new Vuex.Store({
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {}, vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {},
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '', vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
vuex_version: '1.0.1', vuex_version: '1.0.1',
vuex_config: {}, vuex_config: {},
// 入驻信息
vuex_settled: {},
vuex_wx_uid: lifeData.vuex_wx_uid || 0, vuex_wx_uid: lifeData.vuex_wx_uid || 0,
}, },
mutations: { mutations: {
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
:send-message-img="sendMessageImg" :send-message-img="sendMessageImg"
:show-message-card="showMessageCard" :show-message-card="showMessageCard"
@getphonenumber="getphonenumber" @getphonenumber="getphonenumber"
@getuserinfo="getuserinfo"
@error="error" @error="error"
@opensetting="opensetting" @opensetting="opensetting"
@launchapp="launchapp" @launchapp="launchapp"
...@@ -324,9 +325,9 @@ export default { ...@@ -324,9 +325,9 @@ export default {
getphonenumber(res) { getphonenumber(res) {
this.$emit('getphonenumber', res); this.$emit('getphonenumber', res);
}, },
// getuserinfo(res) { getuserinfo(res) {
// this.$emit('getuserinfo', res); this.$emit('getuserinfo', res);
// }, },
error(res) { error(res) {
this.$emit('error', res); this.$emit('error', res);
}, },
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
* @property {Boolean} bold 激活选项的字体是否加粗(默认true) * @property {Boolean} bold 激活选项的字体是否加粗(默认true)
* @property {String} bg-color 组件背景颜色,mode为button时有效(默认#eeeeef) * @property {String} bg-color 组件背景颜色,mode为button时有效(默认#eeeeef)
* @property {String} button-color 按钮背景颜色,mode为button时有效(默认#ffffff) * @property {String} button-color 按钮背景颜色,mode为button时有效(默认#ffffff)
* @property {String Number} border-radius 圆角值,单位rpx(默认5)
* @event {Function} change 分段器选项发生改变时触发 * @event {Function} change 分段器选项发生改变时触发
* @example <u-subsection active-color="#ff9900"></u-subsection> * @example <u-subsection active-color="#ff9900"></u-subsection>
*/ */
...@@ -92,12 +91,7 @@ ...@@ -92,12 +91,7 @@
vibrateShort: { vibrateShort: {
type: Boolean, type: Boolean,
default: false default: false
}, }
// 圆角值
borderRadius: {
type: [Number, String],
default: 5
},
}, },
data() { data() {
return { return {
...@@ -111,7 +105,7 @@ ...@@ -111,7 +105,7 @@
}, },
currentIndex: this.current, currentIndex: this.current,
buttonPadding: 3, // mode = button 时,组件的内边距 buttonPadding: 3, // mode = button 时,组件的内边距
// borderRadius: 5, // 圆角值 borderRadius: 5, // 圆角值
firstTimeVibrateShort: true // 组件初始化时,会触发current变化,此时不应震动 firstTimeVibrateShort: true // 组件初始化时,会触发current变化,此时不应震动
}; };
}, },
......
...@@ -2,8 +2,8 @@ module.exports = { ...@@ -2,8 +2,8 @@ module.exports = {
onLoad() { onLoad() {
// 设置默认的转发参数 // 设置默认的转发参数
this.$u.mpShare = { this.$u.mpShare = {
title: '充电桩安装火爆进行中...就等你', // 默认为小程序名称 title: '', // 默认为小程序名称
path: '/pages/index/index', // 默认为当前页面路径 path: '', // 默认为当前页面路径
imageUrl: '' // 默认为当前页面的截图 imageUrl: '' // 默认为当前页面的截图
} }
}, },
......
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