修改图片画质,已上传体验版成功

This commit is contained in:
clay
2022-12-18 23:06:32 +08:00
parent 202da2a061
commit e073739ee5
17 changed files with 193 additions and 174 deletions

View File

@@ -1,8 +1,10 @@
<template>
<view>
<view v-for="(item,index) in detailList" :key="index">
<u-image :src="item.src" width="750rpx" height="530rpx" :lazy-load="true">
</u-image>
<u-swiper :list="swiperList" indicatorMode="line " width="750rpx" height="530rpx" radius="0" circular>
</u-swiper>
<view class="collect">
<u-icon :name="like?'heart-fill':'heart'" color="#FEAA19" size="23" @click.stop="likeTap"></u-icon>
<view class="collect_text">收藏</view>
@@ -41,7 +43,7 @@
return {
like: false,
detailList: [{
src: '/static/detail/zhanwei_xppx.png',
// src: '/static/detail/zhanwei_xppx.png',
title: '锅巴',
tag: '零食铺子',
desc: '糯米蟹黄锅巴散装,非油炸绿色健康食品',
@@ -50,7 +52,11 @@
tagTwo: '无添加剂',
time: '2022年12月04日',
content: '<h1>一级标题</h1><br/><h2>二级标题</h2>'
}]
}],
swiperList: [
'/static/detail/zhanwei_xppx.png',
'/static/detail/zhanwei_xppx.png'
]
}
},
methods: {

View File

@@ -59,14 +59,8 @@
<view v-if="tabCurrent === 1" style="margin-bottom: 20rpx;">
<u-form-item label="上传图片" labelPosition="top">
<view style="padding-left: 20rpx;margin-top: 20rpx;">
<u-upload
:fileList="fileList1"
@afterRead="afterRead"
@delete="deletePic"
name="1"
multiple
:maxCount="10"
></u-upload>
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="10"></u-upload>
</view>
</u-form-item>
</view>
@@ -182,50 +176,50 @@
codeChange(text) {
this.tips = text;
},
// 删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
// 新增图片
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
uploadFilePromise(url) {
// return new Promise((resolve, reject) => {
// let a = uni.uploadFile({
// url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
// filePath: url,
// name: 'file',
// formData: {
// user: 'test'
// },
// success: (res) => {
// setTimeout(() => {
// resolve(res.data.data)
// }, 1000)
// }
// });
// })
},
// 删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
// 新增图片
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
uploadFilePromise(url) {
// return new Promise((resolve, reject) => {
// let a = uni.uploadFile({
// url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
// filePath: url,
// name: 'file',
// formData: {
// user: 'test'
// },
// success: (res) => {
// setTimeout(() => {
// resolve(res.data.data)
// }, 1000)
// }
// });
// })
},
}
}
</script>

View File

@@ -1,29 +0,0 @@
<template>
<view>
<myForm></myForm>
<u-button type="success" text="确定" color="#0EBB5B"></u-button>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style lang="scss">
.u-button {
width: 644rpx !important;
height: 86rpx !important;
background: #0EBB5B;
border-radius: 20rpx !important;
margin-top: 168rpx;
}
</style>

View File

