1、分享的图片二维码:上传时的错路径判断

2、发布的静态页面
3、分类的底部导航栏取消
4、积分的任务跳转页面
5、积分商城:数据接口对接
This commit is contained in:
wangzimeng 2025-07-28 17:38:58 +08:00
parent 3564721d23
commit c621ff0ff4
6 changed files with 1721 additions and 296 deletions

View File

@ -6,72 +6,79 @@
<view class="conTop"> <view class="conTop">
<view class="textLine"> <view class="textLine">
<view class="fs30 bold c3" style="line-height: 26rpx;">当前积分</view> <view class="fs30 bold c3" style="line-height: 26rpx;">当前积分</view>
<view class="fs60 bold c3" style="margin-top: 30rpx;line-height: 60rpx;">6963</view> <view class="fs60 bold c3" style="margin-top: 30rpx;line-height: 60rpx;">{{score}}</view>
<view class="scoreDetail" @click="toPage('/pages/user/wallet/score')"> <view class="scoreDetail" @click="toPage('/pages/user/wallet/score')">
<view class="fs28 c9">积分明细</view> <view class="fs28 c9">积分明细</view>
<image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;" <image style="width: 28rpx;height: 28rpx;margin-left: 10rpx;"
src="https://jiangxiaoxian.0rui.cn/rightMore.png"></image> src="https://jiangxiaoxian.0rui.cn/rightMore.png"></image>
</view> </view>
</view> </view>
</view> </view>
<!-- tabs页签 --> <!-- tabs页签 -->
<view class="tabs-box"> <view class="tabs-box">
<su-tabs <su-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="currentTab"></su-tabs>
:list="tabMaps"
@change="onChange"
:scrollable="false"
:current="currentTab"
></su-tabs>
</view> </view>
<!-- 可兑换券列表 --> <!-- 可兑换券列表 -->
<view class="exChangeBox"> <view class="exChangeBox" v-if="currentTab == 0">
<view class="couponsList"> <view class="couponsList">
<view class="list-item"> <view class="list-item" v-for="(item, index) in couponList" :key="index" @click="openCouponPro(item)">
<image style="width: 330rpx;height: 200rpx;" src="https://jiangxiaoxian.0rui.cn/fullCoupon.png"></image> <image style="width: 330rpx;height: 200rpx;" src="https://jiangxiaoxian.0rui.cn/fullCoupon.png">
</image>
<view class="item-text"> <view class="item-text">
<view class="fs30 c3" style="margin: 0 auto;">优惠券满100减50</view> <view class="fs30 c3" style="margin: 0 auto;text-align: center;">{{item.name}}</view>
<view class="exchangeBtn"> <view class="exchangeBtn">
100积分兑换 {{item.score}}积分兑换
</view> </view>
</view> </view>
</view>
<view class="list-item">
<image style="width: 330rpx;height: 200rpx;" src="https://jiangxiaoxian.0rui.cn/fullCoupon.png"></image>
<view class="item-text">
<view class="fs30 c3" style="margin: 0 auto;">优惠券满100减50</view>
<view class="exchangeBtn">
100积分兑换
</view>
</view>
</view>
<view class="list-item">
<image style="width: 330rpx;height: 200rpx;" src="https://jiangxiaoxian.0rui.cn/fullCoupon.png"></image>
<view class="item-text">
<view class="fs30 c3" style="margin: 0 auto;">优惠券满100减50</view>
<view class="exchangeBtn">
100积分兑换
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
<!-- 次数券 -->
<!-- 无数据展示 <view class="exChangeBox" v-if="currentTab == 1">
<view class="couponsList">
<view class="list-item" v-for="(item, index) in couponList" :key="index" @click="openCouponPro(item)">
<image style="width: 330rpx;height: 200rpx;"
src="https://jiangxiaoxian.0rui.cn/scoreNumCoupon.png"></image>
<view class="item-text">
<view class="fs30 c3" style="margin: 0 auto;text-align: center;">{{ item.name }}</view>
<view class="exchangeBtn">
{{item.score}}积分兑换
</view>
</view>
</view>
</view>
</view>
<!-- 无数据展示 -->
<view class="flex flex-column flex-start align-items" <view class="flex flex-column flex-start align-items"
v-if="feetHisList.length == 0" style="margin-top: 300rpx;"> v-if="couponList.length == 0" style="margin-top: 300rpx;">
<image src="https://jiangxiaoxian.0rui.cn/noneList.png" mode="" style="width: 180rpx;height: 180rpx;"> <image src="https://jiangxiaoxian.0rui.cn/noneList.png" mode="" style="width: 180rpx;height: 180rpx;">
</image> </image>
<view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;">暂无数据信息</view> <view style="margin-top: 30rpx;font-size: 28rpx;color: #323232;">暂无数据信息</view>
</view>--> </view>
<su-popup :show="showCouponPro == true" type="center" round="10" :isMaskClick="false">
<view class="popupContacted">
<view class="contactedBox">
<image style="width: 198rpx;height: 122rpx;position: relative;left: 12rpx;" src="https://jiangxiaoxian.0rui.cn/couponSuccess.png"></image>
<view style="font-size: 36rpx;line-height: 50rpx;font-weight: 900;color: #3d3d3d;text-align: center;">是否兑换</view>
<view style="font-size: 30rpx;line-height: 44rpx;font-weight: 400;color: #3d3d3d;text-align: center;">{{couponName}}</view>
</view>
<view class="contactBtn">
<view class="tactBtnBox" style="color: #999999;" @click="showCouponPro = false">取消</view>
<view class="tactBtnBox2" style="color: #333333;" @click="handleCouponSure">确定</view>
</view>
</view>
</su-popup>
</view> </view>
</s-layout> </s-layout>
</template> </template>
@ -87,32 +94,88 @@
reactive reactive
} from 'vue'; } from 'vue';
import _ from 'lodash'; import _ from 'lodash';
const tabMaps = [ const listQuery = ref({
{ page: 1,
name: '优惠券', limit: 10,
value: '0', list_rows: 10,
}, status: 1,
{ })
name: '次数券', const tabMaps = [{
value: '1', name: '优惠券',
}, value: '1',
},
{
name: '次数券',
value: '2',
},
]; ];
const currentTab = ref(0) const currentTab = ref(0)
const score = ref(0)
//tabs //tabs
function onChange(e) { function onChange(e) {
console.log('onChange',e); console.log('onChange', e);
currentTab.value = e.index currentTab.value = e.index
console.log('切换tabs',currentTab.value); console.log('切换tabs', currentTab.value);
// getLogList(); listQuery.value.status = e.value
getCouponList();
} }
// //
const toPage = (e) => { const toPage = (e) => {
uni.navigateTo({ uni.navigateTo({
url: e url: e
}) })
}
//
const couponList = ref([])
const couponCount = ref(0)
async function getCouponList() {
const res = await sheep.$api.app.scoreShop.fullList({
page: listQuery.value.page,
limit: listQuery.value.limit,
status: listQuery.value.status,
order: 'normal'
});
if (res.code === 1) {
couponList.value = res.data.list;
couponCount.value = res.data.count;
score.value = res.data.score
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}
const showCouponPro = ref(false)
const couponName = ref('')
const couponSelectId = ref('')
function openCouponPro(item) {
showCouponPro.value = true;
couponName.value = item.name;
couponSelectId.value = item.id
}
async function handleCouponSure() {
const res = await sheep.$api.app.scoreShop.exCoupon({
id: couponSelectId.value
});
if (res.code === 1) {
uni.showToast({
title: res.msg,
icon: 'success'
})
showCouponPro.value = false;
} else {
uni.showToast({
title: res.msg,
icon: 'error'
})
showCouponPro.value = false;
}
} }
// //
@ -120,7 +183,7 @@
// loadmore(); // loadmore();
}); });
onLoad(() => { onLoad(() => {
// getData(); getCouponList();
}); });
</script> </script>
@ -128,42 +191,43 @@
.fs30 { .fs30 {
font-size: 30rpx; font-size: 30rpx;
} }
.fs60 { .fs60 {
font-size: 60rpx; font-size: 60rpx;
} }
.fs28 { .fs28 {
font-size: 28rpx; font-size: 28rpx;
} }
.bold { .bold {
font-weight: bold; font-weight: bold;
} }
.c3 { .c3 {
color: #333333; color: #333333;
} }
.c9 { .c9 {
color: #999999; color: #999999;
} }
.container { .container {
background-color: #ffffff; background-color: #ffffff;
height: 100vh;
.conTop { .conTop {
width: 100%; width: 100%;
height: 300rpx; height: 300rpx;
background-image: url('https://jiangxiaoxian.0rui.cn/scoreTopBack.png'); background-image: url('https://jiangxiaoxian.0rui.cn/scoreTopBack.png');
background-size: 100%; background-size: 100%;
.textLine { .textLine {
position: relative; position: relative;
top: 68rpx; top: 68rpx;
left: 60rpx; left: 60rpx;
display: block; display: block;
.scoreDetail { .scoreDetail {
margin-top: 20rpx; margin-top: 20rpx;
display: flex; display: flex;
@ -172,34 +236,37 @@
} }
} }
} }
.exChangeBox { .exChangeBox {
background-color: #ffffff; background-color: #ffffff;
width: 690rpx; width: 690rpx;
margin-top: 30rpx;
.couponsList { .couponsList {
width: 100%; width: 100%;
padding: 0 30rpx; padding: 0 30rpx;
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr);; grid-template-columns: repeat(2, 1fr);
;
grid-gap: 20px; grid-gap: 20px;
// display: flex; // display: flex;
// justify-content: center; // justify-content: center;
// align-items: center; // align-items: center;
.list-item { .list-item {
width: 330rpx; width: 330rpx;
border-radius: 18rpx; border-radius: 18rpx;
box-shadow: 4rpx 4rpx 4rpx 4rpx rgba(153, 153, 153, 0.1); box-shadow: 4rpx 4rpx 4rpx 4rpx rgba(153, 153, 153, 0.1);
.item-text { .item-text {
padding: 30rpx; padding: 30rpx;
.exchangeBtn { .exchangeBtn {
background-color: #fcc74e; background-color: #fcc74e;
height: 70rpx; height: 70rpx;
width: 270rpx; width: 270rpx;
margin-top: 30rpx;
border-radius: 223rpx; border-radius: 223rpx;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -210,10 +277,56 @@
} }
} }
} }
} }
} }
.popupContacted {
width: 660rpx;
height: 477rpx;
background-color: #fff;
display: grid;
border-radius: 18rpx;
.contactedBox {
width: 660rpx;
height: 325rpx;
padding: 30rpx 0;
// margin-top: 40rpx;
display: grid;
justify-content: center;
align-items: center;
}
.contactBtn {
width: 660rpx;
height: 92rpx;
border-top: 1rpx solid #eeeeee;
display: flex;
border-radius: 0 0 18rpx 18rpx;
// margin-top: 40rpx;
.tactBtnBox {
width: 330rpx;
height: 92rpx;
border-right: 1rpx solid #eeeeee;
display: flex;
align-items: center;
justify-content: center;
}
.tactBtnBox2 {
width: 330rpx;
height: 92rpx;
// border-right: 1rpx solid #eeeeee;
display: flex;
align-items: center;
justify-content: center;
}
}
}
} }
</style> </style>

