Commit a2d58854 authored by Facius's avatar Facius

首页接口调试

parent a69beaee
......@@ -100,11 +100,11 @@
}
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){
this.current_count = Math.max(e.current_count - 1, 0)
this.current_count = e.current_count
}
if(e && e.images){
......
<template>
<view class="backView">
<view class="topView">
<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="activeTop == ikey ? 'topActiveItemTitle' : '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', item.images.length > 0 ? 'gray666Color' : 'rightTitle']">
<text class="ph-lst-item-index">{{ ikey + 1 }}</text>
<text class="">{{item.name}} ({{item.image_count}}张)</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.images">
<image class="rightImage" v-for="(image, index) in item.images" :src="image" :key="image" @click="handleClickImage(item, image, index)" mode=""></image>
</view>
</view>
</template>
</view>
</view>
</template>
<script>
export default {
data() {
return {
topList:[],
topTitle:'',
activeTop:0,
leftList:[],
rightList:[],
product:'',
product_code:'',
brand:'',
brand_code:'',
dataList:[],
}
},
onLoad(e) {
getApp().trackPage('照片规范列表页')
if(e && e.product){
this.product = e.product
}
if(e && e.product_code){
this.product_code = e.product_code
}
if(e && e.brand){
this.brand = e.brand
uni.setNavigationBarTitle({
title: this.brand
});
}
if(e && e.brand_code){
this.brand_code = e.brand_code
}
this.topTitle = this.product + '-' + this.brand
this.getListData()
},
onShow() {
console.log('onShow 里的rightList:')
console.log(this.rightList)
},
methods: {
getListData: function (){
console.log('getListData:')
console.log('product_code' + this.product_code)
console.log('brand_code' + this.brand_code)
let that = this
this.$u.cloudApi.getGroupStandard({product_code:this.product_code,brand_code:this.brand_code}).then(res =>{
console.log('获取规范标准数据:')
console.log(res)
if(res.result && res.result.length){
that.handleData(res)
}
})
},
handleData: function (res){
this.dataList = res.result
this.dataList.forEach(item => {
item.list.forEach(subItem => {
subItem.isClicked = false
})
})
console.log('添加 新字段 后的数组:')
console.log(this.dataList)
var item = res.result[0]
this.rightList = item.list
},
//顶部点击
topItemClick: function (ikey,item) {
this.activeTop = ikey
this.rightList = item.list
uni.pageScrollTo({scrollTop: 0, duration: 0});
},
// 点击图片
handleClickImage(item, image, index) {
uni.navigateTo({
url:'/pages/photo/detail'
+'?current_image=' + image
+'&image_count=' + item.image_count
+'&current_count=' + (index + 1)
+'&images=' + JSON.stringify(item.images)
+'&title=' + item.name,
})
},
//右侧点击
rightItemClick: function (item,ikey) {
// // for (let i = 0; i < this.rightList.length; i++) {
// // var subItem = this.rightList[i]
// // if(i == ikey){
// // subItem.isClicked = true
// // }
// // }
// // item.clickable = true
// this.$set(this.rightList[ikey],'clickable',true)
// var current_image = item.images[0]
// var current_count = 1
// uni.navigateTo({
// url:'/pages/photo/detail'
// +'?current_image=' + current_image
// +'&image_count=' + item.image_count
// +'&current_count=' + current_count
// +'&images=' + JSON.stringify(item.images)
// +'&title=' + item.name,
// })
},
}
}
</script>
<style>
.backView{
background-color: #F4F5F7;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.topTitle{
margin-top: 80rpx;
font-size: 32rpx;
}
.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;
}
.active-index-text {
background-color:#2272FF;
}
.index-text {
background-color:#999999;
}
.rightView{
background-color: #F4F5F7;
width: 100%;
display: flex;
flex-direction: column;
margin-top: 100rpx;
margin-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 18rpx 30rpx;
border-radius: 12rpx;
background-color: #FFFFFF;
}
.ph-lst-item-index {
font-size: 28rpx;
font-weight: bold;
border-radius: 4rpx;
width: 34rpx;
height: 34rpx;
line-height: 30rpx;
text-align: center;
border-width: 1px;
border-style: solid;
margin-right: 10rpx;
}
.rightContentView{
display: flex;
align-items: center;
width: 100%;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.ph-list-item-arrow {
position: absolute;
width: 56rpx;
height: 56rpx;
right: 30rpx;
}
/* .rightActiveContentView{
background-color: #4CD964;
display: flex;
flex-direction: column;
border-left: 2rpx solid #F3F3F3;
}
.width_50{
width: 480rpx;
}
.width_100{
width: 100%;
} */
.rightTitle{
font-size: 30rpx;
color: #2272FF;
}
.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;
}
.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;
}
.topItemTitle{
font-size: 36rpx;
color: #999999;
font-weight: bold;
padding-left: 30rpx;
}
.topActiveItemTitle{
font-size: 36rpx;
font-weight: bold;
color: #2272FF;
padding-left: 30rpx;
}
.greenBackColor{
background-color: #4CD964;
}
.gray666Color{
color: #666666;
border-color: #666666;
}
<template>
<view class="backView">
<view class="topView">
<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="activeTop == ikey ? 'topActiveItemTitle' : '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', item.images.length > 0 ? 'gray666Color' : 'rightTitle']">
<text class="ph-lst-item-index">{{ ikey + 1 }}</text>
<text class="">{{item.name}} ({{item.image_count}}张)</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.images">
<image class="rightImage" v-for="(image, index) in item.images" :src="image" :key="image"
@click="handleClickImage(item, image, index)" mode=""></image>
</view>
</view>
</template>
</view>
</view>
</template>
<script>
export default {
data() {
return {
topList: [],
activeTop: 0,
leftList: [],
rightList: [],
classifyId: '',
systemId: '',
brand: '',
brandId: '',
dataList: [],
}
},
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()
},
onShow() {
console.log('onShow 里的rightList:')
console.log(this.rightList)
},
methods: {
getListData: function() {
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 => {
console.log('获取规范标准数据:')
console.log(res)
if (res.result && res.result.length) {
that.handleData(res)
}
})
},
handleData: function(res) {
this.dataList = res.result
this.dataList.forEach(item => {
item.list.forEach(subItem => {
subItem.isClicked = false
})
})
console.log('添加 新字段 后的数组:')
console.log(this.dataList)
var item = res.result[0]
this.rightList = item.list
},
//顶部点击
topItemClick: function(ikey, item) {
this.activeTop = ikey
this.rightList = item.list
uni.pageScrollTo({
scrollTop: 0,
duration: 0
});
},
// 点击图片
handleClickImage(item, image, index) {
uni.navigateTo({
url: '/pages/photo/detail' +
'?current_image=' + image +
'&image_count=' + item.image_count +
'&current_count=' + (index + 1) +
'&images=' + JSON.stringify(item.images) +
'&title=' + item.name,
})
},
//右侧点击
rightItemClick: function(item, ikey) {
// // for (let i = 0; i < this.rightList.length; i++) {
// // var subItem = this.rightList[i]
// // if(i == ikey){
// // subItem.isClicked = true
// // }
// // }
// // item.clickable = true
// this.$set(this.rightList[ikey],'clickable',true)
// var current_image = item.images[0]
// var current_count = 1
// uni.navigateTo({
// url:'/pages/photo/detail'
// +'?current_image=' + current_image
// +'&image_count=' + item.image_count
// +'&current_count=' + current_count
// +'&images=' + JSON.stringify(item.images)
// +'&title=' + item.name,
// })
},
}
}
</script>
<style>
.backView {
background-color: #F4F5F7;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.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;
}
.active-index-text {
background-color: #2272FF;
}
.index-text {
background-color: #999999;
}
.rightView {
background-color: #F4F5F7;
width: 100%;
display: flex;
flex-direction: column;
margin-top: 100rpx;
margin-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 18rpx 30rpx;
border-radius: 12rpx;
background-color: #FFFFFF;
}
.ph-lst-item-index {
font-size: 28rpx;
font-weight: bold;
border-radius: 4rpx;
width: 34rpx;
height: 34rpx;
line-height: 30rpx;
text-align: center;
border-width: 1px;
border-style: solid;
margin-right: 10rpx;
}
.rightContentView {
display: flex;
align-items: center;
width: 100%;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.ph-list-item-arrow {
position: absolute;
width: 56rpx;
height: 56rpx;
right: 30rpx;
}
/* .rightActiveContentView{
background-color: #4CD964;
display: flex;
flex-direction: column;
border-left: 2rpx solid #F3F3F3;
}
.width_50{
width: 480rpx;
}
.width_100{
width: 100%;
} */
.rightTitle {
font-size: 30rpx;
color: #2272FF;
}
.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;
}
.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;
}
.topItemTitle {
font-size: 36rpx;
color: #999999;
font-weight: bold;
padding-left: 30rpx;
}
.topActiveItemTitle {
font-size: 36rpx;
font-weight: bold;
color: #2272FF;
padding-left: 30rpx;
}
.greenBackColor {
background-color: #4CD964;
}
.gray666Color {
color: #666666;
border-color: #666666;
}
</style>
......@@ -3,9 +3,10 @@
<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 :class="param[item.type + '_code'] === item.code ? 'select-item-view' : 'item-view'"
@click="itemClick(item)" v-for="(item,ikey) in dataItem.data" :key="item.code">
<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)" :key="item._id">
<text class="itemTitle">{{item.name}}</text>
</view>
</view>
......@@ -20,32 +21,33 @@
export default {
data() {
return {
productList: [],
sysList: [],
classifyList: [],
systemList: [],
brandList: [],
product_code: '',
product: '',
param: {
brand_code: '',
brand: '',
product_code: '',
product: ''
classifyId: '',
systemId: '',
brandId: '',
},
selectedAll: false,
brandName: '',
selectedAll: false,
}
},
computed: {
list() {
return [{
title: '请选择类别',
data: this.productList
type: 'classifyId',
data: this.classifyList
},
{
title: '请选择系统',
data: this.sysList
type: 'systemId',
data: this.systemList
},
{
title: '请选择品牌',
type: 'brandId',
data: this.brandList
}
]
......@@ -53,7 +55,7 @@
},
onLoad(e) {
getApp().trackPage('选择产品页')
this.getProductList()
this.getclassifyList()
},
onShareAppMessage(res) {
......@@ -68,89 +70,84 @@
},
methods: {
getProductList: function() {
getclassifyList: function() {
let that = this
this.$u.cloudApi.getAllProduct().then(res => {
this.$u.cloudApi.getClassifyDictionary().then(res => {
console.log('获取产品数据:')
console.log(res)
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) {
switch (item.type) {
case 'product':
this.initSelect()
this.param.product_code = item.code
this.param.product = item.name
this.$u.cloudApi.getBrand({
product_code: this.param.product_code
itemClick: function(type, item) {
switch (type) {
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 => {
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 => {
console.log('获取品牌数据:', res)
if (res.result.data) {
res.result.data.filter((value) => {
value.type = 'brand'
})
this.brandList = res.result.data
this.changeSelectedAll()
}
this.brandList = res.result
})
break
case 'brandId':
this.param.brandId = item._id
this.selectedAll = true
this.brandName = item.name
break
default:
this.param.brand_code = item.code
this.param.brand = item.name
this.changeSelectedAll()
break
}
// uni.navigateTo({
// url: '/pages/photo/brand' +
// '?product_code=' + this.param.product_code +
// '&product=' + this.param.product,
// })
},
// 点击下一步
handleClick() {
uni.navigateTo({
url: '/pages/photo/list' +
'?brand_code=' + this.param.brand_code +
'&brand=' + this.param.brand +
'&product_code=' + this.param.product_code +
'&product=' + this.param.product,
'?brandId=' + this.param.brandId +
'&brand=' + this.brandName +
'&classifyId=' + this.param.systemId +
'&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