feat:初始提交uni-app项目

This commit is contained in:
2026-01-14 18:19:33 +08:00
commit 0dcbd340e6
515 changed files with 38560 additions and 0 deletions

View File

@@ -0,0 +1,329 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_system = require("../../utils/system.js");
const api_apis = require("../../api/apis.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_uni_dateformat2 = common_vendor.resolveComponent("uni-dateformat");
const _easycom_uni_rate2 = common_vendor.resolveComponent("uni-rate");
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
(_easycom_uni_icons2 + _easycom_uni_dateformat2 + _easycom_uni_rate2 + _easycom_uni_popup2)();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_uni_dateformat = () => "../../uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat.js";
const _easycom_uni_rate = () => "../../uni_modules/uni-rate/components/uni-rate/uni-rate.js";
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
(_easycom_uni_icons + _easycom_uni_dateformat + _easycom_uni_rate + _easycom_uni_popup)();
}
const _sfc_main = {
__name: "preview",
setup(__props) {
const maskState = common_vendor.ref(true);
const infoPopup = common_vendor.ref(null);
const currentInfo = common_vendor.ref({});
const scorePopup = common_vendor.ref(null);
const userScore = common_vendor.ref(0);
const isScore = common_vendor.ref(false);
const classList = common_vendor.ref([]);
const currentId = common_vendor.ref(null);
const currentIndex = common_vendor.ref(0);
const readImgs = common_vendor.ref([]);
const storgClassList = common_vendor.index.getStorageSync("storgClassList") || [];
classList.value = storgClassList.map((item) => {
return {
...item,
//注意 _small.webp是小图,要看大图的话,需要将后缀改变成.jpg
picurl: item.smallPicurl.replace("_small.webp", ".jpg")
};
});
common_vendor.onLoad(async (e) => {
currentId.value = e.id;
if (e.type == "share") {
let res = await api_apis.apiDetailWall({ id: currentId.value });
classList.value = res.data.map((item) => {
return {
...item,
picurl: item.smallPicurl.replace("_small.webp", ".jpg")
};
});
}
currentIndex.value = classList.value.findIndex((item) => item._id == currentId.value);
readImgsFun();
currentInfo.value = classList.value[currentIndex.value];
});
const swiperChange = (e) => {
currentIndex.value = e.detail.current;
readImgsFun();
currentInfo.value = classList.value[currentIndex.value];
};
const readImgsFun = () => {
readImgs.value.push(
currentIndex.value <= 0 ? classList.value.length - 1 : currentIndex.value - 1,
currentIndex.value,
currentIndex.value >= classList.value.length - 1 ? 0 : currentIndex.value + 1
);
readImgs.value = [...new Set(readImgs.value)];
};
const clickInfo = () => {
infoPopup.value.open();
};
const clickInfoClose = () => {
infoPopup.value.close();
};
const clickScore = () => {
if (currentInfo.value.userScore) {
isScore.value = true;
userScore.value = currentInfo.value.userScore;
}
scorePopup.value.open();
};
const clickScoreClose = () => {
scorePopup.value.close();
userScore.value = 0;
isScore.value = false;
};
const submitScore = async () => {
common_vendor.index.showLoading({
title: "加载中..."
});
let {
classid,
_id: wallId
} = currentInfo.value;
let res = await api_apis.apiGetSetScore({
classid,
wallId,
userScore: userScore.value
});
common_vendor.index.hideLoading();
if (res.errCode === 0) {
common_vendor.index.showToast({
title: "评分成功",
icon: "none"
});
}
classList.value[currentIndex.value].userScore = userScore.value;
common_vendor.index.setStorageSync("storgClassList", classList.value);
clickScoreClose();
};
const maskChange = () => {
maskState.value = !maskState.value;
};
const goBack = () => {
common_vendor.index.navigateBack({
success: () => {
},
fail: (err) => {
common_vendor.index.reLaunch({
url: "/pages/index/index"
});
}
});
};
const clickDownload = async () => {
try {
common_vendor.index.showLoading({
title: "下载中...",
// 显示过程中不允许点击其他的东西
mask: true
});
let {
classid,
_id: wallId
} = currentInfo.value;
let res = await api_apis.apiWriteDownload({
classid,
wallId
});
if (res.errCode != 0) {
throw res;
}
common_vendor.index.getImageInfo({
// 这个getImageInfo是为了根据网络地址获得一个临时下载地址以便能够下载到相册里面
//单纯的使用 saveImageToPhotosAlbum 是不能够保存图片的
src: currentInfo.value.picurl,
success: (res2) => {
common_vendor.index.saveImageToPhotosAlbum({
filePath: res2.path,
success: (res3) => {
common_vendor.index.showToast({
title: "保存成功,请到相册查看",
icon: "none"
});
},
fail: (err) => {
if (err.errMsg == "saveImagePhotoAlbum:fail cancel") {
common_vendor.index.showToast({
title: "保存失败,请重新点击下载",
icon: "none"
});
return;
}
common_vendor.index.showModal({
title: "授权提示",
content: "需要授权保存相册",
//success表示系统回复了的情况
success: (res3) => {
if (res3.confirm) {
common_vendor.index.openSetting({
success: (setting) => {
common_vendor.index.__f__(
"log",
"at pages/preview/preview.vue:404",
setting
);
if (setting.authSetting["scope.writePhotosAlbum"]) {
common_vendor.index.showToast({
title: "获取授权成功",
icon: "none"
});
} else {
common_vendor.index.showToast({
title: "获取权限失败",
icon: "none"
});
}
}
});
}
}
});
},
//complete表示无论成功还是失败都会做的事件
complete: () => {
common_vendor.index.hideLoading();
}
});
}
});
} catch (err) {
common_vendor.index.hideLoading();
}
};
common_vendor.onShareAppMessage((e) => {
return {
title: "hzb壁纸-",
// 必须传递id进去否则进不去内部页面
path: "/pages/preview/preview?id=" + currentId.value + "&type=share"
};
});
common_vendor.onShareTimeline(() => {
return {
// 标题
title: "hzb壁纸~~~",
// 分享时候的图片地址。可以本地也可以网络图
// imageUrl:"/static/images/logo2.jpg"
//要想看朋友圈这个需要带的query参数
// type表示是分享传入的
query: "id=" + currentId.value + "&type=share"
};
});
return (_ctx, _cache) => {
return {
a: common_vendor.f(classList.value, (item, index, i0) => {
return common_vendor.e({
a: readImgs.value.includes(index)
}, readImgs.value.includes(index) ? {
b: common_vendor.o(maskChange, item._id),
c: item.picurl
} : {}, {
d: item._id
});
}),
b: currentIndex.value,
c: common_vendor.o(swiperChange),
d: common_vendor.p({
type: "back",
color: "#fff",
size: "20"
}),
e: common_vendor.o(goBack),
f: common_vendor.unref(utils_system.getPreviewBarHeight)() + "px",
g: common_vendor.t(currentIndex.value + 1),
h: common_vendor.t(classList.value.length),
i: common_vendor.p({
date: Date.now(),
format: "hh:mm"
}),
j: common_vendor.p({
date: Date.now(),
format: "MM月dd日"
}),
k: common_vendor.p({
type: "info",
size: "23"
}),
l: common_vendor.o(clickInfo),
m: common_vendor.p({
type: "star",
size: "23"
}),
n: common_vendor.t(currentInfo.value.score),
o: common_vendor.o(clickScore),
p: common_vendor.p({
type: "download",
size: "23"
}),
q: common_vendor.o(clickDownload),
r: maskState.value,
s: common_vendor.p({
type: "closeempty",
size: "18",
color: "#999"
}),
t: common_vendor.o(clickInfoClose),
v: common_vendor.t(currentInfo.value._id),
w: common_vendor.t(currentInfo.value.nickname),
x: common_vendor.p({
readonly: true,
touchable: false,
value: currentInfo.value.score,
size: "16"
}),
y: common_vendor.t(currentInfo.value.score),
z: common_vendor.t(currentInfo.value.description),
A: common_vendor.f(currentInfo.value.tabs, (tab, k0, i0) => {
return {
a: common_vendor.t(tab),
b: tab
};
}),
B: common_vendor.sr(infoPopup, "2dad6c07-6", {
"k": "infoPopup"
}),
C: common_vendor.p({
type: "bottom"
}),
D: common_vendor.t(isScore.value ? "已经评分过了~" : "壁纸评分"),
E: common_vendor.p({
type: "closeempty",
size: "18",
color: "#999"
}),
F: common_vendor.o(clickScoreClose),
G: common_vendor.o(_ctx.onChange),
H: common_vendor.o(($event) => userScore.value = $event),
I: common_vendor.p({
disabled: isScore.value,
["disabled-color"]: "#FFCA3E",
allowHalf: true,
modelValue: userScore.value
}),
J: common_vendor.t(userScore.value),
K: common_vendor.o(submitScore),
L: !userScore.value || isScore.value,
M: common_vendor.sr(scorePopup, "2dad6c07-9", {
"k": "scorePopup"
}),
N: common_vendor.p({
["is-mask-click"]: false
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2dad6c07"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/preview/preview.js.map

View File

@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "预览",
"navigationStyle": "custom",
"usingComponents": {
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
"uni-dateformat": "../../uni_modules/uni-dateformat/components/uni-dateformat/uni-dateformat",
"uni-rate": "../../uni_modules/uni-rate/components/uni-rate/uni-rate",
"uni-popup": "../../uni_modules/uni-popup/components/uni-popup/uni-popup"
}
}

View File

@@ -0,0 +1 @@
<view class="preview data-v-2dad6c07"><swiper class="data-v-2dad6c07" circular="{{true}}" current="{{b}}" bindchange="{{c}}"><swiper-item wx:for="{{a}}" wx:for-item="item" wx:key="d" class="data-v-2dad6c07"><image wx:if="{{item.a}}" class="data-v-2dad6c07" bindtap="{{item.b}}" src="{{item.c}}" mode="aspectFill"></image></swiper-item></swiper><view class="mask data-v-2dad6c07" hidden="{{!r}}"><view class="goBack data-v-2dad6c07" bindtap="{{e}}" style="{{'top:' + f}}"><uni-icons wx:if="{{d}}" class="data-v-2dad6c07" u-i="2dad6c07-0" bind:__l="__l" u-p="{{d}}"></uni-icons></view><view class="count data-v-2dad6c07">{{g}} / {{h}}</view><view class="time data-v-2dad6c07"><uni-dateformat wx:if="{{i}}" class="data-v-2dad6c07" u-i="2dad6c07-1" bind:__l="__l" u-p="{{i}}"></uni-dateformat></view><view class="date data-v-2dad6c07"><uni-dateformat wx:if="{{j}}" class="data-v-2dad6c07" u-i="2dad6c07-2" bind:__l="__l" u-p="{{j}}"></uni-dateformat></view><view class="footer data-v-2dad6c07"><view class="box data-v-2dad6c07" bindtap="{{l}}"><uni-icons wx:if="{{k}}" class="data-v-2dad6c07" u-i="2dad6c07-3" bind:__l="__l" u-p="{{k}}"></uni-icons><view class="text data-v-2dad6c07">信息</view></view><view class="box data-v-2dad6c07" bindtap="{{o}}"><uni-icons wx:if="{{m}}" class="data-v-2dad6c07" u-i="2dad6c07-4" bind:__l="__l" u-p="{{m}}"></uni-icons><view class="text data-v-2dad6c07">{{n}}分</view></view><view class="box data-v-2dad6c07" bindtap="{{q}}"><uni-icons wx:if="{{p}}" class="data-v-2dad6c07" u-i="2dad6c07-5" bind:__l="__l" u-p="{{p}}"></uni-icons><view class="text data-v-2dad6c07">下载</view></view></view></view><uni-popup wx:if="{{C}}" class="r data-v-2dad6c07" u-s="{{['d']}}" u-r="infoPopup" u-i="2dad6c07-6" bind:__l="__l" u-p="{{C}}"><view class="infoPopup data-v-2dad6c07"><view class="popHeader data-v-2dad6c07"><view class="data-v-2dad6c07"></view><view class="title data-v-2dad6c07">壁纸信息</view><view class="close data-v-2dad6c07" bindtap="{{t}}"><uni-icons wx:if="{{s}}" class="data-v-2dad6c07" u-i="2dad6c07-7,2dad6c07-6" bind:__l="__l" u-p="{{s}}"></uni-icons></view></view><scroll-view class="data-v-2dad6c07" scroll-y="{{true}}"><view class="content data-v-2dad6c07"><view class="row data-v-2dad6c07"><view class="label data-v-2dad6c07">壁纸ID</view><text selectable class="value data-v-2dad6c07">{{v}}</text></view><view class="row data-v-2dad6c07"><view class="label data-v-2dad6c07">发布者:</view><text class="value data-v-2dad6c07">{{w}}</text></view><view class="row data-v-2dad6c07"><text class="label data-v-2dad6c07">评分:</text><view class="value roteBox data-v-2dad6c07"><uni-rate wx:if="{{x}}" class="data-v-2dad6c07" u-i="2dad6c07-8,2dad6c07-6" bind:__l="__l" u-p="{{x}}"/><text class="score data-v-2dad6c07">{{y}}</text></view></view><view class="row data-v-2dad6c07"><text class="label data-v-2dad6c07">摘要:</text><view class="value data-v-2dad6c07">{{z}}</view></view><view class="row data-v-2dad6c07"><text class="label data-v-2dad6c07">标签:</text><view class="value tabs data-v-2dad6c07"><view wx:for="{{A}}" wx:for-item="tab" wx:key="b" class="tab data-v-2dad6c07">{{tab.a}}</view></view></view><view class="copyright data-v-2dad6c07"> 声明本图片来用户投稿非商业使用用于免费学习交流如侵犯了您的权益您可以拷贝壁纸ID举报至平台邮箱513894357@qq.com管理将删除侵权壁纸维护您的权益。 </view><view class="safe-area-inset-bottom data-v-2dad6c07"></view></view></scroll-view></view></uni-popup><uni-popup wx:if="{{N}}" class="r data-v-2dad6c07" u-s="{{['d']}}" u-r="scorePopup" u-i="2dad6c07-9" bind:__l="__l" u-p="{{N}}"><view class="scorePopup data-v-2dad6c07"><view class="popHeader data-v-2dad6c07"><view class="data-v-2dad6c07"></view><view class="title data-v-2dad6c07">{{D}}</view><view class="close data-v-2dad6c07" bindtap="{{F}}"><uni-icons wx:if="{{E}}" class="data-v-2dad6c07" u-i="2dad6c07-10,2dad6c07-9" bind:__l="__l" u-p="{{E}}"></uni-icons></view></view><view class="content data-v-2dad6c07"><uni-rate wx:if="{{I}}" class="data-v-2dad6c07" bindchange="{{G}}" u-i="2dad6c07-11,2dad6c07-9" bind:__l="__l" bindupdateModelValue="{{H}}" u-p="{{I}}"/><text class="text data-v-2dad6c07">{{J}}分</text></view><view class="footer data-v-2dad6c07"><button class="data-v-2dad6c07" bindtap="{{K}}" disabled="{{L}}" type="default" size="mini" plain>确认评分</button></view></view></uni-popup></view>

View File

@@ -0,0 +1,256 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.preview.data-v-2dad6c07 {
width: 100%;
height: 100vh;
position: relative;
}
.preview swiper.data-v-2dad6c07 {
width: 100%;
height: 100%;
}
.preview swiper image.data-v-2dad6c07 {
width: 100%;
height: 100%;
}
.preview .mask .goBack.data-v-2dad6c07 {
position: absolute;
left: 0;
right: 0;
margin: auto;
width: -webkit-fit-content;
width: fit-content;
color: #fff;
width: 38px;
height: 38px;
background: rgba(0, 0, 0, 0.5);
left: 30rpx;
top: 0;
margin-left: 0;
border-radius: 100px;
-webkit-backdrop-filter: blur(10rpx);
backdrop-filter: blur(10rpx);
border: 1px solid rbga(255, 255, 255, 0.3);
display: flex;
justify-content: center;
align-items: center;
}
.preview .mask .count.data-v-2dad6c07 {
position: absolute;
top: 10vh;
left: 0;
right: 0;
margin: auto;
width: -webkit-fit-content;
width: fit-content;
background: rgba(0, 0, 0, 0.3);
font-size: 28rpx;
color: #fff;
border-radius: 40rpx;
padding: 8rpx 28rpx;
-webkit-backdrop-filter: blur(20rpx);
backdrop-filter: blur(20rpx);
}
.preview .mask .time.data-v-2dad6c07 {
position: absolute;
left: 0;
right: 0;
margin: auto;
width: -webkit-fit-content;
width: fit-content;
color: #fff;
top: calc(10vh + 80rpx);
font-size: 140rpx;
font-weight: 100rpx;
line-height: 1em;
text-shadow: 0 4rpx rgba(0, 0, 0, 0.3);
}
.preview .mask .date.data-v-2dad6c07 {
position: absolute;
left: 0;
right: 0;
margin: auto;
width: -webkit-fit-content;
width: fit-content;
color: #fff;
top: calc(10vh + 230rpx);
font-size: 34rpx;
text-shadow: 0 2rpx rgba(0, 0, 0, 0.3);
}
.preview .mask .footer.data-v-2dad6c07 {
position: absolute;
left: 0;
right: 0;
margin: auto;
width: -webkit-fit-content;
width: fit-content;
color: #fff;
background: rgba(255, 255, 255, 0.8);
bottom: 10vh;
width: 65vw;
height: 120rpx;
border-radius: 120rpx;
color: #000;
display: flex;
justify-content: space-around;
align-items: center;
box-shadow: 0 2rpx rgba(0, 0, 0, 0.1);
-webkit-backdrop-filter: blur(20rpx);
backdrop-filter: blur(20rpx);
}
.preview .mask .footer .box.data-v-2dad6c07 {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 2rpx 12rpx;
}
.preview .mask .footer .box .text.data-v-2dad6c07 {
font-size: 26rpx;
color: #676767;
}
.preview .popHeader.data-v-2dad6c07 {
display: flex;
justify-content: space-between;
align-items: center;
}
.preview .popHeader .title.data-v-2dad6c07 {
color: #676767;
font-size: 26rpx;
}
.preview .popHeader .close.data-v-2dad6c07 {
padding: 6rpx;
}
.preview .infoPopup.data-v-2dad6c07 {
background: #fff;
padding: 30rpx;
border-radius: 30rpx 30rpx 0 0;
overflow: hidden;
}
.preview .infoPopup scroll-view.data-v-2dad6c07 {
max-height: 60vh;
}
.preview .infoPopup scroll-view .content .row.data-v-2dad6c07 {
display: flex;
padding: 16rpx 0;
font-size: 32rpx;
line-height: 1.7em;
}
.preview .infoPopup scroll-view .content .row .label.data-v-2dad6c07 {
color: #a7a7a7;
width: 140rpx;
text-align: right;
font-size: 30rpx;
}
.preview .infoPopup scroll-view .content .row .value.data-v-2dad6c07 {
flex: 1;
width: 0;
font-size: 30rpx;
}
.preview .infoPopup scroll-view .content .row .roteBox.data-v-2dad6c07 {
display: flex;
align-items: center;
}
.preview .infoPopup scroll-view .content .row .roteBox .score.data-v-2dad6c07 {
font-size: 26rpx;
color: #676767;
padding-left: 10rpx;
}
.preview .infoPopup scroll-view .content .row .tabs.data-v-2dad6c07 {
display: flex;
white-space: wrap;
}
.preview .infoPopup scroll-view .content .row .tabs .tab.data-v-2dad6c07 {
border: 1px solid #28B389;
color: #28B389;
font-size: 22rpx;
padding: 10rpx 30rpx;
border-radius: 40rpx;
line-height: 1em;
margin: 0 10rpx 10rpx 0;
}
.preview .infoPopup scroll-view .content .row .class.data-v-2dad6c07 {
color: #28B389;
}
.preview .infoPopup scroll-view .content .copyright.data-v-2dad6c07 {
font-size: 28rpx;
padding: 20rpx;
background: #F6F6F6;
color: #666;
border-radius: 10rpx;
margin: 20rpx 0;
line-height: 1.5em;
}
.preview .scorePopup.data-v-2dad6c07 {
background: #fff;
padding: 30rpx;
width: 70vw;
border-radius: 30rpx;
overflow: hidden;
}
.preview .scorePopup .content.data-v-2dad6c07 {
padding: 30rpx 0;
display: flex;
justify-content: center;
align-items: center;
}
.preview .scorePopup .content .text.data-v-2dad6c07 {
color: #FFCA3E;
padding-left: 10rpx;
width: 80rpx;
line-height: 1em;
text-align: right;
}
.preview .scorePopup .footer.data-v-2dad6c07 {
display: flex;
justify-content: center;
align-items: center;
}