View File

@ -84,7 +84,7 @@
</view> </view>
</view> </view>
<view class="signBtn"> <view class="signBtn" @click="toTabb('/pages/index/fabu')">
去发布 去发布
</view> </view>
</view> </view>
@ -125,7 +125,7 @@
</view> </view>
</view> </view>
<view class="signBtn"> <view class="signBtn" @click="toPage('/pages/index/category')">
去消费 去消费
</view> </view>
</view> </view>
@ -143,7 +143,7 @@
</view> </view>
</view> </view>
<view class="signBtn"> <view class="signBtn" @click="showShare">
去分享 去分享
</view> </view>
</view> </view>
@ -218,6 +218,7 @@
computed, computed,
reactive reactive
} from 'vue'; } from 'vue';
import { showShareModal } from '@/sheep/hooks/useModal';
const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/app/sign.png'); const headerBg = sheep.$url.css('/assets/addons/shopro/uniapp/app/sign.png');
@ -381,6 +382,30 @@
url: e url: e
}) })
} }
//tabbars
const toTabb = (e) => {
uni.switchTab({
url: e
})
}
//
function showShare() {
// 使URL
const shareInfo = {
title: '每日签到领积分',
desc: '快来签到领取积分奖励吧',
image: 'https://jiangxiaoxian.0rui.cn/valid-image.png', // URL
params: {
page: 'sign'
}
};
//
showShareModal(shareInfo);
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,5 +1,6 @@
<template> <template>
<s-layout title="分类" tabbar="/pages/index/category" :bgStyle="{ color: '#fff' }"> <!-- tabbar="/pages/index/category" -->
<s-layout title="分类" :bgStyle="{ color: '#fff' }">
<view class="s-category"> <view class="s-category">
<view class="three-level-wrap ss-flex ss-col-top"> <view class="three-level-wrap ss-flex ss-col-top">
<view class="side-menu-wrap" :style="[{ top: Number(statusBarHeight + 88) + 'rpx' }]"> <view class="side-menu-wrap" :style="[{ top: Number(statusBarHeight + 88) + 'rpx' }]">

File diff suppressed because it is too large Load Diff

View File

@ -1,137 +1,151 @@
import request from '@/sheep/request'; import request from '@/sheep/request';
import { baseUrl } from '@/sheep/config'; import {
baseUrl
} from '@/sheep/config';
export default { export default {
// 系统初始化 // 系统初始化
init: (templateId) => init: (templateId) =>
request({ request({
url: 'index/init', url: 'index/init',
params: { params: {
templateId, templateId,
}, },
custom: { custom: {
showError: false, showError: false,
showLoading: false, showLoading: false,
}, },
}), }),
// 同步客户端页面到后端 // 同步客户端页面到后端
pageSync: (pages) => pageSync: (pages) =>
request({ request({
url: 'index/pageSync', url: 'index/pageSync',
method: 'POST', method: 'POST',
data: { data: {
pages, pages,
}, },
custom: { custom: {
showError: false, showError: false,
showLoading: false, showLoading: false,
}, },
}), }),
// 发送短信 // 发送短信
sendSms: (data) => sendSms: (data) =>
request({ request({
url: 'index/send', url: 'index/send',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
showSuccess: true, showSuccess: true,
loadingMsg: '发送中', loadingMsg: '发送中',
}, },
}), }),
//意见反馈 //意见反馈
feedback: (data) => feedback: (data) =>
request({ request({
url: 'index/feedback', url: 'index/feedback',
method: 'POST', method: 'POST',
data, data,
}), }),
// 自定义页面 // 自定义页面
page: (id) => page: (id) =>
request({ request({
url: 'index/page', url: 'index/page',
method: 'GET', method: 'GET',
params: { params: {
id: id, id: id,
}, },
}), }),
//积分商城 //积分商城
scoreShop: { scoreShop: {
list: (params) => fullList: (params) =>
request({ request({
url: 'app.score_shop', url: 'meal.score/product_list',
method: 'GET', method: 'GET',
params, params,
}), }),
ids: (params = {}) => exCoupon: (data) =>
request({ request({
url: 'app.score_shop/ids', url: 'meal.score/exchange',
method: 'GET', method: 'POST',
params, data,
}), }),
detail: (id) => list: (params) =>
request({ request({
url: 'app.score_shop/detail', url: 'app.score_shop',
method: 'GET', method: 'GET',
params: { params,
id: id, }),
}, ids: (params = {}) =>
}), request({
}, url: 'app.score_shop/ids',
//小程序直播 method: 'GET',
mplive: { params,
getMpLink: () => }),
request({ detail: (id) =>
url: 'app.mplive/getMpLink', request({
method: 'GET', url: 'app.score_shop/detail',
}), method: 'GET',
getRoomList: (ids) => params: {
request({ id: id,
url: 'app.mplive/getRoomList', },
method: 'GET', }),
params: { },
ids: ids.join(','), //小程序直播
} mplive: {
}), getMpLink: () =>
}, request({
url: 'app.mplive/getMpLink',
method: 'GET',
}),
getRoomList: (ids) =>
request({
url: 'app.mplive/getRoomList',
method: 'GET',
params: {
ids: ids.join(','),
}
}),
},
//上传 //上传
upload: (file, group = 'ugc', callback) => { upload: (file, group = 'ugc', callback) => {
const token = uni.getStorageSync('token'); const token = uni.getStorageSync('token');
uni.showLoading({ uni.showLoading({
title: '上传中', title: '上传中',
}); });
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.uploadFile({ uni.uploadFile({
url: baseUrl + '/api/common/upload', url: baseUrl + '/api/common/upload',
filePath: file, filePath: file,
name: 'file', name: 'file',
formData: { formData: {
group, group,
}, },
header: { header: {
Accept: 'text/json', Accept: 'text/json',
// Authorization: token, // Authorization: token,
token: token token: token
}, },
success: (uploadFileRes) => { success: (uploadFileRes) => {
let result = JSON.parse(uploadFileRes.data); let result = JSON.parse(uploadFileRes.data);
if (result.code === 0) { if (result.code === 0) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: result.msg, title: result.msg,
}); });
} else { } else {
return resolve(result.data); return resolve(result.data);
} }
}, },
fail: (error) => { fail: (error) => {
console.log('上传失败:', error); console.log('上传失败:', error);
return resolve(false); return resolve(false);
}, },
complete: () => { complete: () => {
uni.hideLoading(); uni.hideLoading();
}, },
}); });
}); });
}, },
}; };

