Browse Source

赋能中心页面修改,党群e家跳转登录

master
xuxu 5 years ago
parent
commit
9953c652d1
  1. 14
      app.js
  2. 8
      components/segment/index.wxss
  3. 50
      models/topic.js
  4. 15
      models/user.js
  5. 17
      pages/topics/center/index.js
  6. 3
      pages/topics/center/index.json
  7. 22
      pages/topics/center/index.wxml
  8. 18
      pages/topics/center/index.wxss
  9. 94
      pages/topics/index.js
  10. 6
      pages/topics/index.wxml
  11. 54
      pages/user/index.js

14
app.js

@ -3,11 +3,23 @@ import {HTTP} from '/utils/http.js'
const http = new HTTP() const http = new HTTP()
App({ App({
onLaunch: function (options) { onLaunch: function (options) {
console.log('党群e家');
console.log(options);
if(options.referrerInfo.hasOwnProperty('extraData')){
this.globalData.navigate.mobile = options.extraData.mobile,
this.globalData.navigate.nickname = options.extraData.nickname,
this.globalData.navigate.faceImg = options.extraData.faceImg
}
http.fetchAuthToken(res => { http.fetchAuthToken(res => {
// console.log(res) // console.log(res)
}) })
}, },
globalData: { globalData: {
userInfo: null userInfo: null,
navigate:{
mobile:'',
nickname:'',
faceImg:''
}
} }
}) })

8
components/segment/index.wxss

@ -2,8 +2,8 @@
.header-titles { .header-titles {
height: 36px; height: 36px;
display: flex; display: flex;
/* justify-content: space-around; */ justify-content: center;
padding: 5px; /* padding: 5px; */
} }
.title { .title {
min-width: 100rpx; min-width: 100rpx;
@ -15,12 +15,14 @@
color: #999999; color: #999999;
font-size: 14px; font-size: 14px;
margin-top: 5px; margin-top: 5px;
} }
.item-title{ .item-title{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
transition: 0.5s all ease-in-out; transition: 0.5s all ease-in-out;
flex: 1;
} }
.title-selected { .title-selected {
font-size: 15px; font-size: 15px;
@ -33,7 +35,7 @@
transition: 0.5s all ease-in-out; transition: 0.5s all ease-in-out;
} }
.select-line-active { .select-line-active {
width: 10px; width: 20px;
background-color: #FA4646; background-color: #FA4646;
} }

50
models/topic.js

@ -15,7 +15,11 @@ const TopicBaseUrl = {
topic_addMessage_url:'/api/message/addMessage' ,// 留言箱 topic_addMessage_url:'/api/message/addMessage' ,// 留言箱
topic_streets_url:'/api/whistle/getStreetList',//街道列表 topic_streets_url:'/api/whistle/getStreetList',//街道列表
topic_talents_url:'/api/whistle/save',//添加人才吹哨 topic_talents_url:'/api/whistle/save',//添加人才吹哨
topic_center_url:'/api/content/getListByCode' //赋能中心列表 topic_center_url:'/api/content/getListByCode', //赋能中心列表
resource_type_url:'/api/resources/typelist ',
resource_list_url:'/api/resources/list',
resource_detail_url:'/api/resources/queryById',
resource_collect_url:'/api/resources/collectResources/'
} }
class TopicModel extends HTTP { class TopicModel extends HTTP {
@ -36,6 +40,17 @@ class TopicModel extends HTTP {
this.request(params) this.request(params)
} }
getResourceTypeList(success){
let params = {
url: TopicBaseUrl.resource_type_url,
method: Method.GET,
data: {
},
success: success
}
this.request(params)
}
// 新建议题 // 新建议题
topicAddGroup(title, content,images,success){ topicAddGroup(title, content,images,success){
let params = { let params = {
@ -207,6 +222,39 @@ class TopicModel extends HTTP {
} }
this.request(params) this.request(params)
} }
getResourceList(typeCode,page,success){
let params = {
url: TopicBaseUrl.resource_list_url + "?pageNo=" + page + "&pageSize=10&typeCode=" + typeCode,
method: Method.GET,
data: {
},
success: success
}
this.request(params)
}
getResourceDetail(id,success){
let params = {
url: TopicBaseUrl.resource_detail_url + "?id=" + id,
method: Method.GET,
data: {
},
success: success
}
this.request(params)
}
resourceCollect(id,success){
let params = {
url: TopicBaseUrl.resource_collect_url + `${id}`,
method: Method.POST,
data:{},
success: success
}
this.request(params)
}
} }

