适配app端

This commit is contained in:
Double-_-Z 2024-12-30 19:01:03 +08:00
parent fc5100c63a
commit dde6528455
16 changed files with 252 additions and 73 deletions

3
.gitignore vendored
View File

@ -2,8 +2,7 @@
.DS_Store
# 忽略项目编译后的文件
unpackage/dist
unpackage/cache
unpackage
node_modules/
dist/

View File

@ -1,5 +1,12 @@
// 接口环境
// #ifdef H5
let BASE_URL = '/pixelApi';
// #endif
// #ifdef APP-PLUS ||MP
let BASE_URL = 'http://8.138.171.103/pixelApi';
// #endif
let IP = 'http://8.138.171.103/';// 测试环境
// let IP = 'http://1.12.224.227/';// 正式环境
let FILE_URL = IP+'static/';

View File

@ -44,7 +44,12 @@ const ossUpload = async(vm,filePath,success) => {
let res = await vm.$api.getOssSignal();
if(res?.success){
resultPath = res.data.substring(0, res.data.indexOf("?"));
// #ifdef H5
clientPath = res.data.replace(configService.aliUrl, "/ossUpload");
// #endif
// #ifndef H5
clientPath = res.data;
// #endif
// clientPath = res.data.replace(configService.aliAsyncUrl, "/asyncOssUpload");
}
getImageBase64(vm,filePath,success);

View File

@ -104,6 +104,7 @@
"proxy" : {
"/pixelApi" : {
"target" : "http://8.138.171.103/pixelApi", //
// "target" : "http://1.12.224.227/pixelApi",//
"changeOrigin" : true,
"secure" : true,
@ -114,6 +115,7 @@
},
"/upload" : {
"target" : "http://8.138.171.103", //
// "target" : "http://1.12.224.227",//
"changeOrigin" : true,
"secure" : true,
@ -121,6 +123,7 @@
},
"/aiupload" : {
"target" : "http://8.138.171.103/upload", //
// "target" : "http://1.12.224.227",//
"changeOrigin" : true,
"secure" : true,

View File

@ -92,6 +92,14 @@
flex-direction: column;
min-height: 100vh;
background-size: cover;
// #ifdef APP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.rdt-top{
// #ifdef APP
.app-top{

View File

@ -18,14 +18,14 @@ export default {
src: '',
wbStyles: {
width: '100%',
height: '100vh',
height: '100%',
},
}
},
onLoad(option) {
this.title = option?.title
this.src = option.src ? decodeURI(option.src) : '';
console.log(this.src);
console.log('this.src',this.src);
},
}
</script>

View File

@ -69,6 +69,10 @@
<!-- <image class="work-picture" :src="item.picture" mode="widthFix"></image> -->
<view class="sign-text">{{ siftList[item.serviceId] ? siftList[item.serviceId].name : '暂无' }}</view>
<image :lazy-load="true" class="sign" :src="fileUrl+sign"></image>
<view class="work-todo" @click.native.stop="toDeal(item.serviceId)">
<image :src="fileUrl+magicWand"></image>
<text>做同款</text>
</view>
<!-- <image class="compare-sign" mode="widthFix" :src="item.compare"></image> -->
</view>
</view>
@ -149,6 +153,8 @@ export default {
touchNum : 0,
//
group: 10,
//
magicWand: 'magic-wand.png'
}
},
methods:{
@ -238,7 +244,7 @@ export default {
},
//
toDeal(id = null){
if(id!==null)
if(id!==null&&id!=='')
uni.navigateTo({url: `/pages/mobile_web/workshops/index?id=${id}`});
else this.$refs.uToast.show({type:'error',title: "暂未开放对应功能!"});
},
@ -472,6 +478,32 @@ export default {
left: 0.9em;
z-index: 1;
}
.work-todo{
position: absolute;
bottom: 0.85em;
right: 0.7em;
z-index: 1;
border-radius: 12rpx;
padding: 14rpx 30rpx;
background-color: rgba(0, 0, 0, 0.3);
display: flex;
align-items: center;
text{
font-weight: bold;
background-image: linear-gradient(to right, #cdfbf2 0%, #a3d4ff 100%);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
image{
margin-right: 10rpx;
width: 34rpx;
height: 34rpx;
}
&:active{
opacity: 0.8;
}
}
.compare-sign{
position: absolute;
left: 0;

View File

@ -169,6 +169,14 @@ export default {
background-size: cover;
opacity: 0.9;
// #ifdef APP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.ct-top {
// #ifdef APP
.app-top {

View File

@ -23,14 +23,14 @@
<view class="detail-content">
<u-section title="生成记录" :subTitle="`总数 ${total}`"
color="#befda1" fontSize="34" :arrow="false" subColor="#cbe7fb" />
<scroll-view :scroll-top="scrollTop" :scrollY="true" class="createList" @scroll="scroll"
scroll-with-animation>
<scroll-view :scroll-top="scrollTop" :scrollY="true" class="createList"
scroll-with-animation @scroll="scroll">
<u-collapse :itemStyle="{border: '4rpx solid rgba(56,45,79,1)',borderTopRightRadius: '10rpx',
borderTopLeftRadius: '10rpx',marginTop: '30rpx'}" :arrow="false" :headStyle="{color:'#b3a0da',
backgroundColor: 'rgba(56,45,79,0.6)', borderTopLeftRadius: '10rpx',
borderTopRightRadius: '10rpx'}" :bodyStyle="{backgroundColor: 'rgba(56,45,79,1)',minHeight: '100rpx'}">
<u-collapse-item v-for="(item, index) in createList" :key="item.id">
<template #title>
<template slot="title">
<view class="create-item-title">
<view class="cit-left">
{{ index+1 }}. {{ item.type }}
@ -51,7 +51,7 @@
</view>
</view>
<view @click="goTop">
<u-back-top :scrollTop="scrollTop" zIndex="100" :iconStyle="{ color: '#fff' }"
<u-back-top :scrollTop="oldScrollTop" zIndex="100" :iconStyle="{ color: '#fff' }"
:customStyle="{background: 'linear-gradient(180deg, rgba(56,45,79,1) 0%, #b3a0da 100%)',filter: 'opacity(0.96)'}"></u-back-top>
</view>
<u-toast ref="uToast"></u-toast>
@ -79,6 +79,7 @@
},
//
scrollTop: 0,
oldScrollTop: 0,
// /
createList: [],
//
@ -126,13 +127,16 @@
back(){
uni.navigateBack();
},
//
scroll(e){
this.scrollTop = e.detail.scrollTop
},
//
goTop() {
this.scrollTop = this.oldScrollTop;
this.$nextTick(()=>{
this.scrollTop = 0;
});
},
//
scroll(e){
this.oldScrollTop = e.detail.scrollTop;
},
//
dateFormat(time){
@ -180,6 +184,14 @@
flex-direction: column;
min-height: 100vh;
background-size: cover;
// #ifdef APP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.cdt-top{
// #ifdef APP
.app-top{

View File

@ -319,6 +319,14 @@
flex-direction: column;
min-height: 100vh;
background-size: cover;
// #ifdef APP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.lg-top{
// #ifdef APP
.app-top{

View File

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@ -243,6 +243,14 @@ export default {
background-size: cover;
opacity: 0.9;
// #ifdef APP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.st-top {
// #ifdef APP
.app-top {

View File

@ -23,19 +23,19 @@
<view class="detail-content">
<u-section title="发布记录" sub-title="筛选"
color="#befda1" fontSize="34" subColor="#cdfbf2">
<template #right>
<template slot="right">
<image @click="showSift = true" class="dc-sift" src="/static/sift.png"></image>
</template>
</u-section>
<scroll-view :scroll-top="scrollTop" :scrollY="true" class="shareList"
@scroll="scroll" scroll-with-animation>
<scroll-view :scrollTop="scrollTop" :scrollY="true" class="shareList"
scroll-with-animation @scroll="scroll">
<u-swipe-action :index="index" v-for="(item, index) in shareList"
:key="item.id" @click="handleClick" bgColor="#3e3256"
:key="item.id" @click="handleClick" bgColor="#3e3256" @content-click="contentClick"
:options="[{text:'删除',style:{backgroundColor:'#dd524d',marginRight: '-2rpx'}}]">
<view class="share-item">
<view class="share-item" :class="currentClickIndex===index?'change-morphology':''">
<view class="si-left">
<u-lazy-load border-radius="16" class="sil-image"
:image="item.path" @click="previewImage(item.path)"></u-lazy-load>
<u-lazy-load border-radius="16" class="sil-image" :height="currentClickIndex===index? 200 : 140"
:image="item.path" @click.native.stop="previewImage(item.path)"></u-lazy-load>
</view>
<view class="si-right">
<text :style="{color: statusList[item.reviewStatus].color}">
@ -50,7 +50,7 @@
</view>
</view>
<view @click="goTop">
<u-back-top :scrollTop="scrollTop" zIndex="100" :iconStyle="{ color: '#fff' }"
<u-back-top :scrollTop="oldScrollTop" zIndex="100" :iconStyle="{ color: '#fff' }"
:customStyle="{background: 'linear-gradient(180deg, rgba(56,45,79,1) 0%, #b3a0da 100%)',filter: 'opacity(0.96)'}"></u-back-top>
</view>
<u-select v-model="showSift" :list="statusList" @confirm="selectSift" :defaultValue="[siftIndex]"
@ -80,8 +80,10 @@
current: 1,
reviewStatus: ''
},
currentClickIndex: '',
//
scrollTop: 0,
oldScrollTop: 0,
// /
shareList: [],
//
@ -138,13 +140,16 @@
back(){
uni.navigateBack();
},
//
scroll(e){
this.scrollTop = e.detail.scrollTop
},
//
goTop() {
this.scrollTop = this.oldScrollTop;
this.$nextTick(()=>{
this.scrollTop = 0;
});
},
//
scroll(e){
this.oldScrollTop = e.detail.scrollTop;
},
//
dateFormat(time){
@ -169,6 +174,7 @@
if (res.confirm) {
let res = await that.$api.deleteReleases(that.shareList[itemIndex].id);
if(res?.success){
that.currentClickIndex = '';
that.shareList.splice(itemIndex, 1);
that.$refs.uToast.show({type:'success',title: "发布记录删除成功!"});
}else{
@ -179,6 +185,10 @@
});
}
},
//
contentClick(index){
this.currentClickIndex = this.currentClickIndex===index ? '' : index;
},
//
previewImage(path){
tools.methods.lookImage(0,[path]);
@ -213,6 +223,7 @@
const value = e[0].value;
this.siftIndex = value === '' ? 0 : value;
this.form = {size: 10, current: 1, reviewStatus: value};
this.currentClickIndex = '';
this.getShareList();
},
}
@ -225,6 +236,14 @@
flex-direction: column;
min-height: 100vh;
background-size: cover;
// #ifdef APP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.sdt-top{
// #ifdef APP
.app-top{
@ -271,17 +290,21 @@
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
margin: 20rpx;
.si-left{
transition: 0.3s;
width: 140rpx;
height: 140rpx;
display: flex;
justify-content: center;
align-items: center;
.sil-image{
width: 140rpx;
height: 140rpx;
}
}
.si-right{
flex: 1;
display: flex;
flex-direction: column;
align-items: flex-end;
@ -293,6 +316,26 @@
}
}
}
.change-morphology{
.si-left{
width: 100%;
height: 100%;
transition: 0.5s;
.sil-image{
width: 200rpx;
height: 200rpx;
}
}
.si-right{
width: 100%;
align-items: center;
justify-content: center;
text{
margin-bottom: 10rpx;
margin-right: 0rpx;
}
}
}
}
.dc-sift{
width: 50rpx;

View File

@ -92,14 +92,14 @@ export default {
workForm: {
current: 1,
size: 10,
isFinish: false,
isFinish: true,
total: 0
},
// Form
collectForm: {
current: 1,
size: 10,
isFinish: false,
isFinish: true,
total: 0
},
//

View File

@ -5,7 +5,7 @@
<view class="mw-tips">
<u-icon :name="fileUrl+mannequin" size="30" color="#c2ea04" label="选择模特"
labelColor="#eee" margin-left="20rpx" labelSize="32rpx"></u-icon>
<view class="mwt-btn" @click="handleClickSelect(0)">
<view class="mwt-btn" @click="handleClickSelect(0,$event)">
<view :data-select="1" :class="selectOptions[0]?'mwt-select':''">预设模特</view>
<view :class="selectOptions[0]?'':'mwt-select'">自定义</view>
</view>
@ -43,7 +43,7 @@
<view v-show="showRight" class="mwt-back">
<u-icon @click="currentStep-=1" name="/static/back.png" size="32" color="#fff"></u-icon>
</view>
<view v-show="!showRight" class="mwt-btn" @click="handleClickSelect(1)">
<view v-show="!showRight" class="mwt-btn" @click="handleClickSelect(1,$event)">
<view :data-select="1" :class="selectOptions[1]?'mwt-select':''">预设衣服</view>
<view :class="selectOptions[1]?'':'mwt-select'">自定义</view>
</view>
@ -197,7 +197,7 @@ export default {
}
},
// /
handleClickSelect(index){
handleClickSelect(index,event){
if(index!==null){
this.selectOptions[index] = Boolean(event.target.dataset.select);
this.$forceUpdate();

View File

@ -93,7 +93,7 @@
<view class="section-options">
<view class="section-tags" v-for="(item,index) in getOptions" :key="item.id"
:class="selectElementIndex===index?'section-tags-select':''" @click="selectElement(index)">
<image :src="item.path?encodeURI(item.path):'/static/coat.png'"></image>
<image :src="getTypeImage(item.path)"></image>
<text>{{ item.optionName }}</text>
</view>
<!-- <u-tag v-for="(item,index) in getOptions" :key="item.id" :index="index"
@ -150,7 +150,7 @@
<view class="section-options">
<view class="section-tags" v-for="(item,index) in form.options" :key="item.id"
:class="selectElementIndex===index?'section-tags-select':''" @click="selectElement(index)">
<image :src="item.path?encodeURI(item.path):'/static/coat.png'"></image>
<image :src="getTypeImage(item.path)"></image>
<text>{{ item.optionName }}</text>
</view>
<!-- <u-tag v-for="(item,index) in form.options" :key="item.id" :index="index"
@ -329,6 +329,23 @@ export default {
this.$refs.uToast.show({type:'error',title: "随机加载图片获取失败!"});
}
},
//
getTypeImage(path){
if(path === null || path === ''){
return '/static/coat.png';
}else if(path.startsWith("http")){
return path;
}else if(path.startsWith("/")){
// #ifdef H5
return encodeURI(path);
// #endif
// #ifndef H5
return encodeURI(this.ip+path);
// #endif
}else{
return encodeURI(this.ip+path);
}
},
//
back(){
uni.navigateBack();
@ -438,9 +455,10 @@ export default {
//
async asyncPoll(id) {
if(this.asyncPollTime === -1) return;
// 10
if(this.asyncPollTime > 10) {
// 13
if(this.asyncPollTime > 13) {
this.asyncPollTime = -1;
this.$refs.uToast.show({type:'warning',title:'生成时间过长,请移步作品栏目查看图片'});
return;
}
if(this.asyncPollTime === 3){
@ -540,10 +558,12 @@ export default {
serviceId: id,
bottomImageUrl: bottomImageUrl,
topImageUrl: topImageUrl,
imageUrl: that.uploadFile,
imageUrl: that.uploadFile?.includes('://') ? that.uploadFile : encodeURI(that.ip+that.uploadFile),
};
if(bottomImageUrl === '') delete result.bottomImageUrl;
else result.bottomImageUrl = bottomImageUrl?.includes('://') ? bottomImageUrl : encodeURI(that.ip+bottomImageUrl);
if(topImageUrl === '') delete result.topImageUrl;
else result.topImageUrl = topImageUrl?.includes('://') ? topImageUrl : encodeURI(that.ip+topImageUrl);
break;
}
return result;
@ -587,7 +607,12 @@ export default {
}
//
// #ifdef H5
let downloadUrl = await that.resultFile.replace(that.aliIp, "/ossUpload");
// #endif
// #ifndef H5
let downloadUrl = that.resultFile;
// #endif
// #ifdef H5
uni.request({
@ -708,6 +733,14 @@ export default {
justify-content: space-between;
min-height: 100vh;
background-size: cover;
// #ifdef APP
.app-top{
width: 100%;
position: fixed;
z-index: 81;
top: 0;
}
// #endif
.mwt-top{
// #ifdef APP
.app-top{
@ -757,6 +790,11 @@ export default {
margin-top: 120rpx;
display: flex;
align-items: center;
width: calc(100% + 100rpx);
margin-left: -50rpx;
border-radius: 20rpx;
box-shadow: 0 0 10rpx #eee;
border: 2rpx solid #858585;
}
.mwu-cover{
width: 100%;