fanp 6 years ago
parent
commit
ea42614ad0
  1. 34
      app.js
  2. 3
      components/segment/index.wxss
  3. 2
      config.js
  4. BIN
      images/billboard/arrow-down.png
  5. 12
      pages/article/index.js
  6. 6
      pages/billboards/policy/index.js
  7. 28
      pages/billboards/policy/policy-list/index.js
  8. 21
      pages/billboards/policy/policy-list/index.wxml
  9. 61
      pages/billboards/policy/policy-list/index.wxss
  10. 22
      pages/home/index.js
  11. 18
      pages/topics/interactive/topicArticle/index.js
  12. 14
      pages/user/index.js
  13. 2
      project.config.json
  14. 20
      utils/http.js

34
app.js

@ -3,37 +3,9 @@ import {HTTP} from '/utils/http.js'
const http = new HTTP() const http = new HTTP()
App({ App({
onLaunch: function (options) { onLaunch: function (options) {
// auth.fetchAuthToken(res => { http.fetchAuthToken(res => {
// console.log(res) // console.log(res)
// }) })
// // 获取用户信息
// wx.getSetting({
// success: res => {
// console.log(res)
// if (res.authSetting['scope.userInfo']) {
// // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
// // wx.getUserInfo({
// // success: res => {
// // // 可以将 res 发送给后台解码出 unionId
// // this.globalData.userInfo = res.userInfo
// // // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// // // 所以此处加入 callback 以防止这种情况
// // if (this.userInfoReadyCallback) {
// // this.userInfoReadyCallback(res)
// // }
// // }
// // })
// } else {
// wx.authorize({
// scope: 'scope.userInfo',
// success() {
// }
// })
// }
// }
// })
}, },
globalData: { globalData: {
userInfo: null userInfo: null

3
components/segment/index.wxss

@ -7,6 +7,7 @@
} }
.title { .title {
min-width: 150rpx; min-width: 150rpx;
white-space: nowrap;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -21,7 +22,7 @@
transition: 0.5s all ease-in-out; transition: 0.5s all ease-in-out;
} }
.title-selected { .title-selected {
font-size: 16px; font-size: 15px;
color: #292E3E; color: #292E3E;
} }
.select-line{ .select-line{

2
config.js

@ -1,5 +1,5 @@
const config = { const config = {
// api_url: 'http://192.168.42.44:8083/fqsb', // 服务器地址 // api_url: 'http://192.168.42.44:8083/fqsb', // 服务器地址
api_url: 'https://shibeirencai.elinkit.com.cn:8083/fqsb' api_url: 'https://shibeirencai.elinkit.com.cn:7101/fqsb'
} }
export { config } export { config }

BIN
images/billboard/arrow-down.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

12
pages/article/index.js

@ -27,7 +27,7 @@ Page({
this.addOrRemoveCollectionApi() this.addOrRemoveCollectionApi()
}, },
onlineSubmit () { onlineSubmit () {
console.log('在线报名') //console.log('在线报名')
if (store.hasPhone()) { if (store.hasPhone()) {
this.onlineSignApi() // 在线报名 this.onlineSignApi() // 在线报名
} else { } else {
@ -41,7 +41,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(options) //console.log(options)
const {id} = options const {id} = options
this.setData({ this.setData({
aId: id aId: id
@ -50,8 +50,8 @@ Page({
}, },
fetchArticeApi () { fetchArticeApi () {
artice.getDetail(this.data.aId, (res) => { artice.getDetail(this.data.aId, (res) => {
console.log('artice detail') //console.log('artice detail')
console.log(res) //console.log(res)
const data = res.result const data = res.result
const date = dayjs(data.createTime).format('MM月DD日') const date = dayjs(data.createTime).format('MM月DD日')
this.setData({ this.setData({
@ -68,7 +68,7 @@ Page({
}, },
addOrRemoveCollectionApi () { addOrRemoveCollectionApi () {
artice.addOrRemoveCollect(this.data.aId, res => { artice.addOrRemoveCollect(this.data.aId, res => {
console.log(res) //console.log(res)
if (res.code == 200) { if (res.code == 200) {
this.setData({ this.setData({
isStar: !this.data.isStar isStar: !this.data.isStar
@ -82,7 +82,7 @@ Page({
}, },
onlineSignApi () { onlineSignApi () {
artice.onlineSign(this.data.aId, res => { artice.onlineSign(this.data.aId, res => {
console.log(res) //console.log(res)
wx.showToast({ wx.showToast({
title: res.message, title: res.message,
icon: 'none' icon: 'none'

6
pages/billboards/policy/index.js

@ -31,7 +31,7 @@ Page({
currPage: 1, currPage: 1,
searchKey: '' searchKey: ''
}) })
console.log(e) //console.log(e)
this.fetchPolicyList() this.fetchPolicyList()
}, },
onSearchInput (e) { onSearchInput (e) {
@ -40,7 +40,7 @@ Page({
searchKey: key, searchKey: key,
currPage: 1, currPage: 1,
}) })
console.log(e) //console.log(e)
this.fetchPolicyList() this.fetchPolicyList()
}, },
/** /**
@ -78,7 +78,7 @@ Page({
const {searchKey} = this.data const {searchKey} = this.data
const page = this.data.currPage const page = this.data.currPage
policy.fetchPolicyList(page, searchKey, res => { policy.fetchPolicyList(page, searchKey, res => {
console.log(res) //console.log(res)
const datas = res.list const datas = res.list
let tempDatas = [] let tempDatas = []
datas.forEach(item => { datas.forEach(item => {

28
pages/billboards/policy/policy-list/index.js

@ -11,14 +11,15 @@ Page({
nodes: '', nodes: '',
navs: [], navs: [],
tags: [], // 导航的原始数据 tags: [], // 导航的原始数据
curCode: '' curCode: '',
show: false,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(options) //console.log(options)
const tags = wx.getStorageSync('PolicyTags') const tags = wx.getStorageSync('PolicyTags')
let navs = tags.map(item=> {return item.name}) let navs = tags.map(item=> {return item.name})
const {index} = options const {index} = options
@ -31,17 +32,34 @@ Page({
}) })
this.fetchPolicyArtice() this.fetchPolicyArtice()
}, },
onShowAllButton () {
console.log('show All tbn')
const show = this.data.show
this.setData({
show: !show
})
},
onClickAllBtnItem (e) {
const index = e.currentTarget.dataset.index
this.setData({
navSelectIndex: index,
curCode: this.data.tags[index].code,
show: false,
})
this.fetchPolicyArtice()
},
tapSegemnt (e) { tapSegemnt (e) {
console.log(e.detail) //console.log(e.detail)
const index = e.detail.index const index = e.detail.index
this.setData({ this.setData({
curCode: this.data.tags[index].code curCode: this.data.tags[index].code,
show: false
}) })
this.fetchPolicyArtice() this.fetchPolicyArtice()
}, },
fetchPolicyArtice () { fetchPolicyArtice () {
policy.fetchPolicyArtice(this.data.curCode, res => { policy.fetchPolicyArtice(this.data.curCode, res => {
console.log(res) //console.log(res)
if (res.data) { if (res.data) {
this.setData({ this.setData({
nodes: res.data.content || '' nodes: res.data.content || ''

21
pages/billboards/policy/policy-list/index.wxml

@ -1,14 +1,25 @@
<!--pages/billboards/policy/policy-list/index.wxml--> <!--pages/billboards/policy/policy-list/index.wxml-->
<view class="container"> <view class="container">
<view class="page_hd"> <view class="page_hd">
<e-segment <view class="page_segment">
headerTitles="{{navs}}" <e-segment
defaultSelectIndex="{{navSelectIndex}}" headerTitles="{{navs}}"
bind:tapSegment="tapSegemnt" defaultSelectIndex="{{navSelectIndex}}"
/> bind:tapSegment="tapSegemnt"
/>
</view>
<view class="page_btn_all" bindtap="onShowAllButton">
<image class="arrow_btn" src="/images/billboard/arrow-down.png"></image>
</view>
</view> </view>
<view class="page_bd"> <view class="page_bd">
<rich-text nodes="{{nodes}}"></rich-text> <rich-text nodes="{{nodes}}"></rich-text>
</view> </view>
<e-empty empty="{{nodes.length <= 0}}" message="暂无数据"/> <e-empty empty="{{nodes.length <= 0}}" message="暂无数据"/>
<view class="pop_view pop_view_layout {{show ? 'pop_show': 'pop_hidden'}}">
<block wx:for="{{navs}}" wx:key="pop_{{index}}">
<text bindtap="onClickAllBtnItem" data-index="{{index}}" class="pop_item">{{item}}</text>
</block>
</view>
</view> </view>

61
pages/billboards/policy/policy-list/index.wxss

@ -1,15 +1,70 @@
/* pages/billboards/policy/policy-list/index.wxss */ /* pages/billboards/policy/policy-list/index.wxss */
.container {
position: relative;
}
.page_hd { .page_hd {
position: fixed; position: fixed;
border-bottom: 1px solid #f7f7f7; border-bottom: 1px solid #f7f7f7;
top: 0; top: 0;
height: 48px; height: 40px;
width: 100%; right: 0;
left: 0; left: 0;
z-index: 10; z-index: 10;
background-color: white; background-color: white;
display: flex;
flex-direction: row;
}
.page_segment {
width: 90vw;
}
.page_btn_all {
width: 10vw;
background-color: white;
display: flex;
justify-content: center;
align-items: center;
}
.arrow_btn {
width: 30px;
height: 30px;
} }
.page_bd { .page_bd {
padding: 10px 10px 0 10px; padding: 10px 10px 0 10px;
margin-top: 48px; margin-top: 40px;
}
/* 弹出视图 */
.pop_view {
position: absolute;
left: 0;
right: 0;
top: 0px;
height: 150px;
overflow: scroll;
background-color: white;
transition: 0.2s all ease-in-out;
}
.pop_show {
top: 0;
}
.pop_hidden {
top: -150px;
}
.pop_view_layout {
/* 布局 */
padding: 0 10px;
border-bottom: 2px solid #f7f7f7;
}
.pop_item {
color: #999999;
font-size: 14px;
margin-top: 10px;
display: inline-block;
height: 20px;
margin-right: 10px;
white-space: nowrap;
padding: 8rpx 15rpx;
border-radius: 14px;
border: 1px solid #999999;
} }

22
pages/home/index.js

@ -14,7 +14,7 @@ Page({
}, },
onLoad: function () { onLoad: function () {
homeModel.fetchAuthToken(res => { homeModel.fetchAuthToken(res => {
console.log('Home获取token成功后再请求数据') //console.log('Home获取token成功后再请求数据')
this.fetchHomeList() this.fetchHomeList()
this.fetchHomeBanner() this.fetchHomeBanner()
this.fetchHomeHot() this.fetchHomeHot()
@ -32,7 +32,7 @@ Page({
this.fetchHomeHot() this.fetchHomeHot()
wx.vibrateShort({ wx.vibrateShort({
success () { success () {
console.log('震动') //console.log('震动')
} }
}) })
}, },
@ -54,7 +54,7 @@ Page({
this.setData({ this.setData({
loading: false loading: false
}) })
console.log('啦啦啦') //console.log('啦啦啦')
const datas = res.list const datas = res.list
let tempDatas = [] let tempDatas = []
datas.forEach(item => { datas.forEach(item => {
@ -88,14 +88,14 @@ Page({
// }) // })
} }
} }
console.log(res) //console.log(res)
wx.stopPullDownRefresh() wx.stopPullDownRefresh()
}) })
}, },
fetchHomeBanner () { fetchHomeBanner () {
homeModel.getHomeBanner(res => { homeModel.getHomeBanner(res => {
console.log('Banner') //console.log('Banner')
console.log(res) //console.log(res)
const datas = res.list const datas = res.list
let tempBanners = [] let tempBanners = []
datas.forEach(item => { datas.forEach(item => {
@ -112,8 +112,8 @@ Page({
}, },
fetchHomeHot () { fetchHomeHot () {
homeModel.getHomeHot(res => { homeModel.getHomeHot(res => {
console.log('Hot') //console.log('Hot')
console.log(res) //console.log(res)
const datas = res.list const datas = res.list
let tempHots = [] let tempHots = []
datas.forEach(item => { datas.forEach(item => {
@ -129,15 +129,15 @@ Page({
}, },
// Banner/Hot/List事件 // Banner/Hot/List事件
tapSwiperItem (e) { tapSwiperItem (e) {
console.log(e.detail) //console.log(e.detail)
this.gotoArticePage(e.detail.id) this.gotoArticePage(e.detail.id)
}, },
tapFocusItem (e) { tapFocusItem (e) {
console.log(e.detail) //console.log(e.detail)
this.gotoArticePage(e.detail.id) this.gotoArticePage(e.detail.id)
}, },
clickListItem (e) { clickListItem (e) {
console.log(e.detail) //console.log(e.detail)
const {id, index} = e.detail const {id, index} = e.detail
this.gotoArticePage(id) this.gotoArticePage(id)
}, },

18
pages/topics/interactive/topicArticle/index.js

@ -41,7 +41,7 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(options.topicId) //console.log(options.topicId)
this.setData({ this.setData({
topicId: options.topicId topicId: options.topicId
}) })
@ -60,7 +60,7 @@ Page({
}, },
fetchDetail(){ fetchDetail(){
let topicId = this.data.topicId let topicId = this.data.topicId
console.log('议题详情' + topicId) //console.log('议题详情' + topicId)
topicModel.getTopicDetail(topicId,res => { topicModel.getTopicDetail(topicId,res => {
let data = res.result let data = res.result
this.setData({ this.setData({
@ -82,7 +82,7 @@ Page({
let topicId = this.data.topicId let topicId = this.data.topicId
let page = this.data.currPage let page = this.data.currPage
topicModel.getTopicDetailComment(topicId,page,res => { topicModel.getTopicDetailComment(topicId,page,res => {
console.log('议题评论') //console.log('议题评论')
const datas = res.result.list const datas = res.result.list
let tempDatas = [] let tempDatas = []
@ -119,14 +119,14 @@ Page({
}) })
} }
} }
console.log(this.data.commentList) //console.log(this.data.commentList)
wx.stopPullDownRefresh() wx.stopPullDownRefresh()
}) })
}, },
fetchTopicCollect(){ fetchTopicCollect(){
let topicId = this.data.topicId let topicId = this.data.topicId
topicModel.topicCollect(topicId,res =>{ topicModel.topicCollect(topicId,res =>{
console.log('收藏') //console.log('收藏')
if(res.code === 200){ if(res.code === 200){
this.fetchDetail() this.fetchDetail()
wx.showToast({ wx.showToast({
@ -140,7 +140,7 @@ Page({
fetchTopicUnCollect(){ fetchTopicUnCollect(){
let collectionId = this.data.collectionId let collectionId = this.data.collectionId
topicModel.topicUnCollect(collectionId, res => { topicModel.topicUnCollect(collectionId, res => {
console.log('取消收藏') //console.log('取消收藏')
if (res.code === 200) { if (res.code === 200) {
this.fetchDetail() this.fetchDetail()
wx.showToast({ wx.showToast({
@ -184,7 +184,7 @@ Page({
}, },
onClickPraise(e){ onClickPraise(e){
console.log(e) //console.log(e)
const sIndex = e.currentTarget.dataset.index const sIndex = e.currentTarget.dataset.index
var selectItem = e.currentTarget.dataset.item var selectItem = e.currentTarget.dataset.item
const commentList = this.data.commentList const commentList = this.data.commentList
@ -198,7 +198,7 @@ Page({
// 点击查看图片 // 点击查看图片
previewImg: function (e) { previewImg: function (e) {
console.log(e.currentTarget.dataset.index); //console.log(e.currentTarget.dataset.index);
var index = e.currentTarget.dataset.index; var index = e.currentTarget.dataset.index;
var imgArr = this.data.imgArr; var imgArr = this.data.imgArr;
wx.previewImage({ wx.previewImage({
@ -246,7 +246,7 @@ Page({
// 评论输入框 // 评论输入框
bingTextAreaInput(e){ bingTextAreaInput(e){
console.log(e.detail.value) //console.log(e.detail.value)
this.setData({ this.setData({
currentComment: e.detail.value currentComment: e.detail.value
}) })

14
pages/user/index.js

@ -40,7 +40,7 @@ Page({
// 授权登录 // 授权登录
bindGetUserInfo (e) { bindGetUserInfo (e) {
console.log(e.detail.userInfo) //console.log(e.detail.userInfo)
if (e.detail.userInfo){ if (e.detail.userInfo){
let avatarUrl = e.detail.userInfo.avatarUrl let avatarUrl = e.detail.userInfo.avatarUrl
let nickName = e.detail.userInfo.nickName let nickName = e.detail.userInfo.nickName
@ -64,7 +64,7 @@ Page({
let avatarUrl = res.result.avatarUrl let avatarUrl = res.result.avatarUrl
if (nickName && avatarUrl){ if (nickName && avatarUrl){
console.log('已授权') //console.log('已授权')
this.setData({ this.setData({
userInfo: res.result, userInfo: res.result,
avatarUrl: res.result.avatarUrl, avatarUrl: res.result.avatarUrl,
@ -72,10 +72,10 @@ Page({
reAuth: true, reAuth: true,
},()=>{ },()=>{
if (store.hasPhone()) { if (store.hasPhone()) {
console.log('已经绑定手机号码') //console.log('已经绑定手机号码')
this.getMsgStatus() this.getMsgStatus()
} else { } else {
console.log('未绑定手机号码') //console.log('未绑定手机号码')
wx.redirectTo({ wx.redirectTo({
url: '/pages/register/index', url: '/pages/register/index',
}) })
@ -87,7 +87,7 @@ Page({
phone: res.result.phone || '' phone: res.result.phone || ''
}) })
} else { } else {
console.log('未授权') //console.log('未授权')
this.setData({ this.setData({
isAuth: true isAuth: true
}) })
@ -98,7 +98,7 @@ Page({
// 获取未读消息 // 获取未读消息
getMsgStatus () { getMsgStatus () {
userModel.getMyMessageTotal(res => { userModel.getMyMessageTotal(res => {
console.log(res.result.total) //console.log(res.result.total)
this.setData({ this.setData({
messageTotal: Number(res.result.total) messageTotal: Number(res.result.total)
}) })
@ -108,7 +108,7 @@ Page({
// cell点击 // cell点击
onTapItem (e) { onTapItem (e) {
const { type } = e.currentTarget.dataset const { type } = e.currentTarget.dataset
console.log(type) //console.log(type)
if (type === 'myInfo'){ if (type === 'myInfo'){
wx.navigateTo({ wx.navigateTo({
url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`, url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`,

2
project.config.json

@ -4,7 +4,7 @@
"ignore": [] "ignore": []
}, },
"setting": { "setting": {
"urlCheck": false, "urlCheck": true,
"es6": true, "es6": true,
"enhance": false, "enhance": false,
"postcss": true, "postcss": true,

20
utils/http.js

@ -18,19 +18,19 @@ class HTTP {
// let token = wx.getStorageSync(HTTPConst.TokenStoreKey) || '' // let token = wx.getStorageSync(HTTPConst.TokenStoreKey) || ''
const token = store.readToken() const token = store.readToken()
let url = this.baseUrl + params.url let url = this.baseUrl + params.url
console.log(params.url) //console.log(params.url)
if (!params.method) { if (!params.method) {
params.method = Method.GET params.method = Method.GET
} }
// token 拼接到 请求体中 // token 拼接到 请求体中
let data = params.data let data = params.data
console.log('请求Header和Body参数:') //console.log('请求Header和Body参数:')
let header = { let header = {
'token': token, 'token': token,
'content-type': 'application/json', 'content-type': 'application/json',
} }
console.log(header) //console.log(header)
console.log(data || {}) //console.log(data || {})
wx.request({ wx.request({
url: url, url: url,
data: data, data: data,
@ -38,7 +38,7 @@ class HTTP {
method: params.method, method: params.method,
dataType: 'json', dataType: 'json',
success: (res) => { success: (res) => {
console.log(res.data) //console.log(res.data)
let code = res.statusCode.toString() let code = res.statusCode.toString()
let startCode = code.charAt(0) let startCode = code.charAt(0)
if (startCode == '2') { if (startCode == '2') {
@ -53,14 +53,14 @@ class HTTP {
} }
}) })
} else { } else {
console.log('数据请求失败') //console.log('数据请求失败')
wx.showToast({ wx.showToast({
title: res.data.message || '服务器错误,请稍后重试', title: res.data.message || '服务器错误,请稍后重试',
icon: 'none' icon: 'none'
}) })
} }
} else { } else {
console.log('请求错误') //console.log('请求错误')
wx.showToast({ wx.showToast({
title: '服务器错误!', title: '服务器错误!',
icon: 'none' icon: 'none'
@ -81,8 +81,8 @@ class HTTP {
fetchAuthToken (success) { fetchAuthToken (success) {
// 获取token // 获取token
this._fetchWXCode().then(res => { this._fetchWXCode().then(res => {
console.log('啦啦啦啦凉啊') //console.log('啦啦啦啦凉啊')
console.log(res) //console.log(res)
if (!res) return if (!res) return
let params = { let params = {
url: HTTPConst.TokenURL, url: HTTPConst.TokenURL,
@ -106,7 +106,7 @@ class HTTP {
return new Promise(resolve => { return new Promise(resolve => {
wx.login({ wx.login({
success (res) { success (res) {
console.log('获取Code成功 ' + res.code) //console.log('获取Code成功 ' + res.code)
resolve(res.code) resolve(res.code)
} }
}) })

Loading…
Cancel
Save