15
models/user.js

@ -16,6 +16,7 @@ const UserConst = {
user_whistleDetail_url:'/api/whistle/getWhistleById', // 吹哨详情 user_whistleDetail_url:'/api/whistle/getWhistleById', // 吹哨详情
user_saveWhistleComment_url:'/api/whistle/saveComment' ,// 吹哨评价 user_saveWhistleComment_url:'/api/whistle/saveComment' ,// 吹哨评价
user_updatePhone_url:'/api/miniuser/updatephone',//更新电话号码 user_updatePhone_url:'/api/miniuser/updatephone',//更新电话号码
navigate_user_url:'/api/miniuser/wxregisterbyparams'
} }
class UserModel extends HTTP { class UserModel extends HTTP {
@ -227,6 +228,20 @@ class UserModel extends HTTP {
} }
this.request(params) this.request(params)
} }
navigateUser(datas,success){
let params = {
url:UserConst.navigate_user_url,
method: Method.POST,
data: {
phone:datas.phone,
nickName:datas.nickName,
avatarUrl:datas.avatarUrl
},
success: success
}
this.request(params)
}
} }
export { UserModel } export { UserModel }

17
pages/topics/center/index.js

@ -6,14 +6,27 @@ Component({
properties: { properties: {
list:{ list:{
type:Array, type:Array,
value:[] value:[],
},
typeList:{
type:Array,
value:[],
} }
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
icon:[
{pic:'bank',color:'#03aefb',bg_color:'#d7f3ff'},
{pic:'balance-scale',color:'#4d9fff',bg_color:'#e9f6fc'},
{pic:'id-card',color:'#febc30',bg_color:'#fff3d9'},
{pic:'users',color:'#bea0fe',bg_color:'#f5f0ff'},
{pic:'globe',color:'#bea0fe',bg_color:'#f5f0ff'},
{pic:'heart',color:'#febc30',bg_color:'#fff3d9'},
{pic:'graduation-cap',color:'#bea0fe',bg_color:'#f5f0ff'},
{pic:'comments',color:'#4d9fff',bg_color:'#e9f6fc'},
]
}, },
attached: function () { attached: function () {
console.log("center页面") console.log("center页面")

3
pages/topics/center/index.json

@ -1,6 +1,7 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"van-grid": "/components/vant/grid/index",
"van-grid-item": "/components/vant/grid-item/index"
} }
} }

22
pages/topics/center/index.wxml

@ -1,5 +1,26 @@
<!--pages/topics/interactive/index.wxml--> <!--pages/topics/interactive/index.wxml-->
<swiper class="nav" >
<swiper-item>
<van-grid column-num="4" border="{{false}}">
<block wx:for="{{typeList}}" wx:for-index="index">
<van-grid-item use-slot url="/pages/resource/index?typeCode={{item.typeCode}}">
<view class="circular" style="background-color:{{icon[index].bg_color}}">
<text class="fa fa-{{icon[index].pic}} fa-lg" style="color:{{icon[index].color}};font-size:28px"></text>
</view>
<view>{{item.typeName}}</view>
</van-grid-item>
</block>
</van-grid>
</swiper-item>
<!-- <swiper-item>
<van-grid column-num="4">
<van-grid-item icon="photo-o" text="文字" wx:for="{{ 6 }}" />
</van-grid>
</swiper-item> -->
</swiper>
<view class="container"> <view class="container">
<block wx:for="{{list}}" wx:key="{{index}}"> <block wx:for="{{list}}" wx:key="{{index}}">
<view class="cell" bindtap="clickListItem" data-id="{{item.id}}"> <view class="cell" bindtap="clickListItem" data-id="{{item.id}}">
<view class="content"> <view class="content">
@ -10,7 +31,6 @@
<view class="right-top"> <view class="right-top">
<view class="right-title"> <view class="right-title">
{{item.title}} {{item.title}}
<!-- 啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊 -->
</view> </view>
</view> </view>
<view class="right-bottom"> <view class="right-bottom">

