Commit a2d58854 authored by Facius's avatar Facius

首页接口调试

parent a69beaee
...@@ -100,11 +100,11 @@ ...@@ -100,11 +100,11 @@
} }
if(e && e.current_count){ if(e && e.current_count){
this.done_count = e.current_count this.done_count = Math.max(e.current_count - 1, 0)
} }
if(e && e.current_count){ if(e && e.current_count){
this.current_count = Math.max(e.current_count - 1, 0) this.current_count = e.current_count
} }
if(e && e.images){ if(e && e.images){
......
<template> <template>
<view class="backView"> <view class="backView">
<view class="topView"> <view class="topView">
<view class="topItemView" @click="topItemClick(ikey,item)" v-for="(item,ikey) in dataList":key="ikey"> <view class="topItemView" @click="topItemClick(ikey,item)" v-for="(item,ikey) in dataList" :key="ikey">
<text :class="['ph-lst-top-index', activeTop == ikey ? 'active-index-text' : 'index-text']">{{ ikey + 1 }}</text> <text
:class="['ph-lst-top-index', activeTop == ikey ? 'active-index-text' : 'index-text']">{{ ikey + 1 }}</text>
<text :class="activeTop == ikey ? 'topActiveItemTitle' : 'topItemTitle'">{{item.type}}</text> <text :class="activeTop == ikey ? 'topActiveItemTitle' : 'topItemTitle'">{{item.type}}</text>
</view> </view>
</view> </view>
<view class="rightView"> <view class="rightView">
<view class="right-view-title">拍照项有:</view> <view class="right-view-title">拍照项有:</view>
<template <template v-for="(item,ikey) in rightList">
v-for="(item,ikey) in rightList"
>
<view class="rightItemView" @click="rightItemClick(item,ikey)" :key="ikey"> <view class="rightItemView" @click="rightItemClick(item,ikey)" :key="ikey">
<view class="['rightContentView', item.images.length > 0 ? 'gray666Color' : 'rightTitle']"> <view class="['rightContentView', item.images.length > 0 ? 'gray666Color' : 'rightTitle']">
<text class="ph-lst-item-index">{{ ikey + 1 }}</text> <text class="ph-lst-item-index">{{ ikey + 1 }}</text>
...@@ -19,7 +18,8 @@ ...@@ -19,7 +18,8 @@
<!-- <text class="rightContent u-m-t-14 u-m-l-30 u-p-b-30">{{item.describe}}</text> --> <!-- <text class="rightContent u-m-t-14 u-m-l-30 u-p-b-30">{{item.describe}}</text> -->
</view> </view>
<view class="rightImageView" v-if="item.images"> <view class="rightImageView" v-if="item.images">
<image class="rightImage" v-for="(image, index) in item.images" :src="image" :key="image" @click="handleClickImage(item, image, index)" mode=""></image> <image class="rightImage" v-for="(image, index) in item.images" :src="image" :key="image"
@click="handleClickImage(item, image, index)" mode=""></image>
</view> </view>
</view> </view>
</template> </template>
...@@ -32,44 +32,41 @@ ...@@ -32,44 +32,41 @@
export default { export default {
data() { data() {
return { return {
topList:[], topList: [],
topTitle:'', activeTop: 0,
activeTop:0, leftList: [],
leftList:[], rightList: [],
rightList:[], classifyId: '',
product:'', systemId: '',
product_code:'', brand: '',
brand:'', brandId: '',
brand_code:'', dataList: [],
dataList:[],
} }
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('照片规范列表页') getApp().trackPage('照片规范列表页')
if(e && e.product){ if (e && e.brandId) {
this.product = e.product this.brandId = e.brandId
} }
if(e && e.product_code){ if (e && e.brand) {
this.product_code = e.product_code
}
if(e && e.brand){
this.brand = e.brand this.brand = e.brand
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.brand title: this.brand
}); });
} }
if(e && e.brand_code){ if (e && e.systemId) {
this.brand_code = e.brand_code this.systemId = e.systemId
}
this.topTitle = this.product + '-' + this.brand }
this.getListData()
if (e && e.classifyId) {
this.classifyId = e.classifyId
}
this.getListData()
}, },
...@@ -80,25 +77,26 @@ ...@@ -80,25 +77,26 @@
methods: { methods: {
getListData: function (){ getListData: function() {
console.log('getListData:')
console.log('product_code' + this.product_code)
console.log('brand_code' + this.brand_code)
let that = this let that = this
this.$u.cloudApi.getGroupStandard({product_code:this.product_code,brand_code:this.brand_code}).then(res =>{ this.$u.cloudApi.getGroupStandardV2({
'token': getApp().globalData.token,
'classify_id': this.classifyId,
'system_id': this.systemId,
'brand_id': this.brandId
}).then(res => {
console.log('获取规范标准数据:') console.log('获取规范标准数据:')
console.log(res) console.log(res)
if(res.result && res.result.length){ if (res.result && res.result.length) {
that.handleData(res) that.handleData(res)
} }
}) })
}, },
handleData: function (res){ handleData: function(res) {
this.dataList = res.result this.dataList = res.result
...@@ -118,26 +116,29 @@ ...@@ -118,26 +116,29 @@
}, },
//顶部点击 //顶部点击
topItemClick: function (ikey,item) { topItemClick: function(ikey, item) {
this.activeTop = ikey this.activeTop = ikey
this.rightList = item.list this.rightList = item.list
uni.pageScrollTo({scrollTop: 0, duration: 0}); uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
}, },
// 点击图片 // 点击图片
handleClickImage(item, image, index) { handleClickImage(item, image, index) {
uni.navigateTo({ uni.navigateTo({
url:'/pages/photo/detail' url: '/pages/photo/detail' +
+'?current_image=' + image '?current_image=' + image +
+'&image_count=' + item.image_count '&image_count=' + item.image_count +
+'&current_count=' + (index + 1) '&current_count=' + (index + 1) +
+'&images=' + JSON.stringify(item.images) '&images=' + JSON.stringify(item.images) +
+'&title=' + item.name, '&title=' + item.name,
}) })
}, },
//右侧点击 //右侧点击
rightItemClick: function (item,ikey) { rightItemClick: function(item, ikey) {
// // for (let i = 0; i < this.rightList.length; i++) { // // for (let i = 0; i < this.rightList.length; i++) {
// // var subItem = this.rightList[i] // // var subItem = this.rightList[i]
...@@ -165,7 +166,7 @@ ...@@ -165,7 +166,7 @@
</script> </script>
<style> <style>
.backView{ .backView {
background-color: #F4F5F7; background-color: #F4F5F7;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -176,12 +177,7 @@ ...@@ -176,12 +177,7 @@
align-items: center; align-items: center;
} }
.topTitle{ .centerBackView {
margin-top: 80rpx;
font-size: 32rpx;
}
.centerBackView{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin-top: 80rpx; margin-top: 80rpx;
...@@ -201,12 +197,14 @@ ...@@ -201,12 +197,14 @@
} }
.active-index-text { .active-index-text {
background-color:#2272FF; background-color: #2272FF;
} }
.index-text { .index-text {
background-color:#999999; background-color: #999999;
} }
.rightView{
.rightView {
background-color: #F4F5F7; background-color: #F4F5F7;
width: 100%; width: 100%;
display: flex; display: flex;
...@@ -223,7 +221,7 @@ ...@@ -223,7 +221,7 @@
margin-left: 30rpx; margin-left: 30rpx;
} }
.rightItemView{ .rightItemView {
/* width: 100%; */ /* width: 100%; */
/* display: flex; */ /* display: flex; */
/* flex-direction: row; */ /* flex-direction: row; */
...@@ -234,6 +232,7 @@ ...@@ -234,6 +232,7 @@
border-radius: 12rpx; border-radius: 12rpx;
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.ph-lst-item-index { .ph-lst-item-index {
font-size: 28rpx; font-size: 28rpx;
font-weight: bold; font-weight: bold;
...@@ -246,7 +245,8 @@ ...@@ -246,7 +245,8 @@
border-style: solid; border-style: solid;
margin-right: 10rpx; margin-right: 10rpx;
} }
.rightContentView{
.rightContentView {
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%; width: 100%;
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
right: 30rpx; right: 30rpx;
} }
/* .rightActiveContentView{ /* .rightActiveContentView{
background-color: #4CD964; background-color: #4CD964;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -277,18 +277,18 @@ ...@@ -277,18 +277,18 @@
width: 100%; width: 100%;
} */ } */
.rightTitle{ .rightTitle {
font-size: 30rpx; font-size: 30rpx;
color: #2272FF; color: #2272FF;
} }
.rightContent{ .rightContent {
font-size: 30rpx; font-size: 30rpx;
color: #333333; color: #333333;
line-height: 40rpx; line-height: 40rpx;
} }
.rightImageView{ .rightImageView {
/* width: 300rpx; */ /* width: 300rpx; */
/* height: 320rpx; */ /* height: 320rpx; */
display: flex; display: flex;
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
margin-top: 26rpx; margin-top: 26rpx;
} }
.rightImage{ .rightImage {
background-color: #F3F3F3; background-color: #F3F3F3;
width: 116rpx; width: 116rpx;
height: 116rpx; height: 116rpx;
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
} }
.topView{ .topView {
background-color: #FAFAFA; background-color: #FAFAFA;
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
...@@ -316,7 +316,7 @@ ...@@ -316,7 +316,7 @@
z-index: 1; z-index: 1;
} }
.topItemView{ .topItemView {
/* width: 210rpx; */ /* width: 210rpx; */
height: 100rpx; height: 100rpx;
display: flex; display: flex;
...@@ -327,7 +327,7 @@ ...@@ -327,7 +327,7 @@
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.topItemTitle{ .topItemTitle {
font-size: 36rpx; font-size: 36rpx;
color: #999999; color: #999999;
font-weight: bold; font-weight: bold;
...@@ -335,23 +335,19 @@ ...@@ -335,23 +335,19 @@
} }
.topActiveItemTitle{ .topActiveItemTitle {
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
color: #2272FF; color: #2272FF;
padding-left: 30rpx; padding-left: 30rpx;
} }
.greenBackColor{ .greenBackColor {
background-color: #4CD964; background-color: #4CD964;
} }
.gray666Color{ .gray666Color {
color: #666666; color: #666666;
border-color: #666666; border-color: #666666;
} }
</style> </style>
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
<view class="ph-pr-arr" v-for="(dataItem, index) in list" :key="index"> <view class="ph-pr-arr" v-for="(dataItem, index) in list" :key="index">
<template v-if="dataItem.data.length > 0"> <template v-if="dataItem.data.length > 0">
<view class="topTitle"><text>{{ dataItem.title }}</text></view> <view class="topTitle"><text>{{ dataItem.title }}</text></view>
<view class="ph-pr-content" > <view class="ph-pr-content">
<view :class="param[item.type + '_code'] === item.code ? 'select-item-view' : 'item-view'" <view v-for="(item,ikey) in dataItem.data"
@click="itemClick(item)" v-for="(item,ikey) in dataItem.data" :key="item.code"> :class="param[dataItem.type] === item._id ? 'select-item-view' : 'item-view'"
@click="itemClick(dataItem.type, item)" :key="item._id">
<text class="itemTitle">{{item.name}}</text> <text class="itemTitle">{{item.name}}</text>
</view> </view>
</view> </view>
...@@ -20,17 +21,15 @@ ...@@ -20,17 +21,15 @@
export default { export default {
data() { data() {
return { return {
productList: [], classifyList: [],
sysList: [], systemList: [],
brandList: [], brandList: [],
product_code: '',
product: '',
param: { param: {
brand_code: '', classifyId: '',
brand: '', systemId: '',
product_code: '', brandId: '',
product: ''
}, },
brandName: '',
selectedAll: false, selectedAll: false,
} }
}, },
...@@ -38,14 +37,17 @@ ...@@ -38,14 +37,17 @@
list() { list() {
return [{ return [{
title: '请选择类别', title: '请选择类别',
data: this.productList type: 'classifyId',
data: this.classifyList
}, },
{ {
title: '请选择系统', title: '请选择系统',
data: this.sysList type: 'systemId',
data: this.systemList
}, },
{ {
title: '请选择品牌', title: '请选择品牌',
type: 'brandId',
data: this.brandList data: this.brandList
} }
] ]
...@@ -53,7 +55,7 @@ ...@@ -53,7 +55,7 @@
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('选择产品页') getApp().trackPage('选择产品页')
this.getProductList() this.getclassifyList()
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
...@@ -68,89 +70,84 @@ ...@@ -68,89 +70,84 @@
}, },
methods: { methods: {
getProductList: function() { getclassifyList: function() {
let that = this let that = this
this.$u.cloudApi.getAllProduct().then(res => { this.$u.cloudApi.getClassifyDictionary().then(res => {
console.log('获取产品数据:') console.log('获取产品数据:')
console.log(res) console.log(res)
if (res.result && res.result.data) { if (res.result && res.result.data) {
that.productList = res.result.data that.classifyList = res.result.data
that.param.classifyId = that.classifyList[0]._id
that.$u.cloudApi.getRelationDictionary({
"classify_id": that.param.classifyId,
"field": "system_id"
}).then(res1 => {
that.systemList = res1.result
})
} }
}) })
}, },
//选择 点击 //选择 点击
itemClick: function(item) { itemClick: function(type, item) {
switch (item.type) {
case 'product':
this.initSelect()
this.param.product_code = item.code
this.param.product = item.name
this.$u.cloudApi.getBrand({ switch (type) {
product_code: this.param.product_code case 'classifyId':
this.param = {
classifyId: item._id,
systemId: '',
brandId: ''
}
this.selectedAll = false
this.systemList = []
this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"field": "system_id"
}).then(res => { }).then(res => {
console.log('获取品牌数据:', res) this.systemList = res.result
if (res.result.data) {
res.result.data.filter((value) => {
value.type = 'brand'
}) })
this.brandList = res.result.data break
this.changeSelectedAll() case 'systemId':
this.param = {
classifyId: this.param.classifyId,
systemId: item._id,
brandId: ''
} }
this.selectedAll = false
this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"system_id": this.param.systemId,
"field": "brand_id"
}).then(res => {
console.log('获取品牌数据:', res)
this.brandList = res.result
}) })
break break
case 'brandId':
this.param.brandId = item._id
this.selectedAll = true
this.brandName = item.name
break
default: default:
this.param.brand_code = item.code break
this.param.brand = item.name
this.changeSelectedAll()
} }
// uni.navigateTo({
// url: '/pages/photo/brand' +
// '?product_code=' + this.param.product_code +
// '&product=' + this.param.product,
// })
}, },
// 点击下一步 // 点击下一步
handleClick() { handleClick() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/photo/list' + url: '/pages/photo/list' +
'?brand_code=' + this.param.brand_code + '?brandId=' + this.param.brandId +
'&brand=' + this.param.brand + '&brand=' + this.brandName +
'&product_code=' + this.param.product_code + '&classifyId=' + this.param.systemId +
'&product=' + this.param.product, '&systemId=' + this.param.systemId,
}) })
},
// 修改下一步按钮是否可以点击
changeSelectedAll() {
for (var item in this.param) {
if (!this.param[item]) {
this.selectedAll = false
return
}
}
this.selectedAll = true
},
// 初始化选择
initSelect() {
this.param = {
brand_code: '',
brand: '',
product_code: '',
product: ''
}
this.brandList = []
this.selectedAll = false
} }
} }
} }
......
{
"name": "getGroupStandardV2",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"user-common": {
"version": "file:../common/user-common"
}
}
}
{
"name": "saveImage",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"user-common": {
"version": "file:../common/user-common"
}
}
}
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