Commit e0b861e4 authored by 王炽's avatar 王炽

签到接口对接,任务项执行

parent 0ff8a1d9
......@@ -29,4 +29,10 @@ export const fetchBatchReceiveJSON = () => api.post('/c/equity/birthdayGift/batc
export const fetchActivityStateJSON = () => api.get('/c/third/activity/state');
//获取配置项和商品列表
export const getResourceList = () => api.get('c/resource/list');
\ No newline at end of file
export const getResourceList = () => api.get('/c/resource/list');
//获取签到和任务信息接口
export const getSigninAndTaskInfoJSON = () => api.get('/c/activity/todo/list');
//签到接口
export const checkInJSON = (activityId) => api.post('/c/activity/todo/checkIn', {activityId});
\ No newline at end of file
......@@ -17,7 +17,8 @@ const {
// 通常可以吧 baseUrl 单独放在一个 js 文件了
// const baseUrl = "http://172.16.230.108:7777/pmall";
// const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
const baseUrl = "https://momclub-test.feihe.com/pmall";
// let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
// const baseUrl = "https://feihe.m.duibatest.com.cn/pmall"
......
.gongzhonghao_pop_overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: flex-end;
justify-content: center;
z-index: 9999;
.gongzhonghao_pop_container {
width: 100%;
height: 812rpx;
background: #ffffff;
border-radius: 24rpx 24rpx 0 0;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.1);
overflow: hidden;
animation: slideUp 0.3s ease-out;
.pop_header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30rpx 30rpx 0rpx 30rpx;
// border-bottom: 1rpx solid #f0f0f0;
.pop_title {
font-size: 36rpx;
font-weight: bold;
color: #1D1E25;
}
.close_button {
width: 70rpx;
height: 70rpx;
display: flex;
align-items: center;
justify-content: center;
.close_icon {
font-size: 50rpx;
color: #999999;
font-weight: bold;
line-height: 1;
}
}
}
.pop_content {
padding: 30rpx 40rpx 60rpx 40rpx;
display: flex;
flex-direction: column;
align-items: center;
.description_text {
font-size: 28rpx;
color: #6F6D67; ;
text-align: center;
line-height: 1.5;
margin-bottom: 60rpx;
// padding: 0 20rpx;
}
.qr_code_container {
width: 340rpx;
height: 340rpx;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 60rpx;
// padding: 30rpx;
.qr_code_img {
width: 100%;
height: 100%;
}
}
.download_button {
width: 286rpx;
height: 89rpx;
// align-items: center;
// justify-content: center;
// flex-direction: row;
.download_icon {
width: 100%;
height: 100%;
}
// .download_text {
// font-size: 28rpx;
// color: #666666;
// }
}
}
}
}
@keyframes slideUp {
from {
transform: translateY(100%);
}
to {
transform: translateY(0);
}
}
<template>
<view class="gongzhonghao_pop_overlay" v-if="visible" @click="handleClose">
<view class="gongzhonghao_pop_container" @click.stop>
<!-- 弹窗头部 -->
<view class="pop_header">
<text class="pop_title">{{ props.title }}</text>
<view class="close_button" @click="handleClose">
<text class="close_icon">×</text>
</view>
</view>
<!-- 弹窗内容 -->
<view class="pop_content">
<text class="description_text">{{ props.description }}</text>
<!-- 二维码区域 -->
<view class="qr_code_container">
<image
class="qr_code_img"
:src="props.qrCodeUrl"
mode="aspectFit"
/>
</view>
<!-- 下载二维码按钮 -->
<view class="download_button" @click="handleDownload">
<image class="download_icon" src="https://course.feihe.com/momclub-picture/homepage/btn_download.png" mode="aspectFit" />
<!-- <text class="download_text">下载二维码</text> -->
</view>
</view>
</view>
</view>
</template>
<script setup>
import { defineProps, defineEmits } from 'vue';
// Props 定义
const props = defineProps({
visible: {
type: Boolean,
default: false
},
title: {
type: String,
default: '公众号'
},
description: {
type: String,
default: '长按关注星妈会公众号,了解更多专业育儿资讯'
},
qrCodeUrl: {
type: String,
default: 'https://course.feihe.com/momclub-picture/homepage/qrcode_gzh.png'
}
});
// Emits 定义
const emit = defineEmits(['close', 'download']);
// 关闭弹窗
const handleClose = () => {
emit('close');
};
// 下载二维码
const handleDownload = () => {
emit('download', props.title);
};
</script>
<style lang="less" scoped>
@import '@/components/renwu/GongzhonghaoPop.less';
</style>
......@@ -181,6 +181,11 @@
font-size: 24rpx;
color: #666666;
line-height: 1.4;
.agreement_link {
// color: #D3A458;
// text-decoration: underline;
}
}
}
}
......@@ -195,6 +200,7 @@
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 50rpx;
border: none;
outline: none;
......
......@@ -104,11 +104,11 @@
</view>
<view class="agreement_section">
<view class="agreement_checkbox" @click="toggleAgreement">
<view class="checkbox" :class="{ checked: agreementChecked }">
<view class="agreement_checkbox">
<view class="checkbox" :class="{ checked: agreementChecked }" @click="toggleAgreement">
<text v-if="agreementChecked" class="checkmark"></text>
</view>
<text class="agreement_text">我已阅读并同意《星妈会用户注册协议》《星妈会隐私政策》</text>
<text class="agreement_text">我已阅读并同意<text class="agreement_link" @click="handleAgreementClick('member')">《星妈会用户注册协议》</text><text class="agreement_link" @click="handleAgreementClick('privacy')">《星妈会隐私政策》</text></text>
</view>
</view>
......@@ -564,6 +564,22 @@ const toggleAgreement = () => {
agreementChecked.value = !agreementChecked.value;
};
// 协议点击事件处理
const handleAgreementClick = (type) => {
console.log('点击协议:', type);
if (type === "member") {
jump({
type: JumpType.INNER,
url: "/pages/webview/webview?type=MEMBER_URL"
});
} else if (type === "privacy") {
jump({
type: JumpType.INNER,
url: "/pages/webview/webview?type=PRIVACY_URL"
});
}
};
function onDateStatusChange(status) {
if (pageType.value === "edit" && status < userStore.babyInfo.babyStage) {
uni.showToast({
......
......@@ -79,8 +79,9 @@
margin-right: 20rpx;
.icon_img {
width: 50rpx;
height: 50rpx;
width: 100%;
height: 100%;
border-radius: 50%;
}
}
......@@ -118,13 +119,16 @@
font-weight: 500;
}
&:active {
// 只有非已完成状态的按钮才有点击效果
&:not(.completed):active {
transform: scale(0.95);
}
&.completed {
background: #F6DEB7;
// border: 1rpx solid #d4a468;
// 已完成状态不添加点击效果
transition: none;
.task_button_text {
color: #ffffff;
......
......@@ -13,26 +13,26 @@
<view class="task_list">
<view
class="task_item"
v-for="(task, index) in taskList"
v-for="(task, index) in props.taskTodo"
:key="index"
>
<view class="task_icon">
<image
class="icon_img"
:src="task.icon"
:src="task?.taskTodoExtra?.icon"
mode="aspectFit"
/>
</view>
<view class="task_content">
<text class="task_title">{{ task.title }}</text>
<text class="task_points">积分+{{ task.points }}</text>
<text class="task_title">{{ task?.taskTodoExtra?.title }}</text>
<text class="task_points">积分+{{ task?.taskTodoExtra?.credits }}</text>
</view>
<view
class="task_button"
:class="{ completed: task.completed }"
:class="{ completed: task?.taskTodoExtra?.status == '3' }"
@click="handleTaskClick(task, index)"
>
<text class="task_button_text">{{ task.completed ? '已完成' : '去完成' }}</text>
<text class="task_button_text">{{ task?.taskTodoExtra?.status == '3' ? '已完成' : '去完成' }}</text>
</view>
</view>
</view>
......@@ -49,70 +49,34 @@
</template>
<script setup>
import { defineProps, defineEmits, ref } from 'vue';
import { defineProps, defineEmits, ref, onMounted, watch } from 'vue';
import TaskCompleteTips from './TaskCompleteTips.vue';
import { useIntegralStore } from '../../stores/integral';
// Props 定义
const props = defineProps({
visible: {
type: Boolean,
default: false
},
taskTodo: {
type: Array,
default: () => []
}
});
// Emits 定义
const emit = defineEmits(['close', 'taskClick']);
const integralStore = useIntegralStore();
// 任务完成提示弹窗状态
const showTaskCompleteTips = ref(false);
const currentTaskPoints = ref(0);
const currentTaskTitle = ref('');
// 任务列表数据
const taskList = [
{
id: 1,
title: '完善信息',
points: 20,
icon: '/static/images/task_info.png',
completed: false
},
{
id: 2,
title: '邀请好友',
points: 20,
icon: '/static/images/task_invite.png',
completed: false
},
{
id: 3,
title: '浏览星妈优选商城',
points: 20,
icon: '/static/images/task_browse.png',
completed: false
},
{
id: 4,
title: '完成首单优选消费',
points: 20,
icon: '/static/images/task_browse.png',
completed: false
},
{
id: 5,
title: '关注公众号',
points: 20,
icon: '/static/images/task_follow.png',
completed: true
},
{
id: 6,
title: '添加企业微信',
points: 20,
icon: '/static/images/task_wechat.png',
completed: false
}
];
const taskList = ref([]);
// 关闭弹窗
const handleClose = () => {
......@@ -121,9 +85,9 @@ const handleClose = () => {
// 任务点击事件
const handleTaskClick = (task, index) => {
if (task.completed) {
if (task?.taskTodoExtra?.status === '3') {
// 已完成的任务不触发跳转
console.log('任务已完成:', task.title);
console.log('任务已完成:', task?.taskTodoExtra?.title);
return;
}
......
{
"code": "dolor ut labore aliqua",
"message": "ea deserunt",
"ok": true,
"success": true,
"data": {
"credits": "50"
}
}
{
"ok": true,
"success": true,
"msg": "获取签到任务成功",
"code": "200",
"data": {
"checkInTodo": {
"id": 1,
"name": "每日签到",
"checkInExtra": {
"rule": "连续签到7天可获得额外奖励",
"type": "daily_checkin",
"taskCode": "CHECKIN_001",
"taskId": "checkin_daily_001",
"joinRecord": [
{
"index": 1,
"joined": true,
"credits": 10,
"coefficient": 0,
"today": false
},
{
"index": 2,
"joined": true,
"credits": 10,
"coefficient": 0,
"today": false
},
{
"index": 3,
"joined": true,
"credits": 10,
"coefficient": 1,
"today": true
},
{
"index": 4,
"joined": false,
"credits": 10,
"coefficient": 1,
"today": false
},
{
"index": 5,
"joined": false,
"credits": 10,
"coefficient": 1,
"today": false
},
{
"index": 6,
"joined": false,
"credits": 10,
"coefficient": 1,
"today": false
},
{
"index": 7,
"joined": false,
"credits": 20,
"coefficient": 2,
"today": false
}
]
}
},
"taskTodo": [
{
"id": 1,
"name": "完善信息",
"taskTodoExtra": {
"title": "完善信息",
"sort": 1,
"credits": 20,
"type": "Perfect",
"icon": "https://course.feihe.com/momclub-picture/brandpage/v1_ip1.png",
"desc": "完善宝宝基本信息,获得个性化推荐",
"extra": "完善信息",
"status": "1"
}
},
{
"id": 3,
"name": "浏览星妈优选商城",
"taskTodoExtra": {
"title": "浏览星妈优选商城",
"sort": 3,
"credits": 20,
"type": "BROWSE_PAGE",
"icon": "https://course.feihe.com/momclub-picture/brandpage/v1_ip1.png",
"desc": "浏览星妈优选商城商品",
"extra": "浏览星妈优选商城",
"status": "1"
}
},
{
"id": 4,
"name": "完成首单优选消费",
"taskTodoExtra": {
"title": "完成首单优选消费",
"sort": 4,
"credits": 20,
"type": "EXCHANGE_GOODS",
"icon": "https://course.feihe.com/momclub-picture/brandpage/v1_ip2.png",
"desc": "在星妈优选商城完成首单消费",
"extra": "完成首单优选消费",
"status": "1"
}
},
{
"id": 5,
"name": "关注公众号",
"taskTodoExtra": {
"title": "关注公众号",
"sort": 5,
"credits": 20,
"type": "FollowWx",
"icon": "https://course.feihe.com/momclub-picture/brandpage/v1_ip2.png",
"desc": "关注星妈会官方微信公众号",
"extra": "关注公众号",
"status": "1"
}
},
{
"id": 6,
"name": "添加企业微信",
"taskTodoExtra": {
"title": "添加企业微信",
"sort": 6,
"credits": 20,
"type": "AddQw",
"icon": "https://course.feihe.com/momclub-picture/brandpage/v1_ip1.png",
"desc": "添加星妈会企业微信客服",
"extra": "添加企业微信",
"status": "1"
}
},
{
"id": 7,
"name": "注册会员",
"taskTodoExtra": {
"title": "注册会员",
"sort": 7,
"credits": 20,
"type": "Register",
"icon": "https://course.feihe.com/momclub-picture/brandpage/v1_ip1.png",
"desc": "注册星妈会会员",
"extra": "注册会员",
"status": "1"
}
}
]
}
}
\ No newline at end of file
import { defineStore } from "pinia";
import { getSigninAndTaskInfoJSON, checkInJSON } from "../api/integral";
import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json';
import checkInMock from '../mock/checkIndata.json';
export const useIntegralStore = defineStore("integral", {
state: () => {
return {
_signinAndTaskInfo: null,
_checkInData: null, // 新增:存储签到数据
};
},
actions: {
async getSigninAndTaskInfo(isdebug = false) {
if(isdebug) {
this._signinAndTaskInfo = signinAndTaskInfoMock;
return signinAndTaskInfoMock;
}else{
const res = await getSigninAndTaskInfoJSON();
this._signinAndTaskInfo = res;
return res;
}
},
async checkIn(activityId,isdebug = false) {
if(isdebug) {
this._checkInData = checkInMock; // 存储到state中
return checkInMock;
}else{
const res = await checkInJSON(activityId);
this._checkInData = res; // 存储到state中
return res;
}
},
},
getters: {
signinAndTaskInfo : (state) => {return state._signinAndTaskInfo; },
checkInData : (state) => {return state._checkInData; },
},
});
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment