作者 朱振飞

项目初始化

... ... @@ -4,36 +4,63 @@ App({
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: 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)
}
}
})
},
post: function (url, data, showLoad) {
/**
* 自定义post函数,返回Promise
* +-------------------
* @param {String} url 接口网址
* @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32}
* +-------------------
* @return {Promise} promise 返回promise供后续操作
*/
if (showLoad == undefined || showLoad){
wx.showLoading({
title: '加载中',
})
}
wx.showNavigationBarLoading()
var promise = new Promise((resolve, reject) => {
//init
let that = this;
let postData = data;
//网络请求
wx.request({
url: this.globalData.baseUrl + url,
data: postData,
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'XX-Token': wx.getStorageSync('token')
},
success: function (res) {//返回取得的数据
if (res.data.code == '1') {
resolve(res.data.data);
} else if (res.data.code == '201') {
resolve(res.data);
} else {
wx.showModal({
title: '提示',
content: res.data.msg,
showCancel: false
})
reject(res.data)
}
(showLoad || showLoad == undefined) ? wx.hideLoading() : "";
wx.hideNavigationBarLoading()
},
fail: function (e) {
reject('网络出错');
(showLoad || showLoad == undefined) ? wx.hideLoading() : "";
wx.hideNavigationBarLoading()
}
}
})
})
});
return promise;
},
globalData: {
userInfo: null
userInfo: null,
baseUrl:'http://lqz.w.brotop.cn'
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/matrix/matrix",
"pages/my/approveInfo/approveInfo",
"pages/myInform/myInform",
... ... @@ -12,7 +14,6 @@
"pages/colleagues_2/colleagues_2",
"pages/colleagues/colleagues",
"pages/enterprise_q&a/enterprise_q&a",
"pages/matrix/matrix",
"pages/interact/interactPost/interactPost",
"pages/interact/interact",
"pages/my/myAttention/myAttention",
... ... @@ -26,8 +27,8 @@
{
"pagePath": "pages/matrix/matrix",
"text": "企业矩阵",
"iconPath": "/images/01_nav_fill@2x.png",
"selectedIconPath": "images/01_nav_fill@2x.png"
"iconPath": "/images/01_nav@2x.png",
"selectedIconPath": "/images/01_nav_fill@2x.png"
},
{
"pagePath": "pages/attract/attract",
... ...

292 字节 | 宽: | 高:

3.8 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖
... ... @@ -17,14 +17,12 @@
<image src='/images/shaixuan@3x.png' mode='widthFix'></image>
</view>
</view>
<!-- 新闻 -->
<view class='news_detail_container'>
<view class='news_detail_items'>
<view class='news_detail_item ' bindtap='btn_matrix'>
<view class='new_info'>
<view class='new_title'>市国土管局关于同意西青李七庄街天骄北道侧工业地块农用地转用土地征收实施方案的函</view>
<view class='new_time_address'>
<view class='form'>腾讯新闻</view>
<view class='time'>2019.01.01</view>
... ... @@ -37,7 +35,6 @@
<view class='news_detail_item'>
<view class='new_info'>
<view class='new_title'>市国土管局关于同意西青李七庄街天骄北道侧工业地块农用地转用土地征收实施方案的函</view>
<view class='new_time_address'>
<view class='form'>腾讯新闻</view>
<view class='time'>2019.01.01</view>
... ...
// pages/matrix/company/company.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
open:!1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
this.setData({
id: options.id
}), this.getDetail()
},
getDetail(){
let url = '/api/Company/detail', a = this;
let params = {id:a.data.id};
app.post(url,params).then((res)=>{
a.setData({detailInfo:res})
})
},
openText(){
this.setData({open:!this.data.open})
},
onReady: function () {},
onShow: function () {},
onHide: function () {},
onUnload: function () {},
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
... ...
... ... @@ -6,7 +6,7 @@
<!-- detailInfo -->
<view class='compony_info'>
<view class='compony_title'>
<view class='compony_left'>金沃斯英语在线教育</view>
<view class='compony_left'>{{detailInfo.name}}</view>
<view class='focus_button'>+ 关注</view>
</view>
... ... @@ -15,31 +15,31 @@
<view class='detail_icon'>
<image src='/images/dianhua_hui@3x.png' mode='aspectFit'></image>
</view>
<view class='detail_text'>400-2759666</view>
<view class='detail_text'>{{detailInfo.phone}}</view>
</view>
<view class='detailInfo_item'>
<view class='detail_icon'>
<image src='/images/mail@3x.png' mode='aspectFit'></image>
</view>
<view class='detail_text'>26986669@qq.com</view>
<view class='detail_text'>{{detailInfo.email}}</view>
</view>
<view class='detailInfo_item'>
<view class='detail_icon'>
<image src='/images/dingwei@3x.png' mode='aspectFit'></image>
</view>
<view class='detail_text'>天津市和平区南津路129号云川大厦1001</view>
<view class='detail_text'>{{detailInfo.address}}</view>
</view>
</view>
<view class='detailInfo_desc'>
<view class='fanwei'>
经营范围:英国的风俗习惯 、传统 、沟通方式 、国家概况 、文化等各方面有相当程度的了解。
{{detailInfo.excerpt}}
</view>
<view class='company_desc'>
公司简介:金沃斯在线英语教育(GVE)成立于2015年1月,是来自加拿大的在线英语教育公司,总部及产品研发中心位于加拿大多伦多,在中国天津设有运营中心...
<view class='company_desc {{open?"openContent":""}}'>
公司简介:{{detailInfo.content}}
</view>
<view class='open'>
展开
<view class='open' bindtap='openText'>
{{open?"收起":'展开'}}
</view>
</view>
<!-- 企业推荐 -->
... ...
... ... @@ -76,6 +76,11 @@ page{
-webkit-box-orient: vertical;
-webkit-line-clamp:3;
margin-top: 16rpx;
transition: 1s;
}
.company_desc.openContent{
overflow: auto;
-webkit-line-clamp: unset;
}
.open{
height: 96rpx;
... ...
// pages/matrix/matrix.js
const app = getApp();
Page({
/**
... ... @@ -6,20 +7,99 @@ Page({
*/
data: {
current:0,
showType:!1,
areaList: [{
"id": '',
"name": "全部"
}],
ifData: false,
index: 0,
companyList:[],
page:1,
ifData:!1
},
changeShow(){
this.setData({
showType: !this.data.showType
})
},
changeAreas(e){
this.setData({
index:e.detail.value,
park:this.data.areaList[e.detail.value].id,
page:1
})
this.getCompanyList(this.data.category_id,this.data.areaList[e.detail.value].id)
},
// 获取分类
getTypes(){
let url = '/api/Company/getCompanyCategory';
app.post(url,{}).then((res)=>{
this.setData({
typeList: res
})
})
},
// 获取园区
getAreas(){
let url = '/api/Company/getCompanyPark';
app.post(url,{}).then((res)=>{
this.setData({
areaList: this.data.areaList.concat(res)
})
})
},
// 获取矩阵列表
getCompanyList(category_id,park){
let url = '/api/Company/index', b = this;
let params = {
category_id: category_id||'',
park:park||'',
page: b.data.page
}
app.post(url,params).then((res)=>{
b.setData({
companyList: b.data.companyList.concat(res.data),
totalPage: res.total,
currpage: res.current_page,
}), b.data.companyList.length > 0 ? b.setData({
ifData: !0
}) : b.setData({
ifData: !1
}), res.data.length < res.per_page ? b.setData({
noMore: !0,
}) : ''
})
},
getMore(){
let t = this;
!t.data.noMore?(t.setData({
page:t.data.page++
}), t.getCompanyList(t.data.category_id,t.data.park)):""
},
tabCharge(e) {
let that = this;
that.setData({
let s = this;
s.setData({
companyList:[],
page:1,
current: e.currentTarget.dataset.current,
category_id: e.currentTarget.dataset.current
})
s.getCompanyList(e.currentTarget.dataset.current, s.data.park)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
let a = this;
this.getTypes(), this.getAreas(), this.getCompanyList(), wx.getSystemInfo({
success: function (t) {
a.setData({
scrollHeight: t.windowHeight
});
}
})
},
/**
... ...
<!--pages/matrix/matrix.wxml-->
<view class='tab_content'>
<view class='tab_box'>
<view class="tab_item {{current==0?'active':''}}" data-current='0' bindtap='tabCharge'>全部</view>
<view class="tab_item {{current==1?'active':''}}" data-current="1" bindtap='tabCharge'>科技商务</view>
<view class="tab_item {{current==2?'active':''}}" data-current='2' bindtap='tabCharge'>智能制造</view>
<view class="tab_item {{current==3?'active':''}}" data-current="3" bindtap='tabCharge'>数字创意</view>
<view class="tab_item {{current==4?'active':''}}" data-current="4" bindtap='tabCharge'>大健康</view>
<view class='iconfont icon-gengduo1'></view>
<!-- 园区选择 -->
<view class='areasChoose'>
<picker class='areaName' mode='selector' range='{{areaList}}' value="{{index}}" range-key="name" bindchange='changeAreas'>
<view>{{areaList[index].name}}</view>
</picker>
<view class='iconfont icon-gengduo1' bindtap='changeShow'></view>
</view>
<scroll-view class='tab_box' scroll-x='true'>
<view class="tab_item {{current==0?'active':''}}" data-current='0' bindtap='tabCharge'>全部</view>
<block wx:for="{{typeList}}" wx:key=''>
<view class="tab_item {{current==item.id?'active':''}}" data-current='{{item.id}}' bindtap='tabCharge'>{{item.name}}</view>
</block>
</scroll-view>
</view>
<view class='content_box'>
<view class='item_list' bindtap='listDetail'>
<image class='label_img' src='/images/zuire@2x.png'></image>
<text class='label_info'>热门</text>
<image class='list_img' src='/images/huifujishi@2x.png'></image>
<view class='list_left'>
<view>
<view class='list_title'>金沃斯英语在线教育</view>
<view class='list_info'>22</view>
<scroll-view bindscroll="scroll" bindscrolltolower="getMore" class="scroll-content" hidden="{{!ifData}}" scrollTop="{{scrollTop}}" scrollY="true" style="height:{{scrollHeight-89}}px;">
<view class='content_box' wx:if='{{showType}}'>
<navigator class='item_list' 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' src='/images/zuire@2x.png'></image>
<text class='label_info'>热门</text>
<image class='list_img' src='{{item.logo_image}}'></image>
<view class='list_left'>
<view>
<view class='list_title'>{{item.name}}</view>
<view class='list_info'>{{item.excerpt}}</view>
</view>
<view class='iconfont icon-go'></view>
</view>
<view class='iconfont icon-go'></view>
</view>
</navigator>
</view>
</view>
<view class='content_box content_box2'>
<view class='list_item' wx:for='{{[1,2,3]}}'>
<image src='/images/img.jpg'></image>
<view class='list_content_box'>
<view class='list_title_box'>
<image src='/images/huifujishi@2x.png'></image>
<text>金沃斯英语</text>
<view class='content_box content_box2' wx:else>
<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 src='{{item.banner_image}}'></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>
<view class='list_content'>金沃斯在线英语教育是来自加拿大的在线教育...</view>
<view class='iconfont icon-gengduo'></view>
</view>
</navigator>
</view>
</scroll-view>
<view class="none-box" hidden="{{ifData}}">
<view>暂无相关企业</view>
</view>
\ No newline at end of file
... ...
... ... @@ -5,24 +5,28 @@ page {
}
.tab_content {
padding: 30rpx 20rpx;
background: #fff;
width: 100%;
position: fixed;
top: 0;
left: 0;
}
.tab_box {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 80rpx;
white-space: nowrap;
}
.tab_item {
font-size: 26rpx;
color: #999;
display: inline-block;
position: relative;
padding: 0 30rpx;
}
.tab_item.active {
font-size: 26rpx;
color: #169bd5;
}
... ... @@ -173,3 +177,37 @@ page {
color: #333;
margin-top: 10rpx;
}
.areasChoose{
width: 100%;
height: 80rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding:0 30rpx;
box-sizing: border-box;
}
.areaName{
font-size: 28rpx;
color: #666;
position: relative;
}
.areaName::after{
position: absolute;
content: '';
}
.scroll-content{
margin-top: 89px;
background: #FFF;
}
.none-box {
font-size: 30rpx;
color: #8f8f8f;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 350rpx;
text-align: center;
}
... ...
... ... @@ -4,7 +4,7 @@
"ignore": []
},
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
... ... @@ -37,13 +37,13 @@
"list": []
},
"miniprogram": {
"current": 20,
"current": 0,
"list": [
{
"id": -1,
"id": 0,
"name": "公司详情",
"pathName": "pages/matrix/company/company",
"query": "",
"query": "id=1",
"scene": null
},
{
... ...