增加基本项目配置
This commit is contained in:
152
pages/user/signIn/Integral/index.vue
Normal file
152
pages/user/signIn/Integral/index.vue
Normal file
@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div class="integral-details" ref="container">
|
||||
<div class="header">
|
||||
<div class="currentScore">当前积分</div>
|
||||
<div>{{ info.integral }}</div>
|
||||
<div class="line"></div>
|
||||
<!--<div class="nav acea-row">-->
|
||||
<!--<div class="item">-->
|
||||
<!--<div class="num">{{ info.sum_integral }}</div>-->
|
||||
<!--<div>累计积分</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="item">-->
|
||||
<!--<div class="num">{{ info.deduction_integral }}</div>-->
|
||||
<!--<div>累计消费</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="item">-->
|
||||
<!--<div class="num">{{ info.today_integral }}</div>-->
|
||||
<!--<div>今日获得</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
<div class="wrapper">
|
||||
<div class="nav acea-row">
|
||||
<div
|
||||
class="item acea-row row-center-wrapper"
|
||||
:class="current === navListIndex ? 'on' : ''"
|
||||
v-for="(item, navListIndex) in navList"
|
||||
:key="navListIndex"
|
||||
@click="nav(navListIndex)"
|
||||
>
|
||||
<span class="iconfont" :class="item.icon"></span>{{ item.name }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="list" :hidden="current !== 0">
|
||||
<!--<div class="tip acea-row row-middle">-->
|
||||
<!--<span class="iconfont icon-shuoming"></span-->
|
||||
<!-->提示:积分数值的高低会直接影响您的会员等级-->
|
||||
<!--</div>-->
|
||||
<div
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="(item, listIndex) in list"
|
||||
:key="listIndex"
|
||||
>
|
||||
<div>
|
||||
<div class="state">{{ item.title }}</div>
|
||||
<div><data-format :data="item.addTime"></data-format></div>
|
||||
</div>
|
||||
<div class="num" v-if="item.pm == 1">+{{ item.number }}</div>
|
||||
<div class="num font-color-red" v-if="item.pm == 0">
|
||||
-{{ item.number }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="list2" :hidden="current !== 1">-->
|
||||
<!--<div class="item acea-row row-between-wrapper" @click="$yrouter.switchTab('/pages/home/index')">-->
|
||||
<!--<div class="pictrue"><img :src="$VUE_APP_RESOURCES_URL+'/images/score.png'" /></div>-->
|
||||
<!--<div class="name">购买商品可获得积分奖励</div>-->
|
||||
<!--<div class="earn">赚积分</div>-->
|
||||
<!--</div>-->
|
||||
<!--<div-->
|
||||
<!--class="item acea-row row-between-wrapper"-->
|
||||
<!--@click="$yrouter.push('/pages/user/signIn/Sign/index')"-->
|
||||
<!-->-->
|
||||
<!--<div class="pictrue"><img :src="$VUE_APP_RESOURCES_URL+'/images/score.png'" /></div>-->
|
||||
<!--<div class="name">每日签到可获得积分奖励</div>-->
|
||||
<!--<div class="earn">赚积分</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
<Loading :loaded="loaded" :loading="loading"></Loading>
|
||||
</div>
|
||||
</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: {
|
||||
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 => {
|
||||
that.$dialog.message(err.msg);
|
||||
}
|
||||
);
|
||||
},
|
||||
getIntegral: function() {
|
||||
let that = this;
|
||||
postSignUser(that.data).then(
|
||||
res => {
|
||||
that.info = res.data;
|
||||
},
|
||||
err => {
|
||||
that.$dialog.message(err.msg);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
|
||||
.list{
|
||||
}
|
||||
</style>
|
5
pages/user/signIn/Integral/main.js
Normal file
5
pages/user/signIn/Integral/main.js
Normal file
@ -0,0 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import App from './index'
|
||||
|
||||
const app = new Vue(App)
|
||||
app.$mount()
|
205
pages/user/signIn/Sign/index.vue
Normal file
205
pages/user/signIn/Sign/index.vue
Normal file
@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<div class="sign">
|
||||
<div class="header bg-color-red">
|
||||
<div class="headerCon acea-row row-between-wrapper">
|
||||
<div class="left acea-row row-between-wrapper">
|
||||
<div class="pictrue">
|
||||
<img :src="userInfo.avatar" />
|
||||
</div>
|
||||
<div class="text">
|
||||
<div class="line1">{{ userInfo.nickname }}</div>
|
||||
<div class="integral acea-row">
|
||||
<span>积分: {{ userInfo.integral }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@click="$yrouter.push('/pages/user/signIn/SignRecord/index')"
|
||||
class="right acea-row row-middle"
|
||||
>
|
||||
<div class="iconfont icon-caidan"></div>
|
||||
<div>明细</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrapper">
|
||||
<div class="list acea-row row-between-wrapper">
|
||||
<div
|
||||
class="item"
|
||||
v-for="(item, signSystemListIndex) in signSystemList"
|
||||
:key="signSystemListIndex"
|
||||
>
|
||||
<div
|
||||
:class="signSystemListIndex + 1 === signSystemList.length ? 'rewardTxt' : ''"
|
||||
>{{ item.day }}</div>
|
||||
<div
|
||||
class="venus"
|
||||
:class="
|
||||
(signSystemListIndex + 1 === signSystemList.length ? 'reward' : '') +
|
||||
' ' +
|
||||
(sign_index >= signSystemListIndex + 1 ? 'venusSelect' : '')
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
class="num"
|
||||
:class="sign_index >= signSystemListIndex + 1 ? 'on' : ''"
|
||||
>+{{ item.signNum }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--加在 but 上 on 为已签到-->
|
||||
<div
|
||||
class="but bg-color-red"
|
||||
:class="userInfo.is_day_sgin ? 'on' : ''"
|
||||
@click="goSign"
|
||||
>{{ userInfo.isDaySign ? "已签到" : "立即签到" }}</div>
|
||||
<div class="lock"></div>
|
||||
</div>
|
||||
<div class="wrapper wrapper2">
|
||||
<div class="tip">已累计签到</div>
|
||||
<div class="list2 acea-row row-center row-bottom">
|
||||
<div
|
||||
class="item"
|
||||
v-for="(item, signCountIndex) in signCount"
|
||||
:key="signCountIndex"
|
||||
>{{ item || 0 }}</div>
|
||||
<div class="data">天</div>
|
||||
</div>
|
||||
<div class="tip2">据说连续签到第{{ day }}天可获得超额积分,一定要坚持签到哦~~~</div>
|
||||
<div class="list3">
|
||||
<div
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="(item, signListIndex) in signList"
|
||||
:key="signListIndex"
|
||||
>
|
||||
<div>
|
||||
<div class="name line1">{{ item.title }}</div>
|
||||
<div class="data">{{ item.addTime }}</div>
|
||||
</div>
|
||||
<div class="num font-color-red">+{{ item.number }}</div>
|
||||
</div>
|
||||
<div
|
||||
@click="$yrouter.push('/pages/user/signIn/SignRecord/index')"
|
||||
class="Loads acea-row row-center-wrapper"
|
||||
v-if="signList.length > 0"
|
||||
>
|
||||
点击加载更多
|
||||
<div class="iconfont icon-xiangyou acea-row row-center-wrapper"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="signTip acea-row row-center-wrapper" :class="active === true ? 'on' : ''">
|
||||
<div class="signTipLight loadingpic">
|
||||
<img :src="$VUE_APP_RESOURCES_URL+'/images/light.png'" />
|
||||
</div>
|
||||
<div class="signTipCon">
|
||||
<div class="state">签到成功</div>
|
||||
<div class="integral">获得{{ integral }}积分</div>
|
||||
<div class="signTipBnt" @click="close">好的</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mask" @touchmove.prevent :hidden="active === false"></div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.Loads .iconfont {
|
||||
font-size: 0.25rem;
|
||||
margin: 0.02rem 0 0 0.1rem;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import {
|
||||
postSignUser,
|
||||
getSignConfig,
|
||||
postSignIntegral,
|
||||
getSignList
|
||||
} from "@/api/user";
|
||||
import { add } from "@/utils/bc";
|
||||
|
||||
export default {
|
||||
name: "Sign",
|
||||
components: {},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
userInfo: {},
|
||||
integral: 0,
|
||||
signCount: [],
|
||||
sign_index: 0,
|
||||
signSystemList: [],
|
||||
signList: [],
|
||||
page: 1,
|
||||
limit: 3,
|
||||
active: false,
|
||||
day: ""
|
||||
};
|
||||
},
|
||||
mounted: function() {
|
||||
this.signUser();
|
||||
this.signConfig();
|
||||
this.getSignList();
|
||||
},
|
||||
methods: {
|
||||
// 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 => {
|
||||
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)
|
||||
return that.$dialog.toast({ mes: "您今日已签到!" });
|
||||
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>
|
5
pages/user/signIn/Sign/main.js
Normal file
5
pages/user/signIn/Sign/main.js
Normal file
@ -0,0 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import App from './index'
|
||||
|
||||
const app = new Vue(App)
|
||||
app.$mount()
|
65
pages/user/signIn/SignRecord/index.vue
Normal file
65
pages/user/signIn/SignRecord/index.vue
Normal file
@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div class="sign-record" ref="container">
|
||||
<div class="list">
|
||||
<div class="item" v-for="(item, signListIndex) in signList" :key="signListIndex">
|
||||
<div class="data">{{ item.time }}</div>
|
||||
<div class="listn">
|
||||
<div
|
||||
class="itemn acea-row row-between-wrapper"
|
||||
v-for="(itemn, indexn) in item.list"
|
||||
:key="indexn"
|
||||
>
|
||||
<div>
|
||||
<div class="name line1">{{ itemn.title }}</div>
|
||||
<div>{{ itemn.addTime }}</div>
|
||||
</div>
|
||||
<div class="num font-color-red">+{{ itemn.number }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Loading :loaded="loadend" :loading="loading"></Loading>
|
||||
</div>
|
||||
</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>
|
5
pages/user/signIn/SignRecord/main.js
Normal file
5
pages/user/signIn/SignRecord/main.js
Normal file
@ -0,0 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import App from './index'
|
||||
|
||||
const app = new Vue(App)
|
||||
app.$mount()
|
Reference in New Issue
Block a user