作者 lihongjuan

122

//app.js
App({
onLaunch: function () {
onLaunch: function() {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
... ... @@ -8,74 +8,96 @@ App({
// 获取用户信息
console.log(111)
// 添加显示条数
// wx.setTabBarItem({
// index: 4,
// text: '1',
// // iconPath: 'images/index1.png',
// // selectedIconPath: 'images/index1.png'
// })
},
changeToken() {
let url = '/api/user/codeToToken', t = this;
let url = '/api/user/codeToToken',
t = this;
wx.login({
success: function (res) {
t.post(url, { code: res.code }).then((r) => {
success: function(res) {
t.post(url, {
code: res.code
}).then((r) => {
wx.setStorageSync('token', r.userInfo.token)
})
}
})
},
post: function (url, data, showLoad) {
post: function(url, data, showLoad) {
let app = this;
/**
* 自定义post函数,返回Promise
* +-------------------
* @param {String} url 接口网址
* @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32}
* +-------------------
* @return {Promise} promise 返回promise供后续操作
*/
(showLoad == undefined || showLoad)?
wx.showLoading({
title: '加载中',
})
:''
* 自定义post函数,返回Promise
* +-------------------
* @param {String} url 接口网址
* @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32}
* +-------------------
* @return {Promise} promise 返回promise供后续操作
*/
(showLoad == undefined || showLoad) ?
wx.showLoading({
title: '加载中',
}): ''
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this,token=wx.getStorageSync('token'),header={
'content-type': 'application/x-www-form-urlencoded',
'token': token||''
},postData;
data.header ? (token ? (header['token'] = token, delete data.header):setTimeout(()=>{
let that = this,
token = wx.getStorageSync('token'),
header = {
'content-type': 'application/x-www-form-urlencoded',
'token': token || ''
},
postData;
data.header ? (token ? (header['token'] = token, delete data.header) : setTimeout(() => {
wx.navigateTo({
url: '/pages/register/register',
})
},1100)):""
}, 1100)) : ""
//网络请求
wx.request({
url: this.globalData.baseUrl + url,
data: data,
method: 'POST',
header: header,
success: function (res) {//返回取得的数据
success: function(res) { //返回取得的数据
if (res.data.code == '1') {
resolve(res.data.data);
} else if (res.data.code == '201') {
resolve(res.data);
}else {
} else {
wx.showToast({
title: res.data.msg,
icon:'none',
icon: 'none',
})
reject(res.data)
if (res.data.code == '401'){
setTimeout(()=>{
wx.navigateTo({
url: '/pages/register/register',
})
},1200)
if (res.data.code == '401') {
console.log(app.globalData.register)
if (!app.globalData.register){
setTimeout(() => {
wx.navigateTo({
url: '/pages/register/register',
})
}, 1200)
app.globalData.register = 1
return false;
}
}
}
(showLoad || showLoad == undefined) ? wx.hideLoading() : "";
(showLoad || showLoad == undefined) ? wx.hideLoading(): "";
wx.hideNavigationBarLoading()
},
fail: function (e) {
fail: function(e) {
reject('网络出错');
(showLoad || showLoad == undefined) ? wx.hideLoading() : "";
(showLoad || showLoad == undefined) ? wx.hideLoading(): "";
wx.hideNavigationBarLoading()
}
})
... ... @@ -85,7 +107,7 @@ App({
timeFormate(timestamp, timeType) {
if (timestamp) {
var timeStamp = timestamp.length == 13 ? timestamp : timestamp * 1000
var date = new Date(timeStamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
var date = new Date(timeStamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() + ' ';
... ... @@ -103,6 +125,6 @@ App({
},
globalData: {
userInfo: null,
baseUrl:'https://txgyy.jjjtech.cn/'
baseUrl: 'https://txgyy.jjjtech.cn',
}
})
\ No newline at end of file
... ...
... ... @@ -25,23 +25,25 @@
"pages/attract/articleDetail/articleDetail",
"pages/detail/detail",
"pages/dangjianwork",
"pages/dangjianwork/dangjianwork"
"pages/dangjianwork/dangjianwork",
"pages/attract/dangjiandetail/dangjiandetail",
"pages/attract/dangjianbannerdetail/dangjianbannerdetail"
],
"tabBar": {
"list": [
{
"pagePath": "pages/dangjianwork/dangjianwork",
"text": "党建工作",
"iconPath": "/images/01_nav@2x.png",
"selectedIconPath": "/images/01_nav_fill@2x.png"
},
{
"pagePath": "pages/matrix/matrix",
"text": "企业矩阵",
"iconPath": "/images/01_nav@2x.png",
"selectedIconPath": "/images/01_nav_fill@2x.png"
},
{
"pagePath": "pages/dangjianwork/dangjianwork",
"text": "党建工作",
"iconPath": "/images/graydang.png",
"selectedIconPath": "/images/dang.png"
},
{
"pagePath": "pages/attract/attract",
"text": "政策宣传",
"iconPath": "/images/02_nav@2x.png",
... ...
/**app.wxss**/
@font-face {
font-family: 'iconfont'; /* project id 1064555 */
src: url('//at.alicdn.com/t/font_1064555_yx59k1gs2ch.eot');
src: url('//at.alicdn.com/t/font_1064555_yx59k1gs2ch.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_1064555_yx59k1gs2ch.woff2') format('woff2'),
url('//at.alicdn.com/t/font_1064555_yx59k1gs2ch.woff') format('woff'),
url('//at.alicdn.com/t/font_1064555_yx59k1gs2ch.ttf') format('truetype'),
url('//at.alicdn.com/t/font_1064555_yx59k1gs2ch.svg#iconfont') format('svg');
@font-face {font-family: "iconfont";
src: url('//at.alicdn.com/t/font_1064555_9hqi8uo5w7e.eot?t=1558076740553'); /* IE9 */
src: url('//at.alicdn.com/t/font_1064555_9hqi8uo5w7e.eot?t=1558076740553#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAA2kAAsAAAAAGHgAAA1UAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCGKAqeSJgnATYCJANoCzYABCAFhG0HgiQbWRQzkpJWKbL/+oCOe7EFlUqoTmYOOYUbYjnWF1387Q9TZppvKwU6YO2CbmHXv+7yxTUYMp3PTu1kfz+Ukofv92vnfvE1RUJhE7ORyHQtQVNlaJ1Myg89ok2bvT3sDotbRYl4hRKIOCkcrcehHhGnEqUJqURJVSTtiwlhPq9bb2idtA6hojKabn0hqYmEFdZz4/gmEmBuGcDB5P5yqhlzqMczZBg6cSeN10v+nCP5ZDmLl+EiV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9hqi8uo5w7e.woff?t=1558076740553') format('woff'),
url('//at.alicdn.com/t/font_1064555_9hqi8uo5w7e.ttf?t=1558076740553') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('//at.alicdn.com/t/font_1064555_9hqi8uo5w7e.svg?t=1558076740553#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
... ... @@ -17,6 +17,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-huangguan:before {
content: "\e60a";
}
.icon-fenxiang:before {
content: "\e600";
}
... ... @@ -108,6 +112,23 @@
.icon-tongzhi:before {
content: "\e608";
}
.icon-icon-test:before {
content: "\e609";
}
.none-box {
font-size: 30rpx;
color: #8f8f8f;
... ...
... ... @@ -93,6 +93,8 @@ Page({
title: '已取消点赞',
icon: 'none'
})
console.log(t.data.comments)
type == '2'?(
t.data.comments[index].is_like = r.is_like,
t.data.comments[index].likes = r.likes,
... ...
... ... @@ -20,14 +20,13 @@ Page({
list:[],
ifData:!1,
noMore:!1,
imgUrls: ['http://txgyy.jjjtech.cn/uploads/20190409/7f686056aea2291e40351b38e8ef9a08.png',
'http://txgyy.jjjtech.cn/uploads/20190409/7f686056aea2291e40351b38e8ef9a08.png'
],
imgUrls: [],
indicatorDots: false,
autoplay: false,
interval: 2000,
duration: 1000,
currentSwiper: 0,
top:''
},
... ... @@ -47,6 +46,34 @@ Page({
}), this.policyType(), this.getBanner();
},
//获取轮播图
getopbanner(){
let that=this;
let url = '/api/Article/getAttractInvestmentList';
app.post(url, {}).then(r => {
console.log(r)
this.setData({
imgUrls: r
})
if (r.length == 0) {
console.log(73478)
that.setData({
top: '100rpx'
})
} else {
console.log(345)
that.setData({
top: '390rpx'
})
}
})
console.log(this.data.imgUrls)
},
//轮播图
swiperChange: function (e) {
this.setData({
... ... @@ -58,13 +85,15 @@ Page({
app.post(url,{}).then(r=>{
console.log(r)
this.setData({
banner: r.banner
banner: r.banner,
})
})
},
policyType(){
let url = '/api/Article/category',a = this;
app.post(url,{header: true}).then((res)=>{
console.log(res)
a.setData({
policyList:res,
category_id: res[0].id
... ... @@ -108,8 +137,10 @@ Page({
})
},
bannerDetail(e){
let url = e.currentTarget.dataset.src
console.log(url)
wx.navigateTo({
url: '/pages/attract/detail/detail?id='+e.currentTarget.id,
url: '/pages/attract/detail/detail?id='+e.currentTarget.dataset.id,
})
},
/**
... ... @@ -123,7 +154,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getopbanner()
},
/**
... ...
... ... @@ -5,11 +5,11 @@
</view> -->
<view class="swiper_image">
<view class="swiper_image" wx:if="{{imgUrls.length!=0}}">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange">
<block wx:for="{{imgUrls}}" wx:key="doct">
<swiper-item style="border-radius:10px;">
<image src="{{item}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" />
<swiper-item style="border-radius:10px;" >
<image src="{{item.banner}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" data-src="{{item.url}}" data-id="{{item.id}}" bindtap='bannerDetail'/>
</swiper-item>
</block>
</swiper>
... ... @@ -27,7 +27,7 @@
<view class='menu_content'>
<scroll-view class='menu_items' scroll-x="true" scroll-left="{{navScrollLeft}}" scroll-with-animation="{{true}}">
<block wx:for='{{policyList}}' wx:key=''>
<view class='menu_item {{currentTab== index?"active":""}}' bindtap='switchTab' data-current='{{index}}' id='{{item.id}}'>
<view class='menu_item {{currentTab== index?"nameactive":""}}' bindtap='switchTab' data-current='{{index}}' id='{{item.id}}'>
{{item.name}}
</view>
</block>
... ... @@ -39,7 +39,7 @@
</view>
<!-- 新闻 -->
<view class="news_detail_container" hidden='{{!ifData}}' style="height:{{windowHeight-205}}px;">
<view class="news_detail_container" hidden='{{!ifData}}' style="height:{{windowHeight-205}}px;margin-top:{{top}}">
<view class='news_detail_items'>
<block wx:for='{{list}}' wx:key=''>
<navigator class='news_detail_item' url='/pages/attract/articleDetail/articleDetail?id={{item.id}}' id="{{item.id}}">
... ...
... ... @@ -28,7 +28,7 @@ page {
.menu_content {
display: flex;
position: fixed;
top: 310rpx;
/* top: 310rpx; */
left: 0;
width: 100%;
z-index: 101;
... ... @@ -88,7 +88,7 @@ page {
.news_detail_container {
background: #fff;
margin-top: 390rpx;
/* margin-top: 390rpx; */
position: relative;
}
... ... @@ -172,46 +172,29 @@ page {
/* 轮播图 */
.swiper_image {
/* width: 686rpx;
height: 300rpx; */
font-size: 0;
/* margin: 30rpx auto 0; */
position: relative;
/* box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11);
border-radius: 10px; */
}
.swiper_item_img {
/* border-radius: 10rpx; */
/* height: 300rpx; */
}
.swiper_image image {
width: 100%;
height: 100%;
/* box-shadow:0px -1px 6px 0px rgba(212,137,96,0.11); */
/* border-radius: 10px; */
}
.swiper_item_img swiper-item {
/* width: 686rpx; */
/* height: 300rpx; */
/* box-shadow: 0px -1px 6px 0px rgba(212, 137, 96, 0.11); */
/* display: felx; */
/* align-items: center;
justify-content: center;
border-radius: 10px; */
border-radius:0!important;
}
.swiper_item_img swiper-item image {
width: 100%;
height: 100%;
/* border-radius: 10px; */
}
.dots {
/* width: 156rpx; */
height: 36rpx;
display: flex;
flex-direction: row;
... ... @@ -239,5 +222,7 @@ page {
height: 16rpx;
border-radius: 50%;
background-color: #fff;
}
.nameactive{
color:#169BD5
}
\ No newline at end of file
... ...
// pages/attract/dangjianbannerdetail/dangjianbannerdetail.js
const app = getApp()
const wxParse = require('../../../wxParse/wxParse.js')
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
wx.setNavigationBarTitle({
title: options.name,
})
wxParse.wxParse('contentHtml', 'html', options.content, this, 5);
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {},
"navigationBarTitleText": "党建工作",
"navigationBarBackgroundColor": "#169BD5",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": true
}
\ No newline at end of file
... ...
<import src="/wxParse/wxParse.wxml" />
<view class="content">
<template is="wxParse" data="{{wxParseData:contentHtml.nodes}}" />
</view>
... ...
.content{
padding: 32rpx;
color: #333;
font-size:20rpx 30rpx
}
\ No newline at end of file
... ...
// pages/attract/articleDetail/articleDetail.js
const A = getApp();
const wxParse = require('../../../wxParse/wxParse.js')
Page({
/**
* 页面的初始数据
*/
data: {
comments: [],
noMore: !0,
page: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let t = this;
t.setData({
id: options.id
}), t.d(options.id), t.c();
},
d(id) {
let url = 'api/Party/detail', params = {
id: id
}, t = this;
A.post(url, params).then((r) => {
console.log(r)
t.setData({
detail: r
})
wxParse.wxParse('contentHtml', 'html', r.content, t, 5);
})
},
comment() {
this.setData({
startComment: true
})
},
outFocus() {
this.setData({
startComment: false
})
},
c() {
let url = '/api/Party/getCommentList', t = this, params = {
id: t.data.id,
page: t.data.page
};
A.post(url, params).then((r) => {
t.setData({
comments: t.data.comments.concat(r.data),
total: r.total,
noMore: r.last_page == r.current_page ? !0 : !1
})
})
},
s() {
let t = this, params = {
id: t.data.id,
content: t.data.content
}, url = '/api/Party/setComment';
t.data.parent_id ? params.parent_id = t.data.parent_id : '';
!t.data.subing ? (params.content ? (t.setData({ subing: true }), A.post(url, params, false).then((r) => {
t.setData({
content: '',
parent_id: '',
comments: [],
page: 1,
startComment: false,
subing: false
})
t.c();
}).catch(() => {
t.setData({ subing: false })
})) : wx.showToast({
title: '请输入评论',
icon: 'none'
})) : ""
},
zan(e) {
let url = '/api/interact/setLike', params = {
object_id: e.currentTarget.id,
type: e.currentTarget.dataset.type
}, index = e.currentTarget.dataset.indx, t = this, type = e.currentTarget.dataset.type;
A.post(url, params).then((r) => {
r.is_like == 1 ? wx.showToast({
title: '点赞成功',
icon: 'none'
}) : wx.showToast({
title: '已取消点赞',
icon: 'none'
})
console.log(r)
type == '2' ? (
t.data.comments[index].is_like = r.is_like,
t.data.comments[index].likes = r.likes,
t.setData({
comments: t.data.comments
})) : t.setData({
'detail.is_like': r.is_like
})
})
},
subComments(e) {
this.setData({
content: e.detail.value
})
},
parentSet(e) {
this.setData({
parent_id: e.currentTarget.id,
startComment: true
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let t = this;
!t.data.noMore ? (t.setData({
page: t.data.page + 1
}), t.c()) : ""
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
let that = this;
return {
title: that.data.detail.title, // 转发后 所显示的title
path: '/pages/attract/articleDetail/articleDetail?id=' + that.data.id, // 相对的路径
success: (res) => {
},
fail: function (res) {
// 分享失败
console.log(res)
}
}
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "党建工作"
}
\ No newline at end of file
... ...
<view class='title margin_set'>{{detail.title}}</view>
<view class='content margin_set'>
<view class='article'>
<view class='from' hidden='{{!detail.source}}'>来源:{{detail.source}}</view>
<view class='time ar-time'>{{detail.create_time_text}}</view>
</view>
<import src="/wxParse/wxParse.wxml" />
<template is="wxParse" data="{{wxParseData:contentHtml.nodes}}" />
</view>
<view class='comment_box' >
<view class='comment_title' hidden='{{total==0}}'>评论</view>
<view class='null_box' hidden='{{total>0}}'>暂无相关评论</view>
<view class='comment_item' wx:for='{{comments}}' wx:key=''>
<view class='left_box'>
<image class='head_img' src='{{item.avatar}}'></image>
</view>
<view class='comment_content_box' bindtap='parentSet' id='{{item.id}}'>
<view class='comment_name'>{{item.nickname}}</view>
<view class='comment_content'>{{item.content}}</view>
<view class='list_state_box'>
<view class='time'>{{item.create_time_text}}</view>
<view class='list_icon'>
<view catchtap='zan' class='zan_box' data-indx="{{index}}" id='{{item.id}}' data-type='2'>
<text class='time'>{{item.likes}}</text>
<text class='iconfont icon-zan zan active' wx:if="{{item.is_like}}"></text>
<text class='iconfont icon-zan zan' wx:else></text>
</view>
</view>
</view>
</view>
<view class='sec_comments' wx:if="{{item.child.length>0}}">
<view class='sec_comment' wx:for='{{item.child}}' wx:for-item='sec' wx:key=''>
<view class='text_bottom'>
<text class='color_blue'>{{sec.nickname}}:</text>{{sec.content}}
</view>
</view>
<view class='underline'></view>
</view>
</view>
</view>
<view class='bottom_box' hidden='{{startComment}}'>
<view class="label_item" bindtap='comment'>
<text class='iconfont icon-bianji1 icon'></text>
<view>{{content||"写评论"}}</view>
</view>
<view class='label_icon_box'>
<view class='iconfont icon-pinglun icon pinglun'>
<text class='count' hidden='{{total==0}}'>{{total}}</text>
</view>
<view class='iconfont icon-fenxiang icon fenxiang'>
<button open-type='share'></button>
</view>
<text class='iconfont icon-zan icon active' style='font-size: 48rpx;' wx:if="{{detail.is_like}}" catchtap='zan' id='{{detail.id}}' data-type='4'></text>
<text class='iconfont icon-zan icon' wx:else style='font-size: 48rpx;' catchtap='zan' id='{{detail.id}}' data-type='4'></text>
</view>
</view>
<view class='bottom_box' hidden='{{!startComment}}'>
<view class='bottom_box_input'>
<input placeholder='发表评论...' value='{{content}}' focus='{{startComment}}' bindinput='subComments' bindblur='outFocus' cursor-spacing='10' class='comments' />
<!-- <view class='sub_box comments' bindtap='comment' hidden='{{startComment}}'>{{content||"发表评论..."}}</view> -->
</view>
<view class='bottom_box_text' bindtap='s'>
发表
</view>
</view>
\ No newline at end of file
... ...
/* pages/attract/articleDetail/articleDetail.wxss */
.title{
font-size: 34rpx;
color: #333;
font-weight: bold;
padding: 52rpx 0 40rpx;
}
.margin_set{
margin: 0 46rpx;
}
.content image{
width: 100%!important;
}
.content{
padding-bottom: 40rpx;
}
.article{
margin-bottom: 20rpx;
display: flex;
font-size: 28rpx;
color: #666;
font-weight: normal;
}
.from{
margin-right: 30rpx;
}
/* */
.comment_box {
padding: 30rpx 30rpx 180rpx;
background: #fff;
box-sizing: border-box;
margin-top: 16rpx;
border-top: 16rpx solid #f5f5f5;
}
.comment_title {
font-size: 34rpx;
font-weight: bold;
color: #333;
border-bottom: 1rpx solid #f5f5f5;
padding-bottom: 30rpx;
text-align: center;
}
.comment_item {
display: flex;
align-items: flex-start;
padding: 30rpx 0;
margin-bottom: 16rpx;
background: #fff;
border-bottom: 1rpx solid #f5f5f5;
flex-wrap: wrap;
}
.comment_item:last-child {
border-bottom: 0;
}
.head_img {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
}
.comment_content_box {
width: 85%;
}
.comment_content {
font-size: 28rpx;
color: #333;
margin-top: 10rpx;
}
.comment_name,.color_blue {
font-size: 24rpx;
color: #45609f;
}
.time {
font-size: 24rpx;
color: #999;
}
.ar-time{
display: flex;
align-items: center;
}
.wxParse-img{
max-width:100%;
overflow: hidden;
}
.zan {
font-size: 40rpx;
margin-left: 10rpx;
}
.list_info_box {
font-size: 24rpx;
color: #b3b3b3;
}
.list_state_box {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 26rpx;
color: #999;
margin-top: 15rpx;
}
.list_comment_box {
background: #ebecf0;
font-size: 24rpx;
color: #6b7e91;
margin-top: 28rpx;
}
.comment_list {
border-bottom: 1rpx solid #fff;
padding: 10rpx 17rpx;
}
/* */
.null_box {
width: 100%;
height: 110rpx;
}
.bottom_box {
width: 100%;
height: 96rpx;
position: fixed;
left: 0;
bottom: 0;
background: #fff;
display: flex;
align-items: center;
padding: 0 30rpx;
box-shadow:0rpx 0rpx 12rpx rgba(0,0,0,0.05);
}
.label_item {
width: 340rpx;
height: 64rpx;
background: rgba(247, 247, 247, 1);
border: 1rpx solid rgba(238, 238, 238, 1);
border-radius: 206rpx;
display: flex;
align-items: center;
font-size: 28rpx;
color: #666;
padding: 5rpx 20rpx;
margin-left: 30rpx;
}
.zan.active{
color: #45609f;
}
.icon-bianji1{
margin-right: 10rpx;
}
.label_icon_box{
width: 40%;
display: flex;
align-items: center;
justify-content: space-around;
padding: 0 30rpx;
}
.icon {
font-size: 40rpx;
color: #666666;
}
.icon.active{
color: #45609f;
}
.pinglun{
position: relative;
}
.pinglun .count{
background: #FF3131;
color: #FFF;
font-size: 16rpx;
position: absolute;
border-radius: 16rpx;
padding: 4rpx 10rpx;
right: 6rpx;
top: -10rpx;
transform: translateX(90%);
}
.fenxiang{
position: relative;
}
.fenxiang button{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
.bottom_box{
width: 750rpx;
/* min-height: 120rpx; */
display: flex;
align-items: center;
justify-content: center;
background: #fff;
position: fixed;
bottom: 0;
border-top: 2rpx solid #F5F5F5;
padding: 20rpx 0;
z-index: 10;
}
.comments{
border:1rpx solid #F5F5F5;
font-size: 28rpx;
padding: 15rpx;
max-height: 130rpx;
}
.bottom_box_input{
width: 608rpx;
display: flex;
background:rgba(247,247,247,1);
border:2px solid rgba(238,238,238,1);
opacity:1;
border-radius:8rpx;
}
.bottom_box_input input{
width: 100%;
height: 64rpx;
padding: 0 32rpx;
font-size: 28rpx;
}
.bottom_box_input::placeholder{
color: #CCCCCC;
}
.bottom_box_text{
margin-left: 16rpx;
font-size:32rpx;
font-family:PingFang SC;
font-weight:600;
line-height:44rpx;
color:rgba(51,51,51,1);
opacity:1;
}
.item_box{
margin-top: 16rpx;
padding-bottom: 120rpx;
}
.sub_box{
color: #666;
}
.sec_comments{
width: 85%;
margin-left: auto;
-webkit-margin-start: auto;
}
.text_bottom{
margin-top: 22rpx;
background:rgba(245,245,245,1);
border-radius:8rpx;
padding: 16rpx;
font-size:24rpx;
font-family:PingFang SC;
font-weight:400;
line-height:34rpx;
color:rgba(51,51,51,1);
opacity:1;
}
.null_box{
height: 120rpx;
font-size: 28rpx;
color: #666;
display: flex;
align-items: center;
justify-content: center;
}
... ...
... ... @@ -19,7 +19,7 @@ Page({
},
d(id){
let d = this, url ='/api/Article/getAttractInvestment',p={
park:id,
id:id,
header: true
};
t.post(url, p).then((r)=>{
... ...
// pages/dangjianwork.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pages/dangjianwork.wxml-->
<text>pages/dangjianwork.wxml</text>
... ...
/* pages/dangjianwork.wxss */
\ No newline at end of file
... ...
// pages/attract/attract.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
policyList: [
// {
// "id": "",
// "name": "全部",
// "weigh": "权重",
// "status": "状态"
// }
],
navScrollLeft: 0,
currentTab: 0,
page: 1,
list: [],
ifData: !1,
noMore: !1,
top:''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.getSystemInfo({
success: (res) => {
this.setData({
pixelRatio: res.pixelRatio,
windowHeight: res.windowHeight,
windowWidth: res.windowWidth,
tabWidth: res.windowWidth - 39
})
}
}), this.policyType(), this.getBanner();
},
//获取轮播图
getopbanner() {
let that=this
let url = '/api/Article/getSlideList';
app.post(url, {}).then(r => {
console.log(r)
this.setData({
imgUrls: r
})
if(r.length==0){
console.log(73478)
that.setData({
top:'100rpx'
})
}else{
console.log(345)
that.setData({
top:'390rpx'
})
}
})
console.log(that.data.top)
console.log(this.data.imgUrls)
},
getBanner() {
let url = '/api/Article/getAttractInvestmentBanner';
app.post(url, {}).then(r => {
this.setData({
banner: r.banner
})
})
},
policyType() {
let url = '/api/Party/category', a = this;
app.post(url, { header: true }).then((res) => {
a.setData({
policyList: res,
category_id: res[0].id
})
a.getList(res[0].id, 1)
})
},
chooseLocation() {
wx.chooseLocation({
success: function (res) { },
})
},
switchTab(e) {
let b = this, singlewidth = b.data.tabWidth / 5, cur = e.currentTarget.dataset.current;
b.setData({
navScrollLeft: (cur - 2) * singlewidth,
category_id: e.currentTarget.id,
page: 1,
list: []
}), b.data.currentTab != cur ? b.setData({
currentTab: cur
}) : '', b.getList(e.currentTarget.id, 1)
},
getList(id, page) {
let e = this, url = '/api/Party/index', params = {
category_id: id,
page: page,
header: true
}, list = page == 1 ? [] : t.data.list; app.post(url, params).then((res) => {
e.setData({
list: list.concat(res.data),
page: res.current_page,
lastPage: res.last_page,
ifData: !0,
noMore: res.last_page == res.per_page ? !0 : !1
})
!e.data.list.concat(res.data).length ? e.setData({
ifData: !1
}) : ''
wx.stopPullDownRefresh();
})
},
bannerDetail(e) {
let url = e.currentTarget.dataset.src
console.log(url)
wx.navigateTo({
//url: '/' + url + '?id=' + e.currentTarget.dataset.id,
url: '/pages/attract/dangjianbannerdetail/dangjianbannerdetail?name=' + e.currentTarget.dataset.title + '&content=' + e.currentTarget.dataset.content
})
},
/**
* 生命周期函数--监听页面初次渲染完成 v
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getopbanner()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
let t = this;
t.setData({
page: 1
})
t.getList(t.data.category_id, 1)
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let t = this;
!t.data.noMore ? (t.setData({
page: t.data.page + 1
}), t.getList(t.data.category_id, t.data.page)) : wx.showToast({
title: '没有更多了',
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {},
"navigationBarTitleText": "党建工作",
"navigationBarBackgroundColor": "#169BD5",
"navigationBarTextStyle": "white",
"enablePullDownRefresh": true
}
\ No newline at end of file
... ...
<!--pages/attract/attract.wxml-->
<view class='top_view'>
<!-- <view class='top_banner'>
<image src='{{banner}}' width='100%' mode='widthFix' bindtap='bannerDetail' id='1'></image>
</view> -->
<view class="swiper_image" wx:if="{{imgUrls.length!=0}}">
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" class="swiper_item_img" bindchange="swiperChange">
<block wx:for="{{imgUrls}}" wx:key="doct">
<swiper-item style="border-radius:10px;" >
<image src="{{item.image}}" data-index='{{index}}' class="slide-image" bindtap='viewImg' width="355" height="150" data-src="{{item.url}}" data-id="{{item.id}}" bindtap='bannerDetail' data-title="{{item.title}}" data-content="{{item.content}}"/>
</swiper-item>
</block>
</swiper>
<view class="dots">
<block wx:for="{{imgUrls}}" wx:key="">
<view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
</block>
</view>
</view>
<!-- 菜单按钮 -->
<view class='menu_content'>
<scroll-view class='menu_items' scroll-x="true" scroll-left="{{navScrollLeft}}" scroll-with-animation="{{true}}">
<block wx:for='{{policyList}}' wx:key=''>
<view class='menu_item {{currentTab== index?"nameactive":""}}' bindtap='switchTab' data-current='{{index}}' id='{{item.id}}'>
{{item.name}}
</view>
</block>
</scroll-view>
<!-- <view class='paixun'>
<image src='/images/shaixuan@3x.png' mode='widthFix'></image>
</view> -->
</view>
</view>
<!-- 新闻 -->
<view class="news_detail_container" hidden='{{!ifData}}' style="height:{{windowHeight-205}}px;margin-top:{{top}}">
<view class='news_detail_items'>
<block wx:for='{{list}}' wx:key=''>
<navigator class='news_detail_item' url='/pages/attract/dangjiandetail/dangjiandetail?id={{item.id}}' id="{{item.id}}" >
<view class='new_info'>
<view class='new_title'><text class='recommond' wx:if='{{item.recommend}}'>推荐</text>{{item.title}}</view>
<view class='new_time_address'>
<view class='form' wx:if="{{item.keywords}}">{{item.keywords}}</view>
<view class='time'>{{item.create_time_text}}</view>
</view>
</view>
<view class='new_info_image' wx:if="{{item.thumb_image}}">
<image src='{{item.thumb_image}}' mode='widthFix'></image>
</view>
</navigator>
</block>
</view>
</view>
<view class="none-box" hidden="{{ifData}}">
<view>暂无相关信息</view>
</view>
\ No newline at end of file
... ...
/* pages/attract/attract.wxss */
page{
background: #FFF;
}
.top_banner image{
width: 100%;
}
.top_view{
background: #F7F7F7;
position:fixed;
top:0;
left:0;
width:100%;
z-index:101;
}
/* .top_banner{
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 101;
} */
.menu_content{
display: flex;
position: fixed;
/* top: 310rpx; */
left: 0;
width: 100%;
z-index: 101;
border-top: 8rpx solid #f5f5f5;
}
.menu_items{
display: flex;
font-size: 26rpx;
background: #FFF;
border-bottom: 2rpx solid #f5f5f5;
position: relative;
flex: 1;
overflow: hidden;
white-space: nowrap;
line-height: 74rpx;
}
.menu_item{
padding:0 33rpx;
display: inline-block;
text-align: center;
}
/* .menu_item:first-child{
padding-left: rpx;
} */
.menu_item.active{
color: #169BD5;
}
.paixun{
position: relative;
display: flex;
align-items: center;
height: 74rpx;
width: 78rpx;
justify-content: center;
background-color: #FFF;
}
.paixun image{
width: 32rpx;
}
.paixun:before{
content:'';
height: 32rpx;
width: 2rpx;
background-color: #f5f5f5;
top: 50%;
left: 0;
position: absolute;
transform: translateY(-50%);
}
.news_detail_container{
background: #FFF;
/* margin-top: 390rpx; */
position: relative;
}
.news_detail_items{
margin: 0 32rpx;
}
.news_detail_item{
border-bottom:2rpx solid #f5f5f5;
display: flex;
padding: 24rpx 0;
}
.news_detail_item:last-child{
border: none;
}
.new_info_image{
width: 248rpx;
height: 146rpx;
border-radius: 8rpx;
overflow: hidden;
margin-left: 32rpx;
}
.new_info_image image{
width: 100%;
}
.new_info{
flex: 1;
height: 146rpx;
display: flex;
flex-flow: column;
justify-content: space-between;
font-size: 32rpx;
color: #333;
}
.new_title{
display: -webkit-box;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp:2;
}
.new_time_address{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 22rpx;
color: #999;
}
.zhaoshang_desc{
margin: 0 30rpx;
}
.none-box{
top: 600rpx;
}
.recommond{
font-size: 20rpx;
padding:4rpx 8rpx;
background-color: #E80404;
color: #fff;
display: inline-flex;
align-items: center;
justify-content: center;
width: 60rpx;
box-sizing: border-box;
border-radius: 8rpx;
margin-right: 10rpx;
position: relative;
top: -4rpx;
}
.swiper_image {
font-size: 0;
position: relative;
}
.swiper_image image {
width: 100%;
height: 100%;
}
.swiper_item_img swiper-item {
border-radius:0!important;
}
.swiper_item_img swiper-item image {
width: 100%;
height: 100%;
}
.dots {
height: 36rpx;
display: flex;
flex-direction: row;
position: absolute;
justify-content: center;
left: 0;
right: 0;
bottom: 20rpx;
}
/*未选中时的小圆点样式 */
.dot {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
margin-right: 26rpx;
background-color: #b9c0f7;
}
/*选中以后的小圆点样式 */
.active {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
background-color: #fff;
}
.nameactive{
color:#169BD5
}
\ No newline at end of file
... ...
... ... @@ -18,7 +18,8 @@ Page({
page:1,
ifData:!1,
navScrollLeft:0,
noMore:!0
noMore:!0,
beautiful_switch:0
},
changeShow(){
this.setData({
... ... @@ -38,6 +39,7 @@ Page({
getTypes(){
let url = '/api/Company/getCompanyCategory';
app.post(url,{}).then((res)=>{
console.log(res)
this.setData({
typeList: res
})
... ... @@ -53,10 +55,11 @@ Page({
})
},
// 获取矩阵列表
getCompanyList(category_id,park){
getCompanyList(beautiful_switch,category_id,park){
let url = '/api/Company/index', b = this, companyList = b.data.page > 1 ? b.data.companyList : [];
let params = {
category_id: category_id||'',
beautiful_switch: beautiful_switch||'0',
category_id: category_id||'0',
park:park||'',
page: b.data.page
}
... ... @@ -95,13 +98,14 @@ Page({
tabCharge(e) {
let s = this, singleWidth = s.data.windowWidth / 7, cur = e.currentTarget.dataset.index+1;
s.setData({
beautiful_switch: e.currentTarget.dataset.beau,
companyList:[],
page:1,
current: e.currentTarget.dataset.current,
category_id: e.currentTarget.dataset.current,
navScrollLeft:(cur-2)*singleWidth
})
s.getCompanyList(e.currentTarget.dataset.current, s.data.park)
s.getCompanyList(e.currentTarget.dataset.beau,e.currentTarget.dataset.current, s.data.park)
},
/**
... ... @@ -109,13 +113,41 @@ Page({
*/
onLoad: function(options) {
let a = this;
a.getTypes(), a.getAreas(), a.getCompanyList(), wx.getSystemInfo({
a.changeToken(),a.getUserInfo(),a.getTypes(), a.getAreas(), a.getCompanyList(), wx.getSystemInfo({
success: function (t) {
a.setData({
scrollHeight: t.windowHeight-50,
windowWidth: t.windowWidth
});
}
});
},
getUserInfo() {
let d = this, url = '/api/user/index', params = {
header: true
}; app.post(url, params).then((r) => {
console.log(84352784356347865)
console.log(r.noticeNum)
d.setData({ userInfo: r.userInfo, noticeNum: r.noticeNum })
if (r.noticeNum!=0){
console.log(723457717342345325)
let num = r.noticeNum
num = num.toString()
wx.setTabBarBadge({
index: 4,
text: num
})
}else{
wx.hideTabBarRedDot({
index: 4,
})
}
})
},
... ... @@ -130,7 +162,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
... ... @@ -153,7 +185,7 @@ Page({
onPullDownRefresh: function() {
let t = this;t.setData({
page: 1,
}), t.getCompanyList(t.data.category_id, t.data.park);
}), t.getCompanyList(t.data.beautiful_switch,t.data.category_id, t.data.park);
},
/**
... ...
... ... @@ -8,9 +8,15 @@
</view> -->
<scroll-view class='tab_box' scroll-left="{{navScrollLeft}}" scroll-x='true' scroll-with-animation='true'>
<view class="tab_item {{current==0?'active':''}}" data-current='0' bindtap='tabCharge'>全部</view>
<view class="tab_item {{current==0?'active':''}}" data-current='0' bindtap='tabCharge' data-beau="0">全部</view>
<view class="tab_item zuiactive" data-current='0' bindtap='tabCharge' data-beau="1">
最美企业
<view class="iconfont icon-huangguan"></view>
</view>
<block wx:for="{{typeList}}" wx:key=''>
<view class="tab_item {{current == item.id?'active':''}}" data-current='{{item.id}}' bindtap='tabCharge' data-index='{{index}}'>{{item.name}}</view>
<view class="tab_item {{current == item.id?'active':''}}" data-current='{{item.id}}' bindtap='tabCharge' data-index='{{index}}' data-beau="0">{{item.name}}</view>
</block>
</scroll-view>
<view class='iconfont icon-gengduo1' bindtap='changeShow'></view>
... ... @@ -37,16 +43,22 @@
<navigator class='list_item' wx:for='{{companyList}}' wx:key='' url="/pages/matrix/company/company?id={{item.id}}"
open-type="navigate"
hover-class="other-navigator-hover">
<image class='label_img' hidden='{{!item.recommend_switch}}' src='/images/zuire@2x.png'></image>
<text class='label_info' hidden='{{!item.recommend_switch}}'>推荐</text>
<image class='label_img' hidden='{{!item.recommend_switch}}' src='/images/zuire@2x.png'></image>
<text class='label_info' hidden='{{!item.recommend_switch}}'>推荐</text>
<image src='{{item.logo_image}}' mode='aspectFill' class='top_logo'></image>
<view class='list_content_box'>
<view class='list_title_box'>
<!-- <image src='{{item.logo_image}}'></image> -->
<text>{{item.name}}</text>
</view>
<view class='list_content'>{{item.excerpt}}</view>
<view class='iconfont icon-gengduo'></view>
<!-- <view class='iconfont icon-gengduo'></view> -->
</view>
</navigator>
</view>
... ...
... ... @@ -91,6 +91,24 @@ page {
text-align: center;
}
.label_imgbe {
position: absolute;
right: 0;
top: 44rpx;
width: 80rpx;
height: 32rpx;
}
.label_infobe {
position: absolute;
right: -4rpx;
top: 9rpx;
width: 80rpx;
height: 32rpx;
font-size: 16rpx;
color: #fff;
text-align: center;
}
.list_img {
width: 128rpx;
height: 128rpx;
... ... @@ -143,6 +161,7 @@ page {
margin-bottom: 20rpx;
box-shadow: 0 10rpx 0 0 #62bae0;
position: relative;
padding-bottom: 10rpx;
}
... ... @@ -153,7 +172,7 @@ page {
.list_item .top_logo {
width: 100%;
/* height: 336rpx; */
height:195rpx;
height:212rpx;
}
.list_title_box {
... ... @@ -180,11 +199,11 @@ page {
font-size: 26rpx;
color: #666;
/* height: 68rpx; */
height:31rpx;
/* height:30rpx; */
margin-top: 4rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
-webkit-line-clamp: 1;
overflow: hidden;
text-overflow: ellipsis;
}
... ... @@ -254,4 +273,18 @@ page {
top: 10rpx;
right: -30rpx;
transition: 1s;
}
.zuiactive{
color:#e80404;
font-size: 34rpx;
/* position: relative */
}
.icon-huangguan{
color:#FFB300;
position: absolute;
top:-21rpx;
left:18rpx;
font-size:39rpx;
transform: rotate(-15deg)
}
\ No newline at end of file
... ...
... ... @@ -12,7 +12,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
renzheng(e) {
let type = e.currentTarget.dataset.type;
... ... @@ -40,6 +40,22 @@ Page({
header: true
}; t.post(url,params).then((r)=>{
d.setData({ userInfo: r.userInfo, noticeNum: r.noticeNum})
console.log('13264632654237', r.noticeNum)
if (r.noticeNum != 0) {
console.log(723457717342345325)
let num = r.noticeNum
num = num.toString()
wx.setTabBarBadge({
index: 4,
text: num
})
}else{
wx.hideTabBarRedDot({
index: 4,
})
}
})
},
btn_post() {
... ... @@ -85,6 +101,7 @@ Page({
onShow: function () {
this.checkstatus();
this.getUserInfo()
},
/**
* 生命周期函数--监听页面隐藏
... ...