diff --git a/app.wxss b/app.wxss index 2876473..f986072 100644 --- a/app.wxss +++ b/app.wxss @@ -2,4 +2,5 @@ page{ font-family: PingFangSC-Regular; + /* background-color: #f7f7f7; */ } \ No newline at end of file diff --git a/components/card/index.wxml b/components/card/index.wxml index 34d6ecc..a8ea1cd 100644 --- a/components/card/index.wxml +++ b/components/card/index.wxml @@ -1,5 +1,5 @@ - - 橡胶谷园区 + + {{title}} diff --git a/components/card/index.wxss b/components/card/index.wxss index 484e504..315f94a 100644 --- a/components/card/index.wxss +++ b/components/card/index.wxss @@ -1,5 +1,6 @@ /* components/card/index.wxss */ .card { + background-color: white; border: 1px solid #e7e7e7; box-shadow: 1px 1px 1px #eee; } @@ -8,11 +9,12 @@ height: 106px; } .card_title { + padding: 0 10px; display: flex; flex-direction: row; align-items: center; justify-content: center; - height: 41px; + min-height: 41px; color: #373737; font-size: 12px; } \ No newline at end of file diff --git a/components/cell/index.wxss b/components/cell/index.wxss index 2f1585b..1e3e478 100644 --- a/components/cell/index.wxss +++ b/components/cell/index.wxss @@ -1,5 +1,6 @@ /* components/cell/index.wxss */ .cell { + background-color: white; border-bottom: 1px solid #E7E7E7; display: flex; flex-direction: column; diff --git a/components/empty/index.js b/components/empty/index.js new file mode 100644 index 0000000..7519f39 --- /dev/null +++ b/components/empty/index.js @@ -0,0 +1,34 @@ +// components/empty/index.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + loading: { + type: Boolean, + value: true, + }, + empty: { + type: Boolean, + value: false, + }, + message: { + type: Boolean, + value: '页面迷路了!' + } + }, + + /** + * 组件的初始数据 + */ + data: { + + }, + + /** + * 组件的方法列表 + */ + methods: { + + } +}) diff --git a/components/empty/index.json b/components/empty/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/empty/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/empty/index.wxml b/components/empty/index.wxml new file mode 100644 index 0000000..ffef962 --- /dev/null +++ b/components/empty/index.wxml @@ -0,0 +1,10 @@ + + + + 加载中 + + + + + + diff --git a/components/empty/index.wxss b/components/empty/index.wxss new file mode 100644 index 0000000..8f3e25c --- /dev/null +++ b/components/empty/index.wxss @@ -0,0 +1,50 @@ +/* components/empty/index.wxss */ + +.empty { + position: relative; + width: 100%; +} + +.empty-loading { + position: absolute; + top: 0; + right: 0; + left: 0; + bottom: 0; +} +.empty-bd { + padding: 10px 0; + text-align: center; + font-size: 17px; + color: #888; +} + +.load-indicator { + font-size: 16px; + color: #888; + text-align: center; +} +dot { + display: inline-block; + overflow: hidden; + height: 1em; + line-height: 1; + vertical-align: -.25em; +} + +dot::after { + display: block; + white-space: pre-wrap; + content: "...\A..\A."; + animation: loading 3s infinite step-start both; +} + +@keyframes loading { + 33% { + transform: translate3d(0, -2em, 0); + } + + 66% { + transform: translate3d(0, -1em, 0); + } +} diff --git a/components/focus/index.wxml b/components/focus/index.wxml index 438d78c..6049dd0 100644 --- a/components/focus/index.wxml +++ b/components/focus/index.wxml @@ -1,5 +1,5 @@ - + diff --git a/images/common/btn_bg_disable.png b/components/image-button/images/btn_bg_disable.png similarity index 100% rename from images/common/btn_bg_disable.png rename to components/image-button/images/btn_bg_disable.png diff --git a/components/image-button/index.js b/components/image-button/index.js index 9300fde..6d918a1 100644 --- a/components/image-button/index.js +++ b/components/image-button/index.js @@ -5,6 +5,10 @@ Component({ */ properties: { title: String, + disable: { + type: Boolean, + value: false, + } }, /** diff --git a/components/image-button/index.wxml b/components/image-button/index.wxml index 58bb6fe..77ad10e 100644 --- a/components/image-button/index.wxml +++ b/components/image-button/index.wxml @@ -1,5 +1,5 @@ - + {{title}} diff --git a/components/swiper/index.wxml b/components/swiper/index.wxml index 0c1dbfe..ea851fb 100644 --- a/components/swiper/index.wxml +++ b/components/swiper/index.wxml @@ -1,5 +1,5 @@ - + { wx.showToast({ title: '短信验证码已发送!', icon: 'none' }) + success(data) } } this.request(params) } - // 验证和注册 - register (phone, name, vscode, success) { + checkRegister (success) { let params = { - url: '', + url: AuthConst.check_register_url, + method: Method.POST, + success: success, + } + this.request(params) + } + // 提交验证和注册 + mobileRegister (phone, name, vscode, success) { + let params = { + url: AuthConst.verify_update_phone_url, method: Method.POST, data: { - + isRegister: 1, + phone: phone, + realName: name, + verificationCode: vscode, }, success: (data) => { + console.log(data) if (data) { success(data) } else { @@ -51,7 +68,7 @@ class AuthModel extends HTTP { this._fetchWXCode().then(res => { if (!res) return let params = { - url: token_url, + url: AuthConst.token_url, method: Method.GET, data: { code: res diff --git a/pages/article/index.js b/pages/article/index.js index b7b754b..749eb23 100644 --- a/pages/article/index.js +++ b/pages/article/index.js @@ -11,13 +11,14 @@ Page({ data: { nodes: '', isStar: true, // 是否 - showBtn: true, + showBtn: false, aId: '', title: '', date: '', origin: '', unStar: '/images/common/star.png', star: '/images/common/star_light.png', + disable: true, }, onClickCollect () { // 收藏功能 @@ -50,7 +51,8 @@ Page({ date: date, origin: data.source, isStar: data.isCollection ? true : false, - showBtn: data.typeFlag == 0 ? false : true + showBtn: data.typeFlag >= 2 ? true : false, + disable: data.typeFlag == 3 ? true : false, }) }) }, @@ -71,6 +73,14 @@ Page({ onlineSignApi () { artice.onlineSign(this.data.aId, res => { console.log(res) + wx.showToast({ + title: res.message, + icon: 'none' + }) + this.setData({ + disable: true + }) + // this.fetchArticeApi() }) }, diff --git a/pages/article/index.wxml b/pages/article/index.wxml index 969de5b..da2c9be 100644 --- a/pages/article/index.wxml +++ b/pages/article/index.wxml @@ -12,6 +12,6 @@ - + diff --git a/pages/article/index.wxss b/pages/article/index.wxss index 8b6383e..499b497 100644 --- a/pages/article/index.wxss +++ b/pages/article/index.wxss @@ -1,4 +1,7 @@ /* pages/article/index.wxss */ +.contianer { + overflow: hidden; +} .page_hd { padding: 0 15px; display: flex; diff --git a/pages/billboards/index.js b/pages/billboards/index.js index 7168720..6cb2289 100644 --- a/pages/billboards/index.js +++ b/pages/billboards/index.js @@ -1,6 +1,6 @@ // pages/billboards/index.js -import {AuthModel} from '../../models/auth.js' -let auth = new AuthModel() +// import {AuthModel} from '../../models/auth.js' +// let auth = new AuthModel() Page({ @@ -15,9 +15,6 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - auth.fetchAuthToken(res => { - console.log(res) - }) }, onClickItem (e) { const {index} = e.currentTarget.dataset diff --git a/pages/billboards/park/images/1.png b/pages/billboards/park/images/1.png new file mode 100644 index 0000000..de45b9f Binary files /dev/null and b/pages/billboards/park/images/1.png differ diff --git a/pages/billboards/park/images/2.png b/pages/billboards/park/images/2.png new file mode 100644 index 0000000..cd7d0ff Binary files /dev/null and b/pages/billboards/park/images/2.png differ diff --git a/pages/billboards/park/images/3.png b/pages/billboards/park/images/3.png new file mode 100644 index 0000000..ea60709 Binary files /dev/null and b/pages/billboards/park/images/3.png differ diff --git a/pages/billboards/park/images/4.png b/pages/billboards/park/images/4.png new file mode 100644 index 0000000..3d5d8b8 Binary files /dev/null and b/pages/billboards/park/images/4.png differ diff --git a/pages/billboards/park/index.wxml b/pages/billboards/park/index.wxml index 692e750..537b15f 100644 --- a/pages/billboards/park/index.wxml +++ b/pages/billboards/park/index.wxml @@ -1,7 +1,7 @@ - - - - + + + + diff --git a/pages/billboards/park/park-list/index.js b/pages/billboards/park/park-list/index.js index 8095d2e..afacbf6 100644 --- a/pages/billboards/park/park-list/index.js +++ b/pages/billboards/park/park-list/index.js @@ -7,6 +7,7 @@ Page({ * 页面的初始数据 */ data: { + loading: true, list: [], curCode: '', curPage:1, @@ -34,8 +35,34 @@ Page({ const {curCode} = this.data const page = this.data.curPage billboard.fetchBailList(curCode, page, res => { + this.setData({ + loading:false, + }) console.log(res) + const list = res.list + if (page == 1) { + this.setData({ + list: list + }) + } else { + if (list.length > 0) { + const list = [...this.data.list, ...list] + this.setData({ + list: list + }) + } else { + const page = this.data.currPage - 1 + this.setData({ + currPage: page + }) + wx.showToast({ + title: '已加载全部', + icon: 'none' + }) + } + } }) + wx.stopPullDownRefresh() }, /** * 页面相关事件处理函数--监听用户下拉动作 diff --git a/pages/billboards/park/park-list/index.wxml b/pages/billboards/park/park-list/index.wxml index 2e95c39..8d07538 100644 --- a/pages/billboards/park/park-list/index.wxml +++ b/pages/billboards/park/park-list/index.wxml @@ -1,7 +1,9 @@ - diff --git a/pages/billboards/park/park-list/index.wxss b/pages/billboards/park/park-list/index.wxss index 548a507..425ba09 100644 --- a/pages/billboards/park/park-list/index.wxss +++ b/pages/billboards/park/park-list/index.wxss @@ -13,7 +13,7 @@ .page_empty { width: 100%; height: 100px; - margin-top: 100px; + margin-top: 20px; font-size: 14px; color: #aaa; text-align: center; diff --git a/pages/billboards/policy/policy-list/index.js b/pages/billboards/policy/policy-list/index.js index 5d9121a..89ec41b 100644 --- a/pages/billboards/policy/policy-list/index.js +++ b/pages/billboards/policy/policy-list/index.js @@ -42,9 +42,8 @@ Page({ fetchPolicyArtice () { policy.fetchPolicyArtice(this.data.curCode, res => { console.log(res) - const list = res.list this.setData({ - nodes: list[0].content + nodes: res.data.content || '' }) }) } diff --git a/pages/home/index.js b/pages/home/index.js index 3a3846b..2ef6cdc 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -6,6 +6,7 @@ import { HomeModel } from '../../models/home.js' let homeModel = new HomeModel() Page({ data: { + loading: true, currPage: 1, banners: [], hots: [], @@ -26,6 +27,11 @@ Page({ currPage: 1, }) this.fetchHomeList() + wx.vibrateShort({ + success () { + console.log('震动') + } + }) }, /** @@ -42,6 +48,9 @@ Page({ fetchHomeList() { let page = this.data.currPage homeModel.getHomeList(page, res => { + this.setData({ + loading: false + }) console.log('啦啦啦') const datas = res.list let tempDatas = [] @@ -89,7 +98,7 @@ Page({ console.log(item) tempBanners.push({ id: item.id, - image: 'http://m.360buyimg.com/mobilecms/s700x280_jfs/t1/45210/40/7669/143615/5d53b19dEc9559d0a/cd9eade239533517.jpg!cr_1125x445_0_171!q70.jpg.dpg' + image: item.titlePic }) }) this.setData({ diff --git a/pages/home/index.json b/pages/home/index.json index 4721f9c..c97011e 100644 --- a/pages/home/index.json +++ b/pages/home/index.json @@ -1,8 +1,11 @@ { "enablePullDownRefresh": true, + "backgroundColor": "#f7f7f7", + "backgroundTextStyle": "dark", "usingComponents": { "e-swiper": "/components/swiper/index", "e-focus": "/components/focus/index", - "e-cell": "/components/cell/index" + "e-cell": "/components/cell/index", + "e-empty": "/components/empty/index" } } \ No newline at end of file diff --git a/pages/home/index.wxml b/pages/home/index.wxml index 07e9f53..4a88be0 100644 --- a/pages/home/index.wxml +++ b/pages/home/index.wxml @@ -11,4 +11,5 @@ showTop="{{item.showTop}}" bind:clickListItem="clickListItem"/> + diff --git a/pages/register/index.js b/pages/register/index.js index c92bd4d..9077897 100644 --- a/pages/register/index.js +++ b/pages/register/index.js @@ -1,4 +1,7 @@ // pages/register/index.js +import {AuthModel} from '../..//models/auth.js' +let auth = new AuthModel() + Page({ /** @@ -18,9 +21,11 @@ Page({ rules: { required: true, message: '验证码必填' }, }, ], - formData: { - - } + formData: {}, + time: 60, + fetchCode: true, + interval: null, + btnTitle: '获取验证码' }, /** @@ -28,6 +33,68 @@ Page({ */ onLoad: function (options) { + }, + onHide () { + clearInterval(this.data.interval) + }, + // 重新获取Code + refetchCodeDownTime () { + + this.data.interval = setInterval(() => { + const time = this.data.time - 1 + const title = `${time}s 重新发送` + this.setData({ + fetchCode: false, + time: time, + btnTitle: title + }) + if (time == 0) { + this.setData({ + fetchCode: true, + time: 60, + btnTitle: '重新发送' + }) + clearInterval(this.data.interval) + } + }, 1000) + }, + // 调用获取 Code 接口 + onGetMsgCode () { + this.selectComponent('#form').validate((valid, errors) => { + if (!valid) { + let emptyPhone = false + errors.forEach(item => { + if (item.name === 'mobile') { + emptyPhone = true + wx.showToast({ + title: item.message, + icon: 'none' + }) + } + }) + if (!emptyPhone) { + + // console.log(this.data.formData) + this.fetchMsgCodeApi() + } + } + }) + }, + fetchMsgCodeApi () { + auth.getMsgCode(this.data.formData.mobile, res => { + console.log(res) + this.refetchCodeDownTime() + }) + }, + registerApi () { + const {mobile, name, vcode} = this.data.formData + console.log(mobile,name, vcode) + auth.mobileRegister(mobile, name, vcode, res => { + console.log(res) + wx.reLaunch({ + url: '/pages/home/index', + }) + }) }, formInputChange (e) { const { field } = e.currentTarget.dataset @@ -40,6 +107,7 @@ Page({ console.log('valid', valid, errors) if (!valid) { const firstError = Object.keys(errors) + console.log(firstError) if (firstError.length) { const error = errors[firstError[0]].message wx.showToast({ @@ -48,9 +116,7 @@ Page({ }) } } else { - wx.showToast({ - title: '校验通过' - }) + this.registerApi() } }) } diff --git a/pages/register/index.wxml b/pages/register/index.wxml index a537af9..0d97d7b 100644 --- a/pages/register/index.wxml +++ b/pages/register/index.wxml @@ -13,9 +13,9 @@ - + - 获取验证码 + {{btnTitle}} diff --git a/utils/http.js b/utils/http.js index e00b0b1..df9c871 100644 --- a/utils/http.js +++ b/utils/http.js @@ -36,7 +36,7 @@ class HTTP { let code = res.statusCode.toString() let startCode = code.charAt(0) if (startCode == '2') { - if (res.data.code == 200) { + if (res.data.code == 200 || res.data.code == 0) { params.success && params.success(res.data) } else { console.log('数据请求失败') @@ -47,11 +47,18 @@ class HTTP { } } else { console.log('请求错误') + wx.showToast({ + title: '服务器错误!', + icon: 'none' + }) params.error && params.error(res) } }, fail: function (res) { - console.log('服务器错误') + wx.showToast({ + title: '网络连接错误,请求失败!', + icon: 'none' + }) params.fail && params.fail(res) }, })