18
pages/topics/center/index.wxss

@ -1,4 +1,5 @@
/* pages/topics/interactive/index.wxss */ /* pages/topics/interactive/index.wxss */
@import '../../../style/font.wxss';
.publish{ .publish{
position: fixed; position: fixed;
width: 40px; width: 40px;
@ -60,9 +61,6 @@ image{
justify-content: center; justify-content: center;
/* border:1px solid black; */ /* border:1px solid black; */
} }
.rightActive{
}
.right-top{ .right-top{
height:60%; height:60%;
@ -122,4 +120,18 @@ image{
font-size: 12px; font-size: 12px;
color: #D4D4D4; color: #D4D4D4;
}
.nav{
height:250px;
}
.circular{
width: 55px;
height: 55px;
border-radius: 50%;
/* background-color: thistle; */
display: flex;
align-items: center;
justify-content: center;
} }

94
pages/topics/index.js

@ -3,25 +3,27 @@ import dayjs from '../../utils/dayjs/index.js'
import relativeTime from '../../utils/dayjs/relativeTime.js' import relativeTime from '../../utils/dayjs/relativeTime.js'
import { TopicModel } from '../../models/topic.js' import { TopicModel } from '../../models/topic.js'
import { store } from '../../utils/store.js' import { store } from '../../utils/store.js'
import { UserModel } from '../../models/user.js'
let userModel = new UserModel()
dayjs.extend(relativeTime) dayjs.extend(relativeTime)
let topicModel = new TopicModel() let topicModel = new TopicModel()
const app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
// headerTitles: ['互动区', '金点子', '留言箱'], headerTitles: ['找资源','报需求','交朋友' ],
headerTitles: ['留言互动', '赋能中心', '人才吹哨'],
segmentIndex: 0, segmentIndex: 0,
currPage: 1, currPage: 1,
//留言互动的列表 //留言互动的列表
topicList: [], topicList: [],
goodIdeaList: [], goodIdeaList: [],
//赋能中心的列表 //赋能中心的列表
centerList: [] centerList: [],
typeList:[]
}, },
@ -76,38 +78,75 @@ Page({
// url: '/pages/home/index', // url: '/pages/home/index',
// }) // })
// } // }
if(app.globalData.navigate.mobile){
var params = {
phone:app.globalData.navigate.mobile,
nickName:app.globalData.navigate.nickname,
avatarUrl:app.globalData.navigate.faceImg
}
userModel.navigateUser(params,res=>{
store.saveUserInfo({
nickName: params.nickName,
avatarUrl: params.avatarUrl,
phone: params.phone
})
wx.reLaunch({
url: '/pages/home/index',
})
})
}else{
if (res.confirm) {
wx.redirectTo({
url: '/pages/weChatAuth/index?type=2',
})
} else if (res.cancel) {
wx.switchTab({
url: '/pages/home/index',
})
}
}
}
})
}
} else {
console.log('未绑定微信')
if(app.globalData.navigate.mobile){
var params = {
phone:app.globalData.navigate.mobile,
nickName:app.globalData.navigate.nickname,
avatarUrl:app.globalData.navigate.faceImg
}
userModel.navigateUser(params,res=>{
store.saveUserInfo({
nickName: params.nickName,
avatarUrl: params.avatarUrl,
phone: params.phone
})
wx.reLaunch({
url: '/pages/home/index',
})
})
}else{
wx.showModal({
title: '温馨提示',
content: '是否前往绑定微信?',
success(res) {
if (res.confirm) { if (res.confirm) {
wx.redirectTo({ wx.redirectTo({
url: '/pages/weChatAuth/index?type=2', url: '/pages/weChatAuth/index',
}) })
} else if (res.cancel) { } else if (res.cancel) {
wx.switchTab({ wx.switchTab({
url: '/pages/home/index', url: '/pages/home/index',
}) })
} }
} }
}) })
} }
} else {
console.log('未绑定微信')
wx.showModal({
title: '温馨提示',
content: '是否前往绑定微信?',
success(res) {
if (res.confirm) {
wx.redirectTo({
url: '/pages/weChatAuth/index',
})
} else if (res.cancel) {
wx.switchTab({
url: '/pages/home/index',
})
}
}
})
} }
}, },
@ -170,6 +209,13 @@ Page({
//赋能中心 //赋能中心
fetchCenterList(){ fetchCenterList(){
let page = this.data.currPage; let page = this.data.currPage;
topicModel.getResourceTypeList(res=>{
this.setData({
typeList:res.result
})
})
topicModel.getCenterList(page,res => { topicModel.getCenterList(page,res => {
if (res.list.length == 0) { if (res.list.length == 0) {
wx.showToast({ wx.showToast({

6
pages/topics/index.wxml

@ -3,7 +3,7 @@
<e-segment bind:tapSegment="tapSegment" headerTitles="{{headerTitles}}" defaultSelectIndex="{{selectedTitle}}"/> <e-segment bind:tapSegment="tapSegment" headerTitles="{{headerTitles}}" defaultSelectIndex="{{selectedTitle}}"/>
<interactive wx:if="{{segmentIndex==0}}" list="{{topicList}}" bind:deleteTopic="deleteTopic"/> <interactive wx:if="{{segmentIndex==2}}" list="{{topicList}}" bind:deleteTopic="deleteTopic"/>
@ -12,9 +12,9 @@
<!-- 一会改成centerList --> <!-- 一会改成centerList -->
<center wx:if="{{segmentIndex==1}}" list="{{centerList}}"/> <center wx:if="{{segmentIndex==0}}" list="{{centerList}}" typeList="{{typeList}}"/>
<!-- <message wx:if="{{segmentIndex==2}}" /> --> <!-- <message wx:if="{{segmentIndex==2}}" /> -->
<talents wx:if="{{segmentIndex==2}}" /> <talents wx:if="{{segmentIndex==1}}" />
</view> </view>

54
pages/user/index.js

@ -65,24 +65,44 @@ Page({
this.getMsgStatus() this.getMsgStatus()
} else { } else {
//console.log('未绑定手机号码') //console.log('未绑定手机号码')
wx.showModal({ if(app.globalData.navigate.mobile){
title: '温馨提示', var params = {
content: '是否前往验证手机号码?', phone:app.globalData.navigate.mobile,
success(res) { nickName:app.globalData.navigate.nickname,
if (res.confirm) { avatarUrl:app.globalData.navigate.faceImg
// wx.redirectTo({
// url: '/pages/register/index',
// })
wx.redirectTo({
url: '/pages/weChatAuth/index?type=2',
})
} else if (res.cancel) {
wx.switchTab({
url: '/pages/home/index',
})
}
} }
}) userModel.navigateUser(params,res=>{
store.saveUserInfo({
nickName: params.nickName,
avatarUrl: params.avatarUrl,
phone: params.phone
})
wx.reLaunch({
url: '/pages/home/index',
})
})
}else{
wx.showModal({
title: '温馨提示',
content: '是否前往验证手机号码?',
success(res) {
if (res.confirm) {
// wx.redirectTo({
// url: '/pages/register/index',
// })
wx.redirectTo({
url: '/pages/weChatAuth/index?type=2',
})
} else if (res.cancel) {
wx.switchTab({
url: '/pages/home/index',
})
}
}
})
}
} }
}) })
store.saveUserInfo({ store.saveUserInfo({

Loading…
Cancel
Save