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
<text :class="activeTop == ikey ? 'topActiveItemTitle' : 'topItemTitle'">{{item.type}}</text> :class="['ph-lst-top-index', activeTop == ikey ? 'active-index-text' : 'index-text']">{{ ikey + 1 }}</text>
</view> <text :class="activeTop == ikey ? 'topActiveItemTitle' : 'topItemTitle'">{{item.type}}</text>
</view> </view>
<view class="rightView"> </view>
<view class="right-view-title">拍照项有:</view> <view class="rightView">
<template <view class="right-view-title">拍照项有:</view>
v-for="(item,ikey) in rightList" <template 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> <text class="">{{item.name}} ({{item.image_count}}张)</text>
<text class="">{{item.name}} ({{item.image_count}}张)</text> <image class="ph-list-item-arrow" src="/static/photo/arrow.png"></image>
<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> -->
<!-- <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"
<image class="rightImage" v-for="(image, index) in item.images" :src="image" :key="image" @click="handleClickImage(item, image, index)" mode=""></image> @click="handleClickImage(item, image, index)" mode=""></image>
</view> </view>
</view> </view>
</template> </template>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
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.brandId) {
if(e && e.product){ this.brandId = e.brandId
this.product = e.product }
}
if (e && e.brand) {
if(e && e.product_code){ this.brand = e.brand
this.product_code = e.product_code uni.setNavigationBarTitle({
} title: this.brand
});
if(e && e.brand){ }
this.brand = e.brand
uni.setNavigationBarTitle({ if (e && e.systemId) {
title: this.brand this.systemId = e.systemId
});
} }
if(e && e.brand_code){ if (e && e.classifyId) {
this.brand_code = e.brand_code this.classifyId = e.classifyId
} }
this.topTitle = this.product + '-' + this.brand this.getListData()
this.getListData()
},
onShow() {
}, console.log('onShow 里的rightList:')
console.log(this.rightList)
onShow() { },
console.log('onShow 里的rightList:')
console.log(this.rightList) methods: {
},
getListData: function() {
methods: {
let that = this
getListData: function (){
this.$u.cloudApi.getGroupStandardV2({
console.log('getListData:') 'token': getApp().globalData.token,
console.log('product_code' + this.product_code) 'classify_id': this.classifyId,
console.log('brand_code' + this.brand_code) 'system_id': this.systemId,
'brand_id': this.brandId
let that = this }).then(res => {
console.log('获取规范标准数据:')
this.$u.cloudApi.getGroupStandard({product_code:this.product_code,brand_code:this.brand_code}).then(res =>{ console.log(res)
console.log('获取规范标准数据:') if (res.result && res.result.length) {
console.log(res) that.handleData(res)
if(res.result && res.result.length){ }
that.handleData(res) })
}
}) },
}, handleData: function(res) {
handleData: function (res){ this.dataList = res.result
this.dataList = res.result this.dataList.forEach(item => {
this.dataList.forEach(item => { item.list.forEach(subItem => {
subItem.isClicked = false
item.list.forEach(subItem => { })
subItem.isClicked = false
}) })
}) console.log('添加 新字段 后的数组:')
console.log(this.dataList)
console.log('添加 新字段 后的数组:')
console.log(this.dataList) var item = res.result[0]
this.rightList = item.list
var item = res.result[0] },
this.rightList = item.list
}, //顶部点击
topItemClick: function(ikey, item) {
//顶部点击 this.activeTop = ikey
topItemClick: function (ikey,item) { this.rightList = item.list
this.activeTop = ikey uni.pageScrollTo({
this.rightList = item.list scrollTop: 0,
uni.pageScrollTo({scrollTop: 0, duration: 0}); duration: 0
}, });
},
// 点击图片
handleClickImage(item, image, index) { // 点击图片
uni.navigateTo({ handleClickImage(item, image, index) {
url:'/pages/photo/detail' uni.navigateTo({
+'?current_image=' + image url: '/pages/photo/detail' +
+'&image_count=' + item.image_count '?current_image=' + image +
+'&current_count=' + (index + 1) '&image_count=' + item.image_count +
+'&images=' + JSON.stringify(item.images) '&current_count=' + (index + 1) +
+'&title=' + item.name, '&images=' + JSON.stringify(item.images) +
}) '&title=' + item.name,
}, })
},
//右侧点击
rightItemClick: function (item,ikey) { //右侧点击
rightItemClick: function(item, ikey) {
// // for (let i = 0; i < this.rightList.length; i++) {
// // var subItem = this.rightList[i] // // for (let i = 0; i < this.rightList.length; i++) {
// // if(i == ikey){ // // var subItem = this.rightList[i]
// // subItem.isClicked = true // // if(i == ikey){
// // } // // subItem.isClicked = true
// // } // // }
// // item.clickable = true // // }
// this.$set(this.rightList[ikey],'clickable',true) // // item.clickable = true
// var current_image = item.images[0] // this.$set(this.rightList[ikey],'clickable',true)
// var current_count = 1 // var current_image = item.images[0]
// uni.navigateTo({ // var current_count = 1
// url:'/pages/photo/detail' // uni.navigateTo({
// +'?current_image=' + current_image // url:'/pages/photo/detail'
// +'&image_count=' + item.image_count // +'?current_image=' + current_image
// +'&current_count=' + current_count // +'&image_count=' + item.image_count
// +'&images=' + JSON.stringify(item.images) // +'&current_count=' + current_count
// +'&title=' + item.name, // +'&images=' + JSON.stringify(item.images)
// }) // +'&title=' + item.name,
}, // })
},
}
} }
</script> }
</script>
<style>
.backView{ <style>
background-color: #F4F5F7; .backView {
position: absolute; background-color: #F4F5F7;
top: 0; position: absolute;
left: 0; top: 0;
width: 100%; left: 0;
display: flex; width: 100%;
flex-direction: column; display: flex;
align-items: center; flex-direction: column;
} align-items: center;
}
.topTitle{
margin-top: 80rpx; .centerBackView {
font-size: 32rpx; display: flex;
} flex-direction: row;
margin-top: 80rpx;
.centerBackView{ width: 100%;
display: flex; }
flex-direction: row;
margin-top: 80rpx; .ph-lst-top-index {
width: 100%; font-size: 26rpx;
} font-weight: bold;
color: #FFFFFF;
.ph-lst-top-index { border-radius: 8rpx;
font-size: 26rpx; background-color: #999999;
font-weight: bold; width: 36rpx;
color: #FFFFFF; height: 36rpx;
border-radius: 8rpx; line-height: 36rpx;
background-color: #999999; text-align: center;
width: 36rpx; }
height: 36rpx;
line-height: 36rpx; .active-index-text {
text-align: center; background-color: #2272FF;
} }
.active-index-text { .index-text {
background-color:#2272FF; background-color: #999999;
} }
.index-text {
background-color:#999999; .rightView {
} background-color: #F4F5F7;
.rightView{ width: 100%;
background-color: #F4F5F7; display: flex;
width: 100%; flex-direction: column;
display: flex; margin-top: 100rpx;
flex-direction: column; margin-bottom: 50rpx;
margin-top: 100rpx; }
margin-bottom: 50rpx;
} .right-view-title {
font-size: 36rpx;
.right-view-title { font-weight: bold;
font-size: 36rpx; height: 104rpx;
font-weight: bold; line-height: 104rpx;
height: 104rpx; margin-left: 30rpx;
line-height: 104rpx; }
margin-left: 30rpx;
} .rightItemView {
/* width: 100%; */
.rightItemView{ /* display: flex; */
/* width: 100%; */ /* flex-direction: row; */
/* display: flex; */ /* justify-content: space-between; */
/* flex-direction: row; */ /* border-bottom: 20rpx solid #F3F3F3; */
/* justify-content: space-between; */ margin: 0rpx 30rpx 20rpx 30rpx;
/* border-bottom: 20rpx solid #F3F3F3; */ padding: 36rpx 30rpx 18rpx 30rpx;
margin: 0rpx 30rpx 20rpx 30rpx; border-radius: 12rpx;
padding: 36rpx 30rpx 18rpx 30rpx; background-color: #FFFFFF;
border-radius: 12rpx; }
background-color: #FFFFFF;
} .ph-lst-item-index {
.ph-lst-item-index { font-size: 28rpx;
font-size: 28rpx; font-weight: bold;
font-weight: bold; border-radius: 4rpx;
border-radius: 4rpx; width: 34rpx;
width: 34rpx; height: 34rpx;
height: 34rpx; line-height: 30rpx;
line-height: 30rpx; text-align: center;
text-align: center; border-width: 1px;
border-width: 1px; 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%;
/* flex-direction: column; */ /* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */ /* border-left: 2rpx solid #F3F3F3; */
} }
.ph-list-item-arrow { .ph-list-item-arrow {
position: absolute; position: absolute;
width: 56rpx; width: 56rpx;
height: 56rpx; height: 56rpx;
right: 30rpx; right: 30rpx;
} }
/* .rightActiveContentView{ /* .rightActiveContentView{
background-color: #4CD964; background-color: #4CD964;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-left: 2rpx solid #F3F3F3; border-left: 2rpx solid #F3F3F3;
} }
.width_50{ .width_50{
width: 480rpx; width: 480rpx;
} }
.width_100{ .width_100{
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;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
flex-wrap: wrap; flex-wrap: wrap;
margin-top: 26rpx; margin-top: 26rpx;
} }
.rightImage{ .rightImage {
background-color: #F3F3F3; background-color: #F3F3F3;
width: 116rpx; width: 116rpx;
height: 116rpx; height: 116rpx;
margin: 0rpx 12rpx 12rpx 0rpx; margin: 0rpx 12rpx 12rpx 0rpx;
} }
.topView{ .topView {
background-color: #FAFAFA; background-color: #FAFAFA;
width: 100%; width: 100%;
height: 100rpx; height: 100rpx;
position: fixed; position: fixed;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
z-index: 1; z-index: 1;
} }
.topItemView{ .topItemView {
/* width: 210rpx; */ /* width: 210rpx; */
height: 100rpx; height: 100rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
-webkit-flex: 1; -webkit-flex: 1;
flex: 1; flex: 1;
background-color: #FFFFFF; background-color: #FFFFFF;
} }
.topItemTitle{ .topItemTitle {
font-size: 36rpx; font-size: 36rpx;
color: #999999; color: #999999;
font-weight: bold; font-weight: bold;
padding-left: 30rpx; padding-left: 30rpx;
} }
.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,32 +21,33 @@ ...@@ -20,32 +21,33 @@
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: ''
}, },
selectedAll: false, brandName: '',
selectedAll: false,
} }
}, },
computed: { computed: {
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) { switch (type) {
case 'product': case 'classifyId':
this.initSelect() this.param = {
this.param.product_code = item.code classifyId: item._id,
this.param.product = item.name systemId: '',
brandId: ''
this.$u.cloudApi.getBrand({ }
product_code: this.param.product_code this.selectedAll = false
this.systemList = []
this.brandList = []
this.$u.cloudApi.getRelationDictionary({
"classify_id": this.param.classifyId,
"field": "system_id"
}).then(res => {
this.systemList = res.result
})
break
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 => { }).then(res => {
console.log('获取品牌数据:', res) console.log('获取品牌数据:', res)
this.brandList = res.result
if (res.result.data) {
res.result.data.filter((value) => {
value.type = 'brand'
})
this.brandList = res.result.data
this.changeSelectedAll()
}
}) })
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