Commit 61257b89 authored by Facius's avatar Facius

首页、列表页的界面修改

parent 01df1405
......@@ -4,8 +4,21 @@
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
},
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/photo/product",
"style": {
"navigationBarTitleText": "扳手会工单规范",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7"
}
},
{
"path": "pages/photo/index",
"style": {
"navigationBarTitleText": "拍照小工具首页"
}
},
{
"path": "pages/index/index",
"style": {
......@@ -117,18 +130,7 @@
"navigationBarTitleText": "工单详情"
}
},
{
"path": "pages/photo/index",
"style": {
"navigationBarTitleText": "拍照小工具首页"
}
},
{
"path": "pages/photo/product",
"style": {
"navigationBarTitleText": "扳手会工单规范"
}
},
{
"path": "pages/photo/take",
"style": {
......@@ -160,7 +162,9 @@
{
"path": "pages/photo/list",
"style": {
"navigationBarTitleText": "规范展示"
"navigationBarTitleText": "规范展示",
"navigationBarBackgroundColor":"#FFFFFF",
"backgroundColor":"#F4F5F7"
}
},
......
......@@ -100,7 +100,11 @@
}
if(e && e.current_count){
this.current_count = e.current_count
this.done_count = e.current_count
}
if(e && e.current_count){
this.current_count = Math.max(e.current_count - 1, 0)
}
if(e && e.images){
......
<template>
<view class="backView">
<view class="topView">
<view :class="activeTop == ikey ? 'topItemView whiteBackColor' : 'topItemView FAbackColor' " @click="topItemClick(ikey,item)" v-for="(item,ikey) in dataList":key="ikey">
<text class="topActiveItemTitle" v-if="activeTop == ikey">{{item.type}}</text>
<text class="topItemTitle" v-if="activeTop != ikey">{{item.type}}</text>
<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',item.clickable ? 'FAbackColor' : '']" @click="rightItemClick(item,ikey)" :key="ikey">
<view :class=" item.images ? 'rightContentView width_50' : 'rightContentView width_100' ">
<text :class=" item.clickable ? 'gray999Color rightTitle u-m-t-30 u-m-l-30' : 'rightTitle u-m-t-30 u-m-l-30' ">{{item.name}} ({{item.image_count}}张)</text>
<text class="rightContent u-m-t-14 u-m-l-30 u-p-b-30">{{item.describe}}</text>
<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>
<cover-image class="ph-list-item-arrow" src="/static/photo/arrow.png"></cover-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" :src="item.images[0]" 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>
</template>
......@@ -121,29 +124,41 @@
uni.pageScrollTo({scrollTop: 0, duration: 0});
},
//右侧点击
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
// 点击图片
handleClickImage(item, image, index) {
uni.navigateTo({
url:'/pages/photo/detail'
+'?current_image=' + current_image
+'?current_image=' + image
+'&image_count=' + item.image_count
+'&current_count=' + current_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,
// })
},
}
}
......@@ -173,50 +188,80 @@
margin-top: 80rpx;
width: 100%;
}
.leftView{
background-color: #FFFFFF;
width: 20%;
display: flex;
flex-direction: column;
.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;
}
.leftItemView{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 80rpx;
border-bottom: 2rpx solid #F3F3F3;
.active-index-text {
background-color:#2272FF;
}
.leftItemText{
font-size: 28rpx;
.index-text {
background-color:#999999;
}
.rightView{
background-color: #FFFFFF;
background-color: #F4F5F7;
width: 100%;
display: flex;
flex-direction: column;
margin-top: 96rpx;
margin: 100rpx;
}
.rightItemView{
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
border-bottom: 20rpx solid #F3F3F3;
.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;
flex-direction: column;
border-left: 2rpx solid #F3F3F3;
align-items: center;
width: 100%;
/* flex-direction: column; */
/* border-left: 2rpx solid #F3F3F3; */
}
.rightActiveContentView{
.ph-list-item-arrow {
position: absolute;
width: 56rpx;
height: 56rpx;
right: 30rpx;
}
/* .rightActiveContentView{
background-color: #4CD964;
display: flex;
flex-direction: column;
......@@ -230,70 +275,69 @@
.width_100{
width: 100%;
}
} */
.rightTitle{
font-size: 32rpx;
color: #4D87EA;
font-size: 30rpx;
color: #2272FF;
}
.rightContent{
font-size: 28rpx;
font-size: 30rpx;
color: #333333;
line-height: 40rpx;
}
.rightImageView{
width: 300rpx;
height: 320rpx;
/* width: 300rpx; */
/* height: 320rpx; */
display: flex;
align-items: center;
justify-content: center;
justify-content: flex-start;
flex-wrap: wrap;
margin-top: 26rpx;
}
.rightImage{
background-color: #F3F3F3;
width: 240rpx;
height: 240rpx;
width: 116rpx;
height: 116rpx;
margin: 0rpx 12rpx 12rpx 0rpx;
}
.topView{
background-color: #FAFAFA;
width: 100%;
height: 96rpx;
height: 100rpx;
position: fixed;
display: flex;
flex-direction: row;
}
.topItemView{
width: 210rpx;
height: 96rpx;
/* width: 210rpx; */
height: 100rpx;
display: flex;
align-items: center;
justify-content: center;
}
.whiteBackColor{
-webkit-flex: 1;
flex: 1;
background-color: #FFFFFF;
}
.FAbackColor{
background-color: #FAFAFA;
}
.topItemTitle{
font-size: 32rpx;
font-size: 36rpx;
color: #999999;
font-weight: bold;
padding-left: 30rpx;
}
.topActiveItemTitle{
font-size: 32rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
color: #2272FF;
padding-left: 30rpx;
}
......@@ -301,8 +345,9 @@
background-color: #4CD964;
}
.gray999Color{
color: #999999;
.gray666Color{
color: #666666;
border-color: #666666;
}
......
<template>
<view class="backView">
<text class="topTitle">选择产品</text>
<view class="u-p-b-48">
<view class="itemView u-m-t-48" @click="itemClick(item)" v-for="(item,ikey) in productList":key="ikey">
<text class="itemTitle">{{item.name}}</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
productList:[],
product_code:'',
product:'',
}
},
onLoad(e) {
getApp().trackPage('选择产品页')
this.getProductList()
},
onShareAppMessage(res) {
let shareObj = {
title: '',
path: '/pages/photo/product',
imageUrl: '',
success(){},
fail(){}
}
return shareObj
},
methods: {
getProductList: function(){
let that = this
this.$u.cloudApi.getAllProduct().then(res =>{
console.log('获取产品数据:')
console.log(res)
if(res.result && res.result.data){
that.productList = res.result.data
}
})
<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 :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">
<text class="itemTitle">{{item.name}}</text>
</view>
</view>
</template>
</view>
<button class="ph-pr-button" type="primary" @click="handleClick"
:style="selectedAll ? 'background-color: #2272FF;' : 'background-color: #D1D4D4;'">下一步</button>
</view>
</template>
<script>
export default {
data() {
return {
productList: [],
sysList: [],
brandList: [],
product_code: '',
product: '',
param: {
brand_code: '',
brand: '',
product_code: '',
product: ''
},
selectedAll: false,
}
},
computed: {
list() {
return [{
title: '请选择类别',
data: this.productList
},
{
title: '请选择系统',
data: this.sysList
},
{
title: '请选择品牌',
data: this.brandList
}
]
}
},
onLoad(e) {
getApp().trackPage('选择产品页')
this.getProductList()
},
onShareAppMessage(res) {
let shareObj = {
title: '',
path: '/pages/photo/product',
imageUrl: '',
success() {},
fail() {}
}
return shareObj
},
methods: {
getProductList: function() {
let that = this
this.$u.cloudApi.getAllProduct().then(res => {
console.log('获取产品数据:')
console.log(res)
if (res.result && res.result.data) {
that.productList = res.result.data
}
})
},
//选择 点击
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
}).then(res => {
console.log('获取品牌数据:', res)
if (res.result.data) {
res.result.data.filter((value) => {
value.type = 'brand'
})
this.brandList = res.result.data
this.changeSelectedAll()
}
})
break
default:
this.param.brand_code = item.code
this.param.brand = item.name
this.changeSelectedAll()
}
// 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,
})
},
// 修改下一步按钮是否可以点击
changeSelectedAll() {
for (var item in this.param) {
if (!this.param[item]) {
this.selectedAll = false
return
}
}
this.selectedAll = true
},
//选择 点击
itemClick: function (item) {
if(item.code){
this.product_code = item.code
// 初始化选择
initSelect() {
this.param = {
brand_code: '',
brand: '',
product_code: '',
product: ''
}
if(item.name){
this.product = item.name
}
uni.navigateTo({
url:'/pages/photo/brand'
+ '?product_code=' + this.product_code
+ '&product=' + this.product,
})
},
}
}
</script>
<style>
.backView{
background-color: #FAFAFA;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.topTitle{
margin-top: 192rpx;
font-size: 32rpx;
}
.itemView{
background-color: #FFFFFF;
width: 548rpx;
height: 96rpx;
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;
}
.itemTitle{
font-size: 32rpx;
font-weight:bold;
}
this.brandList = []
this.selectedAll = false
}
}
}
</script>
<style>
.backView {
background-color: #FAFAFA;
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;
border-radius: 52rpx;
height: 104rpx;
font-size: 32rpx;
width: 600rpx;
line-height: 104rpx;
}
</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