@@ -1,196 +0,0 @@
<template>
<view>
<view class="products_box">
<u-grid :border="false" col="2">
<u-grid-item v-for="(item,index) in productList" :key="index">
<u-image src="/static/products/sy_bb.png" width="354rpx" height="539rpx" :lazy-load="true">
</u-image>
<view class="bgContent">
<view>
<u-image :src="item.src" width="346rpx" height="320rpx" :lazy-load="true"
@click="toDetailPage()">
</u-image>
<view class="img_tag">{{item.img_tag}}</view>
</view>
<view style="padding: 16rpx;">
<view class="title_box">
<text class="title">{{item.title}}</text>
<u-tag :text="item.tag" type="warning" shape="circle"></u-tag>
</view>
<view class="product_desc">
{{item.desc}}
</view>
<view class="releaseDate">
<u-image src="/static/products/sy_icon_sjf.png" width="22rpx" height="22rpx"
:lazy-load="true">
</u-image>
<text class="release">发布日期</text>
<text>{{item.time}}</text>
</view>
</view>
</view>
<u-button v-if="type==1" type="success" text="移除" color="#0EBB5B"></u-button>
<u-button v-if="type==2" type="success" text="取消收藏" color="#0EBB5B"></u-button>
</u-grid-item>
</u-grid>
</view>
</view>
</template>
<script>
export default {
data() {
return {
type: '',
productList: [{
src: '/static/products/zhanwei_dg.png',
title: '锅巴',
tag: '无添加剂',
img_tag: '零食铺子',
desc: '糯米蟹黄锅巴散装,非油炸绿色健康食品',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg.png',
title: '干吃汤圆',
tag: '天然原料',
img_tag: '糕点卷酥',
desc: '休闲食品厂家甜品糯米食品零食闽南特产宵夜好吃糍粑',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg.png',
title: '紫薯魔芋人参魔芋人参魔芋人参…',
tag: '天然原料',
img_tag: '健康创新',
desc: '紫薯魔芋人参代餐粉 冲调饮品贴牌加工 五谷杂粮粉代餐',
time: '2022-12-04'
},
{
src: '/static/products/zhanwei_dg.png',
title: '焦糖饼干',
tag: '无防腐剂',
img_tag: '饼干曲奇',
desc: '比利时风味焦糖饼干代餐小吃零食品',
time: '2022-12-04'
}
]
}
},
onLoad(options) {
this.type = options.id
},
methods: {
}
}
</script>
<style lang="scss">
.u-button {
width: 150rpx !important;
height: 50rpx !important;
background: #0EBB5B;
border-radius: 10rpx !important;
margin-top: 22rpx;
margin-bottom: 50rpx;
}
.products_box {
padding: 10rpx;
.u-grid-item {
.bgContent {
position: absolute;
right: 0;
top: 0;
.u-image__image {
margin-left: 6px;
}
.img_tag {
position: absolute;
padding: 2rpx 8rpx;
right: 5px;
top: 30rpx;
border-radius: 54rpx 0px 0px 54rpx;
box-shadow: 0px 2rpx 4rpx 0px #078C42;
background: linear-gradient(135deg, #0DB658 0%, #16DD6D 100%);
font-size: 20rpx;
color: #FFFFFF;
line-height: 28rpx;
}
.title_box {
position: relative;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
.title {
width: 186rpx;
font-size: 26rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: bold;
color: #0EBB5B;
line-height: 37rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.u-tag {
height: 26rpx;
line-height: 26rpx;
background: linear-gradient(124deg, #FEAA19 0%, #FDCF3A 100%);
.u-tag__text {
font-size: 20rpx;
}
}
}
.product_desc {
font-size: 22rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #3E3E3E;
line-height: 26rpx;
margin-top: 24rpx;
margin-bottom: 20rpx;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.releaseDate {
font-size: 22rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #A3A3A3;
line-height: 26rpx;
display: flex;
align-items: center;
padding-bottom: 25rpx;
image {
margin-left: 0;
}
.release {
padding: 0 10rpx 0 5rpx;
}
}
}
}
}
</style>

View File

@@ -1,90 +0,0 @@
<template>
<view>
<u-navbar :autoBack="true" title="会员中心"></u-navbar>
<u--image src="/static/my/wo_icon_hyzxbj.png" width="750rpx" height="349rpx" :lazy-load="true">
</u--image>
<myAvatar></myAvatar>
<myForm></myForm>
<view class="commitment">
{{commitment}}
</view>
<u-button type="success" text="升级VIP" color="#0EBB5B" @click="showModal()"></u-button>
<u-modal :show="showM" closeOnClickOverlay confirmText="确定" @confirm="confirm" @close="close">
<rich-text :nodes="content"></rich-text>
</u-modal>
</view>
</template>
<script>
export default {
data() {
return {
showM: false,
content: `请保持手机畅通<br>
客服会及时联系您`,
commitment: '承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置'
}
},
methods: {
// 联系客服模态框
showModal() {
this.showM = true
},
confirm() {
this.showM = false
},
cancel() {
this.showM = false
},
close() {
this.showM = false
},
}
}
</script>
<style lang="scss">
.commitment {
font-size: 26rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #C8C8C8;
line-height: 28rpx;
margin: 40rpx 66rpx;
}
.u-button {
width: 644rpx !important;
height: 86rpx !important;
background: #0EBB5B;
border-radius: 20rpx !important;
}
.u-modal {
width: 472rpx !important;
}
.u-modal__content {
padding: 43rpx 104rpx !important;
text-indent: 14rpx;
}
.u-modal__content__text {
font-size: 32rpx !important;
font-weight: 400;
color: #252421 !important;
}
.u-modal__button-group__wrapper--hover {
background: #0EBB5B !important;
}
.u-modal__button-group__wrapper--confirm {
background: #0EBB5B;
.u-modal__button-group__wrapper__text {
color: #fff !important;
}
}
</style>

View File

@@ -43,25 +43,25 @@
//跳转到绑定公司页面
bindCompany() {
uni.navigateTo({
url: '/pages/my/bindCompony/bindCompony'
url: '../../packageMy/bindCompony/bindCompony'
})
},
//跳转到会员中心页面
toMemberCenter() {
uni.navigateTo({
url: '/pages/my/memberCenter/memberCenter'
url: '../../packageMy/memberCenter/memberCenter'
})
},
//跳转到浏览记录页面
toBrowseHistory() {
uni.navigateTo({
url: '/pages/my/browseHistory/browseHistory?id=' + 1
url: '../../packageMy/browseHistory/browseHistory?id=' + 1
})
},
//跳转到我的收藏页面
toMyCollect() {
uni.navigateTo({
url: '/pages/my/browseHistory/browseHistory?id=' + 2
url: '../../packageMy/browseHistory/browseHistory?id=' + 2
})
},
// 联系客服模态框