|
|
@@ -22,6 +22,12 @@ |
|
|
|
<view @click="downloadImg" class="uploadBtn">
|
|
|
|
<text>下载照片</text>
|
|
|
|
</view>
|
|
|
|
<view class="grayBtn" @click="photoSupper">
|
|
|
|
<!-- <view v-if="supperPhotoState == 0 || supperPhotoState == 3" class="free">
|
|
|
|
<text>耗金币1枚</text>
|
|
|
|
</view> -->
|
|
|
|
{{ supperTips() }}
|
|
|
|
</view>
|
|
|
|
<!-- 底部 -->
|
|
|
|
<view class="bottomBox">
|
|
|
|
<view class="tips">
|
|
|
@@ -69,16 +75,21 @@ |
|
|
|
// import myloading from '../../components/myLoading.vue'
|
|
|
|
//#region 导入
|
|
|
|
import { onLoad } from "@dcloudio/uni-app";
|
|
|
|
import { ref, reactive } from "vue";
|
|
|
|
import { ref, reactive, watch } from "vue";
|
|
|
|
import { userInfoModules } from "@/store/modules/userInfo";
|
|
|
|
import { getPhotoListApi } from "../../api/lookPhoto.js";
|
|
|
|
import {
|
|
|
|
getPhotoListApi,
|
|
|
|
photoSupperApi,
|
|
|
|
getSupperPhotoStateApi,
|
|
|
|
} from "../../api/lookPhoto.js";
|
|
|
|
//#endregion
|
|
|
|
const userInfoModulesPinia = userInfoModules();
|
|
|
|
//#region 轮播图
|
|
|
|
const workId = ref(null);
|
|
|
|
onLoad((options) => {
|
|
|
|
const workId = ref(null); //作品id
|
|
|
|
onLoad(async (options) => {
|
|
|
|
workId.value = options.id;
|
|
|
|
getSwiperList();
|
|
|
|
await getSwiperList();
|
|
|
|
await getSupperPhotoState(swiperList.value[0].id);
|
|
|
|
});
|
|
|
|
const swiperList = ref([]); //轮播图
|
|
|
|
const previewImageList = ref([]); //预览图片列表
|
|
|
@@ -88,7 +99,11 @@ async function getSwiperList() { |
|
|
|
console.log(res.data.photoList);
|
|
|
|
swiperList.value = res.data.photoList;
|
|
|
|
swiperList.value.forEach((item) => {
|
|
|
|
previewImageList.value.push(item.image);
|
|
|
|
if (item.imageSuper) {
|
|
|
|
previewImageList.value.push(item.imageSuper);
|
|
|
|
} else {
|
|
|
|
previewImageList.value.push(item.image);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//#endregion ---------------------
|
|
|
@@ -102,7 +117,9 @@ function downloadImg() { |
|
|
|
let filePath = wx.env.USER_DATA_PATH + "/" + "zhixiang.png";
|
|
|
|
uni.downloadFile({
|
|
|
|
filePath: filePath,
|
|
|
|
url: swiperList.value[swiperIndex.value].image, //仅为示例,并非真实的资源
|
|
|
|
url: swiperList.value[swiperIndex.value].imageSuper
|
|
|
|
? swiperList.value[swiperIndex.value].imageSuper
|
|
|
|
: swiperList.value[swiperIndex.value].image, //仅为示例,并非真实的资源
|
|
|
|
// url: "http://tmp/iFlp7n9vAaaEa3276321f9c19ed0031617eb27119af4.png", //仅为示例,并非真实的资源
|
|
|
|
success: (res) => {
|
|
|
|
let data = res;
|
|
|
@@ -239,6 +256,79 @@ function buyCoin() { |
|
|
|
}
|
|
|
|
//#endregion ---------------------
|
|
|
|
|
|
|
|
//#region 超分相关
|
|
|
|
const supperPhotoState = ref(false);
|
|
|
|
async function photoSupper() {
|
|
|
|
if (supperPhotoState.value == 1 || supperPhotoState.value == 2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// uni.showModal({
|
|
|
|
// title: "提示",
|
|
|
|
// content: "确定高清处理?",
|
|
|
|
// success: function (res) {
|
|
|
|
// if (res.confirm) {
|
|
|
|
// checkboxValue.value = ["同意智像相机用户使用协议"];
|
|
|
|
// // handleLogin();
|
|
|
|
// getphonenumber(e);
|
|
|
|
// } else if (res.cancel) {
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// fail: (err) => {},
|
|
|
|
// });
|
|
|
|
try {
|
|
|
|
uni.showLoading({
|
|
|
|
title: "高清处理中...",
|
|
|
|
mask: true,
|
|
|
|
});
|
|
|
|
const res = await photoSupperApi({
|
|
|
|
id: swiperList.value[swiperIndex.value].id,
|
|
|
|
});
|
|
|
|
console.log(res);
|
|
|
|
uni.hideLoading();
|
|
|
|
uni.showToast({
|
|
|
|
title: "高清处理请求成功,请重稍后",
|
|
|
|
icon: "none",
|
|
|
|
});
|
|
|
|
|
|
|
|
getSupperPhotoState(swiperList.value[swiperIndex.value].id);
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error, "超分失败");
|
|
|
|
uni.hideLoading();
|
|
|
|
uni.showToast({
|
|
|
|
title: "高清处理失败,请重试",
|
|
|
|
icon: "none",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function getSupperPhotoState(id) {
|
|
|
|
try {
|
|
|
|
const res = await getSupperPhotoStateApi(id);
|
|
|
|
supperPhotoState.value = res.data.status;
|
|
|
|
console.log(supperPhotoState.value, "状态");
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error, "超分失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function supperTips(params) {
|
|
|
|
if (supperPhotoState.value == 0 || supperPhotoState.value == 3) {
|
|
|
|
return "一键高清";
|
|
|
|
} else if (supperPhotoState.value == 1) {
|
|
|
|
return "高清处理中,请稍后";
|
|
|
|
} else if (supperPhotoState.value == 2) {
|
|
|
|
return "已高清处理";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
watch(
|
|
|
|
() => swiperIndex.value,
|
|
|
|
(index) => {
|
|
|
|
getSupperPhotoState(swiperList.value[index].id);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
//#endregion ---------------------
|
|
|
|
|
|
|
|
//#region
|
|
|
|
|
|
|
|
//#endregion ---------------------
|
|
|
@@ -282,7 +372,7 @@ function buyCoin() { |
|
|
|
// 俩按钮
|
|
|
|
.uploadBtn {
|
|
|
|
position: relative;
|
|
|
|
margin-top: 140rpx;
|
|
|
|
margin-top: 100rpx;
|
|
|
|
width: 520rpx;
|
|
|
|
height: 100rpx;
|
|
|
|
line-height: 100rpx;
|
|
|
@@ -326,18 +416,30 @@ function buyCoin() { |
|
|
|
}
|
|
|
|
}
|
|
|
|
.grayBtn {
|
|
|
|
background-color: transparent;
|
|
|
|
border: 1px solid #6a6c6e;
|
|
|
|
margin-top: 50rpx;
|
|
|
|
.free {
|
|
|
|
position: absolute;
|
|
|
|
color: #fff;
|
|
|
|
top: -18rpx;
|
|
|
|
right: -70rpx;
|
|
|
|
width: 142rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
background-color: #ff4f00;
|
|
|
|
border-radius: 25rpx 25rpx 25rpx 0;
|
|
|
|
font-size: 22rpx;
|
|
|
|
font-weight: 900;
|
|
|
|
line-height: 50rpx;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.bottomBox {
|
|
|
|
flex: 1;
|
|
|
|
position: absolute;
|
|
|
|
// position: absolute;
|
|
|
|
bottom: 80rpx;
|
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
padding: 65rpx 50rpx 0;
|
|
|
|
padding: 65rpx 10rpx 0;
|
|
|
|
.tips {
|
|
|
|
position: absolute;
|
|
|
|
top: 0rpx;
|
|
|
@@ -360,29 +462,4 @@ function buyCoin() { |
|
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// .bottomBox {
|
|
|
|
// width: 100%;
|
|
|
|
// display: flex;
|
|
|
|
// flex-direction: column;
|
|
|
|
// align-items: center;
|
|
|
|
// justify-content: center;
|
|
|
|
// .balance {
|
|
|
|
// margin-top: 30rpx;
|
|
|
|
// font-size: 40rpx;
|
|
|
|
// margin-bottom: 50rpx;
|
|
|
|
// }
|
|
|
|
// .buttonBox {
|
|
|
|
// width: 60%;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// .shareBox {
|
|
|
|
// margin-top: 90rpx;
|
|
|
|
// width: 100%;
|
|
|
|
// display: flex;
|
|
|
|
// justify-content: space-between;
|
|
|
|
// .buttonBox {
|
|
|
|
// width: 30%;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
</style>
|