Commit d89ca9e7 by liangyuhang

Initial Commit

parents
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/
// app.js
App({
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
},
globalData: {
userInfo: null
}
})
{
"pages": [
"pages/index/index",
"pages/logs/logs",
"pages/crisisrep/crisisrep",
"pages/crisislib/crisislib",
"pages/usercenter/index"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "危机汇",
"navigationBarTextStyle": "black"
},
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"iconPath": "image/icon_cloud.png",
"selectedIconPath": "image/icon_cloud_HL.png",
"text": "首页"
},{
"pagePath": "pages/crisisrep/crisisrep",
"iconPath": "image/icon_API.png",
"selectedIconPath": "image/icon_API_HL.png",
"text": "危机报告"
}, {
"pagePath": "pages/crisislib/crisislib",
"iconPath": "image/icon_component.png",
"selectedIconPath": "image/icon_component_HL.png",
"text": "危机库"
}, {
"pagePath": "pages/usercenter/index",
"iconPath": "image/icon_component.png",
"selectedIconPath": "image/icon_component_HL.png",
"text": "用户中心"
}]
},
"style": "v2",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents"
}
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
// pages/crisislib/crisislib.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--pages/crisislib/crisislib.wxml-->
<text>pages/crisislib/crisislib.wxml</text>
/* pages/crisislib/crisislib.wxss */
\ No newline at end of file
// pages/crisisrep/crisisrep.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/crisisrep/crisisrep.wxml-->
<text>pages/crisisrep/crisisrep.wxml</text>
/* pages/crisisrep/crisisrep.wxss */
\ No newline at end of file
// index.js
// 获取应用实例
const app = getApp()
Page({
data: {
crisisDynamic:[],
crisisField:[],
crisisArticle:[],
crisisReport:[],
banner:true,
toView: 'banner',
},
// 事件处理函数
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad() {
this.setCrisisDynamicData();
this.setCrisisFieldData();
this.setCrisisArticleData();
this.setCrisisReportData();
},
setCrisisDynamicData(){
wx.request({
method: 'GET',
url: 'http://localhost:8088/mobile/index/event/recently',
success: (res) =>{
this.setData({
crisisDynamic:res.data.data.list
})
},
fail(e){
console.log(e)
}
})
},
setCrisisFieldData(){
wx.request({
method: 'GET',
url: 'http://localhost:8088/mobile/index/focusIndustry?timeType=month',
success: (res) =>{
this.setData({
crisisField:res.data.data
})
},
fail(e){
console.log(e)
}
})
},
setCrisisArticleData(){
wx.request({
method: 'GET',
url: 'http://localhost:8088/mobile/index/article/recently',
success: (res) =>{
// console.log(res)
this.setData({
crisisArticle:res.data.data
})
},
fail(e){
console.log(e)
}
})
},
setCrisisReportData(){
wx.request({
method: 'GET',
url: 'http://localhost:8088/mobile/index/report/recently?size=4',
success: (res) =>{
this.setData({
crisisReport:res.data.data
})
},
fail(e){
console.log(e)
}
})
},
onGetOpenid() {
wx.request({
method: 'GET',
url: 'http://localhost:8088/mobile/index/event/recently?page=1&size=3',
success(res) {
console.log(res)
},
fail(e){
console.log(e)
}
})
},
closeBanner(){
this.setData({
banner: false
})
},
scrollToViewFn(e){
var _id = e.currentTarget.dataset.id;
this.setData({
toView: _id
})
// console.log(this.data.toView)
},
refreshFieldData(e){
var _id = e.currentTarget.dataset.id;
console.log(_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)
}
})
}
})
{
"usingComponents": {},
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--index.wxml-->
<scroll-view scroll-y="true" style="height: 100vh" scroll-into-view="{{toView}}" scroll-with-animation="true" >
<!-- 横幅 -->
<view class="banner" wx:if="{{banner}}">
<swiper class="banner_container" autoplay="true" vertical="true" circular="true">
<block wx:for="{{crisisDynamic}}">
<swiper-item>
<text>{{item.title}}</text>
<view class="close" bindtap="closeBanner">X</view>
</swiper-item>
</block>
</swiper>
</view>
<!-- 顶部 -->
<view id="top" class="con">
<view class="search">
<view class="search_in">
<input type="text"/>
<button class="search_btn" bindtap="search">搜索</button>
</view>
</view>
<view class="box">
<view class="icon" bindtap="scrollToViewFn" data-id="dynamic">
<image src="https://d1icd6shlvmxi6.cloudfront.net/gsc/L5VHPP/e9/83/b8/e983b88902ca4085bcbc34d714ac6904/images/%E9%A6%96%E9%A1%B5/u7.svg?pageId=794f4729-ba77-4770-92d6-71dfe84a18c1"/>
<text class="text">危机动态</text>
</view>
<view class="icon" bindtap="scrollToViewFn" data-id="field">
<image src="https://d1icd6shlvmxi6.cloudfront.net/gsc/L5VHPP/e9/83/b8/e983b88902ca4085bcbc34d714ac6904/images/首页/u14.svg?pageId=794f4729-ba77-4770-92d6-71dfe84a18c1"/>
<text class="text">聚焦领域</text>
</view>
<view class="icon" bindtap="scrollToViewFn" data-id="article">
<image src="https://d1icd6shlvmxi6.cloudfront.net/gsc/L5VHPP/e9/83/b8/e983b88902ca4085bcbc34d714ac6904/images/首页/u17.svg?pageId=794f4729-ba77-4770-92d6-71dfe84a18c1"/>
<text class="text">危机复盘</text>
</view>
<view class="icon" bindtap="scrollToViewFn" data-id="report">
<image src="https://d1icd6shlvmxi6.cloudfront.net/gsc/L5VHPP/e9/83/b8/e983b88902ca4085bcbc34d714ac6904/images/首页/u10.svg?pageId=794f4729-ba77-4770-92d6-71dfe84a18c1"/>
<text class="text">危机报告</text>
</view>
</view>
</view>
<view class="line"></view>
<!-- 危机动态 -->
<view id="dynamic" class="con">
<view class="up">
<text class="title left">危机动态</text>
<navigator url="/pages/crisislib/crisislib" open-type="switchTab" class="right">查看全部></navigator>
<view class="clear"></view>
</view>
<swiper indicator-dots="true" autoplay="true" class="carousel" circular="true">
<block wx:for="{{crisisDynamic}}">
<swiper-item>
<navigator url="https://crisis.zhiweidata.com/event/{{item.id}}">
<image class="dynamic_img" src="https://d1icd6shlvmxi6.cloudfront.net/gsc/L5VHPP/e9/83/b8/e983b88902ca4085bcbc34d714ac6904/images/首页/u22.svg?pageId=794f4729-ba77-4770-92d6-71dfe84a18c1" mode="scaleToFill" />
<image class="dynamic_img2" src="https://d1icd6shlvmxi6.cloudfront.net/gsc/L5VHPP/e9/83/b8/e983b88902ca4085bcbc34d714ac6904/images/%E9%A6%96%E9%A1%B5/u21.png?pageId=794f4729-ba77-4770-92d6-71dfe84a18c1" mode="scaleToFill" />
</navigator>
<text class="dynamic_title">{{item.title}}</text>
<text class="dynamic_level">{{item.crisisLevelZh}}</text>
<text class="dynamic_introduction">{{item.introduction}}</text>
<text class="dynamic_brand">{{item.priBrand}}</text>
<text class="dynamic_tag">{{item.priCrisisTags}}</text>
</swiper-item>
</block>
</swiper>
</view>
<view class="line"></view>
<!-- 聚焦领域 -->
<view id="field" class="con">
<view>
<text class="title left">聚焦领域</text>
<text class="right">查看全部></text>
<view class="clear"></view>
</view>
<view class="time">
<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>
<view class="table">
<view class="tr bg-w">
<view class="th">全行业</view>
<view class="th">危机占比</view>
<view class="th">涉及品牌</view>
</view>
<block wx:for="{{crisisField}}" wx:key="index">
<view class="tr {{index%2 === 0?'':'bg-g'}}">
<view class="td">{{item.tag}}</view>
<view class="td">{{item.proportion}}</view>
<view class="td">{{item.brand}}</view>
</view>
</block>
</view>
</view>
<view class="line"></view>
<!-- 危机复盘 -->
<view id="article" class="con">
<view>
<text class="title left">危机复盘</text>
<text class="right">查看全部></text>
<view class="clear"></view>
</view>
<block wx:for="{{crisisArticle}}" wx:key="index">
<view class="tr {{index%2 === 0?'':'bg-g'}}">
<view class="td">{{item.title}}</view>
<view class="td">{{item.publishTime}}</view>
</view>
</block>
</view>
<view class="line"></view>
<!-- 危机报告 -->
<view id="report" class="con">
<view>
<text class="title left">危机报告</text>
<navigator url="/pages/crisisrep/crisisrep" open-type="switchTab" class="right">查看全部></navigator>
<view class="clear"></view>
</view>
<block wx:for="{{crisisReport}}" wx:key="index">
<!-- 首个新闻 -->
<view wx:if="{{index==0}}" class="top_report" data-item="{{crisisReport[0]}}">
<image class="img" src="https://crisis.zhiweidata.com/app/{{crisisReport[0].imgUrl}}" />
<view class="info">{{crisisReport[0].reportName}}</view>
</view>
<!-- 列表 -->
<view wx:if="{{index>0}}">
<view class="imgBox">
<image src="https://crisis.zhiweidata.com/app/{{item.imgUrl}}"/>
</view>
<view class="content">
<view class="report_name">{{item.reportName}}</view>
<view class="report_time">{{item.time}}</view>
</view>
</view>
</block>
<view class="line-title">--我是有底线的--</view>
</view>
</scroll-view>
/**index.wxss**/
.banner{
position: relative;
height: 50rpx;
text-align: center;
vertical-align: middle;
background-color: #dae3f1;
color: #025FEA;
}
.banner .banner_container{
height: 50rpx;
}
.banner text{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
letter-spacing: 2px;
}
.banner .close{
display: inline;
position: absolute;
right: 20rpx;
}
.search {
position: relative;
height: 90rpx;
background-color: #fff;
margin-top: 50rpx;
}
.search .search_in {
box-sizing: border-box;
height: 60rpx;
width: 100%;
background-color: #ffffff;
border-radius: 10rpx;
border: 1px solid #8b8b8b;
}
.search_in .search_btn {
position: absolute;
right: 0;
top:0;
height: 60rpx;
line-height: 30rpx;
width: 22vw;
border-radius:0 10rpx 10rpx 0;
background-color: #00a2ff;
color: #ffffff;
text-align: center;
font-size: 26rpx;
}
.line{
margin : 15px 0;
width: 100%;
border-top: 15px solid rgb(242 242 242);
}
.clear{
clear:both;
}
.con{
width: 92%;
margin: 0 auto;
}
.box{
display: flex;
flex-direction: row;
text-align: center;
margin-top: 25px;
}
.icon{
width: 25vw;
}
.icon image{
width: 7vw;
height: 7vw;
}
.title{
display: flex;
font-family: "微软雅黑 Bold", "微软雅黑 Regular", 微软雅黑, sans-serif;
font-weight: 700;
font-style: normal;
font-size: 18px;
color: rgb(0, 0, 0);
text-align: left;
}
.carousel{
margin-top: 25rpx;
}
.icon .text{
display: block;
}
.left{
float: left;
}
.right{
float:right;
display:block;
color: #7f7f7f;
}
.clear{
clear: both;
}
.carousel{
position: relative;
}
.carousel .dynamic_img{
position: absolute;
}
.carousel .dynamic_title{
position: absolute;
top: 20rpx;
left: 30rpx;
font-weight: 700;
font-style: normal;
font-size: 18px;
color: #FFFFFF;
}
.carousel .dynamic_level{
position: absolute;
top: 20rpx;
right: 30rpx;
color: #FFFFFF;
width: 80rpx;
height: 50rpx;
background-color: #f87653;
text-align: center;
}
.carousel .dynamic_introduction{
position: absolute;
top: 100rpx;
left: 30rpx;
color: #FFFFFF;
}
.carousel .dynamic_brand{
position: absolute;
bottom: 50rpx;
left: 30rpx;
width: 150rpx;
height: 50rpx;
background-color: #ffffff;
text-align: center;
}
.carousel .dynamic_tag{
position: absolute;
bottom: 50rpx;
left: 200rpx;
width: 150rpx;
height: 50rpx;
background-color: #ffffff;
text-align: center;
}
.time{
display: flex;
flex-direction: row;
}
.select_time{
width: 15vw;
height: 35rpx;
background-color: #f2f2f2;
font-size: 25rpx;
margin: 25rpx 15rpx 25rpx 0rpx;
text-align: center;
}
.tr {
display: flex;
width: 100%;
justify-content: center;
height: 72rpx;
align-items: center;
font-size: 22rpx;
color: #666666;
}
.td {
width:40%;
justify-content: center;
text-align: center;
align-items: center;
color: #666666;
}
.bg-g{
background: #F6F7F9;
}
.th {
width: 40%;
justify-content: center;
background: #E9E9E9;
color: #333333;
display: flex;
height: 72rpx;
align-items: center;
font-size: 22rpx;
}
#report image{
margin-top: 25rpx;
width: 100%;
}
.line-title {
text-align: center;
padding: 30rpx 0;
color: #888888;
}
.top_report{
position: relative;
width: 100%;
height: 324rpx;
background-color: #ffffff;
border-radius: 10px;
border: solid 2px #eeeeee;
overflow: hidden;
}
.top_report .img{
width: 100%;
height: 100%;
}
.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;
}
.imgBox {
position: relative;
width: 230rpx;
height: 144rpx;
margin-right: 30rpx;
}
.imgBox .img {
width: 100%;
height: 100%;
}
.content {
flex: 1;
}
.content .title {
height: 28rpx;
line-height: 28rpx;
margin-bottom: 14rpx;
font-size: 28rpx;
color: #353535;
overflow: hidden;
text-overflow: ellipsis;
line-clamp: 1;
}
.infos {
display: flex;
}
.brand {
padding: 0 10rpx;
height: 36rpx;
margin-right: 14rpx;
background-color: #a1a3b6;
border-radius: 4rpx;
font-size: 20rpx;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
}
.labels {
border-radius: 4rpx;
border: solid 2rpx #dddddd;
font-size: 20rpx;
color: #999999;
padding: 0 6rpx;
height: 36rpx;
display: flex;
justify-content: center;
align-items: center;
}
.labels .right {
padding: 8rpx 10rpx;
}
.time {
height: 19rpx;
font-size: 24rpx;
line-height: 24rpx;
color: #999999;
padding-top: 35rpx;
}
.tag {
position: absolute;
left: -10rpx;
top: -10rpx;
width: 66rpx;
height: 35rpx;
line-height: 35rpx;
background-color: #ff7f49;
border-radius: 4rpx 4rpx 4rpx 0rpx;
text-align: center;
color: #ffffff;
font-size: 19rpx;
}
.tag::before {
position: absolute;
bottom: -10rpx;
left: 0;
content: '';
width: 0;
height: 0;
border-top: 10rpx solid #ff7f49;
border-left: 10rpx solid transparent;
}
\ No newline at end of file
// logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad() {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return {
date: util.formatTime(new Date(log)),
timeStamp: log
}
})
})
}
})
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}
\ No newline at end of file
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log.date}}</text>
</block>
</view>
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}
// 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/index.wxml-->
<text>pages/usercenter/index.wxml</text>
/* pages/usercenter/index.wxss */
\ No newline at end of file
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": false,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": false,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"enableEngineNative": false,
"useIsolateContext": true,
"userConfirmedBundleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"showES6CompileOption": false
},
"compileType": "miniprogram",
"libVersion": "2.23.4",
"appid": "wx70d8f2455f2152c2",
"projectname": "危机汇",
"debugOptions": {
"hidedInDevtools": []
},
"scripts": {},
"staticServerOptions": {
"baseURL": "",
"servePath": ""
},
"isGameTourist": false,
"condition": {
"search": {
"list": []
},
"conversation": {
"list": []
},
"game": {
"list": []
},
"plugin": {
"list": []
},
"gamePlugin": {
"list": []
},
"miniprogram": {
"list": []
}
}
}
\ No newline at end of file
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : `0${n}`
}
module.exports = {
formatTime
}
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