Browse Source

更新

master
luyisha 3 years ago
parent
commit
e6dc47cc22
  1. 61
      common/js/api.js
  2. 67
      pages.json
  3. 79
      pages/NoticeDetails/NoticeDetails.vue
  4. 12
      pages/about/about.vue
  5. 165
      pages/about/bannerManage/addBanner.vue
  6. 130
      pages/about/bannerManage/bannerManage.vue
  7. 2
      pages/about/bonusSet/index.vue
  8. 135
      pages/about/noticeManage/addNotice.vue
  9. 137
      pages/about/noticeManage/noticeManage.vue
  10. 44
      pages/home/home.vue
  11. BIN
      static/user/icon_flag.png
  12. BIN
      static/user/icon_window.png
  13. 9
      uni_modules/uni-id-pages/pages/login/login-withpwd.vue

61
common/js/api.js

@ -1,9 +1,8 @@
let baseUrl = 'http://192.168.66.221:8000'
// let baseUrl = 'http://192.168.66.221:8000'
let baseUrl = 'http://192.168.66.16:8084'
let API = {
login(data, success, fail){
API.sendRequest('post', data, '/passport/login', success, fail)
},
// 注册
register(data, success, fail){
API.sendRequest('post', data, '/passport/register', success, fail)
},
@ -11,62 +10,84 @@ let API = {
retrieve(data, success, fail){
API.sendRequest('post', data, '/passport/retrieve', success, fail)
},
// 登录
login(data, success, fail){
API.sendRequest('post', data, '/passport/login', success, fail)
},
// 修改密码
modifyPassword(data, success, fail){
API.sendRequest('post', data, '/user/modifyPassword', success, fail)
API.sendRequest('post', data, '/user/modifyPassword', success, fail, true)
},
// 短信验证码
sendCode(data, success, fail){
API.sendRequest('post', data, '/passport/sendCode', success, fail)
API.sendRequest('post', data, '/passport/sendCode', success, fail, true)
},
// 提现记录
getWithdrawal(data, success, fail){
API.sendRequest('post', data, '/user/withdrawalRecords', success, fail)
API.sendRequest('post', data, '/user/withdrawalRecords', success, fail, true)
},
getRecharge(data, success, fail){
API.sendRequest('post', data, '/user/rechargeRecords', success, fail)
API.sendRequest('post', data, '/user/rechargeRecords', success, fail, true)
},
// 消费记录
getConsumption(data, success, fail){
API.sendRequest('post', data, '/user/consumptionRecords', success, fail)
API.sendRequest('post', data, '/user/consumptionRecords', success, fail, true)
},
// 中奖记录
getAwards(data, success, fail){
API.sendRequest('post', data, '/user/awardsRecords', success, fail)
API.sendRequest('post', data, '/user/awardsRecords', success, fail, true)
},
// 首页专区
getZoneList(data, success, fail){
API.sendRequest('post', data, '/zone/zoneList', success, fail)
API.sendRequest('post', data, '/index/zoneList', success, fail, false)
},
// 首页专区-专区列表
getGoodsList(data, success, fail){
API.sendRequest('post', data, '/zone/zoneGoodsList', success, fail)
API.sendRequest('post', data, '/zone/zoneGoodsList', success, fail, true)
},
// 开始刮奖
beginLottery(data, success, fail){
API.sendRequest('post', data, '/zone/beginLottery', success, fail)
API.sendRequest('post', data, '/zone/beginLottery', success, fail, true)
},
// 刮完奖请求
endLottery(data, success, fail){
API.sendRequest('post', data, '/zone/endLottery', success, fail)
API.sendRequest('post', data, '/zone/endLottery', success, fail, true)
},
// 首页中奖纪录
getAwardRecords(data, success, fail){
API.sendRequest('post', data, '/index/awardRecords', success, fail)
API.sendRequest('post', data, '/index/awardRecords', success, fail, false)
},
// 首页轮播图
getRotationChart(data, success, fail){
API.sendRequest('post', data, '/index/rotationChart', success, fail)
API.sendRequest('post', data, '/index/rotationChart', success, fail, false)
},
// 通用api
request(url, data, success, fail){
API.sendRequest('post', data, url, success, fail)
request(url, data, success, fail, boolean=true){
API.sendRequest('post', data, url, success, fail, boolean)
},
sendRequest(method, data, url, success, fail){
sendRequest(method, data, url, success, fail, boolean){
let types = '';
if (method == 'POST') {
types = 'application/x-www-form-urlencoded'
} else {
types = 'application/json';
}
let requestObj = {}
if(boolean){
requestObj.header = {
'Content-Type': types,
'Accept': 'application/json, text/javascript, */*; q=0.01',
// 'Authorization': uni.getStorageSync('user_token')||''
'token': uni.getStorageSync('user_token')||''
}
}
uni.request({
url:baseUrl+url,
data: data,
method: method,
data: data,
...requestObj,
success(res) {
// console.log(res, '000');
// 200=成功, 400 = 失败错误返回、404 token验证失败

67
pages.json

@ -254,6 +254,73 @@
}
}
,{
"path" : "pages/NoticeDetails/NoticeDetails",
"style" :
{
"navigationBarTitleText": "公告详情",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/about/bannerManage/bannerManage",
"style" :
{
"navigationBarTitleText": "轮播图管理",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": {
"buttons": [
{
"text": "添加轮播 ",
"fontSize": "14",
"color": "#999"
}
]
}
}
}
}
,{
"path" : "pages/about/bannerManage/addBanner",
"style" :
{
"navigationBarTitleText": "添加轮播图",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/about/noticeManage/noticeManage",
"style" :
{
"navigationBarTitleText": "公告设置",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": {
"buttons": [
{
"text": "添加公告 ",
"fontSize": "14",
"color": "#999"
}
]
}
}
}
}
,{
"path" : "pages/about/noticeManage/addNotice",
"style" :
{
"navigationBarTitleText": "添加公告",
"enablePullDownRefresh": false
}
}
],
"subPackages": [{
"root": "uni_modules/uni-feedback",

79
pages/NoticeDetails/NoticeDetails.vue

@ -0,0 +1,79 @@
<template>
<view>
<view class="nav_area"></view>
<view class="wrapper">
<view class="title">{{title}}</view>
<view class="time">{{create_time}}</view>
<view class="content">
<text v-html="content"></text>
</view>
</view>
</view>
</template>
<script>
import API from '@/common/js/api.js'
export default {
data() {
return {
title: '关于中奖概率调整问题',
create_time: '发布时间:2023.08.10 23:00:00',
content: `关于中奖概率调整问题关于中奖概率调整问题关于中奖概率调整问题关于中奖概率调整问题关于中奖概率
调整问题关于中奖概率调整问题`
}
},
onLoad(e) {
this.id = e.id;
this.getDetail();
},
methods: {
getDetail(){
API.request('/index/getNoticeInfo', {id: this.id}, res=>{
this.title = res.data.title;
this.create_time = res.data.create_time;
this.content = res.data.content;
})
}
}
}
</script>
<style scoped lang="scss">
.nav_area {
position: fixed;
top: 0px;
left: 0px;
z-index: 99;
background-color: #fff;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
width: 700rpx;
height: 88rpx;
padding: 0px 25rpx;
padding-top: var(--status-bar-height);
box-sizing: content-box;
color: #b0b0b0;
font-size: 14px;
}
.wrapper{
text-align: center;
padding: 10px 20px;
.title{
font-size: 16px;
line-height: 50px;
}
.time{
font-size: 12px;
color: #999;
}
.content{
font-size: 14px;
text-align: justify;
text-indent: 30px;
line-height: 24px;
margin: 20px 0px;
}
}
</style>

12
pages/about/about.vue

@ -44,6 +44,18 @@
"to": '/pages/about/serviceSet/serviceSet',
"icon": "compose",
"iconN": "manager"
},
{
"title": '轮播图管理',
"to": '/pages/about/bannerManage/bannerManage',
"icon": "compose",
"iconN": "window"
},
{
"title": '公告管理',
"to": '/pages/about/noticeManage/noticeManage',
"icon": "compose",
"iconN": "flag"
}
]
]

165
pages/about/bannerManage/addBanner.vue

@ -0,0 +1,165 @@
<template>
<view>
<view class="nav_area"></view>
<view class="setPage">
<view class="">
<view class="banner_area">
<!-- <swiper class="" v-if="editInfo.banner.length>0" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
<swiper-item v-for="(item, index) in editInfo.banner">
<image class="swiper-item" :src="item.url"></image>
</swiper-item>
</swiper> -->
<view class="" v-if="editInfo.image">
<image class="" :src="editInfo.image"></image>
</view>
<text v-else @click="addImg">点击添加轮播图</text>
</view>
<view style="" class="">
<view class="input_box">
<text>名称</text>
<input type="text" v-model="editInfo.title" placeholder="请输入轮播名称" placeholder-style="color: #999;">
</view>
<view class="input_box">
<text>排序</text>
<input type="text" v-model="editInfo.sort" placeholder="请输入轮播排序,数字越小,位置越前" placeholder-style="color: #999;">
</view>
</view>
<view class="submit" @click="confirm()">
确定发布
</view>
</view>
</view>
</view>
</template>
<script>
import API from '@/common/js/api.js'
export default {
data() {
return {
id: '',
editInfo: {title:'',sort:'', image: ''},
}
},
methods: {
addImg(){
uni.chooseImage({
count: 1,
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
uni.uploadFile({
url: 'http://192.168.66.221:8000'+'/rotationChart/upload',
filePath: tempFilePaths[0],
name: 'file',
header: {
token: uni.getStorageSync('user_token')
},
formData: {
'image': tempFilePaths[0]
},
success: (uploadFileRes) => {
console.log(uploadFileRes.data);
// this.editInfo.image
}
});
}
});
},
confirm(){
let data = {
id: this.id||'',
title: this.editInfo.title,
sort: this.editInfo.sort,
image: this.editInfo.image
};
API.request('/rotationChart/save', data, res=>{
uni.showToast({
title: res.msg
})
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
}, 1500)
})
},
},
onLoad(e) {
if(e){
this.id = e.id;
this.editInfo.title = e.title;
this.editInfo.image = e.image;
this.editInfo.sort = e.sort;
}
},
}
</script>
<style lang="scss" scoped>
.nav_area {
position: fixed;
top: 0px;
left: 0px;
z-index: 99;
background-color: #fff;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
width: 700rpx;
height: 88rpx;
padding: 0px 25rpx;
padding-top: var(--status-bar-height);
box-sizing: content-box;
color: #b0b0b0;
font-size: 14px;
}
.setPage{
padding: 40rpx;
font-size: 14px;
color: #999;
}
.banner_area{
width: 670rpx;
height: 248rpx;
border: 1px solid #eee;
border-radius: 5px;
text-align: center;
line-height: 248rpx;
overflow: hidden;
image{
width: 670rpx;
height: 248rpx;
}
}
.input_box{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 40rpx;
input{
width: 572rpx;
height: 80rpx;
border: 1px solid #eee;
border-radius: 5px;
padding: 0px 10px;
box-sizing: border-box;
color: #444;
}
}
.submit{
width: 670rpx;
height: 88rpx;
border-radius: 10px;
font-size: 14px;
text-align: center;
line-height: 88rpx;
color: #fff;
background-color: #e33837;
position: fixed;
bottom: 40rpx;
}
</style>

