Init project

This commit is contained in:
lifizer
2023-09-20 21:49:33 +08:00
parent 85a5989c96
commit c9ceac9f37
710 changed files with 125705 additions and 0 deletions
+151
View File
@@ -0,0 +1,151 @@
<template>
<view class="integral-details" ref="container">
<view class="header">
<view class="currentScore">当前积分</view>
<view>{{ info.integral }}</view>
<view class="line"></view>
<!--<view class="nav acea-row">-->
<!--<view class="item">-->
<!--<view class="num">{{ info.sum_integral }}</view>-->
<!--<view>累计积分</view>-->
<!--</view>-->
<!--<view class="item">-->
<!--<view class="num">{{ info.deduction_integral }}</view>-->
<!--<view>累计消费</view>-->
<!--</view>-->
<!--<view class="item">-->
<!--<view class="num">{{ info.today_integral }}</view>-->
<!--<view>今日获得</view>-->
<!--</view>-->
<!--</view>-->
</view>
<view class="wrapper">
<view class="nav acea-row">
<view
class="item acea-row row-center-wrapper"
:class="current === navListIndex ? 'on' : ''"
v-for="(item, navListIndex) in navList"
:key="navListIndex"
@click="nav(navListIndex)"
>
<text class="iconfont" :class="item.icon"></text>
{{ item.name }}
</view>
</view>
<view class="list" :hidden="current !== 0">
<!--<view class="tip acea-row row-middle">-->
<!--<text class="iconfont icon-shuoming"><text-->
<!--&gt;提示:积分数值的高低会直接影响您的会员等级-->
<!--</view>-->
<view
class="item acea-row row-between-wrapper"
v-for="(item, listIndex) in list"
:key="listIndex"
>
<view>
<text class="state">{{ item.title }}</text>
<view>
<data-format :date="item.addTime"></data-format>
</view>
</view>
<text class="num" v-if="item.pm == 1">+{{ item.number }}</text>
<text class="num font-color-red" v-if="item.pm == 0">-{{ item.number }}</text>
</view>
</view>
</view>
<Loading :loaded="loaded" :loading="loading"></Loading>
</view>
</template>
<script>
import { getIntegralList, postSignUser } from "@/api/user";
import Loading from "@/components/Loading";
import DataFormat from "@/components/DataFormat";
export default {
name: "Integral",
components: {
Loading,
DataFormat
},
props: {},
data: function() {
return {
navList: [
{ name: "分值明细", icon: "icon-mingxi" }
// { name: "分值提升", icon: "icon-tishengfenzhi" }
],
current: 0,
where: {
page: 1,
limit: 15
},
data: {
sign: 1,
integral: 1,
all: 1
},
list: [],
info: [],
loaded: false,
loading: false
};
},
mounted: function() {
this.getIntegral();
this.getInfo();
},
onReachBottom() {
!this.loading && this.getInfo();
},
methods: {
goSignIn() {
this.$yrouter.push("/pages/user/signIn/Sign/index");
},
goHome() {
this.$yrouter.switchTab("/pages/home/index");
},
nav: function(index) {
this.current = index;
},
getInfo: function() {
let that = this;
if (that.loaded == true || that.loading == true) return;
that.loading = true;
getIntegralList(that.where).then(
res => {
that.loading = false;
that.loaded = res.data.length < that.where.limit;
that.loadTitle = that.loaded ? "人家是有底线的" : "上拉加载更多";
that.where.page = that.where.page + 1;
that.list.push.apply(that.list, res.data);
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none',
duration: 2000
});
}
);
},
getIntegral: function() {
let that = this;
postSignUser(that.data).then(
res => {
that.info = res.data;
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none',
duration: 2000
});
}
);
}
}
};
</script>
<style lang="less">
.list {
}
</style>
+186
View File
@@ -0,0 +1,186 @@
<template>
<view class="sign">
<view class="header bg-color-red">
<view class="headerCon acea-row row-between-wrapper">
<view class="left acea-row row-between-wrapper">
<view class="pictrue">
<image :src="userInfo.avatar" />
</view>
<view class="text">
<view class="line1">{{ userInfo.nickname }}</view>
<view class="integral acea-row">
<text>积分: {{ userInfo.integral }}</text>
</view>
</view>
</view>
<view @click="goSignRecord()" class="right acea-row row-middle">
<view class="iconfont icon-caidan"></view>
<view>明细</view>
</view>
</view>
</view>
<view class="wrapper">
<view class="list acea-row row-between-wrapper">
<view class="item" v-for="(item, signSystemListIndex) in signSystemList" :key="signSystemListIndex">
<view :class="signSystemListIndex + 1 === signSystemList.length ? 'rewardTxt' : ''">{{ item.day }}</view>
<view class="venus" :class=" (signSystemListIndex + 1 === signSystemList.length ? 'reward' : '') +' ' + (sign_index >= signSystemListIndex + 1 ? 'venusSelect' : '')"></view>
<view class="num" :class="sign_index >= signSystemListIndex + 1 ? 'on' : ''">+{{ item.sign_num }}</view>
</view>
</view>
<!--加在 but 上 on 为已签到-->
<view class="but bg-color-red" :class="userInfo.is_day_sgin ? 'on' : ''" @click="goSign">{{ userInfo.isDaySign ? "已签到" : "立即签到" }}</view>
<view class="lock"></view>
</view>
<view class="wrapper wrapper2">
<view class="tip">已累计签到</view>
<view class="list2 acea-row row-center row-bottom">
<view class="item" v-for="(item, signCountIndex) in signCount" :key="signCountIndex">{{ item || 0 }}</view>
<view class="data">天</view>
</view>
<view class="tip2">据说连续签到第{{ day }}天可获得超额积分,一定要坚持签到哦~~~</view>
<view class="list3">
<view class="item acea-row row-between-wrapper" v-for="(item, signListIndex) in signList" :key="signListIndex">
<view>
<view class="name line1">{{ item.title }}</view>
<view class="data">{{ item.addTime }}</view>
</view>
<view class="num font-color-red">+{{ item.number }}</view>
</view>
<view @click="goSignRecord()" class="Loads acea-row row-center-wrapper" v-if="signList.length > 0">
点击加载更多
<view class="iconfont icon-xiangyou acea-row row-center-wrapper"></view>
</view>
</view>
</view>
<view class="signTip acea-row row-center-wrapper" :class="active === true ? 'on' : ''">
<view class="signTipLight loadingpic">
<image :src="webUrl+'/20200729163719734861.png'" />
</view>
<view class="signTipCon">
<view class="state">签到成功</view>
<view class="integral">获得{{ integral }}积分</view>
<view class="signTipBnt" @click="close">好的</view>
</view>
</view>
<view class="mask" @touchmove.prevent :hidden="active === false"></view>
</view>
</template>
<style scoped lang="less">
.Loads .iconfont {
font-size: 0.25*100rpx;
margin: 0.02*100rpx 0 0 0.1*100rpx;
}
</style>
<script>
import {
postSignUser,
getSignConfig,
postSignIntegral,
getSignList
} from "@/api/user";
import {
add
} from "@/utils/bc";
export default {
name: "Sign",
components: {},
props: {},
data: function() {
return {
webUrl:this.$VUE_APP_RESOURCES_URL,
userInfo: {},
integral: 0,
signCount: [],
sign_index: 0,
signSystemList: [],
signList: [],
page: 1,
limit: 3,
active: false,
day: ""
};
},
mounted: function() {
uni.showLoading({ title: "加载中", mask: true });
this.signUser();
this.signConfig();
this.getSignList();
},
methods: {
goSignRecord() {
this.$yrouter.push("/pages/user/signIn/SignRecord/index");
},
// js给数字补0;num:需要补0的数字,length:长度(补到多少位);
PrefixInteger: function(num, length) {
return (Array(length).join("0") + num).slice(-length).split("");
},
//数字转中文
Rp: function(n) {
var cnum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
var s = "";
n = "" + n; // 数字转为字符串
for (var i = 0; i < n.length; i++) {
s += cnum[parseInt(n.charAt(i))];
}
return s;
},
// 获取用户信息
signUser: function() {
let that = this;
postSignUser({
sign: 1
}).then(res => {
uni.hideLoading();
res.data.integral = parseInt(res.data.integral);
var sumSginDay = res.data.sumSignDay;
that.userInfo = res.data;
that.signCount = that.PrefixInteger(sumSginDay, 4);
that.sign_index = parseInt(res.data.signNum);
});
},
// 签到配置
signConfig: function() {
let that = this;
getSignConfig().then(res => {
that.signSystemList = res.data;
that.day = that.Rp(that.signSystemList.length);
});
},
// 用户签到
goSign: function() {
let that = this,
sumSginDay = that.userInfo.sumSignDay;
if (that.userInfo.is_day_sgin) {
uni.showToast({
title: "您今日已签到!",
icon: "none",
duration: 2000
});
return
}
postSignIntegral().then(res => {
that.active = true;
that.integral = res.data.integral;
let sign_index = parseInt(that.sign_index + 1);
that.sign_index =
sign_index > that.signSystemList.length ? 1 : sign_index;
that.signCount = that.PrefixInteger(sumSginDay + 1, 4);
that.userInfo.is_day_sgin = true;
that.userInfo.integral = add(that.userInfo.integral, res.data.integral);
that.getSignList();
});
},
// 获取签到列表;
getSignList: function() {
let that = this;
getSignList(that.page, that.limit).then(res => {
that.signList = res.data;
});
},
close: function() {
this.active = false;
}
}
};
</script>
+65
View File
@@ -0,0 +1,65 @@
<template>
<view class="sign-record" ref="container">
<view class="list">
<view class="item" v-for="(item, signListIndex) in signList" :key="signListIndex">
<view class="data">{{ item.time }}</view>
<view class="listn">
<view
class="itemn acea-row row-between-wrapper"
v-for="(itemn, indexn) in item.list"
:key="indexn"
>
<view>
<view class="name line1">{{ itemn.title }}</view>
<view>{{ itemn.addTime }}</view>
</view>
<view class="num font-color-red">+{{ itemn.number }}</view>
</view>
</view>
</view>
</view>
<Loading :loaded="loadend" :loading="loading"></Loading>
</view>
</template>
<script>
import { getSignMonth } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "SignRecord",
components: {
Loading
},
props: {},
data: function() {
return {
page: 1,
limit: 3,
signList: [],
loading: false,
loadend: false,
active: false
};
},
mounted: function() {
this.signListTap();
},
onReachBottom() {
!this.loading && this.signListTap();
},
methods: {
signListTap: function() {
let that = this;
if (that.loading) return; //阻止下次请求(false可以进行请求);
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
that.loading = true;
getSignMonth(that.page, that.limit).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
that.signList.push.apply(that.signList, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
});
}
}
};
</script>