pc端完善
This commit is contained in:
parent
2384142adc
commit
05bdd90f19
2
main.js
2
main.js
@ -13,6 +13,8 @@ Vue.use(uView);
|
|||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
import ElementUI from 'element-ui'
|
import ElementUI from 'element-ui'
|
||||||
import 'element-ui/lib/theme-chalk/index.css'
|
import 'element-ui/lib/theme-chalk/index.css'
|
||||||
|
import VueMasonry from 'vue-masonry-css'
|
||||||
|
Vue.use(VueMasonry);
|
||||||
Vue.use(ElementUI)
|
Vue.use(ElementUI)
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"element-ui": "^2.15.14"
|
"element-ui": "^2.15.14",
|
||||||
|
"vue-masonry-css": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ export default {
|
|||||||
// #endif
|
// #endif
|
||||||
this.scrollTop = e.scrollTop;
|
this.scrollTop = e.scrollTop;
|
||||||
},
|
},
|
||||||
// #ifdef MP
|
// #ifdef MP || APP
|
||||||
onLoad(){
|
onLoad(){
|
||||||
let index = uni.getStorageSync('current');
|
let index = uni.getStorageSync('current');
|
||||||
this.current = index?index:0;
|
this.current = index?index:0;
|
||||||
@ -91,12 +91,12 @@ export default {
|
|||||||
let index = uni.getStorageSync('current');
|
let index = uni.getStorageSync('current');
|
||||||
this.current = index?index:0;
|
this.current = index?index:0;
|
||||||
this.isLogin = this.$store.state.vuex_token;
|
this.isLogin = this.$store.state.vuex_token;
|
||||||
// #ifdef MP
|
// #ifdef MP || APP
|
||||||
if(this.current === 2){
|
if(this.current === 2){
|
||||||
this.changeCurrent(this.current);
|
this.changeCurrent(this.current);
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef MP
|
// #ifndef MP || APP
|
||||||
if(this.current === 1){
|
if(this.current === 1){
|
||||||
uni.pageScrollTo({scrollTop: 0});
|
uni.pageScrollTo({scrollTop: 0});
|
||||||
}
|
}
|
||||||
|
@ -236,10 +236,10 @@ export default {
|
|||||||
},
|
},
|
||||||
// 返回
|
// 返回
|
||||||
back(){
|
back(){
|
||||||
// #ifdef MP
|
// #ifdef MP || APP
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef MP
|
// #ifndef MP || APP
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/mobile_web/recharge/recharge'
|
url: '/pages/mobile_web/recharge/recharge'
|
||||||
})
|
})
|
||||||
|
@ -136,10 +136,10 @@
|
|||||||
methods:{
|
methods:{
|
||||||
// 返回
|
// 返回
|
||||||
back(){
|
back(){
|
||||||
// #ifdef MP
|
// #ifdef MP || APP
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef MP
|
// #ifndef MP || APP
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/mobile_web/index/index'
|
url: '/pages/mobile_web/index/index'
|
||||||
})
|
})
|
||||||
|
@ -414,10 +414,10 @@ export default {
|
|||||||
},
|
},
|
||||||
// 返回
|
// 返回
|
||||||
back(){
|
back(){
|
||||||
// #ifdef MP
|
// #ifdef MP || APP
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef MP
|
// #ifndef MP || APP
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/mobile_web/index/index'
|
url: '/pages/mobile_web/index/index'
|
||||||
})
|
})
|
||||||
|
@ -45,22 +45,28 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="hs-services">
|
<view class="hs-services">
|
||||||
<!-- 多列布局图片 -->
|
<!-- 瀑布流布局图片 -->
|
||||||
<view class="hs-service" v-for="(item,index) in workList" :key="item.id">
|
<masonry :cols="7" gutter="1em">
|
||||||
<u-lazy-load @click="preview(item)" :title="item.serviceName||'暂无'" border-radius="30" class="hss-picture"
|
<view class="hs-service" v-for="(item,index) in workList" :key="item.id">
|
||||||
:image="getWorkPath(item.path)" v-loading="item.loading"></u-lazy-load>
|
<u-lazy-load @click="preview(item)" :title="item.serviceName||'暂无'" border-radius="30" class="hss-picture"
|
||||||
<view class="sign-text">{{ item.serviceName || '暂无' }}</view>
|
:image="getWorkPath(item.path)" v-loading="item.loading"></u-lazy-load>
|
||||||
<image :lazy-load="true" class="sign" :src="fileUrl+sign"></image>
|
<view class="sign-text">{{ item.serviceName || '暂无' }}</view>
|
||||||
<view class="work-todo">
|
<image :lazy-load="true" class="sign" :src="fileUrl+sign"></image>
|
||||||
<view class="wt-same" @click.stop="$emit('handleChangeService', item.serviceId)">
|
<view class="work-todo">
|
||||||
<image :src="fileUrl+magicWand"></image>
|
<view class="wt-same" @click.stop="$emit('handleChangeService', item.serviceId)">
|
||||||
<text>做同款</text>
|
<image :src="fileUrl+magicWand"></image>
|
||||||
</view>
|
<text>做同款</text>
|
||||||
<view class="wt-same wt-download" @click="download(item)">
|
</view>
|
||||||
<u-icon name="download" size="36" color="#c9fe76" />
|
<view class="wt-same wt-download" @click="download(item)">
|
||||||
<text>下载 </text>
|
<u-icon name="download" size="36" color="#c9fe76" />
|
||||||
</view>
|
<text>下载 </text>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</masonry>
|
||||||
|
<!-- 下面这里等后端有了之后,用isFinish判断 -->
|
||||||
|
<view class="last-tip" :class="recommendForm.isFinish?'':'clickable'" @click="getMore">
|
||||||
|
{{ recommendForm.isFinish ? '~~ 已加载全部 ~~' : '~~ 点击加载更多 ~~' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -102,7 +108,7 @@ export default {
|
|||||||
// 推荐作品表单
|
// 推荐作品表单
|
||||||
recommendForm: {
|
recommendForm: {
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 10,
|
size: 20,
|
||||||
isFinish: true,
|
isFinish: true,
|
||||||
serviceName: '',
|
serviceName: '',
|
||||||
isBackend: 0
|
isBackend: 0
|
||||||
@ -237,6 +243,12 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 查看更多
|
||||||
|
getMore(){
|
||||||
|
if(this.recommendForm.isFinish) return;
|
||||||
|
this.recommendForm.current++;
|
||||||
|
this.getWorkList();
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -406,18 +418,18 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.hs-services{
|
.hs-services{
|
||||||
padding: 40rpx;
|
padding: 0rpx 40rpx 40rpx;
|
||||||
column-count:5;
|
// column-count:5;
|
||||||
-moz-column-count:5; /* Firefox */
|
// -moz-column-count:5; /* Firefox */
|
||||||
-webkit-column-count:5; /* Safari 和 Chrome */
|
// -webkit-column-count:5; /* Safari 和 Chrome */
|
||||||
column-gap: 2em;
|
// column-gap: 2em;
|
||||||
-moz-column-gap: 2em;
|
// -moz-column-gap: 2em;
|
||||||
-webkit-column-gap: 2em;
|
// -webkit-column-gap: 2em;
|
||||||
.hs-service{
|
.hs-service{
|
||||||
-webkit-column-break-inside: avoid;
|
-webkit-column-break-inside: avoid;
|
||||||
break-inside: avoid; /*防止断点*/
|
break-inside: avoid; /*防止断点*/
|
||||||
// width: 400rpx;
|
// width: 400rpx;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 1em;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 30rpx;
|
border-radius: 30rpx;
|
||||||
@ -509,6 +521,25 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.last-tip{
|
||||||
|
font-size: 36rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
background-image: linear-gradient(to right, #a3d4ff 0%, #bee7df 100%);
|
||||||
|
background-clip: text;
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
}
|
||||||
|
.clickable{
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover{
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
&:active{
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
@ -35,9 +35,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="second-content">
|
<view class="second-content">
|
||||||
<Second @showToast="showToast" @handleChangeService="handleChangeService"/>
|
<Second @showToast="$emit('toast')" @handleChangeService="handleChangeService"/>
|
||||||
</view>
|
</view>
|
||||||
<u-toast ref="uToast"></u-toast>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -104,20 +103,16 @@ export default {
|
|||||||
this.$refs.uploadCover.clearFiles();
|
this.$refs.uploadCover.clearFiles();
|
||||||
const size = file.size / 1024; // 计算文件大小
|
const size = file.size / 1024; // 计算文件大小
|
||||||
if(size<5 || (size/1024)>5){
|
if(size<5 || (size/1024)>5){
|
||||||
this.$refs.uToast.show({type: 'warning',title: "请上传大小为5KB~5MB的图片!"});
|
this.$emit('toast',{type: 'warning',title: "请上传大小为5KB~5MB的图片!"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let isAccept = new RegExp('image/*').test(file.raw.type)
|
let isAccept = new RegExp('image/*').test(file.raw.type)
|
||||||
if (!isAccept) {
|
if (!isAccept) {
|
||||||
this.$refs.uToast.show({type: 'warning',title: "图片上传格式错误!"});
|
this.$emit('toast',{type: 'warning',title: "图片上传格式错误!"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.$emit('workshopPage',fileList[0]?.url);
|
uni.$emit('workshopPage',fileList[0]?.url);
|
||||||
},
|
},
|
||||||
// 提示语弹窗
|
|
||||||
showToast({type,title}){
|
|
||||||
this.$refs.uToast.show({type: type, title: title});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
@ -222,6 +217,7 @@ export default {
|
|||||||
position: relative;
|
position: relative;
|
||||||
margin: 10rpx 40rpx;
|
margin: 10rpx 40rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
|
// height: 330rpx;
|
||||||
.work-module{
|
.work-module{
|
||||||
width: 240rpx;
|
width: 240rpx;
|
||||||
height: 330rpx;
|
height: 330rpx;
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<el-dropdown-menu :append-to-body="false" slot="dropdown">
|
<el-dropdown-menu :append-to-body="false" slot="dropdown">
|
||||||
<el-dropdown-item v-for="(item,index) in dropList" :key="index"
|
<el-dropdown-item v-for="(item,index) in dropList" :key="index"
|
||||||
class="dropdown-item" :command="item.path">{{ item.name }}
|
class="dropdown-item" :command="item.path">
|
||||||
|
{{ item.name }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item command="loginout" class="dropdown-loginout" divided>退出登录</el-dropdown-item>
|
<el-dropdown-item command="loginout" class="dropdown-loginout" divided>退出登录</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
@ -39,6 +40,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-toast ref="uToast"></u-toast>
|
<u-toast ref="uToast"></u-toast>
|
||||||
|
<RecordDrawer :refType="drawerRefType" :showDialog="showRecordDrawer" @toast="showToast" @close="showRecordDrawer = false" />
|
||||||
<LoginDialog :showLogin="showLogin" @toast="showToast" @close="showLogin = false" @openCode="showMobileDownloadDialog = true"
|
<LoginDialog :showLogin="showLogin" @toast="showToast" @close="showLogin = false" @openCode="showMobileDownloadDialog = true"
|
||||||
@login="login"/>
|
@login="login"/>
|
||||||
<MobileDownloadDialog @toast="showToast" :showDialog="showMobileDownloadDialog" @close="showMobileDownloadDialog = false" />
|
<MobileDownloadDialog @toast="showToast" :showDialog="showMobileDownloadDialog" @close="showMobileDownloadDialog = false" />
|
||||||
@ -51,6 +53,7 @@
|
|||||||
import LoginDialog from './loginDialog.vue';
|
import LoginDialog from './loginDialog.vue';
|
||||||
import MobileDownloadDialog from './mobileDownloadDialog.vue';
|
import MobileDownloadDialog from './mobileDownloadDialog.vue';
|
||||||
import IdentityDialog from './identityDialog.vue';
|
import IdentityDialog from './identityDialog.vue';
|
||||||
|
import RecordDrawer from './recordDrawer.vue';
|
||||||
import configService from '@/common/config.service.js';
|
import configService from '@/common/config.service.js';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -66,7 +69,8 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
LoginDialog,
|
LoginDialog,
|
||||||
MobileDownloadDialog,
|
MobileDownloadDialog,
|
||||||
IdentityDialog
|
IdentityDialog,
|
||||||
|
RecordDrawer
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
@ -85,6 +89,10 @@ export default {
|
|||||||
name: '工作台',
|
name: '工作台',
|
||||||
path: 'workshops'
|
path: 'workshops'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '作品',
|
||||||
|
path: 'work'
|
||||||
|
},
|
||||||
],
|
],
|
||||||
// 头像
|
// 头像
|
||||||
avatar: 'avatar.png',
|
avatar: 'avatar.png',
|
||||||
@ -100,23 +108,31 @@ export default {
|
|||||||
showMobileDownloadDialog: false,
|
showMobileDownloadDialog: false,
|
||||||
// 个人信息+充值弹窗显示
|
// 个人信息+充值弹窗显示
|
||||||
showIdentityDialog: false,
|
showIdentityDialog: false,
|
||||||
|
// 记录抽屉栏显示
|
||||||
|
showRecordDrawer: false,
|
||||||
|
// 抽屉栏ref组件类型
|
||||||
|
drawerRefType: '',
|
||||||
// 下拉栏列表
|
// 下拉栏列表
|
||||||
dropList: [
|
dropList: [
|
||||||
|
// {
|
||||||
|
// name: '我的作品',
|
||||||
|
// path: ''
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: '我的藏品',
|
||||||
|
// path: ''
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
name: '我的作品',
|
name: '充值记录',
|
||||||
path: ''
|
path: 'recharge'
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '我的藏品',
|
|
||||||
path: ''
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '生成记录',
|
name: '生成记录',
|
||||||
path: ''
|
path: 'create'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '发布记录',
|
name: '发布记录',
|
||||||
path: ''
|
path: 'share'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@ -172,7 +188,10 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if(path) uni.navigateTo({url: path});
|
} else if(path){
|
||||||
|
this.drawerRefType = path;
|
||||||
|
this.showRecordDrawer = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 换页
|
// 换页
|
||||||
changePage(index){
|
changePage(index){
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="pay-btn">
|
<view class="pay-btn">
|
||||||
<view class="pay-text" :class=" selectElementIndex ? '' : 'pay-disabled'" @click="toShowCell(2)">
|
<view class="pay-text" :class=" selectElementIndex !== '' ? '' : 'pay-disabled'" @click="toShowCell(2)">
|
||||||
<u-icon name="weixin-fill" color="#b2f08f" size="40" margin-left="10"
|
<u-icon name="weixin-fill" color="#b2f08f" size="40" margin-left="10"
|
||||||
label="微信支付" label-color="#b2f08f" label-size="32"/>
|
label="微信支付" label-color="#b2f08f" label-size="32"/>
|
||||||
</view>
|
</view>
|
||||||
@ -191,22 +191,28 @@ export default {
|
|||||||
this.showCell = false;
|
this.showCell = false;
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
// 下面判断模拟后端获取数据生成微信支付二维码
|
// 下面判断模拟后端获取数据生成微信支付二维码
|
||||||
if(type === 2){
|
if(type === 2 && this.selectElementIndex !== ''){
|
||||||
this.payLoading = true;
|
this.payLoading = true;
|
||||||
setTimeout(()=>{this.payLoading = false;},1000)
|
this.showCell = true;
|
||||||
|
this.currentType = type;
|
||||||
|
setTimeout(()=>{this.payLoading = false;},1000);
|
||||||
|
}else if(type !== 2){
|
||||||
|
this.showCell = true;
|
||||||
|
this.currentType = type;
|
||||||
}
|
}
|
||||||
this.showCell = true;
|
|
||||||
this.currentType = type;
|
|
||||||
});
|
});
|
||||||
// 当前侧栏关闭——打开侧栏
|
// 当前侧栏关闭——打开侧栏
|
||||||
} else {
|
} else {
|
||||||
// 下面判断模拟后端获取数据生成微信支付二维码
|
// 下面判断模拟后端获取数据生成微信支付二维码
|
||||||
if(type === 2){
|
if(type === 2 && this.selectElementIndex !== ''){
|
||||||
this.payLoading = true;
|
this.payLoading = true;
|
||||||
setTimeout(()=>{this.payLoading = false;},1000)
|
this.showCell = true;
|
||||||
|
this.currentType = type;
|
||||||
|
setTimeout(()=>{this.payLoading = false;},1000);
|
||||||
|
}else if(type !== 2){
|
||||||
|
this.showCell = true;
|
||||||
|
this.currentType = type;
|
||||||
}
|
}
|
||||||
this.showCell = true;
|
|
||||||
this.currentType = type;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 预览图片
|
// 预览图片
|
||||||
@ -215,7 +221,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 选择支付额度
|
// 选择支付额度
|
||||||
selectOption(index){
|
selectOption(index){
|
||||||
if(this.selectElementIndex && this.selectElementIndex !== index){
|
if(this.showCell && this.currentType === 2 && this.selectElementIndex !== index){
|
||||||
this.showCell = false;
|
this.showCell = false;
|
||||||
setTimeout(()=>{this.toShowCell(2);})
|
setTimeout(()=>{this.toShowCell(2);})
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
</view>
|
</view>
|
||||||
<view style="width: 100%;height: 100rpx;"></view>
|
<view style="width: 100%;height: 100rpx;"></view>
|
||||||
<view class="pc-main">
|
<view class="pc-main">
|
||||||
<component ref="pageRef" @changeService="changeService" :sid="serviceId" :is="refs[current]" />
|
<component ref="pageRef" @toast="showToast" @changeService="changeService" :sid="serviceId" :is="refs[current]" />
|
||||||
</view>
|
</view>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
<Movable textColor="#94d500" @toast="showToast" v-if="isLogin !== ''"/>
|
||||||
<Loading :show="loading" />
|
<Loading :show="loading" />
|
||||||
<u-back-top class="back-top" :scrollTop="scrollTop" zIndex="100" :iconStyle="{ color: '#fff', fontSize: '50rpx' }"
|
<u-back-top class="back-top" :scrollTop="scrollTop" zIndex="100" :iconStyle="{ color: '#fff', fontSize: '50rpx' }"
|
||||||
:customStyle="{background: 'linear-gradient(180deg, #96fe11 0%, #f0fdbf 100%)',
|
:customStyle="{background: 'linear-gradient(180deg, #96fe11 0%, #f0fdbf 100%)',
|
||||||
@ -27,12 +28,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from './components/header.vue';
|
import Header from './components/header.vue';
|
||||||
import Home from '@/pages/pc_web/home/home.vue';
|
import Home from '@/pages/pc_web/home/home.vue';
|
||||||
import Workshops from '@/pages/pc_web/workshops/workshops.vue'
|
import Workshops from '@/pages/pc_web/workshops/workshops.vue';
|
||||||
|
import Work from '@/pages/pc_web/work/work.vue';
|
||||||
|
import Movable from './components/movable.vue';
|
||||||
import configService from '@/common/config.service.js';
|
import configService from '@/common/config.service.js';
|
||||||
import { tools } from '@/utils/utils.js';
|
import { tools } from '@/utils/utils.js';
|
||||||
export default {
|
export default {
|
||||||
components:{
|
components:{
|
||||||
Header, Home, Workshops
|
Header, Home, Workshops, Work, Movable
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
@ -42,7 +45,7 @@ export default {
|
|||||||
// 当前页码下标
|
// 当前页码下标
|
||||||
current: uni.getStorageSync('pc_current')||0,
|
current: uni.getStorageSync('pc_current')||0,
|
||||||
// refs组件列表
|
// refs组件列表
|
||||||
refs: ['home','workshops'],
|
refs: ['home','workshops','work'],
|
||||||
// 加载
|
// 加载
|
||||||
loading: false,
|
loading: false,
|
||||||
// 滚动顶部
|
// 滚动顶部
|
||||||
@ -100,13 +103,17 @@ export default {
|
|||||||
// 切换主体
|
// 切换主体
|
||||||
changePlat(current){
|
changePlat(current){
|
||||||
if(this.current === current) return;
|
if(this.current === current) return;
|
||||||
if(current === 1 && !this.isLogin){
|
if(current !== 0 && !this.isLogin){
|
||||||
this.$refs.header.showLogin = true;
|
this.$refs.header.showLogin = true;
|
||||||
this.$refs.uToast.show({type: 'warning', title: '请先登录!'});
|
this.$refs.uToast.show({type: 'warning', title: '请先登录!'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.setStorageSync('pc_current', current);
|
uni.setStorageSync('pc_current', current);
|
||||||
this.current = current;
|
this.current = current;
|
||||||
|
},
|
||||||
|
// 提示语弹窗
|
||||||
|
showToast({type,title,duration = 2000}){
|
||||||
|
this.$refs.uToast.show({type: type, title: title,duration: duration});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,6 @@
|
|||||||
<view class="error-tips" v-if="errorTips">失败原因:{{ errorTips }}</view>
|
<view class="error-tips" v-if="errorTips">失败原因:{{ errorTips }}</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <Loading :show="loading"></Loading> -->
|
<!-- <Loading :show="loading"></Loading> -->
|
||||||
<u-toast ref="uToast"></u-toast>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -281,10 +280,10 @@ export default {
|
|||||||
this.serviceItem.type = Number(this.serviceItem.type);
|
this.serviceItem.type = Number(this.serviceItem.type);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.$refs.uToast.show({type: 'error', title: '服务列表获取失败'});
|
this.$emit('toast',{type:'error',title: "服务列表获取失败!"});
|
||||||
}
|
}
|
||||||
}catch(e){
|
}catch(e){
|
||||||
this.$refs.uToast.show({type: 'error', title: '服务列表获取失败'});
|
this.$emit('toast',{type:'error',title: "服务列表获取失败!"});
|
||||||
}finally{
|
}finally{
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
@ -295,7 +294,7 @@ export default {
|
|||||||
if(res?.success){
|
if(res?.success){
|
||||||
this.rangeImageList = res.data;
|
this.rangeImageList = res.data;
|
||||||
}else{
|
}else{
|
||||||
this.$refs.uToast.show({type:'error',title: "随机加载图片获取失败!"});
|
this.$emit('toast',{type:'error',title: "随机加载图片获取失败!"});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取单个服务内容
|
// 获取单个服务内容
|
||||||
@ -305,7 +304,7 @@ export default {
|
|||||||
this.serviceItem = res.data;
|
this.serviceItem = res.data;
|
||||||
this.serviceItem.type = Number(this.serviceItem.type);
|
this.serviceItem.type = Number(this.serviceItem.type);
|
||||||
}else{
|
}else{
|
||||||
this.$refs.uToast.show({type:'error',title: "ai功能暂未开放!"});
|
this.$emit('toast',{type:'error',title: "ai功能暂未开放!"});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 更换服务
|
// 更换服务
|
||||||
@ -347,13 +346,13 @@ export default {
|
|||||||
if(this.serviceItem.exampleUrl){
|
if(this.serviceItem.exampleUrl){
|
||||||
window.open(encodeURI(this.serviceItem.exampleUrl));
|
window.open(encodeURI(this.serviceItem.exampleUrl));
|
||||||
}else{
|
}else{
|
||||||
this.$refs.uToast.show({type:'warning',title: "暂无使用教程,请自求多福!"});
|
this.$emit('toast',{type:'warning',title: "暂无使用教程,请自求多福!"});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 增强提示词
|
// 增强提示词
|
||||||
async strengthenTip({input, deal}){
|
async strengthenTip({input, deal}){
|
||||||
if(input === ''){
|
if(input === ''){
|
||||||
this.$refs.uToast.show({type:'warning',title: "请提供部分词句!"});
|
this.$emit('toast',{type:'warning',title: "请提供部分词句!"});
|
||||||
deal();
|
deal();
|
||||||
return;
|
return;
|
||||||
}else{
|
}else{
|
||||||
@ -361,7 +360,7 @@ export default {
|
|||||||
if(res.success){
|
if(res.success){
|
||||||
deal(res.data);
|
deal(res.data);
|
||||||
}else{
|
}else{
|
||||||
this.$refs.uToast.show({type:'error',title: "提示词强化失败!"});
|
this.$emit('toast',{type:'error',title: "提示词强化失败!"});
|
||||||
deal();
|
deal();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -383,15 +382,15 @@ export default {
|
|||||||
selectImage(file,uploadFiles){
|
selectImage(file,uploadFiles){
|
||||||
let that = this;
|
let that = this;
|
||||||
if (file.raw.type.indexOf('image/') === -1) {
|
if (file.raw.type.indexOf('image/') === -1) {
|
||||||
this.$refs.uploadCover.clearFiles();
|
that.$refs.uploadCover.clearFiles();
|
||||||
that.$refs.uToast.show({type: 'warning',title: "图片上传格式错误!"});
|
that.$emit('toast',{type: 'warning',title: "图片上传格式错误!"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size = file.raw.size / 1024; // 计算文件大小
|
const size = file.raw.size / 1024; // 计算文件大小
|
||||||
if(size<5 || (size/1024)>5){
|
if(size<5 || (size/1024)>5){
|
||||||
this.$refs.uploadCover.clearFiles();
|
that.$refs.uploadCover.clearFiles();
|
||||||
that.$refs.uToast.show({type: 'warning',title: "图片大小不符合规范!"});
|
that.$emit('toast',{type: 'warning',title: "图片大小不符合规范!"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
that.uploadDisabled = true;
|
that.uploadDisabled = true;
|
||||||
@ -402,29 +401,29 @@ export default {
|
|||||||
legalJudge(){
|
legalJudge(){
|
||||||
const currentType = this.serviceItem.type;
|
const currentType = this.serviceItem.type;
|
||||||
if(currentType !== 3 && currentType !== 1 && this.formData.uploadFile === ''){
|
if(currentType !== 3 && currentType !== 1 && this.formData.uploadFile === ''){
|
||||||
this.$refs.uToast.show({type:'error',title: currentType === 4 ? "请选择模特!" : "请上传图片!"});
|
this.$emit('toast',{type:'error',title: currentType === 4 ? "请选择模特!" : "请上传图片!"});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(currentType === 1){
|
if(currentType === 1){
|
||||||
if(this.selectElementIndex === '' || !this.serviceItem.text){
|
if(this.selectElementIndex === '' || !this.serviceItem.text){
|
||||||
this.$refs.uToast.show({type:'error',title: "请完善信息!"});
|
this.$emit('toast',{type:'error',title: "请完善信息!"});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(currentType === 2 && this.selectElementIndex === ''){
|
if(currentType === 2 && this.selectElementIndex === ''){
|
||||||
this.$refs.uToast.show({type:'error',title: "请选择图片元素!"});
|
this.$emit('toast',{type:'error',title: "请选择图片元素!"});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(currentType === 3){
|
if(currentType === 3){
|
||||||
if(this.selectElementIndex === '' || !this.serviceItem.text || !this.serviceItem.promt){
|
if(this.selectElementIndex === '' || !this.serviceItem.text || !this.serviceItem.promt){
|
||||||
this.$refs.uToast.show({type:'error',title: "请完善信息!"});
|
this.$emit('toast',{type:'error',title: "请完善信息!"});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(currentType === 4){
|
if(currentType === 4){
|
||||||
const { bottomsUrl, coatUrl } = this.$refs.dressRef.form;
|
const { bottomsUrl, coatUrl } = this.$refs.dressRef.form;
|
||||||
if(coatUrl===''){
|
if(coatUrl===''){
|
||||||
this.$refs.uToast.show({type:'error',title: "请选择更换上衣!"});
|
this.$emit('toast',{type:'error',title: "请选择更换上衣!"});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -465,13 +464,13 @@ export default {
|
|||||||
let resp = await that.$api.generateImages(that.getParams(that.serviceItem));
|
let resp = await that.$api.generateImages(that.getParams(that.serviceItem));
|
||||||
if(resp?.success){
|
if(resp?.success){
|
||||||
that.setResultFile(resp.data.path);
|
that.setResultFile(resp.data.path);
|
||||||
that.$refs.uToast.show({type:'success',title:
|
that.$emit('toast',{type:'success',title:
|
||||||
'等待ai生成中......点击先看临时工表演',duration: 3000});
|
'等待ai生成中......点击先看临时工表演',duration: 3000});
|
||||||
that.dotLoading = false;
|
that.dotLoading = false;
|
||||||
// 开启轮询
|
// 开启轮询
|
||||||
that.delayLoadImage(resp.data.id);
|
that.delayLoadImage(resp.data.id);
|
||||||
}else{
|
}else{
|
||||||
that.$refs.uToast.show({type:'error',title: `${that.serviceItem.name}失败!`});
|
that.$emit('toast',{type:'error',title: `${that.serviceItem.name}失败!`});
|
||||||
that.dotLoading = false;
|
that.dotLoading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -573,11 +572,11 @@ export default {
|
|||||||
// 超13次轮询结束
|
// 超13次轮询结束
|
||||||
if(this.asyncPollTime > 13) {
|
if(this.asyncPollTime > 13) {
|
||||||
this.asyncPollTime = -1;
|
this.asyncPollTime = -1;
|
||||||
this.$refs.uToast.show({type:'warning',title:'生成时间过长,请移步作品栏目查看图片'});
|
this.$emit('toast',{type:'warning',title:'生成时间过长,请移步作品栏目查看图片'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(this.asyncPollTime === 3){
|
if(this.asyncPollTime === 3){
|
||||||
this.$refs.uToast.show({type:'warning',title:'火速插队中......客官可稍后移步作品栏目查看图片',
|
this.$emit('toast',{type:'warning',title:'火速插队中......客官可稍后移步作品栏目查看图片',
|
||||||
duration: 3000});
|
duration: 3000});
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -590,7 +589,7 @@ export default {
|
|||||||
// 结果判断
|
// 结果判断
|
||||||
this.asyncResult = res.data?.creationState === 't';
|
this.asyncResult = res.data?.creationState === 't';
|
||||||
this.errorTips = this.asyncResult ? '' : res.data?.reason;
|
this.errorTips = this.asyncResult ? '' : res.data?.reason;
|
||||||
this.$refs.uToast.show({type:this.asyncResult?'success':'error',title: `${this.serviceItem.name}${this.asyncResult?'成功':'失败'}`});
|
this.$emit('toast',{type:this.asyncResult?'success':'error',title: `${this.serviceItem.name}${this.asyncResult?'成功':'失败'}`});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.asyncPollTime++;
|
this.asyncPollTime++;
|
||||||
@ -622,7 +621,7 @@ export default {
|
|||||||
// 下载图片
|
// 下载图片
|
||||||
download(){
|
download(){
|
||||||
if(!this.asyncResult){
|
if(!this.asyncResult){
|
||||||
this.$refs.uToast.show({type:'error',title: "图片生成失败,请重试!"});
|
this.$emit('toast',{type:'error',title: "图片生成失败,请重试!"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.open(this.formData.resultFile);
|
window.open(this.formData.resultFile);
|
||||||
|
Loading…
Reference in New Issue
Block a user