130
pages/about/bannerManage/bannerManage.vue

@ -0,0 +1,130 @@
<template>
<view>
<view class="nav_area"></view>
<view class="setPage">
<view v-for="(item,index) in setList" :key="index" class="set_item">
<view class="icon_new"><image :src="item.image" mode=""></image></view>
<view style="flex:1;" class="flex-col">
<view class="box3"><text>轮播名称</text>{{item.title}}</view>
<view class=""><text>排序</text>{{item.sort}}%</view>
</view>
<view style="" class="flex-col">
<view class="red" @click="edit(item,index)">编辑</view>
<text class="" @click="remove(item,index)">删除</text>
</view>
</view>
</view>
</view>
</template>
<script>
import API from '@/common/js/api.js'
export default {
data() {
return {
setList: [
{title:'诚邀你一起中百胜多负少的',sort:'1'},
{title:'0万元',sort:'2'},
{title:'10万元',sort:'3'},
{title:'20000万元',sort:'4'}
],
page: 1
}
},
methods: {
edit(val, i){
uni.navigateTo({
url: './addBanner?id='+val.id+'&image='+val.image+'&title='+val.title+'&sort='+val.sort
})
},
remove(val, i){
let _this = this;
uni.showModal({
title:'温馨提示',
content:"确定是否删除该信息",
success() {
API.request('/rotationChart/delete', {id: val.id}, res=>{
uni.showToast({
title: res.msg
})
_this.setList.splice(i, 1);
})
}
})
},
getList(){
API.request('/rotationChart/list', {page:this.page, limit: 10}, res=>{
this.setList = res.data.list;
})
}
},
onLoad(e) {
this.getList();
},
onNavigationBarButtonTap() {
uni.navigateTo({
url: './addBanner'
})
}
}
</script>
<style lang="scss" scoped>
.nav_area {
position: fixed;
top: 0px;
left: 0px;
z-index: 99;
background-color: #fff;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
width: 700rpx;
height: 88rpx;
padding: 0px 25rpx;
padding-top: var(--status-bar-height);
box-sizing: content-box;
color: #b0b0b0;
font-size: 14px;
}
.setPage{
padding: 0px 40rpx;
font-size: 14px;
color: #444;
}
.set_item{
height: 96rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 0px;
// border-bottom: 1px solid #ebebeb;
.icon_new{
width: 220rpx;
height: 96rpx;
margin-right: 18rpx;
image{
width: 220rpx;
height: 96rpx;
border-radius: 10px;
background-color: #000;
}
}
text{
color: #999;
}
.box3{
display: -webkit-box;//将盒子转换为弹性盒子 -webkit-box-orient: vertical;//文本显示方式,默认水平 -webkit-line-clamp: 1;//设置显示多少行 overflow: hidden;
}
.flex-col{
height: 100%;
display: flex;flex-direction: column;
justify-content: space-between;
}
.red{
color: #E33837;
}
}
</style>

