From e6dc47cc222896f8230301b76e322ec5c557d902 Mon Sep 17 00:00:00 2001 From: luyisha Date: Thu, 7 Sep 2023 10:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/api.js | 61 ++++--- pages.json | 67 +++++++ pages/NoticeDetails/NoticeDetails.vue | 79 +++++++++ pages/about/about.vue | 12 ++ pages/about/bannerManage/addBanner.vue | 165 ++++++++++++++++++ pages/about/bannerManage/bannerManage.vue | 130 ++++++++++++++ pages/about/bonusSet/index.vue | 2 +- pages/about/noticeManage/addNotice.vue | 135 ++++++++++++++ pages/about/noticeManage/noticeManage.vue | 137 +++++++++++++++ pages/home/home.vue | 44 ++++- static/user/icon_flag.png | Bin 0 -> 312 bytes static/user/icon_window.png | Bin 0 -> 205 bytes .../pages/login/login-withpwd.vue | 9 +- 13 files changed, 809 insertions(+), 32 deletions(-) create mode 100644 pages/NoticeDetails/NoticeDetails.vue create mode 100644 pages/about/bannerManage/addBanner.vue create mode 100644 pages/about/bannerManage/bannerManage.vue create mode 100644 pages/about/noticeManage/addNotice.vue create mode 100644 pages/about/noticeManage/noticeManage.vue create mode 100644 static/user/icon_flag.png create mode 100644 static/user/icon_window.png diff --git a/common/js/api.js b/common/js/api.js index 96d0573..4751318 100644 --- a/common/js/api.js +++ b/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验证失败 diff --git a/pages.json b/pages.json index ab9a398..ea3fbf1 100644 --- a/pages.json +++ b/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", diff --git a/pages/NoticeDetails/NoticeDetails.vue b/pages/NoticeDetails/NoticeDetails.vue new file mode 100644 index 0000000..33c93ba --- /dev/null +++ b/pages/NoticeDetails/NoticeDetails.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/pages/about/about.vue b/pages/about/about.vue index 1db3c9f..ac6fa0e 100644 --- a/pages/about/about.vue +++ b/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" } ] ] diff --git a/pages/about/bannerManage/addBanner.vue b/pages/about/bannerManage/addBanner.vue new file mode 100644 index 0000000..8f85da7 --- /dev/null +++ b/pages/about/bannerManage/addBanner.vue @@ -0,0 +1,165 @@ + + + + + diff --git a/pages/about/bannerManage/bannerManage.vue b/pages/about/bannerManage/bannerManage.vue new file mode 100644 index 0000000..a97914b --- /dev/null +++ b/pages/about/bannerManage/bannerManage.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/pages/about/bonusSet/index.vue b/pages/about/bonusSet/index.vue index 5b0564c..4f52eb2 100644 --- a/pages/about/bonusSet/index.vue +++ b/pages/about/bonusSet/index.vue @@ -57,7 +57,7 @@ }else{ this.bonusList = res.data; } - }) + }, fail=>{}, false) } }, onLoad(e) { diff --git a/pages/about/noticeManage/addNotice.vue b/pages/about/noticeManage/addNotice.vue new file mode 100644 index 0000000..3248fa0 --- /dev/null +++ b/pages/about/noticeManage/addNotice.vue @@ -0,0 +1,135 @@ + + + + + diff --git a/pages/about/noticeManage/noticeManage.vue b/pages/about/noticeManage/noticeManage.vue new file mode 100644 index 0000000..975b494 --- /dev/null +++ b/pages/about/noticeManage/noticeManage.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/pages/home/home.vue b/pages/home/home.vue index 5e8859a..0fe6437 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -18,8 +18,9 @@ - - 公告:关于中奖概率调整问题 + + 公告: + {{notice.title}} @@ -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; diff --git a/static/user/icon_flag.png b/static/user/icon_flag.png new file mode 100644 index 0000000000000000000000000000000000000000..09930ff26e6c32db996fd491112e3c41e5115558 GIT binary patch literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU3?z3ec*FxKn*g5>S0GI`xS+3Q0Msl}666=m zu&gFn(=J2QRc|`0azV4qL>`@zhHHNg1LdcCx;TbZ%z1moldnO6hc&>S^=Rd;|FLr& zT#wFLQTRB1(((W&={=KsIzmoaH!6mn+*wiLaN3b+$&}0a;exyD8p`U`PqDWOD|~k> z-}(PTVTSOm!=3e~sW{K!;mgH+Z!2uxud%F6$taD0e0s!(~ BVQ>Hd literal 0 HcmV?d00001 diff --git a/static/user/icon_window.png b/static/user/icon_window.png new file mode 100644 index 0000000000000000000000000000000000000000..540cd44e5217d76152c8bea42423163ce28d96ca GIT binary patch literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NV3?%C=ER6$F(g8jpu0R?Wm=gF%0Vu~=666=m zuq?Pn(>_DgGrKq&q&~va#WAE}PVxdagEnRrM@I_<6%U;NC&mCr=az|0O^1H4bh55l z@l8XMm4TIcqAv?0=Yj=FyA}v|1RP;ywP<2x4S1U%Bf6wf;o6G>Y7uQ78wDoxWy!o` ZU|1k2eLZx|^CuunJYD@<);T3K0RTS(GwA>T literal 0 HcmV?d00001 diff --git a/uni_modules/uni-id-pages/pages/login/login-withpwd.vue b/uni_modules/uni-id-pages/pages/login/login-withpwd.vue index 63f9cd1..4a77ad6 100644 --- a/uni_modules/uni-id-pages/pages/login/login-withpwd.vue +++ b/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) }