View File

@ -3,12 +3,12 @@
* @param {String} name * @param {String} name
*/ */
export const get_file_ext = (name) => { export const get_file_ext = (name) => {
const last_len = name.lastIndexOf('.'); const last_len = name.lastIndexOf('.');
const len = name.length; const len = name.length;
return { return {
name: name.substring(0, last_len), name: name.substring(0, last_len),
ext: name.substring(last_len + 1, len), ext: name.substring(last_len + 1, len),
}; };
}; };
/** /**
@ -16,49 +16,49 @@ export const get_file_ext = (name) => {
* @param {Array} fileExtname * @param {Array} fileExtname
*/ */
export const get_extname = (fileExtname) => { export const get_extname = (fileExtname) => {
if (!Array.isArray(fileExtname)) { if (!Array.isArray(fileExtname)) {
let extname = fileExtname.replace(/(\[|\])/g, ''); let extname = fileExtname.replace(/(\[|\])/g, '');
return extname.split(','); return extname.split(',');
} else { } else {
return fileExtname; return fileExtname;
} }
return []; return [];
}; };
/** /**
* 获取文件和检测是否可选 * 获取文件和检测是否可选
*/ */
export const get_files_and_is_max = (res, _extname) => { export const get_files_and_is_max = (res, _extname) => {
let filePaths = []; let filePaths = [];
let files = []; let files = [];
if (!_extname || _extname.length === 0) { if (!_extname || _extname.length === 0) {
return { return {
filePaths, filePaths,
files, files,
}; };
} }
res.tempFiles.forEach((v) => { res.tempFiles.forEach((v) => {
let fileFullName = get_file_ext(v.name); let fileFullName = get_file_ext(v.name);
const extname = fileFullName.ext.toLowerCase(); const extname = fileFullName.ext.toLowerCase();
if (_extname.indexOf(extname) !== -1) { if (_extname.indexOf(extname) !== -1) {
files.push(v); files.push(v);
filePaths.push(v.path); filePaths.push(v.path);
} }
}); });
if (files.length !== res.tempFiles.length) { if (files.length !== res.tempFiles.length) {
uni.showToast({ uni.showToast({
title: `当前选择了${res.tempFiles.length}个文件 ${ title: `当前选择了${res.tempFiles.length}个文件 ${
res.tempFiles.length - files.length res.tempFiles.length - files.length
} 个文件格式不正确`, } 个文件格式不正确`,
icon: 'none', icon: 'none',
duration: 5000, duration: 5000,
}); });
} }
return { return {
filePaths, filePaths,
files, files,
}; };
}; };
/** /**
@ -66,45 +66,59 @@ export const get_files_and_is_max = (res, _extname) => {
* @param {Object} filepath * @param {Object} filepath
*/ */
export const get_file_info = (filepath) => { export const get_file_info = (filepath) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.getImageInfo({ if (!filepath) {
src: filepath, reject(new Error('Invalid file path'));
success(res) { return;
resolve(res); }
},
fail(err) { uni.getImageInfo({
reject(err); src: filepath,
}, success(res) {
}); resolve(res);
}); },
fail(err) {
console.error('Failed to get image info:', err);
reject(err);
},
});
});
}; };
/** /**
* 获取封装数据 * 获取封装数据
*/ */
export const get_file_data = async (files, type = 'image') => { export const get_file_data = async (files, type = 'image') => {
// 最终需要上传数据库的数据 // 最终需要上传数据库的数据
let fileFullName = get_file_ext(files.name); let fileFullName = get_file_ext(files.name);
const extname = fileFullName.ext.toLowerCase(); const extname = fileFullName.ext.toLowerCase();
let filedata = { let filedata = {
name: files.name, name: files.name,
uuid: files.uuid, uuid: files.uuid,
extname: extname || '', extname: extname || '',
cloudPath: files.cloudPath, cloudPath: files.cloudPath,
fileType: files.fileType, fileType: files.fileType,
url: files.path || files.path, url: files.path || files.path,
size: files.size, //单位是字节 size: files.size, //单位是字节
image: {}, image: {},
path: files.path, path: files.path,
video: {}, video: {},
}; };
if (type === 'image') {
const imageinfo = await get_file_info(files.path); try {
delete filedata.video; if (type === 'image') {
filedata.image.width = imageinfo.width; const imageinfo = await get_file_info(files.path);
filedata.image.height = imageinfo.height; delete filedata.video;
filedata.image.location = imageinfo.path; filedata.image.width = imageinfo.width;
} else { filedata.image.height = imageinfo.height;
delete filedata.image; filedata.image.location = imageinfo.path;
} } else {
return filedata; delete filedata.image;
}; }
} catch (error) {
console.error('Error processing file data:', error);
// 返回基本文件数据,即使图片信息获取失败
delete filedata.image;
delete filedata.video;
}
return filedata;
};