2
pages/about/bonusSet/index.vue

@ -57,7 +57,7 @@
}else{
this.bonusList = res.data;
}
})
}, fail=>{}, false)
}
},
onLoad(e) {

135
pages/about/noticeManage/addNotice.vue

@ -0,0 +1,135 @@
<template>
<view>
<view class="nav_area"></view>
<view class="setPage">
<view class="">
<view style="" class="">
<view class="input_box">
<text>标题</text>
<input type="text" v-model="editInfo.title" placeholder="请输入内容" placeholder-style="color: #999;">
</view>
<!-- <view class="input_box">
<text>排序</text>
<input type="text" v-model="editInfo.sort" placeholder="请输入轮播排序,数字越小,位置越前" placeholder-style="color: #999;">
</view> -->
<view class="input2_box">
<text class="label">描述内容</text>
<textarea name="" id="" cols="30" rows="10" placeholder="请输入描述内容"
placeholder-style="color: #999;" v-model="editInfo.content"></textarea>
</view>
</view>
<view class="submit" @click="confirm()">
确定发布
</view>
</view>
</view>
</view>
</template>
<script>
import API from '@/common/js/api.js'
export default {
data() {
return {
id: '',
editInfo: {title:'',sort:'', content: ''},
}
},
methods: {
confirm(){
let data = {
id: this.id||'',
title: this.editInfo.title,
sort: this.editInfo.sort,
content: this.editInfo.content
};
API.request('/notice/save', data, res=>{
uni.showToast({
title: res.msg
})
setTimeout(()=>{
uni.navigateBack({
delta: 1
})
}, 1500)
})
},
},
onLoad(e) {
if(e){
this.id = e.id;
this.editInfo.title = e.title;
this.editInfo.content = e.content;
this.editInfo.sort = e.sort;
}
},
}
</script>
<style lang="scss" scoped>
.nav_area {
position: fixed;
top: 0px;
left: 0px;
z-index: 99;
background-color: #fff;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
width: 700rpx;
height: 88rpx;
padding: 0px 25rpx;
padding-top: var(--status-bar-height);
box-sizing: content-box;
color: #b0b0b0;
font-size: 14px;
}
.setPage{
padding: 40rpx;
font-size: 14px;
color: #999;
}
.input_box{
display: flex;
justify-content: space-between;
align-items: center;
input{
width: 572rpx;
height: 80rpx;
border: 1px solid #eee;
border-radius: 5px;
padding: 0px 10px;
box-sizing: border-box;
color: #444;
}
}
.input2_box{
.label{
line-height: 40px;
}
textarea{
width: 670rpx;
height: 560rpx;
border: 1px solid #eee;
border-radius: 5px;
padding: 10px 10px;
box-sizing: border-box;
color: #444;
}
}
.submit{
width: 670rpx;
height: 88rpx;
border-radius: 10px;
font-size: 14px;
text-align: center;
line-height: 88rpx;
color: #fff;
background-color: #e33837;
position: fixed;
bottom: 40rpx;
}
</style>

137
pages/about/noticeManage/noticeManage.vue

@ -0,0 +1,137 @@
<template>
<view>
<view class="nav_area"></view>
<view class="setPage">
<view v-for="(item,index) in setList" :key="index" class="set_item">
<view style="" class="item_top">
<view class="">标题{{item.title}}</view>
<text class="text" style="font-size: 12px;">发布时间{{item.time}}</text>
<view class=""><text class="box3" v-html="item.content"></text></view>
</view>
<view style="" class="flex-row">
<view class="red" @click="edit(item,index)">编辑</view>
<text class="text" @click="remove(item,index)">删除</text>
</view>
</view>
</view>
</view>
</template>
<script>
import API from '@/common/js/api.js'
export default {
data() {
return {
setList: [
{
"id": 1, //id
"title": "测试", //
"sort": 1, //
"content": "尊敬的平台用户,关于调整中奖概率问题,平台为了中奖概率问题"
},
{
"id": 2, //id
"title": "测试2", //
"sort": 2, //
"content": "手动阀电风扇2"
}
],
page: 1
}
},
methods: {
edit(val, i){
uni.navigateTo({
url: './addNotice?id='+val.id+'&content='+val.content+'&title='+val.title+'&sort='+val.sort
})
},
remove(val, i){
let _this = this;
uni.showModal({
title:'温馨提示',
content:"确定是否删除该信息",
success() {
API.request('/notice/delete', {id: val.id}, res=>{
uni.showToast({
title: res.msg
})
_this.setList.splice(i, 1);
})
}
})
},
getList(){
API.request('/notice/list', {page:this.page, limit: 10}, res=>{
this.setList = res.data.list;
})
}
},
onLoad(e) {
this.getList();
},
onNavigationBarButtonTap() {
uni.navigateTo({
url: './addNotice'
})
}
}
</script>
<style lang="scss" scoped>
.nav_area {
position: fixed;
top: 0px;
left: 0px;
z-index: 99;
background-color: #fff;
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.05);
width: 700rpx;
height: 88rpx;
padding: 0px 25rpx;
padding-top: var(--status-bar-height);
box-sizing: content-box;
color: #b0b0b0;
font-size: 14px;
}
.setPage{
padding: 40rpx;
font-size: 14px;
color: #444;
}
.set_item{
width: 670rpx;
height: 280rpx;
box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.11);
margin-bottom: 40rpx;
border-radius: 10px;
.item_top{
padding: 30rpx 30rpx;
line-height: 24px;
}
.text{
color: #999;
}
.box3{
font-size: 12px;
display: -webkit-box;//
-webkit-box-orient: vertical;//
-webkit-line-clamp: 1;//
overflow: hidden;
}
.flex-row{
display: flex;
align-items: center;
justify-content: space-between;
padding: 0px 110rpx;
}
.red{
color: #E33837;
}
}
</style>

