Browse Source

微信手机号注册; 我的吹哨; 吹哨详情(部分)

master
xuxu 5 years ago
parent
commit
818178df07
  1. 4
      app.json
  2. 1
      app.wxss
  3. 47
      models/user.js
  4. 22
      pages/topics/index.js
  5. 9
      pages/user/index.wxml
  6. 123
      pages/user/myWhistle/index.js
  7. 5
      pages/user/myWhistle/index.json
  8. 17
      pages/user/myWhistle/index.wxml
  9. 42
      pages/user/myWhistle/index.wxss
  10. 42
      pages/user/myWhistle/whistle.wxs
  11. 86
      pages/user/myWhistle/whistleDetail/index.js
  12. 4
      pages/user/myWhistle/whistleDetail/index.json
  13. 62
      pages/user/myWhistle/whistleDetail/index.wxml
  14. 134
      pages/user/myWhistle/whistleDetail/index.wxss
  15. 24
      pages/weChatAuth/index.js
  16. 26
      pages/weChatAuth/index.wxml
  17. 2348
      style/font.wxss

4
app.json

@ -21,7 +21,9 @@
"pages/topics/interactive/topicArticle/index",
"pages/billboards/park/park-category/index",
"pages/billboards/park/park-detail/index",
"pages/weChatAuth/index"
"pages/weChatAuth/index",
"pages/user/myWhistle/index",
"pages/user/myWhistle/whistleDetail/index"
],
"window": {
"backgroundTextStyle": "light",

1
app.wxss

@ -1,4 +1,5 @@
@import 'style/weui.wxss';
@import 'style/font.wxss';
page{
font-family: PingFangSC-Regular;

47
models/user.js

@ -9,7 +9,11 @@ const UserConst = {
user_myActivity_url:'/api/activity/activityList', // 我的活动
user_updateUserInfo_url:'/api/miniuser/updateMiniUser', // 更新用户信息
user_sendUserInfo_url:'/api/miniuser/updateUserInfo' // 上传用户信息
user_sendUserInfo_url:'/api/miniuser/updateUserInfo', // 上传用户信息
user_register_url:'/api/miniuser/wxregister', // 微信注册
user_myWhistle_url:'/api/whistle/getMyWhistleList',// 我的吹哨
user_whistleDetail_url:'/api/whistle/getWhistleById' // 吹哨详情
}
class UserModel extends HTTP {
constructor () {
@ -143,6 +147,47 @@ class UserModel extends HTTP {
}
this.request(params)
}
wxRegister(data,success){
let params = {
url:UserConst.user_register_url,
method: Method.POST,
data: {
encryptedData: data.encryptedData,
iv: data.iv
},
success: success
}
this.request(params)
}
getWhistleList(data,success){
let params = {
url:UserConst.user_myWhistle_url,
method: Method.POST,
data: {
page: data.page,
pageSize: data.pageSize,
},
success: success
}
this.request(params)
}
getWhistleDetail(id,success){
let params = {
url:UserConst.user_whistleDetail_url,
method: Method.POST,
data: {
id:id
},
success: success
}
this.request(params)
}
}
export { UserModel }

22
pages/topics/index.js

@ -55,15 +55,19 @@ Page({
title: '温馨提示',
content: '是否前往验证手机号码?',
success(res) {
if (res.confirm) {
wx.redirectTo({
url: '/pages/register/index',
})
} else if (res.cancel) {
wx.switchTab({
url: '/pages/home/index',
})
}
// if (res.confirm) {
// wx.redirectTo({
// url: '/pages/register/index',
// })
// } else if (res.cancel) {
// wx.switchTab({
// url: '/pages/home/index',
// })
// }
wx.redirectTo({
url: '/pages/weChatAuth/index?type=2',
})
}
})

9
pages/user/index.wxml

@ -39,12 +39,19 @@
link="true"
ext-class="cell-item">
</mp-cell>
<mp-cell
<!-- <mp-cell
bindtap="onTapItem" data-type="myIdea"
icon="/images/user/pins.png"
title="我的金点子"
link="true"
ext-class="cell-item">
</mp-cell> -->
<mp-cell
bindtap="onTapItem" data-type="myWhistle"
icon="/images/user/pins.png"
title="我的吹哨"
link="true"
ext-class="cell-item">
</mp-cell>
<mp-cell
bindtap="onTapItem" data-type="myActivity"

123
pages/user/myWhistle/index.js

@ -0,0 +1,123 @@
// pages/user/myWhistle/index.js
import { UserModel } from '../../../models/user.js'
let userModel = new UserModel()
Page({
/**
* 页面的初始数据
*/
data: {
page:1,
pageSize:10,
next:true,
list:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var data = {
page:this.data.page,
pageSize:this.data.pageSize
}
userModel.getWhistleList(data,res=>{
if(res.result.length > 0){
this.setData({
list:res.result
})
}else{
this.setData({
next:false
})
}
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
var th = this;
var next = th.data.next;
if(!next){
return;
}
var page = th.data.page;
var nextPage = page + 1;
var data = {
page:nextPage,
pageSize:th.data.pageSize
}
userModel.getWhistleList(data,res=>{
if(res.result.length > 0){
let list = this.data.list;
list = list.concat(res.result);
this.setData({
list:list
})
}else{
this.setData({
next:false
})
}
});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
detail:function(e){
if (!e.currentTarget.dataset.id){
return;
}
if (e.currentTarget.dataset.id) {
wx.navigateTo({
url: '../myWhistle/whistleDetail/index?id=' + e.currentTarget.dataset.id
})
}
}
})

5
pages/user/myWhistle/index.json

@ -0,0 +1,5 @@
{
"navigationBarTitleText": "我的吹哨",
"usingComponents": {},
"onReachBottomDistance":50
}

17
pages/user/myWhistle/index.wxml

@ -0,0 +1,17 @@
<!--pages/user/myWhistle/index.wxml-->
<wxs module="whistle" src="whistle.wxs"></wxs>
<block wx:for="{{list}}">
<view class="column" bindtap="detail" data-id="{{item.id}}">
<view class="top">
<view class="content">
{{item.content}}
</view>
</view>
<view class="bottom">
<view style="font-size:12px">{{item.createTime}}</view>
<view style="font-size:13px;color:{{whistle.getColor(item.status)}}">{{whistle.getStatus(item.status)}}</view>
</view>
</view>
</block>

42
pages/user/myWhistle/index.wxss

@ -0,0 +1,42 @@
/* pages/user/myWhistle/index.wxss */
page{
background-color: #fafafa;
width:100%;
height: 100%;
}
.column{
width:100%;
height: 130px;
background-color: white;
margin-top:30rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content:center;
}
.content{
width: 100%;
height:80%;
display: -webkit-box;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
word-break: break-all;
font-size: 16px;
}
.top{
width: 90%;
height: 70px;
display: flex;
align-items: center;
justify-content:center;
}
.bottom{
width:90%;
height: 30px;
display: flex;
align-items: center;
justify-content:space-between;
}

42
pages/user/myWhistle/whistle.wxs

@ -0,0 +1,42 @@
var whistle = {
getImage: function (str) {
var images = str.split(";");
return images;
},
getStatus: function(status){
if (status == '0'){
status = '处理中';
} else if (status == '1'){
status = '已答复';
} else if (status == '2'){
status = '已驳回';
} else if (status == '3') {
status = '已结束';
}
return status;
},
getColor:function(status){
if (status == '0') {
var color = '#ff8a0e';
} else if (status == '1') {
var color = '#f41414';
} else if (status == '2') {
var color = '#1131e4';
} else if (status == '3') {
var color = '#463c59';
}
return color;
}
}
// 导出对外暴露的属性
module.exports = {
getImage:whistle.getImage,
getStatus: whistle.getStatus,
getColor: whistle.getColor
}

86
pages/user/myWhistle/whistleDetail/index.js

@ -0,0 +1,86 @@
// pages/user/myWhistle/whistleDetail/index.js
import { UserModel } from '../../../../models/user.js'
let userModel = new UserModel()
Page({
/**
* 页面的初始数据
*/
data: {
detail:{},
img:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var id = options.id;
userModel.getWhistleDetail(id,res=>{
var img = res.result.picList.split(";");
this.setData({
detail:res.result,
img:img
})
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
previewImage:function(e){
var current = e.target.dataset.src;
var th = this;
wx.previewImage({
current: current, // 当前显示图片的http链接
urls: th.data.img // 需要预览的图片http链接列表
})
}
})

4
pages/user/myWhistle/whistleDetail/index.json

@ -0,0 +1,4 @@
{
"usingComponents": {
}
}

62
pages/user/myWhistle/whistleDetail/index.wxml

@ -0,0 +1,62 @@
<!-- pages/user/myWhistle/whistleDetail/index.wxml -->
<wxs module="whistle" src="../whistle.wxs"></wxs>
<view class="title">
<view>
<view>{{detail.createTime}}</view>
<view>{{detail.departName}}</view>
</view>
<view>处理中</view>
</view>
<view class="content">
<view class="con">{{detail.content}}</view>
<block wx:if="{{detail.picList}}">
<view class="image-show">
<block wx:for="{{img}}">
<!-- <view class="img-box"> -->
<image class="img-box" src="{{item}}" data-src="{{item}}" bindtap="previewImage"></image>
<!-- </view> -->
</block>
</view>
</block>
</view>
<view class="process">
<!-- <view>处理进度</view> -->
<view class="table">
<block wx:for="{{detail.list}}">
<view class="tb">
<view class="timeline">
<view class="line"></view>
<view class="circle">
<!-- <text class="fa fa-dot-circle-o fa-lg"></text> -->
<text class="fa fa-circle fa-lg"></text>
</view>
<view class="line"></view>
</view>
<view class="content-1">
<view class="process-tit"><text style="font-size:16px">{{item.handleType}}</text><text style="font-size:13px">{{item.handleDate}}</text></view>
<text style="font-size:13px;color:#737373;">{{item.handleSuggestions}}</text>
<text style="font-size:13px">处理部门{{item.handleDepartName}}</text>
</view>
<!-- <view class="time">{{item.handleDate}}</view> -->
</view>
</block>
</view>
</view>
<block wx:if="{{detail.status == 1}}">
<button class="btn1" bindtap="evaluation">我要评价</button>
</block>

134
pages/user/myWhistle/whistleDetail/index.wxss

@ -0,0 +1,134 @@
/* pages/user/myWhistle/whistleDetail/index.wxss */
page{
width:100%;
font-size: 28rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.title{
width: 90%;
height: 60px;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.116);
display: flex;
align-items: center;
justify-content: space-between;
}
.content{
width: 90%;
/* height: 200px; */
margin-top: 5px;
border-bottom: 1rpx solid rgba(0, 0, 0, 0.116);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.con{
width:90%;
margin-top:20rpx;
margin-bottom: 20rpx;
font-size: 26rpx;
display: flex;
align-items: center;
}
.image-show{
height: 220rpx;
width:90%;
overflow-x:scroll;
white-space:nowrap;
margin-top:30rpx;
}
.img-box{
margin-right:15rpx;
width:220rpx;
height:180rpx;
display: inline-flex;
position: relative;
}
.process{
width: 100%;
margin-top:20px;
display: flex;
flex-direction: column;
align-items: center;
font-size: 27rpx;
}
.table{
/* background-color: #efeff4; */
/* height: 100%; */
width:90%;
display: flex;
flex-direction: column;
align-items: center;
}
.tb{
width:100%;
/* height:150rpx; */
min-height: 100px;
display: flex;
/* border: 1px solid #000; */
}
/* .time{
width: 30%;
display: flex;
justify-content:right;
font-size:13px;
} */
.timeline{
width: 15%;
display: flex;
flex-direction: column;
}
.content-1{
width:85%;
/* height: 100%; */
display: flex;
flex-direction: column;
justify-content:center;
/* align-items: center; */
/* word-wrap:break-word;
word-break:break-all; */
}
.line{
width:49%;
height: 40%;
border-right: 1px solid #cecdcb;
}
.circle{
width:100%;
height: 20%;
display: flex;
align-items: center;
justify-content:center;
color:#5677fc;
}
.process-tit{
display: flex;
justify-content: space-between;
}
text{
margin-bottom: 5px;
}
.btn1{
width:90%;
background-color: #fc6351;
color: white;
margin-top: 30px;
margin-bottom: 30px;
}

24
pages/weChatAuth/index.js

@ -18,14 +18,17 @@ Page({
userInfo: {
type: Object,
value: {}
}
},
type:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
type:options.type
})
},
/**
@ -106,5 +109,22 @@ Page({
})
}
})
},
bindGetPhoneNumber(e){
// var user = UserModel;
if (e.detail.encryptedData){
console.log(e);
let data = {}
// data.nickName = this.data.nickName;
// data.avatarUrl = this.data.avatarUrl;
data.encryptedData = e.detail.encryptedData;
data.iv = e.detail.iv;
// data.session = app.globalData.session;
userModel.wxRegister(data,res => {
wx.reLaunch({
url: '/pages/home/index',
})
});
}
}
})

26
pages/weChatAuth/index.wxml

@ -1,4 +1,5 @@
<!--pages/weChatAuth/index.wxml-->
<block wx:if="{{type == 1}}">
<view class="container">
<navigator open-type="switchTab" url="/pages/home/index">
<image class="auth_cancel" src="/images/common/close.png"></image>
@ -20,3 +21,28 @@
<view wx:else>请升级微信版本</view>
</view>
</view>
</block>
<block wx:else="{{type == 2}}">
<view class="container">
<navigator open-type="switchTab" url="/pages/home/index">
<image class="auth_cancel" src="/images/common/close.png"></image>
</navigator>
<view class="page_bd">
<view class="image_view">
<view class="title">市北人才</view>
<image class="img" src="/images/temp_1.png"></image>
</view>
<view class="description">
<view class="h1">
</view>
<view>
授权后,可以更好的体验我们哦~
</view>
</view>
<button class="authBtn" type="primary" wx:if="{{canIUse}}" open-type="getPhoneNumber" bindgetphonenumber="bindGetPhoneNumber">获取手机号</button>
<view wx:else>请升级微信版本</view>
</view>
</view>
</block>

2348
style/font.wxss

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save