init
This commit is contained in:
104
pages/mine/exchange_records.vue
Normal file
104
pages/mine/exchange_records.vue
Normal file
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="dataList.length != 0" class="re-box">
|
||||
<view>
|
||||
<text style="font-size: 40rpx;color: #0081ff;" class="cuIcon-titles"></text><text style="font-size: 35rpx;">兑换明细</text>
|
||||
</view>
|
||||
<view style="margin-top: 40rpx;">
|
||||
<view v-for="(item,index) in dataList" :key="index" class="flex solid-bottom padding justify-between">
|
||||
<view class="">
|
||||
<view class="re-type">{{item.goodsName}}</view>
|
||||
<view class="re-time">兑换码:{{item.redemptionCode}}</view>
|
||||
<view class="re-time">兑换时间:{{item.recordsTime}}</view>
|
||||
</view>
|
||||
<view class="re-number">-{{item.recordsNumber}}
|
||||
<text class="cuIcon-vip" style="margin-left: 15rpx;font-size: 40rpx;"></text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view v-else style="text-align: center;" >
|
||||
<image style="width: 400rpx;height: 200rpx;margin-top: 200rpx;" src="https://img.yidaima.cn/feast/nodata.svg"></image>
|
||||
<view style="color: #adadad;">无数据</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listExchange
|
||||
} from "@/api/app/index.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
queryParams: {
|
||||
recordsUserId: uni.getStorageSync("userInfo").userId,
|
||||
},
|
||||
dataList: [],
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
getDataList(){
|
||||
var that = this;
|
||||
listExchange(this.queryParams).then(response => {
|
||||
that.dataList = response.rows
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.re-type{
|
||||
font-size: 33rpx;
|
||||
}
|
||||
.re-time{
|
||||
font-size: 30rpx;
|
||||
color: #adadad;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
.re-number{
|
||||
font-size: 35rpx;
|
||||
color: red;
|
||||
margin-top: 55rpx;
|
||||
}
|
||||
.re-box{
|
||||
min-height: 500rpx;
|
||||
background-color: white;
|
||||
border-radius: 20rpx;
|
||||
margin: 0 40rpx 40rpx 40rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
}
|
||||
/* 列表没有数据 */
|
||||
.no-list-data {
|
||||
text-align: center;
|
||||
margin-bottom: 100rpx;
|
||||
color: #e6e6e6;
|
||||
font-size: 24upx;
|
||||
}
|
||||
|
||||
/* 加载动图 */
|
||||
.artileload {
|
||||
height: 80rpx;
|
||||
width: 80rpx;
|
||||
margin: 20rpx auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
216
pages/mine/guanzhu.vue
Normal file
216
pages/mine/guanzhu.vue
Normal file
@@ -0,0 +1,216 @@
|
||||
<template>
|
||||
<div class="app-page">
|
||||
<!-- 个人信息部分 -->
|
||||
<div class="profile">
|
||||
<!-- 头像 -->
|
||||
<div class="avatar">
|
||||
<img src="https://img.yidaima.cn/%E5%A4%B4%E5%83%8F/9b889964f97e4d0c8f52f7b9ec0d04da.jpg" alt="Avatar" class="avatar-img">
|
||||
</div>
|
||||
<!-- 昵称 -->
|
||||
<div class="nickname">Nan Yin</div>
|
||||
<!-- 个人简介 -->
|
||||
<div class="bio">如果爱意难平,那就把它藏在心底吧!</div>
|
||||
</div>
|
||||
<!-- 联系人部分 -->
|
||||
<div class="contact">
|
||||
<!-- 循环渲染联系人列表 -->
|
||||
<div class="item" v-for="item in contacts" :key="item.id"
|
||||
@click="copyInfo(item.info, item.name, item.name1, item.id)">
|
||||
<!-- 联系人条目 -->
|
||||
<div class="icon-info">
|
||||
<!-- 自定义图标 -->
|
||||
<img :src="item.icon" alt="Custom Icon" class="custom-icon">
|
||||
<!-- 联系人名称 -->
|
||||
<div class="name">{{ item.name }}</div>
|
||||
<!-- 联系人名称 -->
|
||||
<div class="name1">{{ item.name1 }}</div>
|
||||
<!-- 联系人信息 -->
|
||||
<div class="info">{{ item.info }}</div>
|
||||
<div v-if="item.id ==1 || item.id ==2" class="copy"><text class="cuIcon-qrcode"></text></div>
|
||||
<div v-if="item.id ==3 || item.id ==4" class="copy"><text class="cuIcon-copy"></text></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--弹窗-->
|
||||
<view class="cu-modal" :class="modalName=='Modal'?'show':''">
|
||||
<view style="border-radius: 30rpx; background-color: white;" class="cu-dialog">
|
||||
<view class="cu-bar bg-white justify-end">
|
||||
<view style="color: black;font-size: 38rpx;margin-top: 40rpx;" class="content">{{modelTip}}</view>
|
||||
<view class="action" @tap="modalName = null">
|
||||
<text class="cuIcon-close text-red"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class=" bg-white">
|
||||
<image style="width: 75%;" mode="widthFix" show-menu-by-longpress="true"
|
||||
:src="modelSrc"></image>
|
||||
<view class="tipinfo">Tip:长按图片识别 / 保存</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
modelSrc:"",
|
||||
modelTip:"",
|
||||
contacts: [{
|
||||
id: 1,
|
||||
icon: "http://cun.mywl.top/mybk/xtb/qq.png",
|
||||
name: "企鹅",
|
||||
name1: ":",
|
||||
info: "594458910"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
icon: "http://cun.mywl.top/mybk/xtb/wechat.png",
|
||||
name: "微信",
|
||||
name1: ":",
|
||||
info: "forfeastcoding"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
icon: "http://cun.mywl.top/mybk/xtb/email.png",
|
||||
name: "邮箱",
|
||||
name1: ":",
|
||||
info: "594458910@qq.com"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
icon: "http://cun.mywl.top/mybk/xtb/blog.png",
|
||||
name: "博客",
|
||||
name1: ":",
|
||||
info: "http://www.yidaima.cn/"
|
||||
},
|
||||
],
|
||||
modalName: null
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
copyInfo(info, name, name1, id) {
|
||||
if(id == 1){
|
||||
this.modelTip = "我的企鹅码"
|
||||
this.modelSrc = "https://img.yidaima.cn/feast/qq_qrcode.jpg"
|
||||
this.modalName = "Modal"
|
||||
}else if(id == 2){
|
||||
this.modelTip = "我的微信码"
|
||||
this.modelSrc = "https://img.yidaima.cn/feast/wx_qrcode.jpg"
|
||||
this.modalName = "Modal"
|
||||
}
|
||||
uni.setClipboardData({
|
||||
data: info,
|
||||
success() {
|
||||
uni.showToast({
|
||||
title: `${name}已复制`,
|
||||
icon: 'success'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tipinfo {
|
||||
width: 60%;
|
||||
height: 80rpx;
|
||||
border-radius: 60rpx;
|
||||
text-align: center;
|
||||
/* border: 3rpx solid #ae67d6; */
|
||||
margin-left: 20%;
|
||||
line-height: 80rpx;
|
||||
margin-bottom: 40rpx;
|
||||
color: #ae67d6;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.app-page {
|
||||
width: 100vw;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
padding-top: 0rpx;
|
||||
}
|
||||
|
||||
.profile {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-image: url('https://v2.api-m.com/api/wallpaper?return=302');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
height: 33vh;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #fff;
|
||||
box-shadow: 0 2px 24px rgba(0, 0, 0, 0.07);
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
top: 55px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nickname {
|
||||
font-size: 20px;
|
||||
position: relative;
|
||||
top: 60px;
|
||||
}
|
||||
|
||||
.bio {
|
||||
margin-top: 10px;
|
||||
position: relative;
|
||||
top: 62px;
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.contact {
|
||||
border-top: 2px solid #f2f2f2;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.item {
|
||||
border-radius: 12px;
|
||||
background-color: #fafafa;
|
||||
padding: 16px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.icon-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.custom-icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.name,
|
||||
.name1,
|
||||
.info {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.copy {
|
||||
margin-left: auto;
|
||||
color: #1E90FF;
|
||||
}
|
||||
</style>
|
||||
673
pages/mine/index.vue
Normal file
673
pages/mine/index.vue
Normal file
@@ -0,0 +1,673 @@
|
||||
<template>
|
||||
<view class="my">
|
||||
<image src="https://v2.api-m.com/api/wallpaper?return=302" mode="aspectFill" class="my_bg"></image>
|
||||
<view class="header_cell">
|
||||
<view style="margin-top: 40rpx;" class="user_info">
|
||||
<view class="flex justify-center align-center">
|
||||
<image src="https://v2.api-m.com/api/head?return=302" mode="aspectFill" class="user_photo"></image>
|
||||
<view>
|
||||
<view class="text-black text-bold">
|
||||
<text v-if="userid" class="text-xl" style="font-weight: bold;">微信用户_{{userid}}</text>
|
||||
<text v-else class="text-xl" style="font-weight: bold;">游客用户!</text>
|
||||
<text v-if="!userid" class="cu-tag round bg-red" style="margin-left: 20rpx;">未登录</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<!-- <text class="lg text-gray cuIcon-right" @click="handleToSetting"></text> -->
|
||||
|
||||
</view>
|
||||
<text v-if="userid" style="float: right;" class="lg text-gray cuIcon-repair" @click="clean"></text>
|
||||
<view v-if="!userid" class="auth_btn">
|
||||
<button @tap="autologin()" class="cu-btn round bg-black">
|
||||
<text class="lg text-white cuIcon-weixin" style="margin-right: 20rpx;"></text>
|
||||
授权登录
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<view style="margin-top: 90rpx;" class="vip_cell flex justify-between align-center">
|
||||
<view>
|
||||
<view class="text-xl" style="font-weight: bold;color: rgb(241, 198, 142);">
|
||||
{{myIntegral}} 积分
|
||||
<text class="lg cuIcon-vip" style="margin-left: 15rpx;"></text>
|
||||
</view>
|
||||
<view class="text-xs" style="margin-top: 10rpx;font-size: 21rpx;">每邀请一个新用户登录,奖励 {{newUserNumber}} 个积分</view>
|
||||
<!-- <view v-else class="text-xs" style="margin-top: 10rpx;font-size: 23rpx;">授权登录后才可获得积分奖励哦</view> -->
|
||||
</view>
|
||||
<button open-type="share" class="cu-btn round invate_btn">邀 请</button>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="cell_1 flex justify-around align-center bg-white mt30" style="padding: 30rpx 0;border-radius: 15rpx;text-align: center;">
|
||||
广告位
|
||||
</view> -->
|
||||
<view class="cell_2 flex align-center mt30">
|
||||
<button @click="guanzhu(1)" class="kefu">
|
||||
<text style="color: #ff973c;font-size: 60rpx;" class=" cuIcon-appreciatefill"></text>
|
||||
<text style="display: block;margin-top: -60rpx;margin-bottom: 15rpx;font-size: 30rpx;">关注我们</text>
|
||||
</button>
|
||||
<button open-type="contact" class="kefu">
|
||||
<text style="color: #1382ff;font-size: 60rpx;" class=" cuIcon-servicefill"></text>
|
||||
<text style="display: block;margin-top: -60rpx;margin-bottom: 15rpx;font-size: 30rpx;">联系我们</text>
|
||||
</button>
|
||||
</view>
|
||||
<!-- <view style="width: 100%; margin-top: 30rpx;">
|
||||
<ad-custom unit-id="adunit-ff28399b17818338" ad-intervals="30" ></ad-custom>
|
||||
</view> -->
|
||||
<view class="mt30 grid text-center col-4 bg-white"
|
||||
style="padding: 30rpx 0; border-radius: 15rpx;row-gap: 30rpx;">
|
||||
<view @click="exchange()">
|
||||
<view class="cell_3_icon flex justify-center align-center"><text
|
||||
class="text-olive cuIcon-choiceness"></text></view>
|
||||
<view>积分兑换</view>
|
||||
</view>
|
||||
<view @click="exchangeRecords()">
|
||||
<view class="cell_3_icon flex justify-center align-center"><text
|
||||
class="text-cyan cuIcon-selection"></text></view>
|
||||
<view>兑换记录</view>
|
||||
</view>
|
||||
<view @click="integralRecord()">
|
||||
<view class="cell_3_icon flex justify-center align-center"><text class="text-cyan cuIcon-coin"></text>
|
||||
</view>
|
||||
<view>积分记录</view>
|
||||
</view>
|
||||
<view @click="recharge()">
|
||||
<view class="cell_3_icon flex justify-center align-center"><text
|
||||
class="text-olive cuIcon-moneybag"></text></view>
|
||||
<view>充值积分</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能列表 -->
|
||||
<view class="metergasis">
|
||||
<view class="metergasis-li" hover-class="fengrui-li-hover" @tap="Signin()">
|
||||
<view class="metergasis-li-img">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/qiandao.svg" mode="aspectFill">
|
||||
</image>
|
||||
</view>
|
||||
<view class="metergasis-li-h">
|
||||
每日签到
|
||||
</view>
|
||||
<text v-if="isSignin == true" class="metergasis-li-h2">可获得 {{signinIntegral}} 积分</text>
|
||||
<text v-if="isSignin == false" v-esle class="metergasis-li-h2">今日已签到</text>
|
||||
<view class="metergasis-li-rgth">
|
||||
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/more.svg" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="metergasis-li" hover-class="fengrui-li-hover" @tap="categoryNew()">
|
||||
<view class="metergasis-li-img">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/wenzhang.svg" mode="aspectFill">
|
||||
</image>
|
||||
</view>
|
||||
<view class="metergasis-li-h">
|
||||
浏览文章
|
||||
</view>
|
||||
<text class="metergasis-li-h2">每次获得 {{articleIntegral}} 积分 ( {{articleYesNumber}}/{{articleNumber}} )</text>
|
||||
<view class="metergasis-li-rgth">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/more.svg" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="metergasis-li" hover-class="fengrui-li-hover" @tap="categoryNew()">
|
||||
<view class="metergasis-li-img">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/weixin.svg" mode="aspectFill">
|
||||
</image>
|
||||
</view>
|
||||
<view class="metergasis-li-h">
|
||||
分享文章
|
||||
</view>
|
||||
<text class="metergasis-li-h2">每次获得 {{shareIntegral}} 积分 ( {{shareYesNumber}}/{{shareNumber}} )</text>
|
||||
<view class="metergasis-li-rgth">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/more.svg" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="metergasis-li" hover-class="fengrui-li-hover" @tap="lookAd()">
|
||||
<view class="metergasis-li-img">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/ad.svg" mode="aspectFill">
|
||||
</image>
|
||||
</view>
|
||||
<view class="metergasis-li-h">
|
||||
观看广告
|
||||
</view>
|
||||
<text class="metergasis-li-h2">每次获得 {{adIntegral}} 积分 ( {{adYesNumber}}/{{adNumber}} )</text>
|
||||
<view class="metergasis-li-rgth">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/more.svg" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="metergasis-li" hover-class="fengrui-li-hover" @tap="guanzhu(2)">
|
||||
<view style="width: 55rpx; height: 55rpx;" class="metergasis-li-img">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/adduser.svg" mode="aspectFill">
|
||||
</image>
|
||||
</view>
|
||||
<view style="margin-left: 27rpx;" class="metergasis-li-h">
|
||||
添加好友
|
||||
</view>
|
||||
<text class="metergasis-li-h2">添加成功可获得 {{addUserNumber}} 积分</text>
|
||||
<view class="metergasis-li-rgth">
|
||||
<image class="blogui-img" src="https://img.yidaima.cn/feast/more.svg" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="metergasis-li" hover-class="fengrui-li-hover" @tap="lottery()">
|
||||
<view class="metergasis-li-img">
|
||||
<image class="blogui-img" src="http://imgs.emoboy.vip/static/mine/choujiang.svg" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="metergasis-li-h">
|
||||
参与抽奖
|
||||
</view>
|
||||
<text class="metergasis-li-h2">可随机获得积分及奖励</text>
|
||||
<view class="metergasis-li-rgth">
|
||||
<image class="blogui-img" src="http://imgs.emoboy.vip/static/mine/more.svg" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--免责声明弹窗-->
|
||||
<view class="cu-modal" :class="modalName=='mzModal'?'show':''">
|
||||
<view style="border-radius: 30rpx;" class="cu-dialog">
|
||||
<view class="cu-bar bg-white justify-end">
|
||||
<view style="color: black;font-size: 38rpx;margin-top: 50rpx;" class="content">声明</view>
|
||||
</view>
|
||||
<view class=" bg-white">
|
||||
<view style="font-size: 33rpx;color: #6a6a6a;padding: 40rpx 60rpx 60rpx 60rpx;">
|
||||
创作者上传至《南音博客》小程序的素材内容由创作者负责,部分来源于网络和他处购买如有侵权,请在界面中的联系我们进行删除处理 !
|
||||
</view>
|
||||
|
||||
<button @tap="hideModal" style="margin-bottom: 50rpx;width: 55%;height: 90rpx;font-size: 38rpx;"
|
||||
class="cu-btn bg-green">确认</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="no-list-data" >
|
||||
-- 温馨提示 --
|
||||
</view>
|
||||
<view class="no-list-data2" >
|
||||
小程序数据全过程可回溯,若利用技术手段,bug等非法操作获取的积分包括任何数据都将会视作无效,情节严重将追究其法律责任,请大家合法上网,感谢配合
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
autoLoginWx,
|
||||
wxLogin,
|
||||
getUser,
|
||||
addAppIntegra
|
||||
} from "@/api/app/index.js"
|
||||
import {
|
||||
setToken,
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
let videoAd = null;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
adUnitId:"",
|
||||
modalName: null,
|
||||
name: this.$store.state.user.name,
|
||||
userid: null,
|
||||
myIntegral: 0,
|
||||
signinIntegral: 0,
|
||||
isSignin: true,
|
||||
articleIntegral: 0,
|
||||
articleYesNumber: 0,
|
||||
articleNumber: 0,
|
||||
shareIntegral: 0,
|
||||
shareYesNumber: 0,
|
||||
shareNumber: 0,
|
||||
adIntegral: 0,
|
||||
adYesNumber: 0,
|
||||
adNumber: 0,
|
||||
newUserNumber: 0,
|
||||
addUserNumber: 0
|
||||
};
|
||||
},
|
||||
// 分享好友配置
|
||||
onShareAppMessage(res) {
|
||||
var that = this;
|
||||
if (res.from === 'button') { // 来自页面内分享按钮
|
||||
console.log(res.target)
|
||||
}
|
||||
return {
|
||||
title: "南音资源,有你想要的",
|
||||
imageUrl: "",
|
||||
path: 'pages/index?userid='+this.userid,
|
||||
}
|
||||
},
|
||||
onShareTimeline(){
|
||||
return {
|
||||
title:'南音资源,有你想要的',
|
||||
query:{
|
||||
},
|
||||
imageUrl:''
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.userid = uni.getStorageSync("userInfo").userId
|
||||
console.log("用户信息:" + this.userid)
|
||||
if (this.userid) {
|
||||
this.getUserInfo()
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
//初始化激励广告
|
||||
this.adUnitId = uni.getStorageSync("sysSet").adVideoAd
|
||||
this.CreateAd()
|
||||
},
|
||||
methods: {
|
||||
lottery(){
|
||||
this.$tab.navigateTo('/pages/mine/lottery')
|
||||
},
|
||||
CreateAd(){
|
||||
var that = this;
|
||||
if (this.adUnitId != '') {
|
||||
if (wx.createRewardedVideoAd) {
|
||||
videoAd = wx.createRewardedVideoAd({
|
||||
adUnitId: this.adUnitId
|
||||
})
|
||||
videoAd.onLoad(() => {
|
||||
})
|
||||
videoAd.onError((err) => {
|
||||
that.$refs.uToast.show({
|
||||
type: 'error',
|
||||
title: '',
|
||||
message: "请使用移动端设备访问",
|
||||
icon: false
|
||||
})
|
||||
})
|
||||
videoAd.onClose((res) => {
|
||||
if (res && res.isEnded) {
|
||||
that.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "╮(๑•́ ₃•̀๑)╭ 积分+ "+that.adIntegral,
|
||||
icon: false
|
||||
})
|
||||
addAppIntegra({
|
||||
source: '广告任务',
|
||||
userId: that.userid
|
||||
}).then(response => {
|
||||
that.getUserInfo()
|
||||
})
|
||||
} else {
|
||||
that.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "看完才能获得奖励哟!",
|
||||
icon: false
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
exchangeRecords(){
|
||||
var that = this
|
||||
if (!this.userid) {
|
||||
that.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "请先授权登录",
|
||||
icon: false
|
||||
})
|
||||
}else{
|
||||
this.$tab.navigateTo('/pages/mine/exchange_records')
|
||||
}
|
||||
},
|
||||
exchange(){
|
||||
this.$tab.navigateTo('/pages/tool/exchange')
|
||||
},
|
||||
recharge() {
|
||||
this.$tab.navigateTo('/pages/mine/recharge')
|
||||
},
|
||||
categoryNew(){
|
||||
uni.switchTab({
|
||||
url: '/pages/search/index'
|
||||
});
|
||||
},
|
||||
integralRecord(){
|
||||
var that = this
|
||||
if (!this.userid) {
|
||||
that.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "请先授权登录",
|
||||
icon: false
|
||||
})
|
||||
}else{
|
||||
this.$tab.navigateTo('/pages/mine/integral_record')
|
||||
}
|
||||
|
||||
},
|
||||
Signin() {
|
||||
var that = this
|
||||
if (!this.userid) {
|
||||
that.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "请先授权登录",
|
||||
icon: false
|
||||
})
|
||||
}else{
|
||||
if(this.isSignin){
|
||||
|
||||
addAppIntegra({
|
||||
source: '签到',
|
||||
userId: this.userid
|
||||
}).then(response => {
|
||||
that.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "╮(๑•́ ₃•̀๑)╭ 签到成功 ",
|
||||
icon: false
|
||||
})
|
||||
that.getUserInfo()
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
lookAd() {
|
||||
var that = this
|
||||
if (!this.userid) {
|
||||
that.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "登录后可获得积分",
|
||||
icon: false
|
||||
})
|
||||
}else{
|
||||
if(that.adYesNumber >= that.adNumber){
|
||||
that.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "今日次数已使用完!",
|
||||
icon: false
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (videoAd) {
|
||||
videoAd.show().catch(() => {
|
||||
// 失败重试
|
||||
videoAd.load()
|
||||
.then(() => videoAd.show())
|
||||
.catch(err => {
|
||||
console.error('激励视频 广告显示失败', err)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
getUserInfo() {
|
||||
var that = this;
|
||||
getUser(this.userid).then(response => {
|
||||
that.articleYesNumber = 0
|
||||
that.shareYesNumber = 0
|
||||
that.adYesNumber = 0
|
||||
that.isSignin = true
|
||||
for(var i=0; i<response.integral.length; i++){
|
||||
if(response.integral[i].source === '文章浏览'){
|
||||
that.articleYesNumber++;
|
||||
}else if(response.integral[i].source === '文章分享'){
|
||||
that.shareYesNumber++
|
||||
}else if(response.integral[i].source === '广告任务'){
|
||||
that.adYesNumber++
|
||||
}else if(response.integral[i].source === '签到'){
|
||||
that.isSignin = false
|
||||
}
|
||||
}
|
||||
that.signinIntegral = response.signin.split(",")[0]
|
||||
that.myIntegral = response.user.integral
|
||||
that.articleIntegral = response.article.split(",")[0]
|
||||
that.articleNumber = response.article.split(",")[1]
|
||||
that.shareIntegral = response.share.split(",")[0]
|
||||
that.shareNumber = response.share.split(",")[1]
|
||||
that.adIntegral = response.ad.split(",")[0]
|
||||
that.adNumber = response.ad.split(",")[1]
|
||||
that.newUserNumber = response.newUserNumber
|
||||
that.addUserNumber = response.addUserNumber
|
||||
})
|
||||
},
|
||||
autologin() {
|
||||
let that = this;
|
||||
//获取code
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: loginRes => {
|
||||
//获取openid
|
||||
autoLoginWx(loginRes.code).then(response => {
|
||||
var antoInfo = JSON.parse(response.msg)
|
||||
console.log(antoInfo)
|
||||
console.log(antoInfo.openid)
|
||||
//登录
|
||||
wxLogin({
|
||||
openId: antoInfo.openid
|
||||
}).then(logininfo => {
|
||||
console.log(logininfo)
|
||||
setToken(logininfo.token)
|
||||
//设置用户信息
|
||||
this.$store.dispatch('GetInfo').then(res => {
|
||||
that.userid = uni.getStorageSync("userInfo").userId
|
||||
that.getUserInfo()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
mzModalShow() {
|
||||
this.modalName = "mzModal"
|
||||
},
|
||||
hideModal() {
|
||||
this.modalName = null
|
||||
},
|
||||
guanzhu(type) {
|
||||
this.$tab.navigateTo('/pages/mine/guanzhu?type='+type)
|
||||
},
|
||||
handleToSetting() {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
this.$tab.reLaunch('/pages/index')
|
||||
})
|
||||
},
|
||||
blogInfo(val) {
|
||||
this.$tab.navigateTo('/pages/blog/bloginfo')
|
||||
},
|
||||
clean(){
|
||||
uni.removeStorageSync('isIndexModal');
|
||||
this.$refs.uToast.show({
|
||||
type: 'success',
|
||||
title: '',
|
||||
message: "清理成功",
|
||||
icon: false
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.kefu {
|
||||
width: 49%;
|
||||
background-color: white;
|
||||
}
|
||||
/* 列表没有数据 */
|
||||
.no-list-data {
|
||||
text-align: center;
|
||||
margin-bottom: 100rpx;
|
||||
color: #b3b3b3;
|
||||
font-size: 24upx;
|
||||
margin: 40rpx 40rpx 0rpx 40rpx;
|
||||
}
|
||||
.no-list-data2 {
|
||||
text-align: center;
|
||||
margin-bottom: 100rpx;
|
||||
color: #b3b3b3;
|
||||
font-size: 24upx;
|
||||
margin: 10rpx 40rpx 40rpx 40rpx;
|
||||
}
|
||||
|
||||
button::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.blogui-img {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 功能列表 */
|
||||
.metergasis-li-rgth {
|
||||
width: 50upx;
|
||||
height: 50upx;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
position: absolute;
|
||||
right: 0upx;
|
||||
top: 50%;
|
||||
transform: translate(0%, -50%);
|
||||
}
|
||||
|
||||
.metergasis-li-h {
|
||||
grid-row: 1;
|
||||
margin-left: 30upx;
|
||||
font-size: 30upx;
|
||||
}
|
||||
|
||||
.metergasis-li-h2 {
|
||||
grid-row: 1;
|
||||
margin-left: 30upx;
|
||||
font-size: 25upx;
|
||||
color: #ADADAD;
|
||||
margin-left: auto;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.metergasis-li-img {
|
||||
height: 52upx;
|
||||
width: 52upx;
|
||||
border-radius: 100upx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.metergasis-li {
|
||||
padding: 24upx 32upx;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.metergasis {
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 16upx;
|
||||
margin: 2upx 0upx;
|
||||
padding: 2upx;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.my {
|
||||
padding: 30rpx;
|
||||
|
||||
.mt30 {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.my_bg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header_cell {
|
||||
margin-top: 100rpx;
|
||||
|
||||
.user_info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.user_photo {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
box-shadow: 0px 0px 10rpx 1px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 50%;
|
||||
background-color: white;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.auth_btn {
|
||||
margin: 50rpx auto;
|
||||
text-align: center;
|
||||
|
||||
&>button {
|
||||
box-shadow: 3px 3px 10rpx 1px rgba(0, 0, 0, 0.2);
|
||||
padding-left: 50rpx;
|
||||
padding-right: 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.vip_cell {
|
||||
margin-top: 40rpx;
|
||||
width: 690rpx;
|
||||
height: 150rpx;
|
||||
background-image: url('https://img.yidaima.cn/feast/bolang.gif');
|
||||
background-size: 100% 100%;
|
||||
color: white;
|
||||
padding: 0 30rpx;
|
||||
|
||||
.invate_btn {
|
||||
background-color: rgb(241, 198, 142);
|
||||
box-shadow: 3px 3px 10rpx 1px rgba(241, 198, 142, 0.5);
|
||||
width: 150rpx;
|
||||
color: rgb(99, 71, 56);
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cell_1_icon {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
background-color: #f4f2f7;
|
||||
border-radius: 50%;
|
||||
font-size: 50rpx;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
|
||||
.cell_2 {
|
||||
&>view {
|
||||
background-color: white;
|
||||
border-radius: 15rpx;
|
||||
text-align: center;
|
||||
width: 48%;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.cell_2_icon {
|
||||
font-size: 60rpx;
|
||||
margin-bottom: 15rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cell_3_icon {
|
||||
font-size: 50rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.cell_4 {
|
||||
|
||||
&>view,
|
||||
navigator {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
195
pages/mine/integral_record.vue
Normal file
195
pages/mine/integral_record.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="dataList.length != 0" class="re-box">
|
||||
<view>
|
||||
<text style="font-size: 40rpx;color: #0081ff;" class="cuIcon-titles"></text><text style="font-size: 35rpx;">积分明细</text>
|
||||
</view>
|
||||
<view style="margin-top: 40rpx;">
|
||||
<view v-for="(item,index) in dataList" :key="index" class="flex solid-bottom padding justify-between">
|
||||
<view class="content-left">
|
||||
<view class="re-type">{{item.source}}</view>
|
||||
<view class="re-time">{{item.integralTime}}</view>
|
||||
<view v-if="item.isAdd !== 0 && item.resourceId" class="re-exchange">
|
||||
<text class="cuIcon-present exchange-icon"></text>
|
||||
<text class="exchange-title" @click="goToResourceDetail(item.resourceId)">{{item.resourceTitle}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.isAdd == 0" class="re-number">+{{item.integralNumber}}
|
||||
<text class="cuIcon-vip" style="margin-left: 15rpx;font-size: 40rpx;"></text>
|
||||
</view>
|
||||
<view v-else style="color: #07C160;" class="re-number">-{{item.integralNumber}}
|
||||
<text class="cuIcon-vip" style="margin-left: 15rpx;font-size: 40rpx;"></text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view style="text-align: center;" v-else>
|
||||
<image style="width: 400rpx;height: 200rpx;margin-top: 200rpx;" src="https://img.yidaima.cn/feast/nodata.svg"></image>
|
||||
<view style="color: #adadad;">无数据</view>
|
||||
</view>
|
||||
<!-- 加载动图 -->
|
||||
<view class="artileload" v-if="showTotal">
|
||||
<image style="width: 100%;height: 100%;" src="https://img.yidaima.cn/feast/articleload.gif" mode="aspectFit"></image>
|
||||
</view>
|
||||
<!-- 文章列表没有数据 -->
|
||||
<view class="no-list-data" v-else>
|
||||
--我的底线就到这里了--
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listAppIntegra
|
||||
} from "@/api/app/index.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
userId: uni.getStorageSync("userInfo").userId,
|
||||
|
||||
},
|
||||
dataList: [],
|
||||
total: 0,
|
||||
showTotal: false,
|
||||
}
|
||||
},
|
||||
// 上拉分页
|
||||
onReachBottom() {
|
||||
var that = this;
|
||||
var allTotal = this.queryParams.pageNum * this.queryParams.pageSize
|
||||
//this.page为加载次数,this.pageSize为每一次加载的数据条数
|
||||
if (allTotal < this.total) {
|
||||
//this.total为请求数据的总条数。只要现有条数小于总条数就执行一下代码
|
||||
this.showTotal = true;
|
||||
this.queryParams.pageNum++;
|
||||
//加载次数递加
|
||||
//请求更多数据列表
|
||||
listAppIntegra(this.queryParams).then(response => {
|
||||
that.dataList = that.dataList.concat(response.rows)
|
||||
var allTotal2 = this.queryParams.pageNum * this.queryParams.pageSize
|
||||
if (allTotal2 < this.total) {
|
||||
//this.total为请求数据的总条数。只要现有条数小于总条数就执行一下代码
|
||||
this.showTotal = true;
|
||||
} else {
|
||||
this.showTotal = false;
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
this.showTotal = false;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
getDataList(){
|
||||
var that = this;
|
||||
listAppIntegra(this.queryParams).then(response => {
|
||||
that.dataList = response.rows
|
||||
var allTotal = this.queryParams.pageNum * this.queryParams.pageSize
|
||||
that.total = response.total
|
||||
if (allTotal < this.total) {
|
||||
this.showTotal = true;
|
||||
} else {
|
||||
this.showTotal = false;
|
||||
}
|
||||
uni.stopPullDownRefresh(); //停止刷新
|
||||
})
|
||||
},
|
||||
goToResourceDetail(resourceId) {
|
||||
this.$tab.navigateTo('/pages/blog/resource?id=' + resourceId + "&type=1")
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.re-type{
|
||||
font-size: 33rpx;
|
||||
}
|
||||
.re-time{
|
||||
font-size: 30rpx;
|
||||
color: #adadad;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
.content-left {
|
||||
flex: 3;
|
||||
margin-right: 30rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.re-exchange {
|
||||
font-size: 30rpx;
|
||||
color: #606060;
|
||||
margin-top: 15rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #f8f8f8;
|
||||
padding: 10rpx 15rpx;
|
||||
border-radius: 10rpx;
|
||||
max-width: 100%;
|
||||
width: 95%;
|
||||
}
|
||||
.exchange-icon {
|
||||
color: #ff9900;
|
||||
margin-right: 10rpx;
|
||||
font-size: 32rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.exchange-title {
|
||||
color: #ff9900;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
flex: 1;
|
||||
max-width: 420rpx;
|
||||
cursor: pointer;
|
||||
}
|
||||
.re-number{
|
||||
font-size: 40rpx;
|
||||
color: red;
|
||||
margin-top: 20rpx;
|
||||
flex-shrink: 0;
|
||||
text-align: right;
|
||||
min-width: 140rpx;
|
||||
flex: 1;
|
||||
}
|
||||
.re-box{
|
||||
min-height: 500rpx;
|
||||
background-color: white;
|
||||
border-radius: 20rpx;
|
||||
margin: 0 40rpx 40rpx 40rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
}
|
||||
/* 列表没有数据 */
|
||||
.no-list-data {
|
||||
text-align: center;
|
||||
margin-bottom: 100rpx;
|
||||
color: #e6e6e6;
|
||||
font-size: 24upx;
|
||||
}
|
||||
|
||||
/* 加载动图 */
|
||||
.artileload {
|
||||
height: 80rpx;
|
||||
width: 80rpx;
|
||||
margin: 20rpx auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
340
pages/mine/lottery.vue
Normal file
340
pages/mine/lottery.vue
Normal file
@@ -0,0 +1,340 @@
|
||||
<template>
|
||||
|
||||
<view class="">
|
||||
<view class="custom-navbar">
|
||||
<text style="font-size: 40rpx;" @click="back()" class="cuIcon-back"></text>
|
||||
<view class="title">幸运大抽奖</view>
|
||||
<view class="back-button">
|
||||
</view>
|
||||
</view>
|
||||
<choujian style="position: absolute;" ref='choujian' :nImg='nImg' :AwardList="AwardList" :sjNum="sjNum"
|
||||
:lotteryType="lotteryType" @updateMoney="updateMoney" @lookAd="lookAd" @noChance="noChance">
|
||||
</choujian>
|
||||
<view class="tip-box">100%中奖,积分中不停</view>
|
||||
<view class="log-box">
|
||||
<!-- 通知 -->
|
||||
<view class="inform">
|
||||
<view class="inform-info">
|
||||
<view class="info">
|
||||
<swiper class="swiper" :circular="true" :vertical="true" :indicator-dots="false"
|
||||
:autoplay="true" :interval="3000" :duration="1000">
|
||||
<swiper-item v-for="(item,index) in lotteryLog" :key="index">
|
||||
<view class="swiper-item"><text class="one-omit">
|
||||
<text class="cuIcon-vip"
|
||||
style="margin-right: 10rpx;font-size: 23rpx;color: #fcc600;"></text>
|
||||
微信用户_{{item.lotteryUserId}} 抽中了 {{item.name}}</text>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cu-modal" :class="modalName=='Modal'?'show':''">
|
||||
<view style="border-radius: 30rpx;" class="cu-dialog">
|
||||
<view class="cu-bar bg-white justify-end">
|
||||
<view style="color: black;font-size: 38rpx;margin-top: 50rpx;" class="content">提示</view>
|
||||
</view>
|
||||
<view class=" bg-white">
|
||||
<view style="font-size: 35rpx;color: #6a6a6a;padding: 40rpx 60rpx 60rpx 60rpx;">
|
||||
{{lotteryMsg}}
|
||||
</view>
|
||||
|
||||
<button @tap="hideModal" style="margin-bottom: 50rpx;width: 55%;height: 90rpx;font-size: 38rpx;"
|
||||
class="cu-btn bg-green">知道了</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-modal" :class="modalName=='nowLookAd'?'show':''">
|
||||
<view style="border-radius: 30rpx;" class="cu-dialog">
|
||||
<view class="cu-bar bg-white justify-end">
|
||||
<view style="color: black;font-size: 38rpx;margin-top: 50rpx;" class="content">提示</view>
|
||||
<view class="action" @tap="hideModal">
|
||||
<text class="cuIcon-close text-red"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class=" bg-white">
|
||||
<view style="font-size: 35rpx;color: #6a6a6a;padding: 40rpx 60rpx 60rpx 60rpx;">
|
||||
今日免费抽奖次数已用完,观看视频后可额外获得一次抽奖机会哟
|
||||
</view>
|
||||
|
||||
<button @tap="nowLookAd" style="margin-bottom: 50rpx;width: 55%;height: 90rpx;font-size: 38rpx;"
|
||||
class="cu-btn bg-green">观看视频</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-guard"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
lottery,
|
||||
lotteryAdd,
|
||||
listLottery,
|
||||
listLotteryLog
|
||||
} from "@/api/app/index.js"
|
||||
import config from '@/config'
|
||||
import Choujian from '@/components/gb-choujiang/gb-choujiang';
|
||||
let videoAd = null;
|
||||
export default {
|
||||
components: {
|
||||
Choujian
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
adUnitId: "",
|
||||
baseUrl: config.baseUrl,
|
||||
modalName: "",
|
||||
userid: null,
|
||||
// 背景图,可网络地址,可本地
|
||||
nImg: 'https://img.yidaima.cn/luck-1752b306ed4b480b9258b22983a859f6',
|
||||
// 中奖的索引,也就是AwardList数组的索引,sjNum不能等于4,4是立即抽奖
|
||||
sjNum: 0,
|
||||
// false前端,true前端
|
||||
isQd: true,
|
||||
// 可自己后端获取,也可以后端 percentage为概率 10代表10% 100代表100% 注意:必须要有一个概率为100%,
|
||||
AwardList: [],
|
||||
lotteryType: 0,
|
||||
lotteryMsg: "",
|
||||
index: -1,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 6,
|
||||
},
|
||||
lotteryLog: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
var that = this
|
||||
this.adUnitId = uni.getStorageSync("sysSet").adVideoAd
|
||||
//初始化激励广告
|
||||
this.CreateAd()
|
||||
this.userid = uni.getStorageSync("userInfo").userId
|
||||
listLottery().then(response => {
|
||||
// for (var i = 0; i < response.rows.length; i++) {
|
||||
// response.rows[i].image = that.baseUrl + response.rows[i].image
|
||||
// }
|
||||
that.AwardList = response.rows
|
||||
})
|
||||
listLotteryLog(this.queryParams).then(response => {
|
||||
that.lotteryLog = response.rows
|
||||
})
|
||||
this.getData()
|
||||
},
|
||||
methods: {
|
||||
// 中奖后的逻辑
|
||||
updateMoney(money) {
|
||||
var that = this
|
||||
lotteryAdd({
|
||||
source: '抽奖',
|
||||
userId: this.userid,
|
||||
isAdd: 0,
|
||||
integralNumber: that.AwardList[money].reward,
|
||||
fId: that.AwardList[money].id
|
||||
}).then(response => {
|
||||
that.lotteryMsg = "恭喜获得:" + that.AwardList[money].name
|
||||
setTimeout(() => {
|
||||
that.modalName = "Modal"
|
||||
}, 500);
|
||||
|
||||
// 中奖后获取最新状态
|
||||
that.getData()
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
lookAd(index) {
|
||||
// this.$refs.choujian.nowBegin(index);
|
||||
this.index = index
|
||||
this.modalName = 'nowLookAd'
|
||||
},
|
||||
nowLookAd() {
|
||||
this.modalName = ''
|
||||
if (videoAd) {
|
||||
videoAd.show().catch(() => {
|
||||
// 失败重试
|
||||
videoAd.load()
|
||||
.then(() => videoAd.show())
|
||||
.catch(err => {
|
||||
console.error('激励视频 广告显示失败', err)
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
noChance() {
|
||||
this.lotteryMsg = "今日抽奖次数已用完,请明日再来 !"
|
||||
this.modalName = "Modal"
|
||||
},
|
||||
hideModal() {
|
||||
this.modalName = null
|
||||
},
|
||||
// 获取本次中奖的
|
||||
getData() {
|
||||
var that = this
|
||||
// 概率指定,如果是前端控制,如果后端控制下面步骤判断步骤可以省略 直接后端获取sjNum值即可
|
||||
if (this.isQd) {
|
||||
// ------------------------------这里写获取后端中奖索引
|
||||
// 后端赋值控制概率
|
||||
lottery({}).then(response => {
|
||||
that.lotteryType = response.lotteryType
|
||||
that.sjNum = response.sjNum
|
||||
console.log("后端随机数: ", response.sj);
|
||||
console.log("后端中奖索引: ", response.sjNum);
|
||||
|
||||
})
|
||||
} else {
|
||||
// 概率控制 概率100%
|
||||
console.log(Math.random())
|
||||
let sj = Math.round(Math.random() * 99 + 1)
|
||||
}
|
||||
},
|
||||
back() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
CreateAd() {
|
||||
var that = this;
|
||||
if (this.adUnitId != '') {
|
||||
if (wx.createRewardedVideoAd) {
|
||||
videoAd = wx.createRewardedVideoAd({
|
||||
adUnitId: this.adUnitId
|
||||
})
|
||||
videoAd.onLoad(() => {})
|
||||
videoAd.onError((err) => {
|
||||
that.$refs.uToast.show({
|
||||
type: 'error',
|
||||
title: '',
|
||||
message: "请使用移动端设备访问",
|
||||
icon: false
|
||||
})
|
||||
})
|
||||
videoAd.onClose((res) => {
|
||||
if (res && res.isEnded) {
|
||||
// that.$refs.uToast.show({
|
||||
// type: 'success',
|
||||
// title: '',
|
||||
// message: "╮(๑•́ ₃•̀๑)╭ 谢谢您的支持 ",
|
||||
// icon: false
|
||||
// })
|
||||
that.$refs.choujian.nowBegin(that.index);
|
||||
} else {}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.tip-box {
|
||||
position: relative;
|
||||
background: linear-gradient(to right, #FE1C62, #FC8524);
|
||||
height: 55rpx;
|
||||
width: 70%;
|
||||
left: 15%;
|
||||
top: 235rpx;
|
||||
text-align: center;
|
||||
line-height: 55rpx;
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
border-radius: 15rpx;
|
||||
letter-spacing: 10rpx;
|
||||
box-shadow:
|
||||
0 -2px 2px rgba(255, 255, 255, 0.4),
|
||||
/* 上阴影 */
|
||||
0 2px 2px rgba(255, 255, 255, 0.4),
|
||||
/* 下阴影 */
|
||||
2px 0 2px rgba(255, 255, 255, 0.4),
|
||||
/* 左阴影 */
|
||||
-2px 0 2px rgba(255, 255, 255, 0.4);
|
||||
/* 右阴影 */
|
||||
}
|
||||
|
||||
.log-box {
|
||||
position: relative;
|
||||
height: 65rpx;
|
||||
width: 56%;
|
||||
left: 22%;
|
||||
top: 1150rpx;
|
||||
}
|
||||
|
||||
/* 通知 */
|
||||
.inform {
|
||||
|
||||
.inform-info {
|
||||
display: flex;
|
||||
padding: 0 20rpx;
|
||||
height: 65rpx;
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
border-radius: 50rpx;
|
||||
|
||||
.picture {
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
|
||||
image {
|
||||
width: 93rpx;
|
||||
height: 84rpx;
|
||||
margin-top: -20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.swiper {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.swiper-item {
|
||||
line-height: 65rpx;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
text {
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.custom-navbar {
|
||||
/* 自定义导航栏样式 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 60px 10px 10px 10px;
|
||||
background-color: #F118E3;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.title {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
.back-button {
|
||||
padding: 10px;
|
||||
}
|
||||
page {
|
||||
background-color: #1015F2;
|
||||
--safe-area-inset-bottom: env(safe-area-inset-bottom); /* 设置底部安全区域 */
|
||||
}
|
||||
page {
|
||||
}
|
||||
|
||||
.bottom-guard {
|
||||
height: calc(var(--safe-area-inset-bottom)); /* 假设你需要的底部保护区域高度是100px */
|
||||
background-color: #1015F2; /* 设置你想要的颜色 */
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
</style>
|
||||
399
pages/mine/recharge.vue
Normal file
399
pages/mine/recharge.vue
Normal file
@@ -0,0 +1,399 @@
|
||||
<template>
|
||||
<view class="recharge-container">
|
||||
<view class="header">
|
||||
<text class="title">充值积分</text>
|
||||
<text class="subtitle">更多积分,享受更多精彩内容</text>
|
||||
</view>
|
||||
|
||||
<view class="recharge-list">
|
||||
<view class="recharge-item"
|
||||
v-for="(item, index) in rechargeOptions"
|
||||
:key="index"
|
||||
@click="handleRecharge(item)"
|
||||
:class="{'selected': selectedIndex === index}">
|
||||
<view class="item-content">
|
||||
<view class="price-box">
|
||||
<text class="price-symbol">¥</text>
|
||||
<text class="price-value">{{item.price}}</text>
|
||||
</view>
|
||||
<view class="points-box">
|
||||
<view class="main-points">
|
||||
<text class="num">{{item.points}}</text>
|
||||
<text class="unit">积分</text>
|
||||
</view>
|
||||
<view class="bonus">
|
||||
<text class="tag">赠送</text>
|
||||
<text class="num">+{{item.bonus}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="total-box">
|
||||
<text class="label">总计</text>
|
||||
<text class="value">{{item.total}}积分</text>
|
||||
</view>
|
||||
<view class="best-value" v-if="index === 2">
|
||||
<text>超值优惠</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="notice">
|
||||
<view class="notice-item">
|
||||
<text class="dot">·</text>
|
||||
<text>充值积分可用于兑换平台内所有资源</text>
|
||||
</view>
|
||||
<view class="notice-item">
|
||||
<text class="dot">·</text>
|
||||
<text>充值金额越多,赠送积分越多</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="submit-btn" :class="{'disabled': selectedIndex === -1}" @click="submitRecharge">
|
||||
<text v-if="selectedIndex === -1">请选择充值金额</text>
|
||||
<text v-else>确认支付 ¥{{rechargeOptions[selectedIndex].price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.recharge-container {
|
||||
min-height: 100vh;
|
||||
background-color: #f8f8f8;
|
||||
padding: 30rpx;
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 50rpx;
|
||||
padding: 40rpx 0;
|
||||
|
||||
.title {
|
||||
font-size: 44rpx;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
margin-bottom: 20rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.recharge-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20rpx;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.recharge-item {
|
||||
position: relative;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.item-content {
|
||||
background: #fff;
|
||||
padding: 30rpx;
|
||||
height: 100%;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.05);
|
||||
border: 2rpx solid #eee;
|
||||
transition: all 0.3s;
|
||||
|
||||
.price-box {
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.price-symbol {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 48rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.points-box {
|
||||
.main-points {
|
||||
margin-bottom: 10rpx;
|
||||
|
||||
.num {
|
||||
font-size: 32rpx;
|
||||
color: #666;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.unit {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.bonus {
|
||||
.tag {
|
||||
background: #fff1f0;
|
||||
color: #ff4d4f;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 22rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.num {
|
||||
color: #ff4d4f;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.total-box {
|
||||
margin-top: 20rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
.label {
|
||||
color: #999;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.best-value {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(135deg, #ff6b6b, #ff8585);
|
||||
color: #fff;
|
||||
font-size: 22rpx;
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 0 16rpx 0 16rpx;
|
||||
}
|
||||
|
||||
&.selected {
|
||||
.item-content {
|
||||
border-color: #007AFF;
|
||||
background: #f0f7ff;
|
||||
transform: translateY(-2rpx);
|
||||
box-shadow: 0 4rpx 16rpx rgba(0,122,255,0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.notice {
|
||||
padding: 30rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
margin-bottom: 120rpx;
|
||||
|
||||
.notice-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 16rpx;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.dot {
|
||||
color: #007AFF;
|
||||
margin-right: 10rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
position: fixed;
|
||||
bottom: 40rpx;
|
||||
left: 30rpx;
|
||||
right: 30rpx;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
text-align: center;
|
||||
background: #007AFF;
|
||||
color: #fff;
|
||||
border-radius: 45rpx;
|
||||
font-size: 32rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0,122,255,0.2);
|
||||
transition: all 0.3s;
|
||||
|
||||
&.disabled {
|
||||
background: #ccc;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { createRechargeOrder, updateUserPoints } from "@/api/app/index.js"
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
selectedIndex: -1,
|
||||
isIOS: false,
|
||||
rechargeOptions: [
|
||||
{
|
||||
price: 10,
|
||||
points: 100,
|
||||
bonus: 10,
|
||||
total: 110
|
||||
},
|
||||
{
|
||||
price: 30,
|
||||
points: 300,
|
||||
bonus: 30,
|
||||
total: 330
|
||||
},
|
||||
{
|
||||
price: 50,
|
||||
points: 500,
|
||||
bonus: 50,
|
||||
total: 550
|
||||
},
|
||||
{
|
||||
price: 100,
|
||||
points: 1000,
|
||||
bonus: 100,
|
||||
total: 1100
|
||||
},
|
||||
{
|
||||
price: 200,
|
||||
points: 2000,
|
||||
bonus: 300,
|
||||
total: 2300
|
||||
},
|
||||
{
|
||||
price: 300,
|
||||
points: 3000,
|
||||
bonus: 500,
|
||||
total: 3500
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 检查是否是iOS设备
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
this.isIOS = systemInfo.platform === 'ios';
|
||||
},
|
||||
methods: {
|
||||
handleRecharge(item) {
|
||||
this.selectedIndex = this.rechargeOptions.indexOf(item)
|
||||
},
|
||||
submitRecharge() {
|
||||
if(this.selectedIndex === -1) {
|
||||
uni.showToast({
|
||||
title: '请选择充值金额',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// iOS设备提示
|
||||
if(this.isIOS) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '由于相关政策限制,iOS设备暂不支持充值功能,请使用安卓设备或Windows电脑进行充值。',
|
||||
showCancel: false,
|
||||
confirmText: '我知道了'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const selected = this.rechargeOptions[this.selectedIndex];
|
||||
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
});
|
||||
|
||||
// 创建充值订单
|
||||
const orderData = {
|
||||
amount: selected.price,
|
||||
points: selected.total,
|
||||
userId: uni.getStorageSync('userInfo').userId
|
||||
}
|
||||
|
||||
createRechargeOrder(orderData).then(res => {
|
||||
uni.hideLoading();
|
||||
if(res.code === 200) {
|
||||
// 调起微信支付
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
appId: res.data.appId,
|
||||
nonceStr: res.data.nonceStr,
|
||||
package: res.data.packageVal,
|
||||
signType: res.data.signType,
|
||||
timeStamp: res.data.timeStamp,
|
||||
paySign: res.data.paySign,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '充值成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('支付失败', err);
|
||||
uni.showToast({
|
||||
title: '支付失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg || '创建订单失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '网络请求失败',
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
}
|
||||
// handlePaySuccess(points) {
|
||||
// // 更新用户积分
|
||||
// const pointsData = {
|
||||
// userId: uni.getStorageSync('userInfo').userId,
|
||||
// points: points
|
||||
// }
|
||||
|
||||
// updateUserPoints(pointsData).then(res => {
|
||||
// if(res.code === 200) {
|
||||
// uni.showToast({
|
||||
// title: '充值成功',
|
||||
// icon: 'success'
|
||||
// });
|
||||
// // 更新本地存储的用户信息
|
||||
// let userInfo = uni.getStorageSync('userInfo');
|
||||
// userInfo.integral = (parseInt(userInfo.integral) || 0) + points;
|
||||
// uni.setStorageSync('userInfo', userInfo);
|
||||
|
||||
// setTimeout(() => {
|
||||
// uni.navigateBack();
|
||||
// }, 1500);
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: res.msg || '更新积分失败',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user