44
pages/home/home.vue

@ -18,8 +18,9 @@
</swiper>
</view>
<view class="" style="color: #b0b0b0;font-size: 14px;height: 30px;line-height: 14px;">
公告<text style="color: #101010;">关于中奖概率调整问题</text>
<view class="notice" @click="toUrl('notice')">
<text class="notice_t">公告</text>
{{notice.title}}
</view>
<view class="dis-flex goods_area">
<view v-for="(item,index) in goodsList" :key="index" class="goods_item">
@ -146,6 +147,9 @@
"sum_value": "20.00" ,//,
xData: ['1月', '2月', '3月', '4月', '5月'],
data: [155, 250, 360, 100, 180, 204]
},
notice: {
title: '公告公告公告公告公告公告公告公告公告公告公告公告公告公告公告公告'
}
}
},
@ -155,7 +159,9 @@
}
},
onShow() {
this.getAwardRecords();
if(this.userType=='user'){
this.getAwardRecords();
}
},
created() {
@ -164,6 +170,8 @@
if(this.userType=='user'){
this.getZoneList();
this.getRotationChart();
this.getAwardRecords();
this.getNotice();
}
if(this.userType=='background'){
this.getNeedSta();
@ -204,8 +212,10 @@
uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/login/login-withpwd'
})
}else if(item=='login'){
}else if(item=='notice'){
uni.navigateTo({
url: '/pages/NoticeDetails/NoticeDetails?id='+this.notice.id
})
}else if(item=='login'){
}else{
@ -372,12 +382,18 @@
return item.value;
})
})
}
},
/**/
getNotice(){
API.request('/index/getNotice', {}, res=>{
this.notice = res.data;
}, fail=>{}, false)
},
},
onReachBottom() {
if(!this.nomore){
console.log(111);
if(this.userType=='user' && !this.nomore){
this.page++;
this.getAwardRecords(this.page, 10);
}
@ -474,6 +490,18 @@
overflow: hidden;
}
}
.notice{
color: #101010;
font-size: 14px;line-height: 14px;margin-bottom: 30rpx;
display: -webkit-box;//
-webkit-box-orient: vertical;//
-webkit-line-clamp: 1;//
overflow: hidden;
.notice_t{
color: #b0b0b0;
}
}
.goods_area{
flex-wrap: wrap;
justify-content: space-between;

BIN
static/user/icon_flag.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

BIN
static/user/icon_window.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

9
uni_modules/uni-id-pages/pages/login/login-withpwd.vue

@ -60,7 +60,7 @@
data() {
return {
"password": "",
"username": "",
"username": uni.getStorageSync('accounts')[0] || '',
"captcha": "",
"needCaptcha": false,
"focusUsername": false,
@ -166,6 +166,9 @@
title: res.msg
})
uni.setStorageSync('user_token', res.data.token);
let accounts = uni.getStorageSync('accounts') || [];
accounts.push(this.username);
uni.setStorageSync('accounts', accounts);
uni.setStorageSync('userType', 'user');
setTimeout(()=>{
uni.switchTab({
@ -192,7 +195,7 @@
url:'/pages/home/home'
})
}, 1500)
})
}, fail=>{}, false)
}
if(this.userType=='background'){
@ -212,7 +215,7 @@
url:'/pages/home/home'
})
}, 1500)
})
}, fail=>{}, false)
}

Loading…
Cancel
Save