作者 朱振飞

项目初始化

@@ -4,36 +4,63 @@ App({ @@ -4,36 +4,63 @@ App({
4 // 展示本地存储能力 4 // 展示本地存储能力
5 var logs = wx.getStorageSync('logs') || [] 5 var logs = wx.getStorageSync('logs') || []
6 logs.unshift(Date.now()) 6 logs.unshift(Date.now())
7 - wx.setStorageSync('logs', logs)  
8 -  
9 - // 登录  
10 - wx.login({  
11 - success: res => {  
12 - // 发送 res.code 到后台换取 openId, sessionKey, unionId  
13 - }  
14 - })  
15 // 获取用户信息 7 // 获取用户信息
16 - wx.getSetting({  
17 - success: res => {  
18 - if (res.authSetting['scope.userInfo']) {  
19 - // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框  
20 - wx.getUserInfo({  
21 - success: res => {  
22 - // 可以将 res 发送给后台解码出 unionId  
23 - this.globalData.userInfo = res.userInfo  
24 -  
25 - // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回  
26 - // 所以此处加入 callback 以防止这种情况  
27 - if (this.userInfoReadyCallback) {  
28 - this.userInfoReadyCallback(res)  
29 - } 8 + },
  9 + post: function (url, data, showLoad) {
  10 + /**
  11 + * 自定义post函数,返回Promise
  12 + * +-------------------
  13 + * @param {String} url 接口网址
  14 + * @param {arrayObject} data 要传的数组对象 like: {name: 'name', age: 32}
  15 + * +-------------------
  16 + * @return {Promise} promise 返回promise供后续操作
  17 + */
  18 + if (showLoad == undefined || showLoad){
  19 + wx.showLoading({
  20 + title: '加载中',
  21 + })
30 } 22 }
  23 + wx.showNavigationBarLoading()
  24 + var promise = new Promise((resolve, reject) => {
  25 + //init
  26 + let that = this;
  27 + let postData = data;
  28 + //网络请求
  29 + wx.request({
  30 + url: this.globalData.baseUrl + url,
  31 + data: postData,
  32 + method: 'POST',
  33 + header: {
  34 + 'content-type': 'application/x-www-form-urlencoded',
  35 + 'XX-Token': wx.getStorageSync('token')
  36 + },
  37 + success: function (res) {//返回取得的数据
  38 + if (res.data.code == '1') {
  39 + resolve(res.data.data);
  40 + } else if (res.data.code == '201') {
  41 + resolve(res.data);
  42 + } else {
  43 + wx.showModal({
  44 + title: '提示',
  45 + content: res.data.msg,
  46 + showCancel: false
31 }) 47 })
  48 + reject(res.data)
32 } 49 }
  50 + (showLoad || showLoad == undefined) ? wx.hideLoading() : "";
  51 + wx.hideNavigationBarLoading()
  52 + },
  53 + fail: function (e) {
  54 + reject('网络出错');
  55 + (showLoad || showLoad == undefined) ? wx.hideLoading() : "";
  56 + wx.hideNavigationBarLoading()
33 } 57 }
34 }) 58 })
  59 + });
  60 + return promise;
35 }, 61 },
36 globalData: { 62 globalData: {
37 - userInfo: null 63 + userInfo: null,
  64 + baseUrl:'http://lqz.w.brotop.cn'
38 } 65 }
39 }) 66 })
1 { 1 {
2 "pages": [ 2 "pages": [
  3 + "pages/matrix/matrix",
  4 +
3 "pages/my/approveInfo/approveInfo", 5 "pages/my/approveInfo/approveInfo",
4 "pages/myInform/myInform", 6 "pages/myInform/myInform",
5 7
@@ -12,7 +14,6 @@ @@ -12,7 +14,6 @@
12 "pages/colleagues_2/colleagues_2", 14 "pages/colleagues_2/colleagues_2",
13 "pages/colleagues/colleagues", 15 "pages/colleagues/colleagues",
14 "pages/enterprise_q&a/enterprise_q&a", 16 "pages/enterprise_q&a/enterprise_q&a",
15 - "pages/matrix/matrix",  
16 "pages/interact/interactPost/interactPost", 17 "pages/interact/interactPost/interactPost",
17 "pages/interact/interact", 18 "pages/interact/interact",
18 "pages/my/myAttention/myAttention", 19 "pages/my/myAttention/myAttention",
@@ -26,8 +27,8 @@ @@ -26,8 +27,8 @@
26 { 27 {
27 "pagePath": "pages/matrix/matrix", 28 "pagePath": "pages/matrix/matrix",
28 "text": "企业矩阵", 29 "text": "企业矩阵",
29 - "iconPath": "/images/01_nav_fill@2x.png",  
30 - "selectedIconPath": "images/01_nav_fill@2x.png" 30 + "iconPath": "/images/01_nav@2x.png",
  31 + "selectedIconPath": "/images/01_nav_fill@2x.png"
31 }, 32 },
32 { 33 {
33 "pagePath": "pages/attract/attract", 34 "pagePath": "pages/attract/attract",

292 字节 | 宽: | 高:

3.8 KB | 宽: | 高:

  • 两方对比
  • 交换覆盖
  • 透明覆盖
@@ -17,14 +17,12 @@ @@ -17,14 +17,12 @@
17 <image src='/images/shaixuan@3x.png' mode='widthFix'></image> 17 <image src='/images/shaixuan@3x.png' mode='widthFix'></image>
18 </view> 18 </view>
19 </view> 19 </view>
20 -  
21 <!-- 新闻 --> 20 <!-- 新闻 -->
22 <view class='news_detail_container'> 21 <view class='news_detail_container'>
23 <view class='news_detail_items'> 22 <view class='news_detail_items'>
24 <view class='news_detail_item ' bindtap='btn_matrix'> 23 <view class='news_detail_item ' bindtap='btn_matrix'>
25 <view class='new_info'> 24 <view class='new_info'>
26 <view class='new_title'>市国土管局关于同意西青李七庄街天骄北道侧工业地块农用地转用土地征收实施方案的函</view> 25 <view class='new_title'>市国土管局关于同意西青李七庄街天骄北道侧工业地块农用地转用土地征收实施方案的函</view>
27 -  
28 <view class='new_time_address'> 26 <view class='new_time_address'>
29 <view class='form'>腾讯新闻</view> 27 <view class='form'>腾讯新闻</view>
30 <view class='time'>2019.01.01</view> 28 <view class='time'>2019.01.01</view>
@@ -37,7 +35,6 @@ @@ -37,7 +35,6 @@
37 <view class='news_detail_item'> 35 <view class='news_detail_item'>
38 <view class='new_info'> 36 <view class='new_info'>
39 <view class='new_title'>市国土管局关于同意西青李七庄街天骄北道侧工业地块农用地转用土地征收实施方案的函</view> 37 <view class='new_title'>市国土管局关于同意西青李七庄街天骄北道侧工业地块农用地转用土地征收实施方案的函</view>
40 -  
41 <view class='new_time_address'> 38 <view class='new_time_address'>
42 <view class='form'>腾讯新闻</view> 39 <view class='form'>腾讯新闻</view>
43 <view class='time'>2019.01.01</view> 40 <view class='time'>2019.01.01</view>
1 // pages/matrix/company/company.js 1 // pages/matrix/company/company.js
  2 +const app = getApp();
2 Page({ 3 Page({
3 4
4 /** 5 /**
5 * 页面的初始数据 6 * 页面的初始数据
6 */ 7 */
7 data: { 8 data: {
8 - 9 + open:!1
9 }, 10 },
10 11
11 /** 12 /**
12 * 生命周期函数--监听页面加载 13 * 生命周期函数--监听页面加载
13 */ 14 */
14 onLoad: function (options) { 15 onLoad: function (options) {
15 -  
16 - },  
17 -  
18 - /**  
19 - * 生命周期函数--监听页面初次渲染完成  
20 - */  
21 - onReady: function () {  
22 -  
23 - },  
24 -  
25 - /**  
26 - * 生命周期函数--监听页面显示  
27 - */  
28 - onShow: function () {  
29 -  
30 - },  
31 -  
32 - /**  
33 - * 生命周期函数--监听页面隐藏  
34 - */  
35 - onHide: function () {  
36 -  
37 - },  
38 -  
39 - /**  
40 - * 生命周期函数--监听页面卸载  
41 - */  
42 - onUnload: function () {  
43 -  
44 - },  
45 -  
46 - /**  
47 - * 页面相关事件处理函数--监听用户下拉动作  
48 - */  
49 - onPullDownRefresh: function () {  
50 -  
51 - }, 16 + this.setData({
  17 + id: options.id
  18 + }), this.getDetail()
  19 + },
  20 + getDetail(){
  21 + let url = '/api/Company/detail', a = this;
  22 + let params = {id:a.data.id};
  23 + app.post(url,params).then((res)=>{
  24 + a.setData({detailInfo:res})
  25 + })
  26 + },
  27 + openText(){
  28 + this.setData({open:!this.data.open})
  29 + },
  30 + onReady: function () {},
  31 + onShow: function () {},
  32 + onHide: function () {},
  33 + onUnload: function () {},
  34 + onPullDownRefresh: function () {},
52 35
53 /** 36 /**
54 * 页面上拉触底事件的处理函数 37 * 页面上拉触底事件的处理函数
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <!-- detailInfo --> 6 <!-- detailInfo -->
7 <view class='compony_info'> 7 <view class='compony_info'>
8 <view class='compony_title'> 8 <view class='compony_title'>
9 - <view class='compony_left'>金沃斯英语在线教育</view> 9 + <view class='compony_left'>{{detailInfo.name}}</view>
10 <view class='focus_button'>+ 关注</view> 10 <view class='focus_button'>+ 关注</view>
11 </view> 11 </view>
12 12
@@ -15,31 +15,31 @@ @@ -15,31 +15,31 @@
15 <view class='detail_icon'> 15 <view class='detail_icon'>
16 <image src='/images/dianhua_hui@3x.png' mode='aspectFit'></image> 16 <image src='/images/dianhua_hui@3x.png' mode='aspectFit'></image>
17 </view> 17 </view>
18 - <view class='detail_text'>400-2759666</view> 18 + <view class='detail_text'>{{detailInfo.phone}}</view>
19 </view> 19 </view>
20 <view class='detailInfo_item'> 20 <view class='detailInfo_item'>
21 <view class='detail_icon'> 21 <view class='detail_icon'>
22 <image src='/images/mail@3x.png' mode='aspectFit'></image> 22 <image src='/images/mail@3x.png' mode='aspectFit'></image>
23 </view> 23 </view>
24 - <view class='detail_text'>26986669@qq.com</view> 24 + <view class='detail_text'>{{detailInfo.email}}</view>
25 </view> 25 </view>
26 <view class='detailInfo_item'> 26 <view class='detailInfo_item'>
27 <view class='detail_icon'> 27 <view class='detail_icon'>
28 <image src='/images/dingwei@3x.png' mode='aspectFit'></image> 28 <image src='/images/dingwei@3x.png' mode='aspectFit'></image>
29 </view> 29 </view>
30 - <view class='detail_text'>天津市和平区南津路129号云川大厦1001</view> 30 + <view class='detail_text'>{{detailInfo.address}}</view>
31 </view> 31 </view>
32 </view> 32 </view>
33 33
34 <view class='detailInfo_desc'> 34 <view class='detailInfo_desc'>
35 <view class='fanwei'> 35 <view class='fanwei'>
36 - 经营范围:英国的风俗习惯 、传统 、沟通方式 、国家概况 、文化等各方面有相当程度的了解。 36 + {{detailInfo.excerpt}}
37 </view> 37 </view>
38 - <view class='company_desc'>  
39 - 公司简介:金沃斯在线英语教育(GVE)成立于2015年1月,是来自加拿大的在线英语教育公司,总部及产品研发中心位于加拿大多伦多,在中国天津设有运营中心... 38 + <view class='company_desc {{open?"openContent":""}}'>
  39 + 公司简介:{{detailInfo.content}}
40 </view> 40 </view>
41 - <view class='open'>  
42 - 展开 41 + <view class='open' bindtap='openText'>
  42 + {{open?"收起":'展开'}}
43 </view> 43 </view>
44 </view> 44 </view>
45 <!-- 企业推荐 --> 45 <!-- 企业推荐 -->
@@ -76,6 +76,11 @@ page{ @@ -76,6 +76,11 @@ page{
76 -webkit-box-orient: vertical; 76 -webkit-box-orient: vertical;
77 -webkit-line-clamp:3; 77 -webkit-line-clamp:3;
78 margin-top: 16rpx; 78 margin-top: 16rpx;
  79 + transition: 1s;
  80 +}
  81 +.company_desc.openContent{
  82 + overflow: auto;
  83 + -webkit-line-clamp: unset;
79 } 84 }
80 .open{ 85 .open{
81 height: 96rpx; 86 height: 96rpx;
1 // pages/matrix/matrix.js 1 // pages/matrix/matrix.js
  2 +const app = getApp();
2 Page({ 3 Page({
3 4
4 /** 5 /**
@@ -6,20 +7,99 @@ Page({ @@ -6,20 +7,99 @@ Page({
6 */ 7 */
7 data: { 8 data: {
8 current:0, 9 current:0,
  10 + showType:!1,
  11 + areaList: [{
  12 + "id": '',
  13 + "name": "全部"
  14 + }],
  15 + ifData: false,
  16 + index: 0,
  17 + companyList:[],
  18 + page:1,
  19 + ifData:!1
  20 + },
  21 + changeShow(){
  22 + this.setData({
  23 + showType: !this.data.showType
  24 + })
  25 + },
  26 + changeAreas(e){
  27 + this.setData({
  28 + index:e.detail.value,
  29 + park:this.data.areaList[e.detail.value].id,
  30 + page:1
  31 + })
  32 + this.getCompanyList(this.data.category_id,this.data.areaList[e.detail.value].id)
  33 + },
  34 + // 获取分类
  35 + getTypes(){
  36 + let url = '/api/Company/getCompanyCategory';
  37 + app.post(url,{}).then((res)=>{
  38 + this.setData({
  39 + typeList: res
  40 + })
  41 + })
  42 + },
  43 + // 获取园区
  44 + getAreas(){
  45 + let url = '/api/Company/getCompanyPark';
  46 + app.post(url,{}).then((res)=>{
  47 + this.setData({
  48 + areaList: this.data.areaList.concat(res)
  49 + })
  50 + })
  51 + },
  52 + // 获取矩阵列表
  53 + getCompanyList(category_id,park){
  54 + let url = '/api/Company/index', b = this;
  55 + let params = {
  56 + category_id: category_id||'',
  57 + park:park||'',
  58 + page: b.data.page
  59 + }
  60 + app.post(url,params).then((res)=>{
  61 + b.setData({
  62 + companyList: b.data.companyList.concat(res.data),
  63 + totalPage: res.total,
  64 + currpage: res.current_page,
  65 + }), b.data.companyList.length > 0 ? b.setData({
  66 + ifData: !0
  67 + }) : b.setData({
  68 + ifData: !1
  69 + }), res.data.length < res.per_page ? b.setData({
  70 + noMore: !0,
  71 + }) : ''
  72 + })
  73 + },
  74 + getMore(){
  75 + let t = this;
  76 + !t.data.noMore?(t.setData({
  77 + page:t.data.page++
  78 + }), t.getCompanyList(t.data.category_id,t.data.park)):""
9 }, 79 },
10 tabCharge(e) { 80 tabCharge(e) {
11 - let that = this;  
12 - that.setData({ 81 + let s = this;
  82 + s.setData({
  83 + companyList:[],
  84 + page:1,
13 current: e.currentTarget.dataset.current, 85 current: e.currentTarget.dataset.current,
  86 + category_id: e.currentTarget.dataset.current
14 }) 87 })
15 - 88 + s.getCompanyList(e.currentTarget.dataset.current, s.data.park)
16 }, 89 },
17 90
18 /** 91 /**
19 * 生命周期函数--监听页面加载 92 * 生命周期函数--监听页面加载
20 */ 93 */
21 onLoad: function(options) { 94 onLoad: function(options) {
22 - 95 + let a = this;
  96 + this.getTypes(), this.getAreas(), this.getCompanyList(), wx.getSystemInfo({
  97 + success: function (t) {
  98 + a.setData({
  99 + scrollHeight: t.windowHeight
  100 + });
  101 + }
  102 + })
23 }, 103 },
24 104
25 /** 105 /**
1 <!--pages/matrix/matrix.wxml--> 1 <!--pages/matrix/matrix.wxml-->
2 <view class='tab_content'> 2 <view class='tab_content'>
3 - <view class='tab_box'>  
4 - <view class="tab_item {{current==0?'active':''}}" data-current='0' bindtap='tabCharge'>全部</view>  
5 - <view class="tab_item {{current==1?'active':''}}" data-current="1" bindtap='tabCharge'>科技商务</view>  
6 - <view class="tab_item {{current==2?'active':''}}" data-current='2' bindtap='tabCharge'>智能制造</view>  
7 - <view class="tab_item {{current==3?'active':''}}" data-current="3" bindtap='tabCharge'>数字创意</view>  
8 - <view class="tab_item {{current==4?'active':''}}" data-current="4" bindtap='tabCharge'>大健康</view>  
9 - <view class='iconfont icon-gengduo1'></view> 3 + <!-- 园区选择 -->
  4 + <view class='areasChoose'>
  5 + <picker class='areaName' mode='selector' range='{{areaList}}' value="{{index}}" range-key="name" bindchange='changeAreas'>
  6 + <view>{{areaList[index].name}}</view>
  7 + </picker>
  8 + <view class='iconfont icon-gengduo1' bindtap='changeShow'></view>
10 </view> 9 </view>
  10 + <scroll-view class='tab_box' scroll-x='true'>
  11 + <view class="tab_item {{current==0?'active':''}}" data-current='0' bindtap='tabCharge'>全部</view>
  12 + <block wx:for="{{typeList}}" wx:key=''>
  13 + <view class="tab_item {{current==item.id?'active':''}}" data-current='{{item.id}}' bindtap='tabCharge'>{{item.name}}</view>
  14 + </block>
  15 +
  16 + </scroll-view>
11 </view> 17 </view>
12 -<view class='content_box'>  
13 - <view class='item_list' bindtap='listDetail'> 18 +<scroll-view bindscroll="scroll" bindscrolltolower="getMore" class="scroll-content" hidden="{{!ifData}}" scrollTop="{{scrollTop}}" scrollY="true" style="height:{{scrollHeight-89}}px;">
  19 + <view class='content_box' wx:if='{{showType}}'>
  20 + <navigator class='item_list' wx:for='{{companyList}}' wx:key='' url="/pages/matrix/company/company?id={{item.id}}"
  21 + open-type="navigate"
  22 + hover-class="other-navigator-hover">
14 <image class='label_img' src='/images/zuire@2x.png'></image> 23 <image class='label_img' src='/images/zuire@2x.png'></image>
15 <text class='label_info'>热门</text> 24 <text class='label_info'>热门</text>
16 - <image class='list_img' src='/images/huifujishi@2x.png'></image> 25 + <image class='list_img' src='{{item.logo_image}}'></image>
17 <view class='list_left'> 26 <view class='list_left'>
18 <view> 27 <view>
19 - <view class='list_title'>金沃斯英语在线教育</view>  
20 - <view class='list_info'>22</view> 28 + <view class='list_title'>{{item.name}}</view>
  29 + <view class='list_info'>{{item.excerpt}}</view>
21 </view> 30 </view>
22 <view class='iconfont icon-go'></view> 31 <view class='iconfont icon-go'></view>
23 </view> 32 </view>
  33 + </navigator>
24 </view> 34 </view>
25 -</view>  
26 35
27 -<view class='content_box content_box2'>  
28 - <view class='list_item' wx:for='{{[1,2,3]}}'>  
29 - <image src='/images/img.jpg'></image> 36 + <view class='content_box content_box2' wx:else>
  37 + <navigator class='list_item' wx:for='{{companyList}}' wx:key='' url="/pages/matrix/company/company?id={{item.id}}"
  38 + open-type="navigate"
  39 + hover-class="other-navigator-hover">
  40 + <image src='{{item.banner_image}}'></image>
30 <view class='list_content_box'> 41 <view class='list_content_box'>
31 <view class='list_title_box'> 42 <view class='list_title_box'>
32 - <image src='/images/huifujishi@2x.png'></image>  
33 - <text>金沃斯英语</text> 43 + <image src='{{item.logo_image}}'></image>
  44 + <text>{{item.name}}</text>
34 </view> 45 </view>
35 - <view class='list_content'>金沃斯在线英语教育是来自加拿大的在线教育...</view> 46 + <view class='list_content'>{{item.excerpt}}</view>
36 <view class='iconfont icon-gengduo'></view> 47 <view class='iconfont icon-gengduo'></view>
37 </view> 48 </view>
  49 + </navigator>
38 </view> 50 </view>
  51 +</scroll-view>
  52 +
  53 +<view class="none-box" hidden="{{ifData}}">
  54 + <view>暂无相关企业</view>
39 </view> 55 </view>
@@ -5,24 +5,28 @@ page { @@ -5,24 +5,28 @@ page {
5 } 5 }
6 6
7 .tab_content { 7 .tab_content {
8 - padding: 30rpx 20rpx;  
9 background: #fff; 8 background: #fff;
  9 + width: 100%;
  10 + position: fixed;
  11 + top: 0;
  12 + left: 0;
10 } 13 }
11 14
12 .tab_box { 15 .tab_box {
13 - display: flex;  
14 - align-items: center;  
15 - justify-content: space-between; 16 + width: 100%;
  17 + height: 80rpx;
  18 + white-space: nowrap;
16 } 19 }
17 20
18 .tab_item { 21 .tab_item {
19 font-size: 26rpx; 22 font-size: 26rpx;
20 color: #999; 23 color: #999;
  24 + display: inline-block;
21 position: relative; 25 position: relative;
  26 + padding: 0 30rpx;
22 } 27 }
23 28
24 .tab_item.active { 29 .tab_item.active {
25 - font-size: 26rpx;  
26 color: #169bd5; 30 color: #169bd5;
27 } 31 }
28 32
@@ -173,3 +177,37 @@ page { @@ -173,3 +177,37 @@ page {
173 color: #333; 177 color: #333;
174 margin-top: 10rpx; 178 margin-top: 10rpx;
175 } 179 }
  180 +.areasChoose{
  181 + width: 100%;
  182 + height: 80rpx;
  183 + display: flex;
  184 + align-items: center;
  185 + justify-content: space-between;
  186 + padding:0 30rpx;
  187 + box-sizing: border-box;
  188 +}
  189 +
  190 +.areaName{
  191 + font-size: 28rpx;
  192 + color: #666;
  193 + position: relative;
  194 +}
  195 +.areaName::after{
  196 + position: absolute;
  197 + content: '';
  198 +
  199 +}
  200 +.scroll-content{
  201 + margin-top: 89px;
  202 + background: #FFF;
  203 +}
  204 +
  205 +.none-box {
  206 + font-size: 30rpx;
  207 + color: #8f8f8f;
  208 + position: absolute;
  209 + left: 50%;
  210 + transform: translateX(-50%);
  211 + top: 350rpx;
  212 + text-align: center;
  213 +}
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 "ignore": [] 4 "ignore": []
5 }, 5 },
6 "setting": { 6 "setting": {
7 - "urlCheck": true, 7 + "urlCheck": false,
8 "es6": true, 8 "es6": true,
9 "postcss": true, 9 "postcss": true,
10 "minified": true, 10 "minified": true,
@@ -37,13 +37,13 @@ @@ -37,13 +37,13 @@
37 "list": [] 37 "list": []
38 }, 38 },
39 "miniprogram": { 39 "miniprogram": {
40 - "current": 20, 40 + "current": 0,
41 "list": [ 41 "list": [
42 { 42 {
43 - "id": -1, 43 + "id": 0,
44 "name": "公司详情", 44 "name": "公司详情",
45 "pathName": "pages/matrix/company/company", 45 "pathName": "pages/matrix/company/company",
46 - "query": "", 46 + "query": "id=1",
47 "scene": null 47 "scene": null
48 }, 48 },
49 { 49 {