Commit 6ff2ff4b authored by Morson's avatar Morson

Merge branch 'master' of https://git.banshouhui.com/lijundan/self-support

# Conflicts:
#	src/pages.json
#	src/pages/order/search.vue
parents 88759a5d 91ac0bb6
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
currentItem: null, // 选择的某一项 currentItem: null, // 选择的某一项
setting: null, //自定义设置 setting: null, //自定义设置
waterSetting: null, // 水印设置 waterSetting: null, // 水印设置
allImages: [],
tempPath: { tempPath: {
origin: '', // 缓存拍照图片 origin: '', // 缓存拍照图片
mixWater: '' // 缓存水印拍照图片 mixWater: '' // 缓存水印拍照图片
......
...@@ -8,9 +8,9 @@ let orderApiFun = function(vm){ ...@@ -8,9 +8,9 @@ let orderApiFun = function(vm){
let listOrderCount = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/queryOrdersCount/V2', params); let listOrderCount = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/queryOrdersCount/V2', params);
/** /**
* 工单列表接口 http://apidoc.banshouhui.com:3000/mock/31/wxh-worker-rest/rest/order/revision/{token}/list * 工单列表接口 wxh-worker-rest/rest/order/revision/{token}/list
*/ */
let listOrder = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/'+ vm.vuex_token+'/order/revision/list', params); let listOrder = async (params = {}) => await vm.$u.get('/wxh-worker-rest/rest/order/revision/'+ vm.vuex_token+'/list', params);
/** /**
* 获取师傅的预约日历 * 获取师傅的预约日历
......
export default [{ export default [{
"groupName": "女装", "groupName": "接入点信息",
"item": [{ "item": [{
"required": true, "required": true,
"fieldsTitle": "A字裙多个", "fieldsTitle": "多框输入",
"fieldsName": "name", "fieldsName": "name",
"fieldsType": "multiInput", "fieldsType": "multiinput",
"fieldsValue": "", "fieldsValue": "",
"inputOptions":[{ "inputOptions":[{
"fieldsTitle": "A字裙", "fieldsTitle": "开孔大小",
"fieldsName": "name1", "fieldsName": "name1",
"fieldsType": "text", "fieldsType": "text",
"value": '2233',
"placeholder": '开孔大小'
},{ },{
"fieldsTitle": "A字裙", "fieldsTitle": "开孔数量",
"fieldsName": "name2", "fieldsName": "num",
"fieldsType": "text", "fieldsType": "text",
"placeholder": '开孔数量'
},{ },{
"fieldsTitle": "A字裙", "fieldsTitle": "请输入",
"fieldsName": "name3", "fieldsName": "name3",
"fieldsType": "text", "fieldsType": "text",
},{ "placeholder": '请输入'
"fieldsTitle": "A字裙", }],
"fieldsName": "name3", "key": "A多框输入",
"fieldsType": "text",
},{
"fieldsTitle": "A字裙",
"fieldsName": "name4",
"fieldsType": "text",
},{
"fieldsTitle": "A字裙",
"fieldsName": "name5",
"fieldsType": "text",
},],
"key": "A字裙",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/1.jpg", "icon": "https://cdn.uviewui.com/uview/common/classify/1/1.jpg",
"cat": 10 "cat": 10
},{ },{
"required": true, "required": true,
"fieldsTitle": "A字裙", "fieldsTitle": "输入框",
"fieldsName": "name", "fieldsName": "name",
"fieldsType": "input", "fieldsType": "text",
"fieldsValue": "", "fieldsValue": "",
"span":8, "span":8,
"key": "A字裙", "key": "A字裙",
...@@ -58,7 +50,7 @@ export default [{ ...@@ -58,7 +50,7 @@ export default [{
"fieldsTitle": "多选", "fieldsTitle": "多选",
"fieldsName": "checkbox", "fieldsName": "checkbox",
"fieldsType": "checkbox", "fieldsType": "checkbox",
"settings": ['车主电', '物业电', '国电'], "settings": ['居民用电电价(不分时)', '非居民用电电价(不分时)', '居民用电电价峰谷时段(分时)', '非居民用电电价峰谷时段(分时)'],
"key": "半身裙", "key": "半身裙",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/3.jpg", "icon": "https://cdn.uviewui.com/uview/common/classify/1/3.jpg",
"cat": 10 "cat": 10
...@@ -73,7 +65,15 @@ export default [{ ...@@ -73,7 +65,15 @@ export default [{
"cat": 10 "cat": 10
}, },
{ {
"fieldsTitle": "文件选择", "fieldsTitle": "电缆",
"fieldsName": "file",
"fieldsType": "file",
"key": "短裙",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/5.jpg",
"cat": 10
},
{
"fieldsTitle": "管材",
"fieldsName": "file", "fieldsName": "file",
"fieldsType": "file", "fieldsType": "file",
"key": "短裙", "key": "短裙",
...@@ -81,7 +81,7 @@ export default [{ ...@@ -81,7 +81,7 @@ export default [{
"cat": 10 "cat": 10
}, },
{ {
"fieldsTitle": "获取经纬度", "fieldsTitle": "坐标",
"fieldsName": "location", "fieldsName": "location",
"fieldsType": "location", "fieldsType": "location",
"required": true, "required": true,
...@@ -117,8 +117,9 @@ export default [{ ...@@ -117,8 +117,9 @@ export default [{
"cat": 10 "cat": 10
}, },
{ {
"fieldsTitle": "情侣装", "fieldsTitle": "备注",
"key": "情侣装", "key": "备注",
"fieldsType": "textarea",
"icon": "https://cdn.uviewui.com/uview/common/classify/1/10.jpg", "icon": "https://cdn.uviewui.com/uview/common/classify/1/10.jpg",
"cat": 10 "cat": 10
}, },
...@@ -149,986 +150,6 @@ export default [{ ...@@ -149,986 +150,6 @@ export default [{
] ]
}, },
{ {
"groupName": "美食", "groupName": "社区信息",
"item": [{
"fieldsTitle": "火锅",
"key": "火锅",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/1.jpg",
"cat": 6
},
{
"fieldsTitle": "糕点饼干",
"key": "糕点饼干",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/2.jpg",
"cat": 6
},
{
"fieldsTitle": "坚果果干",
"key": "坚果果干",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/3.jpg",
"cat": 6
},
{
"fieldsTitle": "酒类",
"key": "酒类",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/4.jpg",
"cat": 6
},
{
"fieldsTitle": "辣条",
"key": "辣条",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/5.jpg",
"cat": 6
},
{
"fieldsTitle": "大礼包",
"key": "大礼包",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/6.jpg",
"cat": 6
},
{
"fieldsTitle": "精品茗茶",
"key": "茶",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/7.jpg",
"cat": 6
},
{
"fieldsTitle": "休闲食品",
"key": "休闲食品",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/8.jpg",
"cat": 6
},
{
"fieldsTitle": "糖果巧克力",
"key": "糖果巧克力",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/9.jpg",
"cat": 6
},
{
"fieldsTitle": "方便速食",
"key": "方便速食",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/10.jpg",
"cat": 6
},
{
"fieldsTitle": "营养代餐",
"key": "营养代餐",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/11.jpg",
"cat": 6
},
{
"fieldsTitle": "粮油副食",
"key": "粮油",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/12.jpg",
"cat": 6
},
{
"fieldsTitle": "生鲜水果",
"key": "水果",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/13.jpg",
"cat": 6
},
{
"fieldsTitle": "饮品",
"key": "饮品",
"icon": "https://cdn.uviewui.com/uview/common/classify/2/14.jpg",
"cat": 6
}
]
},
{
"groupName": "美妆",
"item": [{
"fieldsTitle": "化妆刷",
"key": "化妆刷",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/1.jpg",
"cat": 3
},
{
"fieldsTitle": "粉底",
"key": "粉底",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/2.jpg",
"cat": 3
},
{
"fieldsTitle": "洗发护发",
"key": "洗发护发",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/3.jpg",
"cat": 3
},
{
"fieldsTitle": "美容工具",
"key": "美容工具",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/4.jpg",
"cat": 3
},
{
"fieldsTitle": "眼部护理",
"key": "眼部护理",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/5.jpg",
"cat": 3
},
{
"fieldsTitle": "眉妆",
"key": "眉妆",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/6.jpg",
"cat": 3
},
{
"fieldsTitle": "卸妆品",
"key": "卸妆品",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/7.jpg",
"cat": 3
},
{
"fieldsTitle": "基础护肤",
"key": "基础护肤",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/8.jpg",
"cat": 3
},
{
"fieldsTitle": "眼妆",
"key": "眼妆",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/9.jpg",
"cat": 3
},
{
"fieldsTitle": "唇妆",
"key": "唇妆",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/10.jpg",
"cat": 3
},
{
"fieldsTitle": "面膜",
"key": "面膜",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/11.jpg",
"cat": 3
},
{
"fieldsTitle": "沐浴用品",
"key": "沐浴用品",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/12.jpg",
"cat": 3
},
{
"fieldsTitle": "护肤套装",
"key": "护肤套装",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/13.jpg",
"cat": 3
},
{
"fieldsTitle": "防晒品",
"key": "防晒品",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/14.jpg",
"cat": 3
},
{
"fieldsTitle": "美甲",
"key": "美甲",
"icon": "https://cdn.uviewui.com/uview/common/classify/3/15.jpg",
"cat": 3
}
]
},
{
"groupName": "居家日用",
"item": [{
"fieldsTitle": "垃圾袋",
"key": "垃圾袋",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/1.jpg",
"cat": 4
},
{
"fieldsTitle": "纸巾",
"key": "纸巾",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/2.jpg",
"cat": 4
},
{
"fieldsTitle": "驱蚊用品",
"key": "驱蚊用品",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/3.jpg",
"cat": 4
},
{
"fieldsTitle": "收纳神器",
"key": "收纳神器",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/4.jpg",
"cat": 4
},
{
"fieldsTitle": "厨房用品",
"key": "厨房用品",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/5.jpg",
"cat": 4
},
{
"fieldsTitle": "厨房烹饪",
"key": "烹饪",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/6.jpg",
"cat": 4
},
{
"fieldsTitle": "衣物晾晒",
"key": "衣物晾晒",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/7.jpg",
"cat": 4
},
{
"fieldsTitle": "衣物护理",
"key": "衣物护理",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/8.jpg",
"cat": 4
},
{
"fieldsTitle": "宠物用品",
"key": "宠物用品",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/9.jpg",
"cat": 4
},
{
"fieldsTitle": "医药保健",
"key": "医药",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/10.jpg",
"cat": 4
},
{
"fieldsTitle": "日用百货",
"key": "百货",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/11.jpg",
"cat": 4
},
{
"fieldsTitle": "清洁用品",
"key": "清洁",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/12.jpg",
"cat": 4
},
{
"fieldsTitle": "绿植园艺",
"key": "绿植",
"icon": "https://cdn.uviewui.com/uview/common/classify/4/13.jpg",
"cat": 4
}
]
},
{
"groupName": "男装",
"item": [{
"fieldsTitle": "爸爸装",
"key": "爸爸装",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/1.jpg",
"cat": 12
},
{
"fieldsTitle": "牛仔裤",
"key": "牛仔裤",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/2.jpg",
"cat": 12
},
{
"fieldsTitle": "衬衫",
"key": "衬衫",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/3.jpg",
"cat": 12
},
{
"fieldsTitle": "休闲裤",
"key": "休闲裤",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/4.jpg",
"cat": 12
},
{
"fieldsTitle": "外套",
"key": "外套",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/5.jpg",
"cat": 12
},
{
"fieldsTitle": "T恤",
"key": "T恤",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/6.jpg",
"cat": 12
},
{
"fieldsTitle": "套装",
"key": "套装",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/7.jpg",
"cat": 12
},
{
"fieldsTitle": "运动裤",
"key": "运动裤",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/8.jpg",
"cat": 12
},
{
"fieldsTitle": "马甲/背心",
"key": "马甲背心",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/9.jpg",
"cat": 12
},
{
"fieldsTitle": "POLO衫",
"key": "POLO衫",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/10.jpg",
"cat": 12
},
{
"fieldsTitle": "商务装",
"key": "商务装",
"icon": "https://cdn.uviewui.com/uview/common/classify/5/11.jpg",
"cat": 12
}
]
},
{
"groupName": "鞋品",
"item": [{
"fieldsTitle": "单鞋",
"key": "单鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/1.jpg",
"cat": 5
},
{
"fieldsTitle": "皮鞋",
"key": "皮鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/2.jpg",
"cat": 5
},
{
"fieldsTitle": "帆布鞋",
"key": "帆布鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/3.jpg",
"cat": 5
},
{
"fieldsTitle": "北京老布鞋",
"key": "北京老布鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/4.jpg",
"cat": 5
},
{
"fieldsTitle": "运动鞋",
"key": "运动鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/5.jpg",
"cat": 5
},
{
"fieldsTitle": "拖鞋",
"key": "拖鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/6.jpg",
"cat": 5
},
{
"fieldsTitle": "凉鞋",
"key": "凉鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/7.jpg",
"cat": 5
},
{
"fieldsTitle": "休闲鞋",
"key": "休闲鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/8.jpg",
"cat": 5
},
{
"fieldsTitle": "高跟鞋",
"key": "高跟鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/9.jpg",
"cat": 5
},
{
"fieldsTitle": "老人鞋",
"key": "老人鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/10.jpg",
"cat": 5
},
{
"fieldsTitle": "懒人鞋",
"key": "懒人鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/6/11.jpg",
"cat": 5
}
]
},
{
"groupName": "数码家电",
"item": [{
"fieldsTitle": "数据线",
"key": "数据线",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/1.jpg",
"cat": 8
},
{
"fieldsTitle": "耳机",
"key": "耳机",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/2.jpg",
"cat": 8
},
{
"fieldsTitle": "生活家电",
"key": "家电",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/3.jpg",
"cat": 8
},
{
"fieldsTitle": "电风扇",
"key": "电风扇",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/4.jpg",
"cat": 8
},
{
"fieldsTitle": "电吹风",
"key": "电吹风",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/5.jpg",
"cat": 8
},
{
"fieldsTitle": "手机壳",
"key": "手机壳",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/6.jpg",
"cat": 8
},
{
"fieldsTitle": "榨汁机",
"key": "榨汁机",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/7.jpg",
"cat": 8
},
{
"fieldsTitle": "小家电",
"key": "小家电",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/8.jpg",
"cat": 8
},
{
"fieldsTitle": "数码电子",
"key": "数码",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/9.jpg",
"cat": 8
},
{
"fieldsTitle": "电饭锅",
"key": "电饭锅",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/10.jpg",
"cat": 8
},
{
"fieldsTitle": "手机支架",
"key": "手机支架",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/11.jpg",
"cat": 8
},
{
"fieldsTitle": "剃须刀",
"key": "剃须刀",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/12.jpg",
"cat": 8
},
{
"fieldsTitle": "充电宝",
"key": "充电宝",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/13.jpg",
"cat": 8
},
{
"fieldsTitle": "手机配件",
"key": "手机配件",
"icon": "https://cdn.uviewui.com/uview/common/classify/7/14.jpg",
"cat": 8
}
]
},
{
"groupName": "母婴",
"item": [{
"fieldsTitle": "婴童服饰",
"key": "衣服",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/1.jpg",
"cat": 2
},
{
"fieldsTitle": "玩具乐器",
"key": "玩具乐器",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/2.jpg",
"cat": 2
},
{
"fieldsTitle": "尿不湿",
"key": "尿不湿",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/3.jpg",
"cat": 2
},
{
"fieldsTitle": "安抚牙胶",
"key": "安抚牙胶",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/4.jpg",
"cat": 2
},
{
"fieldsTitle": "奶瓶奶嘴",
"key": "奶瓶奶嘴",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/5.jpg",
"cat": 2
},
{
"fieldsTitle": "孕妈用品",
"key": "孕妈用品",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/6.jpg",
"cat": 2
},
{
"fieldsTitle": "宝宝用品",
"key": "宝宝用品",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/7.jpg",
"cat": 2
},
{
"fieldsTitle": "婴童湿巾",
"key": "湿巾",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/8.jpg",
"cat": 2
},
{
"fieldsTitle": "喂养洗护",
"key": "洗护",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/9.jpg",
"cat": 2
},
{
"fieldsTitle": "婴童鞋靴",
"key": "童鞋",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/10.jpg",
"cat": 2
},
{
"fieldsTitle": "口水巾",
"key": "口水巾",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/11.jpg",
"cat": 2
},
{
"fieldsTitle": "营养辅食",
"key": "营养",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/12.jpg",
"cat": 2
},
{
"fieldsTitle": "婴幼书籍",
"key": "书籍",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/13.jpg",
"cat": 2
},
{
"fieldsTitle": "婴儿车",
"key": "婴儿车",
"icon": "https://cdn.uviewui.com/uview/common/classify/8/14.jpg",
"cat": 2
}
]
},
{
"groupName": "箱包",
"item": [{
"fieldsTitle": "单肩包",
"key": "单肩包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/1.jpg",
"cat": 0
},
{
"fieldsTitle": "斜挎包",
"key": "斜挎包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/2.jpg",
"cat": 0
},
{
"fieldsTitle": "女包",
"key": "女包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/3.jpg",
"cat": 0
},
{
"fieldsTitle": "男包",
"key": "男包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/4.jpg",
"cat": 0
},
{
"fieldsTitle": "双肩包",
"key": "双肩包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/5.jpg",
"cat": 0
},
{
"fieldsTitle": "小方包",
"key": "小方包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/6.jpg",
"cat": 0
},
{
"fieldsTitle": "钱包",
"key": "钱包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/7.jpg",
"cat": 0
},
{
"fieldsTitle": "旅行箱包",
"key": "旅行箱包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/8.jpg",
"cat": 0
},
{
"fieldsTitle": "零钱包",
"key": "零钱包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/9.jpg",
"cat": 0
},
{
"fieldsTitle": "手提包",
"key": "手提包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/10.jpg",
"cat": 0
},
{
"fieldsTitle": "胸包",
"key": "胸包",
"icon": "https://cdn.uviewui.com/uview/common/classify/9/11.jpg",
"cat": 0
}
]
},
{
"groupName": "内衣",
"item": [{
"fieldsTitle": "袜子",
"key": "袜子",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/1.jpg",
"cat": 11
},
{
"fieldsTitle": "吊带背心",
"key": "吊带背心",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/2.jpg",
"cat": 11
},
{
"fieldsTitle": "抹胸",
"key": "抹胸",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/3.jpg",
"cat": 11
},
{
"fieldsTitle": "内裤",
"key": "内裤",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/4.jpg",
"cat": 11
},
{
"fieldsTitle": "文胸",
"key": "文胸",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/5.jpg",
"cat": 11
},
{
"fieldsTitle": "文胸套装",
"key": "文胸套装",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/6.jpg",
"cat": 11
},
{
"fieldsTitle": "打底塑身",
"key": "打底塑身",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/7.jpg",
"cat": 11
},
{
"fieldsTitle": "家居服",
"key": "家居服",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/8.jpg",
"cat": 11
},
{
"fieldsTitle": "船袜",
"key": "船袜",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/9.jpg",
"cat": 11
},
{
"fieldsTitle": "情侣睡衣",
"key": "情侣睡衣",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/10.jpg",
"cat": 11
},
{
"fieldsTitle": "丝袜",
"key": "丝袜",
"icon": "https://cdn.uviewui.com/uview/common/classify/10/11.jpg",
"cat": 11
}
]
},
{
"groupName": "文娱车品",
"item": [{
"fieldsTitle": "车市车品",
"key": "车市车品",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/1.jpg",
"cat": 7
},
{
"fieldsTitle": "办公文具",
"key": "办公文具",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/2.jpg",
"cat": 7
},
{
"fieldsTitle": "考试必备",
"key": "考试必备",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/3.jpg",
"cat": 7
},
{
"fieldsTitle": "笔记本",
"key": "笔记本",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/4.jpg",
"cat": 7
},
{
"fieldsTitle": "艺术礼品",
"key": "礼品",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/5.jpg",
"cat": 7
},
{
"fieldsTitle": "书写工具",
"key": "书写工具",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/6.jpg",
"cat": 7
},
{
"fieldsTitle": "车载电器",
"key": "车载电器",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/7.jpg",
"cat": 7
},
{
"fieldsTitle": "图书音像",
"key": "图书音像",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/8.jpg",
"cat": 7
},
{
"fieldsTitle": "画具画材",
"key": "画具画材",
"icon": "https://cdn.uviewui.com/uview/common/classify/11/9.jpg",
"cat": 7
}
]
},
{
"groupName": "配饰",
"item": [{
"fieldsTitle": "太阳镜",
"key": "太阳镜",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/1.jpg",
"cat": 0
},
{
"fieldsTitle": "皮带",
"key": "皮带",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/2.jpg",
"cat": 0
},
{
"fieldsTitle": "棒球帽",
"key": "棒球帽",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/3.jpg",
"cat": 0
},
{
"fieldsTitle": "手表",
"key": "手表",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/4.jpg",
"cat": 0
},
{
"fieldsTitle": "发饰",
"key": "发饰",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/5.jpg",
"cat": 0
},
{
"fieldsTitle": "项链",
"key": "项链",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/6.jpg",
"cat": 0
},
{
"fieldsTitle": "手饰",
"key": "手饰",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/7.jpg",
"cat": 0
},
{
"fieldsTitle": "耳环",
"key": "耳环",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/8.jpg",
"cat": 0
},
{
"fieldsTitle": "帽子丝巾",
"key": "帽子丝巾",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/9.jpg",
"cat": 0
},
{
"fieldsTitle": "眼镜墨镜",
"key": "眼镜墨镜",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/10.jpg",
"cat": 0
},
{
"fieldsTitle": "发带发箍",
"key": "发带发箍",
"icon": "https://cdn.uviewui.com/uview/common/classify/12/11.jpg",
"cat": 0
}
]
},
{
"groupName": "家装家纺",
"item": [{
"fieldsTitle": "家居饰品",
"key": "家居饰品",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/1.jpg",
"cat": 0
},
{
"fieldsTitle": "凉席",
"key": "凉席",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/2.jpg",
"cat": 0
},
{
"fieldsTitle": "背枕靠枕",
"key": "靠枕",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/3.jpg",
"cat": 0
},
{
"fieldsTitle": "床上用品",
"key": "床上用品",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/4.jpg",
"cat": 0
},
{
"fieldsTitle": "摆件",
"key": "摆件",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/5.jpg",
"cat": 0
},
{
"fieldsTitle": "四件套",
"key": "四件套",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/6.jpg",
"cat": 0
},
{
"fieldsTitle": "装饰品",
"key": "装饰品",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/7.jpg",
"cat": 0
},
{
"fieldsTitle": "卫浴用品",
"key": "卫浴",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/8.jpg",
"cat": 0
},
{
"fieldsTitle": "家居家装",
"key": "家具",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/9.jpg",
"cat": 0
},
{
"fieldsTitle": "蚊帐",
"key": "蚊帐",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/10.jpg",
"cat": 0
},
{
"fieldsTitle": "墙纸贴纸",
"key": "墙纸",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/11.jpg",
"cat": 0
},
{
"fieldsTitle": "空调被",
"key": "空调被",
"icon": "https://cdn.uviewui.com/uview/common/classify/13/12.jpg",
"cat": 0
}
]
},
{
"groupName": "户外运动",
"item": [{
"fieldsTitle": "游泳装备",
"key": "游泳",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/1.jpg",
"cat": 0
},
{
"fieldsTitle": "泳镜",
"key": "泳镜",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/2.jpg",
"cat": 0
},
{
"fieldsTitle": "户外装备",
"key": "户外",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/3.jpg",
"cat": 0
},
{
"fieldsTitle": "健身服饰",
"key": "健身",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/4.jpg",
"cat": 0
},
{
"fieldsTitle": "泳衣",
"key": "泳衣",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/5.jpg",
"cat": 0
},
{
"fieldsTitle": "瑜伽垫",
"key": "瑜伽垫",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/6.jpg",
"cat": 0
},
{
"fieldsTitle": "瑜伽用品",
"key": "瑜伽",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/7.jpg",
"cat": 0
},
{
"fieldsTitle": "健身装备",
"key": "健身",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/8.jpg",
"cat": 0
},
{
"fieldsTitle": "球迷用品",
"key": "球迷",
"icon": "https://cdn.uviewui.com/uview/common/classify/14/9.jpg",
"cat": 0
}
]
} }
] ]
...@@ -58,14 +58,14 @@ const install = (Vue, vm) => { ...@@ -58,14 +58,14 @@ const install = (Vue, vm) => {
return config; return config;
} }
function getCode(res){ function getCode(res){
const result = res.data // const result = res.data || res
let code // let code
if(res.hasOwnProperty('statusCode')){ // if(result.hasOwnProperty('statusCode')){
code = res.statusCode // code = res.statusCode
}else if(result.hasOwnProperty('code')){ // }else if(result.hasOwnProperty('code')){
code = result.code // code = result.code
} // }
return code return res.statusCode || res.code || res.data.statusCode || res.data.code
} }
function getMsg(res){ function getMsg(res){
res = res.data || res res = res.data || res
......
...@@ -52,14 +52,20 @@ ...@@ -52,14 +52,20 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.list { .list {
display: flex; display: flex;
flex-wrap: wrap;
.txt { .txt{
color: #666; color:#666;
padding: 10rpx; padding:10rpx 30rpx;
margin: 5rpx;
&.active { background: #F4F5F7;
background-color: red; border-radius: 10rpx;
color: #fff; display: flex;
flex-wrap: wrap;
line-height: 50rpx;
max-width: 48%;
&.active{
background-color: #2272FF;
color:#fff;
} }
} }
} }
......
<!-- ******************* 文件上传 ******************* --> <!-- ******************* 文件上传 ******************* -->
<template> <template>
<view class="file-box"> <view class="file-box">
<view class="u-flex" @click="selectUpload"> <!-- <view class="u-flex">
<view class="txt u-flex-1">{{item.fieldsTitle}}</view> <view class="txt u-flex-1">{{item.fieldsTitle}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon> <u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> </view> -->
<view class="pics u-flex u-flex-wrap"> <view class="pics u-flex u-flex-wrap">
<u-image class="pic" v-for="(item,index) in imgList" width="170rpx" height="170" :src="item.path" :key="index"></u-image> <view class="img-list" v-for="(item,index) in imgList" :key="index">
<!-- <u-image class="pic" v-for="item in 6" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image> --> <u-image class="pic" width="170" height="170" :src="item.path" @click.stop="prviewImage(item.path,index)"></u-image>
</view> <view class="icon-del-box" @click.stop="delFile(index)">
<u-popup v-model="maskShow" mode="center" width="500"> <view class="icon-del"></view>
<view class="upload-box u-p-30"> <view class="icon-del rotate"></view>
<view class="title">请选择图片</view>
<view class="u-flex u-row-between">
<view class="upload-item u-text-center" @click="uploadFile('photo')">
<u-image class="pic" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
相册
</view> </view>
<view class="upload-item u-text-center" @click="uploadFile">
<u-image class="pic" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
拍摄
</view> </view>
<view class="img-list" @click="choose">
<u-image class="pic" width="170rpx" height="170" @click="selectUpload" src="https://gitee.com/xuqu/uView/blob/master/static/uview/example/min_button.png"></u-image>
</view> </view>
<!-- <u-image class="pic" v-for="item in 6" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image> -->
</view> </view>
</u-popup> <u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet>
</view> </view>
</template> </template>
...@@ -38,7 +33,15 @@ ...@@ -38,7 +33,15 @@
filters:{}, filters:{},
data() { data() {
return { return {
maskShow:false maskShow:false,
list: [
{
text: '相册'
},
{
text: '拍照'
}
]
} }
}, },
computed: { computed: {
...@@ -53,6 +56,13 @@ ...@@ -53,6 +56,13 @@
// 弹窗展示 // 弹窗展示
this.maskShow = true this.maskShow = true
}, },
uploadSelect(index) {
if (index === 0) {
this.uploadFile('photo')
} else {
this.uploadFile()
}
},
async uploadFile(type){ async uploadFile(type){
const self = this const self = this
if(type&&type==='photo'){ if(type&&type==='photo'){
...@@ -60,6 +70,8 @@ ...@@ -60,6 +70,8 @@
let config = { let config = {
options:{ options:{
sourceType:['album'],//['album', 'camera'] sourceType:['album'],//['album', 'camera']
count: 5,
sizeType: ['compressed']
} }
} }
await this.chooseImage('qiniu',config) await this.chooseImage('qiniu',config)
...@@ -74,7 +86,17 @@ ...@@ -74,7 +86,17 @@
this.imgList.map(item=>{ this.imgList.map(item=>{
dataValue.push(item.key) dataValue.push(item.key)
}) })
console.log(this.imgList)
this.valueChange(dataValue) this.valueChange(dataValue)
},
prviewImage(url, index) {
uni.previewImage({
urls: [url],
current: index
});
},
delFile(index) {
this.imgList.splice(index, 1)
} }
} }
} }
...@@ -87,6 +109,42 @@ ...@@ -87,6 +109,42 @@
margin-right: 0; margin-right: 0;
} }
} }
.img-list {
position: relative;
margin: 8rpx;
border: 1px solid #eee;
width: 170rpx;
height: 170rpx;
.icon-del-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
align-items: center;
justify-content: center;
position: absolute;
top: 10rpx;
right: 10rpx;
height: 40rpx;
width: 40rpx;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2;
transform: rotate(-45deg);
}
.icon-del {
width: 30rpx;
height: 4rpx;
background-color: #fff;
border-radius: 2px;
}
.rotate {
position: absolute;
transform: rotate(90deg);
}
}
// .list { // .list {
// display: flex; // display: flex;
......
<!-- ******************* 输入框 ******************* --> <!-- ******************* 输入框 ******************* -->
<template> <template>
<view> <view>
<u-input v-model="dataValue" @input="valueChange" :type="type" /> <u-input :type="type" class="input-item" v-model="dataValue" @input="valueChange" :border="true" placeholder="请输入" />
</view> </view>
</template> </template>
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
}, },
computed: { computed: {
type() { type() {
if (this.item && this.item.fieldsType == 'password') { console.log(this.item)
if (this.item && this.item.fieldsType == 'password' || this.item.fieldsType == 'textarea') {
return this.item.fieldsType return this.item.fieldsType
} else { } else {
return 'text' return 'text'
...@@ -30,5 +31,8 @@ ...@@ -30,5 +31,8 @@
} }
</script> </script>
<style> <style scoped>
.input-item{
background: #F4F5F7;
}
</style> </style>
<!-- ******************* 定位 ******************* --> <!-- ******************* 定位 ******************* -->
<template> <template>
<view>
<view class="list u-flex u-row-between"> <view class="list u-flex u-row-between">
<text class="required" v-if="item.required">*</text> <image class="item-image" :src="mixingImage" v-if="item.required"></image>
<view class="u-m-r-20">{{item.fieldsTitle}}</view> <view class="u-m-r-20">{{item.fieldsTitle}}</view>
<view class="u-flex-1">{{valueTxt || ''}}</view> <!-- <u-button type="primary" size="mini" @click="$u.debounce(getLocation,1000)">自动定位</u-button> -->
<u-button type="primary" size="mini" @click="$u.debounce(getLocation,1000)">默认按钮</u-button> <view class="u-flex-1 location-name">
<u-icon name="map" color="#2979ff" size="30"></u-icon>自动定位
</view>
</view>
<view class="u-flex-1 location">{{valueTxt || '正在获取中...'}}</view>
</view> </view>
</template> </template>
...@@ -27,10 +32,15 @@ ...@@ -27,10 +32,15 @@
str = '经度:'+dataValue[0]+','+'维度:'+dataValue[1] str = '经度:'+dataValue[0]+','+'维度:'+dataValue[1]
} }
return str return str
},
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
} }
}, },
watch: {}, watch: {},
mounted() {}, created() {
this.getLocation()
},
methods: { methods: {
getLocation() { getLocation() {
let self = this let self = this
...@@ -60,4 +70,17 @@ ...@@ -60,4 +70,17 @@
line-height: 40rpx; line-height: 40rpx;
color: #fa3534; color: #fa3534;
} }
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
.location-name {
color: #2272FF;
text-align: right;
}
.location {
background: #F4F5F7;
padding: 10rpx;
}
</style> </style>
<!-- ******************* 多个输入框 ******************* --> <!-- ******************* 多个输入框 ******************* -->
<template> <template>
<view class="u-flex u-flex-wrap"> <view class="u-flex u-flex-wrap">
<u-input class="input-item" v-for="(item,index) in inputOptions" v-model="item.value" @input="val=>{getValue(item)}" type="text" :key="index"/> <u-input class="input-item" v-for="(item,index) in inputOptions" v-model="item.value" @input="val=>{getValue(item)}" type="text" :key="index" :border="true" :placeholder="item.placeholder" />
</view> </view>
</template> </template>
...@@ -40,8 +40,10 @@ ...@@ -40,8 +40,10 @@
} }
</script> </script>
<style> <style scoped>
.input-item{ .input-item{
width:33.3%; width: 31%;
margin: 5rpx;
background: #F4F5F7;
} }
</style> </style>
...@@ -34,11 +34,20 @@ ...@@ -34,11 +34,20 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.list{ .list{
display: flex; display: flex;
flex-wrap: wrap;
.txt{ .txt{
color:#666; color:#666;
padding:10rpx; padding:10rpx 30rpx;
margin: 5rpx;
background: #F4F5F7;
border-radius: 10rpx;
display: flex;
flex-wrap: wrap;
line-height: 50rpx;
text-align: center;
max-width: 48%;
&.active{ &.active{
background-color: red; background-color: #2272FF;
color:#fff; color:#fff;
} }
} }
......
<!-- ******************* 扫码 ******************* --> <!-- ******************* 扫码 ******************* -->
<template> <template>
<view class=""> <view class="">
<view class="u-flex">
请输入:<u-input class="u-flex-1" v-model="dataValue" @input="valueChange" type="text" />
</view>
<view class="u-flex" @click="scanCode"> <view class="u-flex" @click="scanCode">
<view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view> <view class="txt u-flex-1">扫描二维码(仅挚达充电桩可扫描)</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon> <u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view> </view>
<view class="u-flex">
<u-input class="u-flex-1 input-item" v-model="dataValue" @input="valueChange" type="text" />
</view>
</view> </view>
</template> </template>
<script> <script>
...@@ -63,4 +62,7 @@ ...@@ -63,4 +62,7 @@
line-height: 40rpx; line-height: 40rpx;
color: #fa3534; color: #fa3534;
} }
.input-item{
background: #F4F5F7;
}
</style> </style>
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
keys: [], keys: [],
token: '', token: '',
product: '', product: '',
allImages: []
} }
}, },
created(e) { created(e) {
...@@ -37,10 +38,10 @@ ...@@ -37,10 +38,10 @@
console.log(getApp().globalData.photo.currentItem) console.log(getApp().globalData.photo.currentItem)
const product = app.globalData.photo.product const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}` this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
// if(app.globalData.photo.currentItem) { if(app.globalData.photo.currentItem) {
// // 获取规格Id // 获取规格Id
// this.standardId = app.globalData.photo.currentItem._id this.standardId = app.globalData.photo.currentItem._id
// } }
getApp().trackPage('照片预览页') getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath const globalTempPath = getApp().globalData.photo.tempPath
...@@ -50,7 +51,6 @@ ...@@ -50,7 +51,6 @@
// if(e.standardId) { // if(e.standardId) {
// this.standardId = e.standardId // this.standardId = e.standardId
// } // }
console.log(this.files)
this.token = getApp().globalData.token this.token = getApp().globalData.token
}, },
methods: { methods: {
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
}) })
} }
} }
photo.allImages.unshift(photo.tempPath.mixWater)
if(photo.currentItem){ if(photo.currentItem){
photo.currentItem.imageList.unshift(photo.tempPath.mixWater) photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
} }
...@@ -139,7 +140,6 @@ ...@@ -139,7 +140,6 @@
}, },
submitFile() { submitFile() {
let self = this let self = this
if(self.keys.length) { if(self.keys.length) {
for (let s of self.keys) { for (let s of self.keys) {
self.$u.api.saveImage({ self.$u.api.saveImage({
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
getApp().trackPage('水印设置页') getApp().trackPage('水印设置页')
const globalData = getApp().globalData const globalData = getApp().globalData
this.icon_close_new = globalData.icon_close_new this.icon_close_new = globalData.icon_close_new
this.systemId = globalData.photo.product.systemId this.systemId = globalData.photo.currentItem.systemId
this.getItemList() this.getItemList()
}, },
methods: { methods: {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
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 @click="changeType(3)" class="icon" mode="aspectFit" <cover-image v-if="currentItem.system_id" @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>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
</view> </view>
</view> </view>
</view> </view>
<photo-preview v-if="showType === 2" @changeType="changeType" @finish="goBack" /> <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" />
</view> </view>
</template> </template>
...@@ -57,16 +57,15 @@ ...@@ -57,16 +57,15 @@
import setting from '@/components/photo/setting.vue' import setting from '@/components/photo/setting.vue'
export default { export default {
props: { props: {
currentItem: { // 拍照要求,示意图,system_id, standardId currentItem: { // 对应的规范item
type: Object,
default () { default () {
return { return {
images: [ _id: '', // 规格ID
'https://qn-static.banshouhui.com/live_mark.png', system_id: '', // 系统ID
'https://qn-static.banshouhui.com/live_mark.png', brand_id: '', // 品牌ID
'https://qn-static.banshouhui.com/live_mark.png' classify_id: '', // 分类ID
], images: [], // 拍照要求示意图
main_point: [] main_point: [] // 要点
} }
} }
} }
...@@ -112,13 +111,14 @@ ...@@ -112,13 +111,14 @@
created(e) { created(e) {
const photo = getApp().globalData.photo const photo = getApp().globalData.photo
getApp().trackPage('拍照页') getApp().trackPage('拍照页')
photo.allImages = []
// this.ctx = uni.createCameraContext(); // this.ctx = uni.createCameraContext();
this.updateTime() this.updateTime()
this.getLocation() this.getLocation()
this.getMarkPath() this.getMarkPath()
this.initData() this.initData()
//this.currentItem = photo.currentItem photo.currentItem = this.currentItem
}, },
computed: { computed: {
titleTxt() { titleTxt() {
...@@ -179,6 +179,11 @@ ...@@ -179,6 +179,11 @@
uni.showTabBar() uni.showTabBar()
this.$emit('close') this.$emit('close')
}, },
finish() {
uni.showTabBar()
const photo = getApp().globalData.photo
this.$emit('close', photo.allImages)
},
changeType(type) { changeType(type) {
this.showType = type this.showType = type
}, },
......
## 相机组件使用说明
```
该组件仅用于拍照后返回图片,与业务不关联,目前最多一次可以拍10张图片
```
### 因为相机组件需要全屏展示,所以加载该组件需要在当前页面隐藏顶部导航栏和底部的TabBar
```
uni.hideTabBar()
```
### 然后加上自定义导航栏,通过切换状态takeStatus来显示和隐藏
```
<u-navbar v-if="!takeStatus" :is-back="false" :title-size="26" title-color="#000" title="我的"></u-navbar>
```
## API
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :-: | :-: | :-: | :-: | :-: |
| currentItem | Object | - | - | 对应的规范数据,用于获取示意图和水印,以及保存图片所需的ID **格式见下文** |
### currentItem 格式
```json
{
_id: '', // 保存图片时需要
system_id: '', // 获取水印列表需要
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: [] // 拍照要求
... // 列表其他字段也可传进来,可能会用到
}
```
### Events
|事件称名 |说明 | 返回值 |
|:-: |:-: | :-: |
|@close | 关闭相机或完成拍照的时候触发 | 已拍照完成的图片数组|
## 组件用法
### 基础用法
```html
<u-navbar v-if="!takeStatus" :is-back="false" :title-size="26" title-color="#000" title="我的"></u-navbar>
<view @click="take">打开相机</view>
<take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo>
```
```javascript
import takePhoto from '@/components/take/index.vue'
export default {
components: {
'take-photo': takePhoto
},
data() {
return {
takeStatus: false,
testData: {}
}
},
methods:{
// 打开相机
take() {
uni.hideTabBar() // 打开时隐藏TabBar
this.takeStatus = true
},
// 拍照完成或关闭相机
closeTake(images) {
console.log(images)
this.takeStatus = false
}
}
}
```
\ No newline at end of file
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
{ {
"path": "pages/order/complete", "path": "pages/order/complete",
"style": { "style": {
"navigationBarTitleText": "订单-完工配置" "navigationBarTitleText": "订单-完工配置",
"navigationBarBackgroundColor": "#2272FF",
"navigationBarTextStyle": "white"
} }
},{ },{
"path": "pages/order/feedback", "path": "pages/order/feedback",
...@@ -206,14 +208,62 @@ ...@@ -206,14 +208,62 @@
"navigationStyle": "custom"// 隐藏系统导航栏 "navigationStyle": "custom"// 隐藏系统导航栏
} }
},
{
"path": "pages/photo/index",
"style": {
"navigationBarTitleText": "拍照小工具",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7"
}
},
{
"path": "pages/photo/setting",
"style": {
"navigationBarTitleText": "水印设置",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7"
// "navigationBarBackgroundColor": "#333333",
// "navigationBarTextStyle": "#FFFFFF",
// "disableScroll": true
}
},
{
"path": "pages/photo/take",
"style": {
"navigationStyle":"custom",
"navigationBarTitleText": "拍照",
"navigationBarBackgroundColor": "#333333",
"navigationBarTextStyle": "#FFFFFF",
"disableScroll": true
}
},
{
"path": "pages/photo/preview",
"style": {
"navigationBarTitleText": "照片预览",
"navigationBarBackgroundColor":"#333333",
"backgroundColor":"#FFFFFF",
"navigationBarTextStyle":"white"
}
},
{
"path": "pages/photo/list",
"style": {
"navigationBarTitleText": "规范展示",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7"
} }
}
,{ ,{
"path" : "pages/order/search", "path" : "pages/order/search",
"style" : "style" :
{ {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationBarBackgroundColor": "#F4F5F7", "enablePullDownRefresh": false,
"enablePullDownRefresh": false "navigationBarBackgroundColor":"#F4F5F7"
} }
} }
...@@ -269,6 +319,11 @@ ...@@ -269,6 +319,11 @@
"path": "pages/order/index", //启动页面,必选 "path": "pages/order/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到 "query": "" //启动参数,在页面的onLoad函数里面得到
}, },
{
"name": "拍照小工具", //模式名称
"path": "pages/photo/index", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
},
{ {
"name": "工单搜索", "name": "工单搜索",
"path": "pages/order/search", "path": "pages/order/search",
......
...@@ -163,6 +163,8 @@ ...@@ -163,6 +163,8 @@
}; };
await app.getBaseInfo(self, callBack); await app.getBaseInfo(self, callBack);
this.orderList = []
this.messageList = []
// 加载消息列表 // 加载消息列表
self.loadMessageList(); self.loadMessageList();
self.loadOrderList(); self.loadOrderList();
...@@ -184,7 +186,6 @@ ...@@ -184,7 +186,6 @@
}, },
loadOrderList() { loadOrderList() {
console.log('-----------准备加载推荐列表-----------') console.log('-----------准备加载推荐列表-----------')
return
let self = this; let self = this;
// 加载订单列表 // 加载订单列表
self.search.token = self.vuex_token; self.search.token = self.vuex_token;
...@@ -192,7 +193,7 @@ ...@@ -192,7 +193,7 @@
uni.stopPullDownRefresh() // 结束下拉刷新 uni.stopPullDownRefresh() // 结束下拉刷新
if (res.code == 200) { if (res.code == 200) {
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
self.orderList.push().apply(res.data); self.orderList.push(...res.data);
} }
} else { } else {
console.log(res.message, "初始化订单列表异常"); console.log(res.message, "初始化订单列表异常");
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</u-cell-group> </u-cell-group>
</view> </view>
</view> </view>
<take-photo type="test" v-if="takeStatus" @close="closeTake"></take-photo> <take-photo v-if="takeStatus" :currentItem="testData" @close="closeTake"></take-photo>
</view> </view>
</template> </template>
...@@ -45,7 +45,19 @@ ...@@ -45,7 +45,19 @@
return { return {
pic:'https://uviewui.com/common/logo.png', pic:'https://uviewui.com/common/logo.png',
show:true, show:true,
takeStatus: false takeStatus: false,
testData: {
_id: '1', // 规格ID
system_id: '2', // 系统ID
brand_id: '3', // 品牌ID
classify_id: '4', // 分类ID
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: [] // 要点
}
} }
}, },
computed: { computed: {
...@@ -68,7 +80,8 @@ ...@@ -68,7 +80,8 @@
uni.hideTabBar() uni.hideTabBar()
this.takeStatus = true this.takeStatus = true
}, },
closeTake() { closeTake(img) {
console.log(img)
this.takeStatus = false this.takeStatus = false
} }
} }
......
<template> <template>
<view class="u-wrap"> <view class="u-wrap">
<view class="u-search-box"> <u-tabs-swiper ref="tabs" :current="tabIndex" :list="list" :is-scroll="false" bg-color="#2272FF" inactive-color="#a6c6ff" active-color="#fff" height="120"></u-tabs-swiper>
<view class="u-search-inner">
<u-icon name="search" color="#909399" :size="28"></u-icon>
<text class="u-search-text">搜索</text>
</view>
</view>
<view class="u-menu-wrap"> <view class="u-menu-wrap">
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop" <scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop"
:scroll-into-view="itemId"> :scroll-into-view="itemId">
...@@ -23,9 +18,10 @@ ...@@ -23,9 +18,10 @@
<view class="title">{{groupItem.groupName}}</view> <view class="title">{{groupItem.groupName}}</view>
<view class="class-bd"> <view class="class-bd">
<u-form-item v-for="(item,itemIndex) in groupItem.item" :key="itemIndex" <u-form-item v-for="(item,itemIndex) in groupItem.item" :key="itemIndex"
label-position="top" :prop="item.fieldsName"> label-position="top" :prop="item.fieldsName" :border-bottom="false">
<view class="label" v-if="item.fieldsType!=='location'"> <view class="label" v-if="item.fieldsType!=='location'">
<text class="required" v-if="item.required">*</text> <!-- <text class="required" v-if="item.required">*</text> -->
<image class="item-image" :src="mixingImage" v-if="item.required"></image>
{{item.fieldsTitle}} {{item.fieldsTitle}}
</view> </view>
<template v-if="item.fieldsType"> <template v-if="item.fieldsType">
...@@ -96,6 +92,18 @@ ...@@ -96,6 +92,18 @@
export default { export default {
data() { data() {
return { return {
list: [
{
name: '基础信息'
},
{
name: '勘察信息'
},
{
name: '安装信息'
}
],
tabIndex: 0,
scrollTop: 0, //tab标题的滚动条位置 scrollTop: 0, //tab标题的滚动条位置
oldScrollTop: 0, oldScrollTop: 0,
current: 0, // 预设当前项的值 current: 0, // 预设当前项的值
...@@ -163,7 +171,12 @@ ...@@ -163,7 +171,12 @@
this.getMenuItemTop() this.getMenuItemTop()
}, },
updated() { updated() {
console.log(this.form.name, 'form.name') //console.log(this.form.name, 'form.name')
},
computed: {
mixingImage() {
return process.uniEnv.qn_base_url + 'mixing.png'
}
}, },
methods: { methods: {
// 字段的值更新 // 字段的值更新
...@@ -193,7 +206,7 @@ ...@@ -193,7 +206,7 @@
// 将fieldType类型统一转换为公共组件判定类型 // 将fieldType类型统一转换为公共组件判定类型
let formType = '' let formType = ''
type = type.toLocaleLowerCase() type = type.toLocaleLowerCase()
console.log(type,'type') //console.log(type,'type')
switch (type) { switch (type) {
case 'text': case 'text':
case 'password': case 'password':
...@@ -207,6 +220,9 @@ ...@@ -207,6 +220,9 @@
case 'select': case 'select':
formType = 'select' formType = 'select'
break break
case 'radio':
formType = 'radio'
break
case 'checkbox': case 'checkbox':
formType = 'checkbox' formType = 'checkbox'
break break
...@@ -226,11 +242,11 @@ ...@@ -226,11 +242,11 @@
case 'time': case 'time':
formType = 'time' formType = 'time'
break break
// case 'file': case 'file':
// formType = 'XhFiles' formType = 'XhFiles'
// break break
} }
console.log(formType,'formType') //console.log(formType,'formType')
return formType return formType
}, },
// ------------------------- 以下方法为展示滚动切换 ------------------------- // ------------------------- 以下方法为展示滚动切换 -------------------------
...@@ -356,6 +372,13 @@ ...@@ -356,6 +372,13 @@
} }
.class-item { .class-item {
padding: 50rpx;
.title {
font-weight: bold;
font-size: 32rpx;
line-height: 32rpx;
color: #333;
}
.label { .label {
color: #333; color: #333;
font-size: 28rpx; font-size: 28rpx;
...@@ -368,6 +391,12 @@ ...@@ -368,6 +391,12 @@
line-height: 40rpx; line-height: 40rpx;
color: #fa3534; color: #fa3534;
} }
.item-image {
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
} }
// ---------------------------- 表单样式end ---------------------------- // ---------------------------- 表单样式end ----------------------------
...@@ -426,20 +455,20 @@ ...@@ -426,20 +455,20 @@
.u-tab-item-active { .u-tab-item-active {
position: relative; position: relative;
color: #000; color: #2272FF;
font-size: 30rpx; font-size: 30rpx;
font-weight: 600; font-weight: 600;
background: #fff; background: #fff;
} }
.u-tab-item-active::before { // .u-tab-item-active::before {
content: ""; // content: "";
position: absolute; // position: absolute;
border-left: 4px solid $u-type-primary; // border-left: 4px solid $u-type-primary;
height: 32rpx; // height: 32rpx;
left: 0; // left: 0;
top: 39rpx; // top: 39rpx;
} // }
.u-tab-view { .u-tab-view {
height: 100%; height: 100%;
......
...@@ -79,34 +79,49 @@ ...@@ -79,34 +79,49 @@
<!-- 过程反馈 --> <!-- 过程反馈 -->
<view class="left"> <view class="left">
<view v-show="allowFeedback" @click="clickFeedback" class="button"> <view v-show="allowFeedback" @click="clickFeedback" class="button">
<text style="font-size: small;">过程反馈</text> 过程反馈
</view> </view>
</view> </view>
<!--接单,抢单,已被抢, 预约 ,签到 ,去完工 :class="appoint-btn" v-show="buttonShow(btn)"--> <!--接单,抢单,已被抢, 预约 ,签到 ,去完工 timestampDiff(order.currentOverTime)>0 -->
<view class="center"> <view class="center">
<view> <view>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
<view v-if="showCenterBtn" @click="handleBtn" class="button" :class="centerButtonClass"> <view v-if="showCenterBtn" @click="handleBtn" class="button" :class="btnClass">
{{ centerButtonText }} {{ centerButtonText }}
</view> </view>
<view v-show="order.currentOverTime > 0" >
<view class="tag">{{order.currentOverTime * 1000 > new Date().getTime()?'剩':'超'}}</view>
<u-count-down
:timestamp="timestampDiff(order.currentOverTime)"
font-size="30"
:ref="'uCountDown'"
@change="timeOutChange(order.currentOverTime)" >
</u-count-down>
</view>
</view> </view>
<!-- 异常预约 ,现场拍照 这里是调用拍照的两个组件--> <!-- 异常预约 ,现场拍照 这里是调用拍照的两个组件-->
<view class="right"> <view class="right">
<view v-show="allowFeedback" @click="clickFeedback" class="button"></view> <view v-if="errorSignIn" @click="take" class="button">
<text>异常签到</text>
</view>
<view v-if="scenePhoto" @click="scenePhotoClick" class="button">
<text>现场拍照</text>
</view>
</view> </view>
</view> </view>
<take-photo type="test" v-if="takeStatus" @close="closeTake"></take-photo>
</view> </view>
</template> </template>
<script> <script>
import appointTime from '@/components/appoint/appoint-time.vue' import appointTime from '@/components/appoint/appoint-time.vue'
import { import takePhoto from '@/components/take/index.vue'
getQueryString
} from '@/common/util.js'
export default { export default {
components: { components: {
appointTime appointTime,
'take-photo': takePhoto
}, },
data() { data() {
return { return {
...@@ -127,10 +142,14 @@ ...@@ -127,10 +142,14 @@
centerButtonText: '', centerButtonText: '',
orderRecords: [], orderRecords: [],
method: null, method: null,
allowFeedbackStatus: [30, 31], // 过程反馈状态列表
showCenterBtn: false, showCenterBtn: false,
showTimeSelect: false, showTimeSelect: false,
submitType: "" submitType: '',
nextUrl:'',
btnClass:'appoint-btn',
takeStatus:false,
errorSignIn:false,
scenePhoto: false
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -143,8 +162,8 @@ ...@@ -143,8 +162,8 @@
} }
this.loadOrderDetail() this.loadOrderDetail()
this.loadOrderRecord() this.loadOrderRecord()
this.getLocation()
}, },
created(option) {},
computed: { computed: {
phoneIcon() { phoneIcon() {
return process.uniEnv.qn_base_url + 'icon/dianhua-1@2x.png' return process.uniEnv.qn_base_url + 'icon/dianhua-1@2x.png'
...@@ -158,6 +177,21 @@ ...@@ -158,6 +177,21 @@
} }
}, },
methods: { methods: {
scenePhotoClick() { // 跳转拍照小程序
uni.navigateTo({
url: 'pages/photo/list?orderId='+this.order.orderId+'&brandId='+this.order.lianbaoBrandId+'&brand='+this.order.brandName
+'&systemId='+this.order.partnerCompanyId+'&classifyId='+this.order.categoryId
})
},
take() {
uni.hideTabBar()
this.takeStatus = true
},
closeTake() {
this.takeStatus = false
// 获取返回的图片 ,如果返回的图片存在则直接异常签约,成功后跳转到去完工页面,
},
loadOrderDetail() { // 获取工单详情 loadOrderDetail() { // 获取工单详情
let self = this let self = this
let timestamp = new Date().getTime(); let timestamp = new Date().getTime();
...@@ -176,7 +210,6 @@ ...@@ -176,7 +210,6 @@
// self.method =self.operationDoing[self.order.operationType].action; // self.method =self.operationDoing[self.order.operationType].action;
// // 根据工单的状态确定是否需要过程反馈 // // 根据工单的状态确定是否需要过程反馈
// self.allowFeedback = self.allowFeedbackStatus.indexOf(self.order.orderStatus)>0 // self.allowFeedback = self.allowFeedbackStatus.indexOf(self.order.orderStatus)>0
} else { } else {
console.log(res.message, "获取订单详情失败!"); console.log(res.message, "获取订单详情失败!");
} }
...@@ -189,7 +222,6 @@ ...@@ -189,7 +222,6 @@
}; };
self.$u.api.listOrderRecord(param).then((res) => { self.$u.api.listOrderRecord(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log("===========", res.data)
self.orderRecords = res.data self.orderRecords = res.data
} else { } else {
console.log(res.message, "获取订单详情失败!"); console.log(res.message, "获取订单详情失败!");
...@@ -231,11 +263,13 @@ ...@@ -231,11 +263,13 @@
this.centerButtonText = "接单" this.centerButtonText = "接单"
// 已派单的时显示拒单按钮 // 已派单的时显示拒单按钮
this.allowRejection = true this.allowRejection = true
this.submitType = "orderAccept"
} else if (orderStatus < 31 && orderBusinessType === '订单池') { } else if (orderStatus < 31 && orderBusinessType === '订单池') {
// 抢单 // 抢单
this.centerButton = "appoint1" this.centerButton = "appoint1"
this.centerButtonText = "抢单" this.centerButtonText = "抢单"
this.showCenterBtn = true this.showCenterBtn = true
this.submitType = "orderGan"
} else if (orderStatus === 31 && !this.order.appointmentDatetime) { } else if (orderStatus === 31 && !this.order.appointmentDatetime) {
// 预约 // 预约
this.centerButton = "appoint2" this.centerButton = "appoint2"
...@@ -251,40 +285,142 @@ ...@@ -251,40 +285,142 @@
this.allowFeedback = true this.allowFeedback = true
this.showCenterBtn = true this.showCenterBtn = true
this.submitType = "maintainWorkerCheckin" this.submitType = "maintainWorkerCheckin"
this.errorSignIn = true
} else if (orderStatus > 31 && orderStatus < 80) { } else if (orderStatus > 31 && orderStatus < 80) {
// 完工 // 完工
this.centerButton = "appoint4" this.centerButton = "filish"
this.centerButtonText = "去完工" this.centerButtonText = "去完工"
this.allowFeedback = true this.allowFeedback = true
this.showCenterBtn = true this.showCenterBtn = true
this.scenePhoto = true
} else {} } else {}
}, },
handleBtn() { handleBtn() {
if(this.centerButton === "filish"){
this.filish()
return
}
if(!this.submitType){
return;
}
const data = {} const data = {}
// 不同请求类型传递不同数据 // 不同请求类型传递不同数据
if (this.submitType === 'maintainWorkerCheckin') { if (this.submitType === 'maintainWorkerCheckin') { // 签到
// 检查见到距离是否符合
if(this.getDistance(this.order.contactAddressLatitud,this.order.contactAddressLongitud)>3){
this.$refs.uToast.show({
title: '签到失败,请点击异常签到处理或联系客服',
type: 'error'
})
return
}
data.remark = "123" data.remark = "123"
data.revert = true data.revert = true
} }else if(this.submitType === 'orderAccept'){ // 接单
this.$u.api[this.submitType](data, 123).then(res => { data.orderId = this.order.orderId
if (res.data.code === 200) { }else if(this.submitType === 'orderGan'){ // 抢单
data.orderId = this.order.orderId
}
this.$u.api[this.submitType](data, this.order.orderId).then(res => {
if ((res.data.code!==undefined && res.data.code === 200)
|| (res.code!==undefined && res.code === 200) ) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: this.centerButtonText + '操作成功', title: this.centerButtonText + '操作成功',
type: 'success', type: 'success',
url: 'pages/order/feedback', url: 'pages/order/detail',
params: { params: {
id: 1, id: 1,
menu: 3 menu: 2
} }
}) })
} else { } else {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: res.data.message, title: res.data.message!==undefined ? res.data.message:res.message,
// 如果不传此type参数,默认为default,也可以手动写上 type: 'default' // 如果不传此type参数,默认为default,也可以手动写上 type: 'default'
type: 'error' type: 'error',
callback: res.data.message==='该工单已被抢'?this.isGan():''
}) })
} }
}) })
},
isGan(){
this.centerButtonText = "已被抢"
this.submitType = ""
this.btnClass='isGan-btn'
},
clickFeedback(){
// 过程反馈
uni.navigateTo({
url: 'pages/order/feedback?orderId='+this.order.orderId
})
},
filish(){
// 去完工
uni.navigateTo({
url: 'pages/order/complete?orderId='+this.order.orderId
})
},
/**
* 获取当前位置的经纬度
*/
getLocation() {
let self = this
const dataValue = this.dataValue || []
const waterInfo = this.waterInfo
uni.getLocation({
type: 'gcj02',
success: function(res) {
dataValue.push(res.longitude)
dataValue.push(res.latitude)
self.dataValue = dataValue
},
fail(err) {
}
});
},
getDistance(Latitud, Longitud){
return this.distance(Latitud,Longitud,this.dataValue[0],this.dataValue[1])
},
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离
* @param float $lon1 经度
* @param float $lat1 维度
* @param float $lon2 经度
* @param float $lat2 维度
* @return float 浮点数
*/
distance(la1, lo1, la2, lo2) {
var La1 = la1 * Math.PI / 180.0;
var La2 = la2 * Math.PI / 180.0;
var La3 = La1 - La2;
var Lb3 = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2),Math.cos(La1) * Math.cos(La2) * Math.pow(Math.sin(Lb3 / 2), 2)));
s = s * 6378.137;//地球半径
s = Math.round(s * 10000) / 10000;
// console.log("计算结果",s,'KM');
return s?s.toFixed(2):0;
},
timestampDiff(currentOverTime){ // 计算超时时间
if(!currentOverTime){
return 0
}
var nowTime = new Date(); // 当前时间
if(nowTime.getTime() > currentOverTime*1000){
var diff = nowTime.getTime() - (currentOverTime*1000);
}else{
var diff = (currentOverTime*1000) - nowTime.getTime();
}
return diff;
},
timeOutChange(currentOverTime){
let self = this
var nowTime = new Date(); // 当前时间
if(nowTime.getTime() > currentOverTime*1000){
this.btnClass='timeOut-btn'
self.$refs['uCountDown'].seconds += 2
}
} }
} }
}; };
...@@ -451,6 +587,10 @@ ...@@ -451,6 +587,10 @@
height: 100rpx; height: 100rpx;
background: #929CB8; background: #929CB8;
border-radius: 100rpx; border-radius: 100rpx;
font-size: 25rpx;
font-weight: bold;
align-items: center;
display: flex;
} }
} }
...@@ -477,13 +617,13 @@ ...@@ -477,13 +617,13 @@
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3); box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
} }
.sign-timeout-btn { .isGan-btn {
background: #FA5A49; background: #93a7a6;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3); box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
} }
.appoint-btn { .timeOut-btn {
background: #2272FF; background: #ff0000;
box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3); box-shadow: 2px 2px 20px 0px rgba(34, 114, 255, 0.3);
} }
} }
...@@ -495,8 +635,12 @@ ...@@ -495,8 +635,12 @@
.button { .button {
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
background: #12CF84; background: #d99100;
border-radius: 100rpx; border-radius: 100rpx;
font-size: 25rpx;
font-weight: bold;
align-items: center;
display: flex;
} }
} }
} }
......
...@@ -4,33 +4,31 @@ ...@@ -4,33 +4,31 @@
<view class="tools-box"> <view class="tools-box">
<view class="search-sub"> <view class="search-sub">
<u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white" <u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white"
inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange"> inactive-color="#666" button-color="#2272FF" border-radius="36" @change="sectionChange" height="72"
bold>
</u-subsection> </u-subsection>
</view> </view>
<view class="search-btn"> <view class="search-btn" @click="handleClickSearch">
<u-icon name="search" color="#666" size="32"></u-icon> <image class="search-image" mode="widthFix" :src="sousuoImage"></image>
<text class="search-btn-text">搜订单</text> <text class="search-btn-text">搜订单</text>
</view> </view>
</view> </view>
<view class="u-tabs-box" v-show="curNow == 0"> <view class="u-tabs-box" v-show="curNow == 0">
<u-tabs-swiper activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4" bar-width="44" <u-tabs height="66" activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4" bar-width="44"
:offset="[-1,10]" ref="tabs" :list="list" count="total" :current="current" @change="change" :offset="[0,0]" :list="list" count="total" :current="current" @change="change"
:is-scroll="false" swiperWidth="750"></u-tabs-swiper> :is-scroll="false" font-size="28" bold></u-tabs>
</view> </view>
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" <view class="tab-view">
@animationfinish="animationfinish"> <!-- <swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind"> -->
<swiper-item class="swiper-item" v-for="(res, ind) in orderList" :key="ind">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring> <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring>
<view class="page-box"> <view v-for="(item, index) in orderList" :key="item.orderId">
<view v-for="(item, index) in res" :key="item.orderId">
<OrderCell :orderData="item" :orderType="orderType" :location="dataValue" <OrderCell :orderData="item" :orderType="orderType" :location="dataValue"
@click="handleClick(item)" @action="handleAction(item)"> </OrderCell> @click="handleClick(item)" @action="handleAction(item)"> </OrderCell>
</view> </view>
<u-loadmore :status="loadStatus[ind]" bgColor="#F4F5F7"></u-loadmore> <u-loadmore :status="loadStatus" bgColor="#F4F5F7"></u-loadmore>
</view>
</scroll-view> </scroll-view>
</swiper-item> <!-- </swiper-item> -->
</swiper> </view>
<!-- </view> --> <!-- </view> -->
</TabBarPage> </TabBarPage>
...@@ -48,8 +46,6 @@ ...@@ -48,8 +46,6 @@
return { return {
showSview: true, showSview: true,
curNow: 0, curNow: 0,
timestamp: 1000,
triggered: false,
pageNumber: 0, pageNumber: 0,
pageSize: 10, pageSize: 10,
//waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish //waitAccept、waitAppointment、waitCheckIn、waitFinish、exception、finish
...@@ -61,8 +57,7 @@ ...@@ -61,8 +57,7 @@
4: 'exception', 4: 'exception',
5: 'finish' 5: 'finish'
}, },
orderList: [[],[],[],[],[],[]], orderList: [],
dataList: [],
list: [{ list: [{
name: '待预约', name: '待预约',
total: 0, total: 0,
...@@ -85,12 +80,8 @@ ...@@ -85,12 +80,8 @@
} }
], ],
current: 0, current: 0,
swiperCurrent: 0, loadStatus: 'loading',
tabsHeight: 0,
dx: 0,
loadStatus: ['loading','loading','loading','loading','loading','loading'],
dataValue: [], dataValue: [],
total: 0
}; };
}, },
onLoad() { onLoad() {
...@@ -107,22 +98,26 @@ ...@@ -107,22 +98,26 @@
return this.currentIndex + 1 return this.currentIndex + 1
}, },
currentIndex() { currentIndex() {
return this.curNow == 0 ? this.swiperCurrent : 5 return this.curNow == 0 ? this.current : 5
},
sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png'
} }
}, },
methods: { methods: {
sectionChange(index) { sectionChange(index) {
this.curNow = index; this.curNow = index;
this.pageNumber = 0 this.pageNumber = 0
if (index === 1) { this.orderList = []
this.showSview = false this.loadStatus = 'loading'
// 加载已完工的数据 this.getOrderList(index === 0 ? 0 : 5)
this.getOrderList(5) },
} else { // tab栏切换
this.showSview = true change(index) {
// 加载已完工的数据 this.current = index;
this.getOrderList(0) this.orderList = []
} this.loadStatus = 'loading'
this.getOrderList(index);
}, },
/** /**
* 获取当前位置的经纬度 * 获取当前位置的经纬度
...@@ -145,10 +140,8 @@ ...@@ -145,10 +140,8 @@
}, },
reachBottom(e) { reachBottom(e) {
console.log(e) if (this.loadStatus != 'loadmore') return
console.log(this.loadStatus[this.currentIndex]) this.loadStatus == 'loading'
if (this.loadStatus[this.currentIndex] != 'loadmore') return
this.loadStatus[this.currentIndex] == 'loading'
this.getOrderList(this.currentIndex) this.getOrderList(this.currentIndex)
}, },
// 页面数据 // 页面数据
...@@ -196,11 +189,11 @@ ...@@ -196,11 +189,11 @@
...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list] ...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list,...res.data.list]
/*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/ /*↑↑↑↑↑↑↑↑↑↑测试数据↑↑↑↑↑↑↑↑↑↑↑↑↑*/
// 后台需要返回order_type,防止数据返回延迟期间点击了其他的tab // 后台需要返回orderType,防止数据返回延迟期间点击了其他的tab
if (res.data) { if (res.data) {
self.orderList[res.data.orderType].push(...res.data.list) self.orderList.push(...res.data.list)
self.list[res.data.orderType].total = res.data.total self.list[res.data.orderType].total = res.data.total
self.loadStatus[res.data.orderType] = res.data.total > self.orderList[res.data.orderType].length ? 'loadmore' : 'nomore' self.loadStatus = res.data.total > self.orderList.length ? 'loadmore' : 'nomore'
} }
} else { } else {
console.log(res.message, "获取订单数量失败!"); console.log(res.message, "获取订单数量失败!");
...@@ -235,27 +228,6 @@ ...@@ -235,27 +228,6 @@
} }
}); });
}, },
// tab栏切换
change(index) {
this.swiperCurrent = index;
this.getOrderList(index);
},
transition({
detail: {
dx
}
}) {
this.$refs.tabs.setDx(dx);
},
animationfinish({
detail: {
current
}
}) {
this.$refs.tabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},
viewOderItem(orderId) { // 跳转工单详情页面 viewOderItem(orderId) { // 跳转工单详情页面
uni.navigateTo({ uni.navigateTo({
url: 'pages/order/detail?id=' + orderId url: 'pages/order/detail?id=' + orderId
...@@ -268,6 +240,11 @@ ...@@ -268,6 +240,11 @@
handleAction(item) { handleAction(item) {
console.log('click button') console.log('click button')
this.viewOderItem(item.orderId) this.viewOderItem(item.orderId)
},
handleClickSearch() {
uni.navigateTo({
url: 'pages/order/search'
})
} }
} }
}; };
...@@ -455,22 +432,28 @@ ...@@ -455,22 +432,28 @@
width: 100%; width: 100%;
} }
.swiper-box { .tab-view {
flex: 1;
}
.swiper-item {
height: 100%; height: 100%;
.page-box { overflow: auto;
padding-bottom: 20rpx; padding-bottom: 20rpx;
} }
}
// .swiper-box {
// flex: 1;
// }
// .swiper-item {
// height: 100%;
// .page-box {
// padding-bottom: 20rpx;
// }
// }
.tools-box { .tools-box {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
padding: 20rpx 0rpx 18rpx 0rpx; padding-bottom: 20rpx;
.search-sub { .search-sub {
height: 72rpx; height: 72rpx;
...@@ -484,10 +467,14 @@ ...@@ -484,10 +467,14 @@
border-radius: 36rpx; border-radius: 36rpx;
color: #666666; color: #666666;
display: flex; display: flex;
flex-direction: row; justify-content: center;
justify-content: space-around;
align-items: center; align-items: center;
.search-image {
width: 36rpx;
height: 32rpx;
flex-shrink: 0;
margin-right: 20rpx;
}
.search-btn-text { .search-btn-text {
line-height: 36rpx; line-height: 36rpx;
font-weight: 400; font-weight: 400;
......
<template>
<view class="backView">
<view class="ph-pr-arr" v-for="(dataItem, index) in list" :key="index">
<template v-if="dataItem.data.length > 0">
<view class="topTitle"><text>{{ dataItem.title }}</text></view>
<view class="ph-pr-content">
<view v-for="(item,ikey) in dataItem.data"
:class="param[dataItem.type] === item.id ? 'select-item-view' : 'item-view'"
@click="itemClick(dataItem.type, item, ikey)" :key="item.id">
<text class="itemTitle">{{item.name}}</text>
</view>
</view>
</template>
</view>
<u-button class="ph-pr-button" type="primary" shape="circle" @click="handleClick"
:hover-class="selectedAll ? '' : 'none'" :custom-style="buttonStyle">下一步</u-button>
</view>
</template>
<script>
export default {
data() {
return {
classifyList: [],
systemList: [],
brandList: [],
param: {
classifyId: '',
systemId: '',
brandId: '',
},
brandName: '',
selectedAll: false,
}
},
computed: {
list() {
return [{
title: '请选择类别',
type: 'classifyId',
data: this.classifyList
},
{
title: '请选择系统',
type: 'systemId',
data: this.systemList
},
{
title: '请选择品牌',
type: 'brandId',
data: this.brandList
}
]
},
buttonStyle() {
return this.selectedAll ? {
'color': '#FFFFFF',
'background-color': '#2272FF;',
'width': '600rpx',
'height': '104rpx'
} : {
'color': '#FFFFFF',
'background-color': '#D1D4D4;',
'width': '600rpx',
'height': '104rpx'
}
}
},
onLoad(e) {
getApp().trackPage('选择产品页')
this.getRelationDictionaryV2()
},
onShareAppMessage(res) {
let shareObj = {
title: '',
path: '/pages/photo/product',
imageUrl: '',
success() {},
fail() {}
}
return shareObj
},
methods: {
getRelationDictionaryV2: function() {
this.$u.cloudApi.getRelationDictionaryV2().then(res => {
if (res && res.result) {
this.classifyList = res.result
this.param.classifyId = res.result[0].id
this.systemList = res.result[0].child
}
})
},
//选择 点击
itemClick: function(type, item, ikey) {
switch (type) {
case 'classifyId':
this.param = {
classifyId: item.id,
systemId: '',
brandId: ''
}
this.selectedAll = false
this.systemList = this.classifyList[ikey].child
this.brandList = []
break
case 'systemId':
this.param = {
classifyId: this.param.classifyId,
systemId: item.id,
brandId: ''
}
this.selectedAll = false
this.brandList = this.systemList[ikey].child
break
case 'brandId':
this.param.brandId = item.id
this.selectedAll = true
this.brandName = item.name
break
default:
break
}
},
// 点击下一步
handleClick() {
// 点击下一步设置全局拍照品牌品类
if (!this.selectedAll) {
return
}
const globalData = getApp().globalData
// if (!globalData.token) {
// uni.navigateTo({
// url: '/pages/login/wxlogin'
// })
// return
// }
let keys = ['brandId', 'brandName', 'classifyId', 'systemId']
keys.map(key => {
globalData.photo.product[key] = this[key] || this.param[key]
})
uni.navigateTo({
url: '/pages/photo/list' +
'?brandId=' + this.param.brandId +
'&brand=' + this.brandName +
'&classifyId=' + this.param.classifyId +
'&systemId=' + this.param.systemId,
})
}
}
}
</script>
<style>
.backView {
background-color: #F4f5f7;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
}
.topTitle {
margin-top: 50rpx;
padding-left: 30rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.ph-pr-content {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
padding: 22rpx 22rpx;
}
.ph-pr-arr {
width: 100%;
}
.item-view {
background-color: #FFFFFF;
/* width: 548rpx; */
margin: 0rpx 8rpx 24rpx 8rpx;
/* flex: 1 1 0%;
max-width: 33%; */
width: 222rpx;
height: 76rpx;
display: flex;
align-items: center;
justify-content: center;
border-style: solid;
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
border-width: 0rpx;
border-radius: 12rpx;
font-size: 26rpx;
color: #666666;
}
.select-item-view {
background-color: #2272FF;
margin: 0rpx 8rpx 24rpx 8rpx;
/* flex: 1 1 0%;
max-width: 33%; */
width: 222rpx;
height: 76rpx;
display: flex;
align-items: center;
justify-content: center;
border-style: solid;
box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.05);
border-width: 0rpx;
border-radius: 12rpx;
font-size: 26rpx;
color: #FFFFFF;
}
.ph-pr-button {
position: absolute;
bottom: 76rpx;
font-size: 32rpx;
}
</style>
<template>
<view class="backView">
<u-loading style="position: fixed;top: 50%;" :show="loading" size="36" mode="flower"></u-loading>
<view class="topView">
<view :class="['topItemView', {'active':activeTop===ikey}]" @click="handleTopItemChange(ikey,item)"
v-for="(item,ikey) in dataList" :key="ikey">
<text :class="['ph-lst-top-index', {'active':activeTop===ikey}]">{{ ikey + 1 }}</text>
<text class="topItemTitle">{{item.type}}</text>
</view>
</view>
<view class="rightView">
<view class="right-view-title">拍照项有:</view>
<template v-for="(item,ikey) in rightList">
<view class="rightItemView" @click="rightItemClick(item,ikey)" :key="ikey">
<view :class="['rightContentView', {'active':item.imageList[0]}]">
<text class="ph-lst-item-index">{{ ikey + 1 }}</text>
<text class="">{{item.name}}</text>
<image class="ph-list-item-arrow" src="/static/photo/arrow.png"></image>
<!-- <text class="rightContent u-m-t-14 u-m-l-30 u-p-b-30">{{item.describe}}</text> -->
</view>
<view class="rightImageView" v-if="item.imageList.length > 0">
<image class="rightImage" v-for="(image, index) in item.imageList.slice(0 , 10)" :src="image"
:key="index" @click.stop="handleClickImage(item, index)" mode="aspectFill"></image>
</view>
</view>
</template>
<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>
</view>
<u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom mode="center" width="690rpx"
height="600rpx">
<view class="ph-list-pop-title">
<text>是否一键清空系统展示的图片?</text>
</view>
<view class="ph-list-pop-text">
<text>点击"确定"则删除系统展示的所有图片</text>
</view>
<view class="ph-list-pop-btn-view">
<u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary"
@click="isPopShow = false">
取消
</u-button>
<u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="handleClickSure()">
确定
</u-button>
</view>
</u-popup>
</view>
</template>
<script>
export default {
data() {
return {
topList: [],
activeTop: 0,
leftList: [],
rightList: [],
classifyId: '',
systemId: '',
brand: '',
brandId: '',
dataList: [],
loading: true,
isPopShow: false
}
},
onLoad(e) {
getApp().trackPage('照片规范列表页')
if (e && e.brandId) {
this.brandId = e.brandId
}
if (e && e.brand) {
this.brand = e.brand
uni.setNavigationBarTitle({
title: this.brand
});
}
if (e && e.systemId) {
this.systemId = e.systemId
}
if (e && e.classifyId) {
this.classifyId = e.classifyId
}
this.getListData()
},
computed: {
buttonStyle() {
return {
'color': '#FFFFFF',
'width': '600rpx',
'height': '104rpx',
'font-size': '36rpx'
}
},
buttonDisabled() {
for (var item of this.dataList) {
for (var i of item.list) {
if ((i.imageList || []).length > 0) {
return false
}
}
}
return true
},
customStyleCancel() {
return {
'background-color': '#D1D4D4',
'width': '280rpx',
'height': '96rpx'
}
},
customStyleSave() {
return {
'background-color': '##2272FF',
'width': '280rpx',
'height': '96rpx',
'margin-left': '50rpx'
}
}
},
methods: {
getListData: function() {
this.loading = true
let that = this
this.$u.cloudApi.getGroupStandardV2({
'token': getApp().globalData.token,
'classify_id': this.classifyId,
'system_id': this.systemId,
'brand_id': this.brandId
}).then(res => {
this.loading = false
if (res && res.result) {
if (res.result.error_code) {
uni.showToast({
title: res.result.error_msg
})
} else {
that.handleData(res.result)
}
}
})
},
handleData: function(result) {
this.activeTop = 0
const globalData = getApp().globalData
globalData.photo.productList = result
this.dataList = result
if (result.length > 0) {
var item = result[0]
globalData.photo.waterSetting = item.userWatermark
this.rightList = item.list
}
},
//顶部点击
handleTopItemChange: function(ikey, item) {
this.activeTop = ikey
this.rightList = item.list
const photo = getApp().globalData.photo
photo.topIndex = ikey
photo.waterSetting = item.userWatermark
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
},
// 点击图片
handleClickImage(item, index) {
uni.previewImage({
urls: item.imageList,
current: index
})
},
//右侧点击
rightItemClick: function(item, ikey) {
const photo = getApp().globalData.photo
photo.currentItem = item
photo.itemIndex = ikey
const len = item.imageList.length
photo.currentItemLength = len > 9 ? 10 : len
uni.navigateTo({
url: '/pages/photo/take'
})
},
// 清除图片
handleClickSure: function() {
this.$u.cloudApi.cleanImage({
'token': getApp().globalData.token,
}).then(res => {
this.isPopShow = false
if (res && res.result) {
this.getListData()
}
})
}
}
}
</script>
<style>
.backView {
background-color: #F4F5F7;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
}
.centerBackView {
display: flex;
flex-direction: row;
margin-top: 80rpx;
width: 100%;
}
.ph-lst-top-index {
font-size: 26rpx;
font-weight: bold;
color: #FFFFFF;
border-radius: 8rpx;
background-color: #999999;
width: 36rpx;
height: 36rpx;
line-height: 36rpx;
text-align: center;
}
.ph-lst-top-index.active {
background-color: #2272FF;
}
.rightView {
background-color: #F4F5F7;
width: 100%;
display: flex;
flex-direction: column;
padding-top: 100rpx;
padding-bottom: 50rpx;
}
.right-view-title {
font-size: 36rpx;
font-weight: bold;
height: 104rpx;
line-height: 104rpx;
margin-left: 30rpx;
}
.rightItemView {
/* width: 100%; */
/* display: flex; */
/* flex-direction: row; */
/* justify-content: space-between; */
/* border-bottom: 20rpx solid #F3F3F3; */
margin: 0rpx 30rpx 20rpx 30rpx;
padding: 36rpx 30rpx 30rpx 30rpx;
border-radius: 12rpx;
background-color: #FFFFFF;
/* min-height: 108rpx; */
}
.ph-lst-item-index {
font-size: 24rpx;
font-weight: bold;
border-radius: 4rpx;
width: 34rpx;
height: 34rpx;
line-height: 32rpx;
text-align: center;
border-width: 1px;
border-style: solid;
margin-right: 10rpx;
margin-top: 4rpx;
}
.rightContentView {
display: flex;
align-items: flex-start;
width: 100%;
font-size: 30rpx;
color: #2272FF;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.rightContentView.active {
color: #666666;
border-color: #666666;
}
.ph-list-item-arrow {
position: absolute;
width: 40rpx;
height: 40rpx;
right: 38rpx;
}
.rightContent {
font-size: 30rpx;
color: #333333;
line-height: 40rpx;
}
.rightImageView {
/* width: 300rpx; */
/* height: 320rpx; */
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
margin-top: 26rpx;
}
.rightImage {
background-color: #F3F3F3;
width: 116rpx;
height: 116rpx;
margin: 0rpx 12rpx 12rpx 0rpx;
}
.rightImage:nth-child(5n) {
margin-right: 0;
}
.topView {
background-color: #FAFAFA;
width: 100%;
height: 100rpx;
position: fixed;
display: flex;
flex-direction: row;
z-index: 1;
}
.topItemView {
/* width: 210rpx; */
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
-webkit-flex: 1;
flex: 1;
background-color: #FFFFFF;
color: #999999;
}
.topItemView.active {
color: #2272FF;
}
.topItemTitle {
font-size: 36rpx;
font-weight: bold;
padding-left: 30rpx;
}
.greenBackColor {
background-color: #4CD964;
}
.ph-list-pop-text {
color: #666666;
text-align: center;
margin-top: 20rpx;
font-size: 30rpx;
}
.ph-list-pop-title {
font-size: 40rpx;
padding-top: 150rpx;
text-align: center;
color: #333333;
}
.ph-list-pop-btn-view {
display: flex;
justify-content: center;
margin-top: 150rpx;
}
</style>
<template>
<view>
<view class="contentView">
<u-image class="pic" :src="files[0]" bg-color="transparent" @click="showPreviewFn"></u-image>
<!-- <image class="pic" :src="files[0]" v-lazy mode="aspectFit"></image> -->
</view>
<view class="bottomView">
<image class="btn" :src="btn_remake" @click="$u.throttle(remakePhoto, 3000)"></image>
<image class="btn" :src="btn_continue" @click="$u.throttle(continuePhoto, 3000)"></image>
</view>
<image class="btn finish" src="/static/photo/finish.png" @click="$u.throttle(finishPhoto, 3000)"></image>
</view>
</template>
<script>
import qiniup from '@/components/upload/qiniup';
const app = getApp()
export default {
mixins: [qiniup],
data() {
return {
protocolContent: '',
btn_remake: 'https://qn-static.banshouhui.com/take_order/photo/remake.png',
btn_continue: '/static/photo/continue.png',
standardId: '',
images: [],
files: [],
fileMaps: [],
keys: [],
token: '',
product: '',
}
},
onLoad(e) {
// 获取照片选项对象
const product = app.globalData.photo.product
this.product = `?brandId=${product.brandId}&brand=${product.brandName}&classifyId=${product.classifyId}&systemId=${product.systemId}`
if(app.globalData.photo.currentItem) {
// 获取规格Id
this.standardId = app.globalData.photo.currentItem._id
}
getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath
if(globalTempPath && globalTempPath.mixWater){
this.files = [globalTempPath.mixWater]
}
if(e.standardId) {
this.standardId = e.standardId
}
this.token = getApp().globalData.token
},
methods: {
// 保存照片到本地
async saveTempToLocal(tempImagePath) {
//has_origin //是否保存原图
let that = this
const photo = getApp().globalData.photo
if(!photo.tempPath){
return
}
let path = ''
if(photo.tempPath.origin && photo.waterSetting && photo.waterSetting.has_origin){
// 保存原图到本地
path = photo.tempPath.origin
let result = await this.saveLocal(path)
if(result){
uni.showToast({
icon: 'none',
title: '已将照片原图保存到本地相册'
})
}
}
if(photo.currentItem){
photo.currentItem.imageList.unshift(photo.tempPath.mixWater)
}
// if(photo.productList && photo.productList[photo.topIndex]){
// const topArr = photo.productList[photo.topIndex]
// if(topArr[photo.itemIndex]){
// topArr[photo.itemIndex].imageList.push(photo.tempPath.mixWater)
// }
// }
// photo.
if(photo.tempPath.mixWater){
// 保存水印处理图片到本地
path = photo.tempPath.mixWater
let result1 = await this.saveLocal(path)
if(result1){
uni.showToast({
icon: 'none',
title: '已将水印图片保存到本地相册'
})
}
}
},
saveLocal(path){
return new Promise((resolve,reject)=>{
uni.saveImageToPhotosAlbum({
filePath: path,
success() {
resolve(true)
},
fail() {
reject('保存失败')
}
})
})
},
showPreviewFn(img) {
uni.previewImage({
current: 0,
urls: this.files
});
},
// 重拍图片
remakePhoto() {
uni.navigateBack({
delta:1
})
},
finishPhoto(){
const photo = getApp().globalData.photo
photo.currentItemLength = 10
this.continuePhoto()
// 完成本项
// uni.navigateBack({
// delta:2
// })
},
// 确认图片
continuePhoto() {
let self = this
uni.showLoading({
title:'图片保存中…'
})
self.saveTempToLocal()
self.confirmUpload(true)
},
submitFile() {
let self = this
if(self.keys.length) {
for (let s of self.keys) {
self.$u.cloudApi.saveImage({
"token": self.token,
"standardId": self.standardId,
"url": s,
}).then(async res =>{
console.log(res, "云服务保存图片");
if(res.result.code) {
// TODO 参数是否要来回传递
const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading()
// 当前项的图片显示
// 拍照项张数目增加 等于10张
if(photo.currentItemLength<10){
uni.navigateBack({
delta:1
})
}else{
uni.navigateBack({
delta:2
})
}
// let timer = setTimeout(()=>{
// if(photo.currentItemLength<10){
// uni.navigateBack({
// delta:1
// })
// }else{
// uni.navigateBack({
// delta:2
// })
// }
// },2000)
} else {
uni.showToast({
title:'图片上传失败 '+ res.result.msg
})
}
})
}
}
},
downloadImages() {
let self = this;
for (let url of this.images) {
uni.downloadFile({
url: url, //仅为示例,并非真实的资源
success(res) {
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) {
self.files.push(res.tempFilePath)
}
},
fail(e) {
debugger
}
})
}
},
}
}
</script>
<style lang="scss">
.contentView {
background-color: #333333;
/* padding-top: 120rpx; */
padding-bottom:228rpx;
height: 100vh;
display: flex;
flex-direction: column;
}
/deep/ .u-image{
height:100%!important;
}
/deep/ .u-image__loading{
background-color: transparent!important;
}
/deep/ .u-image__error{
background-color: transparent!important;
}
.pic {
flex:1;
width: 100%;
/* height:auto */
/* height: 760rpx; */
}
.bottomView {
box-shadow: 0 0 1rpx 6rpx rgba(255,255,255,0.05);
background-color: #333333;
width: 100%;
padding:70rpx 0;
position: fixed;
bottom: 0;
display: flex;
justify-content: space-around;
align-items: center;
.btn{
display: block;
width: 200rpx;
height: 88rpx;
}
}
.btn{
display: block;
width: 232rpx;
height: 80rpx;
&.finish{
position: fixed;
top:30rpx;
right:30rpx;
}
}
</style>
<template>
<view class="backView">
<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>
</view>
<view class="itemView firstItem">
<view class="itemTitleView">
<text class="itemTitle">保存原图</text>
<text class="itemNotice">拍照后另保存一张无水印的图片</text>
</view>
<switch class="itemSwitch" :checked="result['has_origin']" @change="handleOrigineChange" color="#007AFF" />
</view>
<view class="itemView" v-if="showTitleSwitch">
<view class="itemTitleView" @click="itemClick({},-1)">
<text class="itemTitle">水印标题</text>
<text class="itemNotice">{{result['lower_right']['title_text'] || '点击可编辑更改'}}</text>
</view>
<switch class="itemSwitch" disabled :checked="result['lower_right']['title_text'] != ''"
@click="handleClickTitleSwitch" color="#007AFF" />
</view>
<view class="itemView" v-for="(item,ikey) in itemList" :key="ikey">
<view class="itemTitleView" @click="itemClick(item,ikey)">
<text class="itemTitle">{{item['watemark_text'] || '自定义' + (ikey + 1)}}</text>
<text class="itemNotice">{{item['watemark_value'] || '点击可编辑更改'}}</text>
</view>
<switch class="itemSwitch" :checked="item['enable']" @change="itemChange(item, ikey)" color="#007AFF" />
</view>
<u-popup border-radius="10" v-model="isPopShow" safe-area-inset-bottom :mask-close-able="false" mode="center"
width="690rpx" height="600rpx" @close="handlePopClose">
<view class="popCenterView">
<text class="popTitle">设置自定义项</text>
<view class="inputBackView">
<view class="ph-pop-left-view">
<view class="leftInputView">
<input class="leftInput" type="text" v-model="currenItem['watemark_text']"
@input="leftInput()" :disabled="currenItem.type === 'title_text'" placeholder="请输入"
maxlength="10" />
</view>
<view class="ph-pop-tip-view" v-if="showTipLeft">*必填项</view>
</view>
<view class="ph-pop-mid-view">:</view>
<view>
<view class="rightInputView">
<input class="rightInput" type="text" v-model="currenItem['watemark_value']"
@input="rightInput()" placeholder="请输入内容" maxlength="30" />
</view>
<view class="ph-pop-tip-view" v-if="showTipRight">*必填项</view>
</view>
</view>
<text class="popNoticeText u-m-t-20">示例:</text>
<text class="popNoticeText">工程队名称:蓝天工程队</text>
<view class="popBtnView">
<u-button :custom-style="customStyleCancel" hover-class="none" shape="circle" type="primary" @click="popCancelClick()">
取消
</u-button>
<u-button :custom-style="customStyleSave" shape="circle" type="primary" @click="popSaveClick()">
保存
</u-button>
</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
data() {
return {
systemId: '',
isSaveOrigine: true,
isPopShow: false,
icon_close_new: '',
result: {
has_origin: true,
lower_right: {
body: []
}
},
currenItem: {
'watemark_text': '',
'watemark_value': ''
},
editingItem: {},
showTipLeft: false,
showTipRight: false,
loading: true
}
},
computed: {
itemList() {
if (this.result['lower_right']) {
var arr = this.result['lower_right']['body']
return arr.filter((item) => {
return item.watemark_type === '备注'
})
} else {
return []
}
},
showTitleSwitch() {
return this.result['lower_right'].hasOwnProperty('title_text')
},
customStyleCancel() {
return {
'background-color': '#D1D4D4',
'width': '280rpx',
'height': '96rpx'
}
},
customStyleSave() {
return {
'background-color': '##2272FF',
'width': '280rpx',
'height': '96rpx',
'margin-left': '50rpx'
}
}
},
onLoad(e) {
getApp().trackPage('水印设置页')
const globalData = getApp().globalData
this.icon_close_new = globalData.icon_close_new
this.systemId = globalData.photo.product.systemId
this.getItemList()
},
methods: {
getItemList: function() {
// this.systemId = '79550af260555cc20afb34156c94b32c' // 测试数据
this.loading = true
this.$u.cloudApi.getUserWatermark({
'token': getApp().globalData.token,
'system_id': this.systemId
}).then(res => {
if (res && res.result) {
if(res.result.error_code){
uni.showToast({title: res.result.error_msg})
}else{
this.result = res.result
}
}else{
uni.showToast({title: '网络异常'})
}
this.loading = false
})
},
saveUserWatermark: function() {
this.loading = true
this.$u.cloudApi.saveUserWatermark({
'token': getApp().globalData.token,
'watermark': this.result
}).then(res => {
if (res.result.code == true) {
const photo = getApp().globalData.photo
photo.waterSetting = this.result
}else{
uni.showToast({title: res.result.msg})
}
this.loading = false
})
},
//保存原图 开关
handleOrigineChange: function(e) {
this.result['has_origin'] = !this.result['has_origin']
this.saveUserWatermark()
},
handleClickTitleSwitch: function(e) {
var string = this.result['lower_right']['title_text'] ? '水印标题不可关闭' : '请先编辑该自定义项'
uni.showToast({
icon: 'none',
title: string
})
},
//自定义 开关
itemChange: function(item, ikey) {
if (item['watemark_value']) {
// 修改
item['enable'] = !item['enable']
this.saveUserWatermark()
} else {
uni.showToast({
icon: 'none',
title: '请先编辑该自定义项'
})
}
},
//自定义 点击
itemClick: function(item, ikey) {
if (ikey === -1) {
this.currenItem = {
'watemark_text': '水印标题',
'watemark_value': this.result['lower_right']['title_text'],
'type': 'title_text'
}
} else {
this.editingItem = item
this.currenItem = {
...item
}
}
this.isPopShow = true
},
//左侧输入框
leftInput: function(e) {
if (this.currenItem['watemark_text']) {
this.showTipLeft = false
}
},
//右侧输入框
rightInput: function(e) {
if (this.currenItem['watemark_value']) {
this.showTipRight = false
}
},
//自定义弹窗 关闭
popCancelClick: function() {
this.isPopShow = false
this.currenItem = {
'watemark_text': '',
'watemark_value': ''
}
},
handlePopClose() {
this.showTipLeft = false,
this.showTipRight = false
},
//自定义弹窗 保存
popSaveClick: function() {
if (this.currenItem['watemark_text'] && this.currenItem['watemark_value']) {
this.isPopShow = false
if (this.currenItem.type === 'title_text') {
this.result['lower_right']['title_text'] = this.currenItem['watemark_value']
} else {
this.editingItem['watemark_text'] = this.currenItem['watemark_text']
this.editingItem['watemark_value'] = this.currenItem['watemark_value']
this.editingItem['enable'] = true
}
this.saveUserWatermark()
} else {
// 提示
if (!this.currenItem['watemark_text']) {
this.showTipLeft = true
}
if (!this.currenItem['watemark_value']) {
this.showTipRight = true
}
}
}
}
}
</script>
<style>
.backView {
background-color: #FAFAFA;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
/*
.firstItemView{
background-color: #FFFFFF;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding-top: 80rpx;
padding-bottom: 80rpx;
border-bottom: 2rpx solid #F4F5F7;
} */
.itemView {
background-color: #FFFFFF;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding-top: 54rpx;
padding-bottom: 54rpx;
}
.itemView.firstItem {
border-bottom: 2rpx solid #F4F5F7;
}
.itemTitleView {
background-color: #FFFFFF;
width: 80%;
display: flex;
flex-direction: column;
padding-left: 30rpx;
}
.itemTitle {
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
.itemNotice {
font-size: 26rpx;
color: #666666;
margin-top: 4rpx;
}
.itemSwitch {
margin-right: 30rpx;
transform: scale(0.78, 0.75);
}
.shadowBackView {
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.popCenterView {
background-color: #FFFFFF;
display: flex;
flex-direction: column;
}
.popTitle {
font-size: 36rpx;
font-weight: bold;
margin-top: 50rpx;
padding-left: 30rpx;
}
.inputBackView {
margin-top: 52rpx;
width: 100%;
height: 90rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
display: flex;
align-items: flex-start;
}
.leftInputView {
width: 220rpx;
height: 72rpx;
border: 2rpx solid #666666;
display: flex;
align-items: center;
justify-content: center;
}
.leftInput {
width: 180rpx;
height: 32rpx;
}
.ph-pop-left-view {
margin-left: 30rpx;
}
.ph-pop-tip-view {
color: #F56C6C;
}
.ph-pop-mid-view {
margin-top: 20rpx;
}
.rightInputView {
width: 360rpx;
height: 72rpx;
border: 2rpx solid #666666;
margin-right: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.rightInput {
width: 320rpx;
height: 32rpx;
}
.popNoticeText {
font-size: 26rpx;
color: #666666;
padding-left: 30rpx;
}
.popBtnView {
margin-top: 110rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
/* .popCancelBtn {
background-color: #D1D4D4;
width: 280rpx;
height: 96rpx;
border-radius: 48rpx;
margin-left: 40rpx;
display: flex;
align-items: center;
justify-content: center;
} */
/* .popSaveBtn {
background-color: #2272FF;
width: 280rpx;
height: 96rpx;
border-radius: 48rpx;
margin-right: 40rpx;
display: flex;
align-items: center;
justify-content: center;
} */
/* .popBtnText {
font-size: 32rpx;
color: #FFFFFF;
font-weight: 600;
} */
</style>
<template>
<view class="camera-container">
<cover-view class="header-box" :style="{'height':navHeight/2 + 'px'}">
<cover-view class="inner">
<cover-image @click="setCameraInfo('devicePosition')" class="icon" mode="aspectFit"
src="/static/photo/icon-switch.png"></cover-image>
<cover-image @click="setCameraInfo('flash')" class="icon" mode="aspectFit"
:src="'/static/photo/icon-light-' + cameraInfo.flash +'.png'"></cover-image>
<cover-image @click="goPage('/pages/photo/setting')" class="icon" mode="aspectFit"
src="/static/photo/icon-setting.png"></cover-image>
</cover-view>
</cover-view>
<camera class="camera-box" v-if="cameraChange&&!standardShow" v-show="" :device-position="cameraInfo.devicePosition"
:flash="cameraInfo.flash" :style="{'height':cameraHeight/2 + 'px','top':parseInt(navHeight/2) + 'px'}"
@error="cameraError">
<cover-view class="mark-box">
<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 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.date || '正在获取中...'}}</cover-view> -->
</cover-view>
<cover-image class="mark-water" mode="aspectFit" :src="waterInfo.markImage"></cover-image>
</camera>
<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-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"> </cover-image>
</cover-view>
<canvas canvas-id="canvas" id="photoCanvas" class="canvas"
:style="{'width':750 + 'rpx','height': cameraHeight + 'rpx'}"></canvas>
<view v-show="standardShow" class="page-mask" :z-index="10000">
<photo-standard :currentItem="currentItem" />
<view class="btn-close">
<image @click="closeShadow" class="icon icon-close" mode="aspectFit" src="/static/photo/icon-close.png">
</image>
</view>
</view>
</view>
</template>
<script>
let r = require("../../libs/bmap-wx.min.js");
let h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG",
ak: "lF1HoyXdiv4uZx6TrGQEZs48F5y8kEHI"
});
import standard from '@/components/photo/standard.vue'
export default {
components: {
'photo-standard': standard,
},
data() {
return {
currentItem: {
name: '111',
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'
],
},
standardShow: true,
cameraInfo: {
devicePosition: 'back',
flash: 'auto'
},
waterInfo: {
longitude: '', // 经度
latitude: '', // 维度
address: '', //地址
date: '', //日期
markImage: 'https://qn-static.banshouhui.com/live_mark.png'
},
tempImgs: {
'markImage': '', // 拍照水印
'origin': '', // 无水印照片
'mixWater': '', // 有水印照片
},
authSetting: {
camera: false, // 相机授权
location: false, // 位置授权
},
navHeight: 130,
cameraWidth: 750,
cameraHeight: 1000, // (4 / 3 * 750) 图片比例4:3
ratio: 0,
cameraChange: false,
waterSetting: null,
shadowInitShow: true, // 第一次进入页面需显示弹窗
}
},
onLoad(e) {
const photo = getApp().globalData.photo
console.log(photo, 'global-photo')
getApp().trackPage('拍照页')
// this.ctx = uni.createCameraContext();
this.updateTime()
this.getLocation()
this.getMarkPath()
this.initData()
this.currentItem = photo.currentItem
},
computed: {
titleTxt() {
const waterSetting = this.waterSetting
let txt = ''
if (!waterSetting || !waterSetting.lower_right) {
return ''
}
txt = waterSetting.lower_right && waterSetting.lower_right.title_text || ''
return txt
},
settingTxtArr() {
let arr = []
// 包含经纬度
const waterInfo = this.waterInfo
arr = ['经度:' + waterInfo.longitude, '纬度:' + waterInfo.latitude, '地址:' + waterInfo.address, '时间:' +
waterInfo.date
]
let settingTxtArr = []
const typeArr = ['经度', '纬度', '地址', '时间']
const waterSetting = this.waterSetting
if (!waterSetting || !waterSetting.lower_right || !waterSetting.lower_right.body) {
return arr
}
const settingArr = waterSetting.lower_right.body
settingArr.map(item => {
const idx = typeArr.indexOf(item.watemark_type)
if (item.enable && (idx > -1 || (item.watemark_value && item.watemark_text))) {
if (idx > -1) {
settingTxtArr.push(arr[idx])
} else {
settingTxtArr.push(item.watemark_text + ':' + item.watemark_value)
}
}
})
return settingTxtArr
}
},
watch: {},
onShow() {
// 默认开启弹窗
const photo = getApp().globalData.photo
this.waterSetting = photo.waterSetting
this.standardShow = this.shadowInitShow
this.cameraChange = true
// this.initData()
},
onHide(){
this.cameraChange = false
},
methods: {
closeShadow() {
this.shadowInitShow = false
this.standardShow = false
},
goBack() {
uni.navigateBack({
delta: 1
})
// uni.redirectTo({
// url: '/pages/photo/list'
// })
},
goPage(url) {
url = url || '/pages/photo/index';
uni.navigateTo({
url: url
})
},
updateTime() {
this.waterInfo.date = this.getTime()
// let timer = setTimeout(() => {
// clearTimeout(timer);
// this.updateTime()
// }, 1000)
},
setCameraInfo(type) {
// 设置相机前置后置、闪关灯等
const cameraInfo = this.cameraInfo
let val = cameraInfo[type]
switch (type) {
case 'devicePosition':
val = val === 'back' ? 'front' : 'back'
break;
case 'flash':
val = val === 'auto' ? 'on' : (val === 'on' ? 'off' : 'auto')
break;
defalut:
break;
}
this.cameraInfo[type] = val
},
initData() {
const globalData = getApp().globalData
this.navHeight = globalData.navHeight
this.cameraHeight = parseInt(globalData.safeHeight*2 - globalData.navHeight - 200) ;
// console.log(globalData.safeHeight,'globalData.safeHeight')
// console.log(this.cameraHeight,'this.cameraHeight')
// console.log(globalData.navHeight,'globalData.navHeight')
this.ratio = globalData.screenHeight / globalData.rpxScreenHeight
// console.log(globalData.screenHeight,globalData.rpxScreenHeight,this.ratio)
this.waterSetting = globalData.photo.waterSetting
// this.cameraHeight = globalData.rpxScreenHeight
},
baiduLocation() {
// 百度sdk解析经纬度
let waterInfo = this.waterInfo
const t = function() {
let t = {
success: function(res) {
let e = res.wxMarkerData[0];
let i = e.address;
waterInfo.address = i
},
fail: function(err) {
// console.log(err, 'err')
}
};
if (waterInfo.latitude && waterInfo.longitude) {
let e = waterInfo.latitude + "," + waterInfo.longitude;
t.location = e;
}
h.regeocoding(t);
};
t()
},
cameraError(e) {
const {
errMsg
} = e.detail
// console.log(e.detail, 'e.detail')
if (errMsg !== 'insertCamera:fail auth deny') {
return
}
this.showSettingModal('camera')
},
//获取位置
getLocation() {
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)
// console.log(waterInfo.longitude, 'that.longitude', waterInfo.latitude, 'that.latitude')
that.baiduLocation()
},
fail(err) {
that.showSettingModal('location')
// that.showLocationAuthModal('')
}
});
},
showSettingModal(type) {
// console.log(type, 'showModal-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
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')
},0)
// this.saveToLocal(res.tempFilePath)
},
fail: (res) => {
console.log(res);
},
complete: () => {
uni.hideLoading();
}
}, this);
}, 50))
},
// 第三步:保存到本地
saveToLocal(tempImagePath) {
//has_origin //是否保存原图
let that = this
uni.saveImageToPhotosAlbum({
filePath: tempImagePath,
success() {
uni.showToast({
icon: 'none',
title: '已将照片保存到本地相册'
})
},
fail() {}
})
},
showPreviewFn(img) {
uni.previewImage({
current: 0,
urls: [img]
});
},
//获取当前时间
getTime: function() {
let d = new Date();
let year = d.getFullYear();
let month = d.getMonth() + 1;
let date = d.getDate();
let days = new Array("日", "一", "二", "三", "四", "五", "六");
let day = d.getDay();
let hour = (d.getHours() < 10) ? ("0" + d.getHours()) : d.getHours();
let min = (d.getMinutes() < 10) ? ("0" + d.getMinutes()) : d.getMinutes();
let sec = (d.getSeconds() < 10) ? ("0" + d.getSeconds()) : d.getSeconds();
let now = year + "年" + month + "月" + date + "日 " + hour + ":" + min + ":" + sec;
return now
},
}
}
</script>
<style scoped lang="scss">
.camera-container {
// padding-top:var(--status-bar-height);
min-height: 100vh;
background-color: black;
}
.header-box {
// padding:10rpx 20rpx;
position: relative;
.inner {
display: flex;
position: absolute;
left: 0;
right: 0;
bottom: 0;
}
.icon {
margin: 20rpx;
display: block;
width: 44rpx;
height: 44rpx;
}
}
.camera-box {
position: absolute;
left:0;
width: 100%;
// height: 100vh;
z-index: 1;
}
.mark-water {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 360rpx;
height: 90rpx;
z-index: 6;
}
.mark-box {
position: absolute;
left: 0;
bottom: 0;
padding: 20rpx;
.txt {
max-width: 500rpx;
max-height: 80rpx;
overflow: hidden;
margin-top: 5rpx;
line-height: 40rpx;
white-space: normal;
font-size: 28rpx;
color: #fff;
&.big {
padding: 10rpx;
margin-bottom: 10rpx;
width: 430rpx;
line-height: 40rpx;
font-size: 32rpx;
background-color: rgba(34, 114, 255, 0.6);
}
}
}
.bottom-box {
position: absolute;
left: 0;
right: 0;
bottom:0;
// bottom: constant(safe-area-inset-bottom);
// bottom: env(safe-area-inset-bottom);
z-index: 5;
box-sizing: border-box;
height: 200rpx;
display: flex;
justify-content: space-between;
padding: 20rpx 78rpx;
align-items: center;
background-color: black;
.txt {
white-space: nowrap;
line-height: 60rpx;
color: #fff;
}
.icon {
display: block;
width: 92rpx;
height: 92rpx;
&.icon-take {
width: 144rpx;
height: 144rpx;
}
}
}
.canvas {
position: fixed;
left: -750rpx;
top: 0;
}
// 拍照规范
.page-mask {
position: fixed;
bottom: 0;
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
z-index: 1000;
width: 750rpx;
height: 100vh;
// padding: 0 30rpx;
box-sizing: border-box;
background-color: rgba(0, 0, 0, 0.8);
.icon {
width: 92rpx;
height: 92rpx;
}
.btn-close {
position: absolute;
bottom: 0;
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
left: 0;
right: 0;
height: 200rpx;
z-index: 100;
display: flex;
justify-content: center;
align-items: center;
}
}
</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