fanp 6 years ago
parent
commit
ea42614ad0
  1. 32
      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. 11
      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

32
app.js

@ -3,37 +3,9 @@ import {HTTP} from '/utils/http.js'
const http = new HTTP()
App({
onLaunch: function (options) {
// auth.fetchAuthToken(res => {
http.fetchAuthToken(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: {
userInfo: null

3
components/segment/index.wxss

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

2
config.js

@ -1,5 +1,5 @@
const config = {
// 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 }

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

6
pages/billboards/policy/index.js

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

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

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

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

@ -1,14 +1,25 @@
<!--pages/billboards/policy/policy-list/index.wxml-->
<view class="container">
<view class="page_hd">
<view class="page_segment">
<e-segment
headerTitles="{{navs}}"
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 class="page_bd">
<rich-text nodes="{{nodes}}"></rich-text>
</view>
<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>

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

@ -1,15 +1,70 @@
/* pages/billboards/policy/policy-list/index.wxss */
.container {
position: relative;
}
.page_hd {
position: fixed;
border-bottom: 1px solid #f7f7f7;
top: 0;
height: 48px;
width: 100%;
height: 40px;
right: 0;
left: 0;
z-index: 10;
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 {
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 () {
homeModel.fetchAuthToken(res => {
console.log('Home获取token成功后再请求数据')
//console.log('Home获取token成功后再请求数据')
this.fetchHomeList()
this.fetchHomeBanner()
this.fetchHomeHot()
@ -32,7 +32,7 @@ Page({
this.fetchHomeHot()
wx.vibrateShort({
success () {
console.log('震动')
//console.log('震动')
}
})
},
@ -54,7 +54,7 @@ Page({
this.setData({
loading: false
})
console.log('啦啦啦')
//console.log('啦啦啦')
const datas = res.list
let tempDatas = []
datas.forEach(item => {
@ -88,14 +88,14 @@ Page({
// })
}
}
console.log(res)
//console.log(res)
wx.stopPullDownRefresh()
})
},
fetchHomeBanner () {
homeModel.getHomeBanner(res => {
console.log('Banner')
console.log(res)
//console.log('Banner')
//console.log(res)
const datas = res.list
let tempBanners = []
datas.forEach(item => {
@ -112,8 +112,8 @@ Page({
},
fetchHomeHot () {
homeModel.getHomeHot(res => {
console.log('Hot')
console.log(res)
//console.log('Hot')
//console.log(res)
const datas = res.list
let tempHots = []
datas.forEach(item => {
@ -129,15 +129,15 @@ Page({
},
// Banner/Hot/List事件
tapSwiperItem (e) {
console.log(e.detail)
//console.log(e.detail)
this.gotoArticePage(e.detail.id)
},
tapFocusItem (e) {
console.log(e.detail)
//console.log(e.detail)
this.gotoArticePage(e.detail.id)
},
clickListItem (e) {
console.log(e.detail)
//console.log(e.detail)
const {id, index} = e.detail
this.gotoArticePage(id)
},

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

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

14
pages/user/index.js

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

2
project.config.json

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

20
utils/http.js

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

Loading…
Cancel
Save