Commit 219f1d76 by liangyuhang

用户登录退出

parent ad208c0d
// components/reportList.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
<!--components/reportList.wxml-->
<view id="report" class="con">
<block wx:for="{{crisisReport}}" wx:key="index">
<!-- 首个新闻 -->
<view class="report-first" wx:if="{{index==0}}" data-item="{{crisisReport[0]}}">
<image src="https://crisis.zhiweidata.com/app/{{crisisReport[0].imgUrl}}" />
<view class="info">{{crisisReport[0].reportName}}</view>
</view>
<!-- 列表 -->
<view class="report-list" wx:if="{{index>0}}">
<view class="imgBox">
<image mode="heightFix" src="https://crisis.zhiweidata.com/app/{{item.imgUrl}}"/>
</view>
<view class="content">
<text class="report-name">{{item.reportName}}</text>
<text class="report-introduction">{{item.introduction}}</text>
<text class="report-time">{{dateUtil.dateFormat(item.publishTime,'yyyy/MM/dd')}}</text>
</view>
</view>
</block>
</view>
/* components/reportList.wxss */
.report-first{
position: relative;
width: 100%;
height: 324rpx;
background-color: #ffffff;
border-radius: 10px;
border: solid 2px #eeeeee;
overflow: hidden;
margin-bottom: 25rpx;
}
.report-first image{
width: 100%;
height: 100%;
}
.report-first .info{
position: absolute;
bottom: 0;
width: 100%;
height: 66rpx;
padding: 0 10rpx;
line-height: 66rpx;
background-color: rgba(0,0,0,0.4);
color: #ffffff;font-size: 28rpx;
}
.report-list{
width: 100%;
height: 180rpx;
margin-bottom: 25rpx;
display: flex;
}
.report-list .imgBox {
height: 100%;
margin-right: 20rpx;
}
.report-list .imgBox image{
width: 100%;
height: 100%;
}
.report-list .content{
position: relative;
height: 180rpx;
width: 100%;
}
.content .report-name{
position: absolute;
top: 0;
left: 0;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
}
.content .report-introduction{
position: absolute;
top: 60rpx;
left: 0;
color: #999;
font-size: 24rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.content .report-time{
position: absolute;
bottom: 0;
left: 0;
color: #999;
font-size: 24rpx;
}
\ No newline at end of file
......@@ -64,7 +64,6 @@ Page({
if(res){
let arr = res.data.data
arr.forEach(item => {
console.log(item)
item.publishTime = moment(item.publishTime).format('YYYY-MM-DD')
})
this.setData({
......@@ -94,20 +93,15 @@ Page({
})
// console.log(this.data.toView)
},
// refreshFieldData(e){
// var _id = e.currentTarget.dataset.id;
// wx.request({
// method: 'GET',
// header: { 'content-type':'application/json' },
// url: 'http://localhost:8088/mobile/index/focusIndustry?timeType='+_id,
// success(res) {
// console.log(res.data.data)
// crisisField:res.data.data
// },
// fail(e){
// console.log(e)
// }
// })
// }
refreshFieldData(e){
var _type = e.currentTarget.dataset.type;
// console.log(_type)
http.getRequest('/mobile/index/focusIndustry?timeType='+_type).then(res=>{
if(res){
this.setData({
crisisField:res.data.data
})
}
})
}
})
......@@ -39,7 +39,7 @@
<view id="dynamic" class="con">
<view class="title-line">
<text class="title">危机动态</text>
<navigator url="/pages/crisislib/crisislib" open-type="switchTab" class="right">查看全部></navigator>
<navigator url="/pages/library/library" open-type="switchTab" class="right">查看全部></navigator>
</view>
<swiper indicator-dots="true" autoplay="true" class="carousel" circular="true">
<block wx:for="{{crisisDynamic}}">
......@@ -67,9 +67,9 @@
<text class="right">查看全部></text>
</view>
<view class="time-type">
<view class="select_time" bindtap="refreshFieldData" data-id="month">近一月</view>
<view class="select_time" bindtap="refreshFieldData" data-id="halfYear">近半年</view>
<view class="select_time" bindtap="refreshFieldData" data-id="year">近一年</view>
<view class="select_time" bindtap="refreshFieldData" data-type="month">近一月</view>
<view class="select_time" bindtap="refreshFieldData" data-type="halfYear">近半年</view>
<view class="select_time" bindtap="refreshFieldData" data-type="year">近一年</view>
</view>
<view class="field-table">
<view class="field-th">
......@@ -83,9 +83,11 @@
<text>{{item.tag}}</text>
<text style="display:block;color: red;font-size: 24rpx;">↑10%</text>
</view>
<!-- <view class="field-proportion">{{item.proportion}}</view> -->
<view class="field-proportion">50%</view>
<text class="field-brand">{{item.brand}}</text>
<view class="field-proportion">{{util.toPercent(item.proportion)}}</view>
<view class="field-brand">
<text>{{item.brand}}</text>
</view>
<text class="unfold" bindtap="closeBanner">展开↓</text>
</view>
</block>
</view>
......@@ -115,7 +117,7 @@
<view id="report" class="con">
<view class="title-line">
<text class="title">危机报告</text>
<navigator url="/pages/crisisrep/crisisrep" open-type="switchTab" class="right">查看全部></navigator>
<navigator url="/pages/report/report" open-type="switchTab" class="right">查看全部></navigator>
</view>
<block wx:for="{{crisisReport}}" wx:key="index">
<!-- 首个新闻 -->
......@@ -131,7 +133,7 @@
<view class="content">
<text class="report-name">{{item.reportName}}</text>
<text class="report-introduction">{{item.introduction}}</text>
<text class="report-time">{{item.publishTime}}</text>
<text class="report-time">{{dateUtil.dateFormat(item.publishTime,'yyyy/MM/dd')}}</text>
</view>
</view>
</block>
......@@ -142,3 +144,6 @@
</scroll-view>
<wxs module="dateUtil" src="../../wxs/timeUtil.wxs"></wxs>
<wxs module="util" src="../../wxs/util.wxs"></wxs>
......@@ -18,7 +18,6 @@ page{
font-weight: 700;
font-style: normal;
font-size: 18px;
color: rgb(0, 0, 0);
}
.right{
float:right;
......@@ -177,29 +176,31 @@ page{
width: 25vh;
}
.field-th text:nth-child(2){
width: 25vh;
width: 30vh;
}
.field-th text:nth-child(3){
width: 50vh;
width: 45vh;
}
.field-list{
display: flex;
justify-content: center;
height: 100rpx;
height: 80rpx;
}
.field-tag{
.field-list .field-tag{
width: 25%;
font-weight: bold;
text-align: center;
}
.field-proportion{
width: 25%;
line-height: 100rpx;
.field-list .field-proportion{
width: 30%;
line-height: 80rpx;
color: #00a2ff;
text-align: center;
font-weight: bold;
}
.field-list .field-brand{
width: 30%;
}
.field-brand{
flex: 1;
.field-list .field-brand text{
font-size: 26rpx;
color: #333333;
display: -webkit-box;
......@@ -207,6 +208,12 @@ page{
-webkit-line-clamp: 2;
overflow: hidden;
}
.field-list .unfold{
font-size: 26rpx;
color: #00a2ff;
padding-left: 20rpx;
line-height: 80rpx;
}
/* 危机复盘 */
......@@ -278,10 +285,11 @@ page{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
}
.content .report-introduction{
position: absolute;
top: 50rpx;
top: 60rpx;
left: 0;
color: #999;
font-size: 24rpx;
......@@ -294,6 +302,8 @@ page{
position: absolute;
bottom: 0;
left: 0;
color: #999;
font-size: 24rpx;
}
......
......@@ -5,7 +5,8 @@ Page({
* 页面的初始数据
*/
data: {
conditions:[],
events:[]
},
/**
......@@ -26,7 +27,9 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
wx.showLoading({
title: '加载中...',
})
},
/**
......
<!--pages/library/library.wxml-->
<text>pages/library/library.wxml</text>
<block></block>
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<!--pages/report/report.wxml-->
<text>pages/report/report.wxml</text>
<reportList></reportList>
// pages/usercenter/index.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/usercenter/usercenter.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
<!--pages/usercenter/usercenter.wxml-->
<text>pages/usercenter/usercenter.wxml</text>
<view class="usercenter">
<!-- 头部背景 -->
<view class="top"></view>
<!-- 用户信息 -->
<view class="userinfo">
<!-- <button open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber" catchtap="getUserProfile" class="login-btn">点此登录</button> -->
<view wx:if="{{isLogin}}">
<view class="userinfo-avatar" bindtap="bindViewTap">
<!-- <open-data type="userAvatarUrl"></open-data> -->
<image src="{{headUrl}}"></image>
</view>
<!-- <open-data type="userNickName" class="nickname"></open-data> -->
<text class="nickname">{{userName}}</text>
<text class="level">{{roleId=="1"?"VIP":""}}</text>
<view class="logout" bind:tap="logout">退出登录</view>
</view>
<button open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber" class="login-btn" wx:else>点此登录</button>
</view>
<!-- 推荐功能 -->
<view class="features">
<text class="title">推荐功能</text>
<view class="container">
<view class="qwe">
<image src="../../image/wechatHL.png" mode="heightFix"></image>
<text style="display: block;">我的危机</text>
</view>
<view class="qwe">
<image src="../../image/wechatHL.png" mode="heightFix"></image>
<text style="display: block;">我的报告</text>
</view>
<view class="qwe">
<image src="../../image/wechatHL.png" mode="heightFix"></image>
<text style="display: block;">账号权限</text>
</view>
<view class="qwe">
<image src="../../image/wechatHL.png" mode="heightFix"></image>
<text style="display: block;">账号管理</text>
</view>
</view>
</view>
</view>
/* pages/usercenter/usercenter.wxss */
.usercenter{
background-color:#e8ebf1;
height:100vh;
}
.top{
width: 100%;
height: 250rpx;
background-color: #00a0e8;
}
.userinfo {
position: relative;
width: 700rpx;
height: 200rpx;
margin: -100rpx auto;
background-color: #fff;
border-radius: 5px;
box-shadow: 0px 5px 5px #e8e8e8;
}
.userinfo-avatar {
position: absolute;
left: 30rpx;
top: -55rpx;
overflow: hidden;
border-radius: 50%;
}
.userinfo-avatar image{
width: 110rpx;
height: 110rpx;
}
.nickname{
position: absolute;
left: 30rpx;
top: 80rpx;
}
.level{
position: absolute;
left: 30rpx;
bottom: 25rpx;
font-size: 24rpx;
color: #999;
}
.logout{
position: absolute;
right: 30rpx;
bottom:25rpx;
font-size: 24rpx;
color: #999;
}
.features{
position: relative;
width: 700rpx;
height: 300rpx;
margin: 150rpx auto;
background-color: #fff;
border-radius: 5px;
box-shadow: 0px 5px 5px #e8e8e8;
}
.features .title{
position: absolute;
left: 30rpx;
top: 30rpx;
}
.features .container{
display: flex;
flex-direction: row;
}
.qwe{
text-align: center;
width: 25vh;
}
.container image{
height: 7vh;
}
\ No newline at end of file
{
"setting": {},
"condition": {
"plugin": {
"list": []
},
"game": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": [
{
"name": "危机库",
"pathName": "pages/library/library",
"query": "",
"scene": null
},
{
"name": "用户中心",
"pathName": "pages/usercenter/usercenter",
"query": "",
"scene": null
}
]
}
}
}
\ No newline at end of file
// const baseURL = 'https://crisis.zhiweidata.com'
const baseURL = 'http://localhost:8088'
const baseURL = 'http://192.168.0.194:8088'
function wxPromisify(fn) {
return function (obj = {}) {
......
var formatNumber = function(n){
n = n.toString()
return n[1] ? n : '0' + n
}
var regYear = getRegExp("(y+)", "i");
var dateFormat = function(timestamp,format){
if (!format) {
format = "yyyy-MM-dd hh:mm:ss";
}
timestamp = parseInt(timestamp);
var realDate = getDate(timestamp);
function timeFormat(num) {
return num < 10 ? '0' + num : num;
}
var date = [
["M+", timeFormat(realDate.getMonth() + 1)],
["d+", timeFormat(realDate.getDate())],
["h+", timeFormat(realDate.getHours())],
["m+", timeFormat(realDate.getMinutes())],
["s+", timeFormat(realDate.getSeconds())],
["q+", Math.floor((realDate.getMonth() + 3) / 3)],
["S+", realDate.getMilliseconds()],
];
var reg1 = regYear.exec(format);
// console.log(reg1[0]);
if (reg1) {
format = format.replace(reg1[1], (realDate.getFullYear() + '').substring(4 - reg1[1].length));
}
for (var i=0;i<date.length;i++) {
var k = date[i][0];
var v = date[i][1];
var reg2 = getRegExp("(" + k + ")").exec(format);
if (reg2) {
format = format.replace(reg2[1], reg2[1].length == 1
? v : ("00" + v).substring(("" + v).length));
}
}
return format;
}
module.exports = {
dateFormat: dateFormat
};
var toPercent = function(point){
var percent = (point*100).toFixed(0);
percent += "%";
return percent;
}
module.exports = {
toPercent: toPercent
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment