@@ -0,0 +1,31 @@ | |||
/* | |||
* Eslint config file | |||
* Documentation: https://eslint.org/docs/user-guide/configuring/ | |||
* Install the Eslint extension before using this feature. | |||
*/ | |||
module.exports = { | |||
env: { | |||
es6: true, | |||
browser: true, | |||
node: true, | |||
}, | |||
ecmaFeatures: { | |||
modules: true, | |||
}, | |||
parserOptions: { | |||
ecmaVersion: 2018, | |||
sourceType: 'module', | |||
}, | |||
globals: { | |||
wx: true, | |||
App: true, | |||
Page: true, | |||
getCurrentPages: true, | |||
getApp: true, | |||
Component: true, | |||
requirePlugin: true, | |||
requireMiniProgram: true, | |||
}, | |||
// extends: 'eslint:recommended', | |||
rules: {}, | |||
} |
@@ -0,0 +1,14 @@ | |||
# Windows | |||
[Dd]esktop.ini | |||
Thumbs.db | |||
$RECYCLE.BIN/ | |||
# macOS | |||
.DS_Store | |||
.fseventsd | |||
.Spotlight-V100 | |||
.TemporaryItems | |||
.Trashes | |||
# Node.js | |||
node_modules/ |
@@ -0,0 +1,158 @@ | |||
import * as STORAGE from './utils/storage' | |||
import * as UTIL from './utils/util' | |||
import * as API from './utils/API' | |||
let APP = getApp(); | |||
App({ | |||
onLaunch() { | |||
var that = this; | |||
//存储storage初始化globalData数据-- | |||
//何时存储,用来判断,不用获取code | |||
that.initGlobalData(); | |||
//获取code | |||
UTIL.getCOdeFromWX({ | |||
complate: (code) => { | |||
// //获取openId | |||
that.getOpenIdFromFW(code); | |||
} | |||
}); | |||
//获取设备信息 | |||
wx.getSystemInfo({ | |||
success: function (res) { | |||
that.globalData.systemType = res.system.indexOf("Android") >= 0 ? "Android" : "IOS"; | |||
that.globalData.isIphoneX = res.model.indexOf("iPhone X") >= 0 || res.model.indexOf("iPhone 1") >= 0; | |||
} | |||
}); | |||
}, | |||
onShow() { | |||
//更新机制 | |||
this.wxappUpdateManager(); | |||
}, | |||
globalData: { | |||
// 系统用户登录信息(用户id、token) | |||
userInfo: { | |||
token: '', | |||
toastTimeout:null | |||
}, | |||
//微信用户登陆信息(昵称、头像、省、城市) | |||
wxUserInfo: { | |||
nickName: '', | |||
avatarUrl: '', | |||
province: '', | |||
city: '' | |||
} | |||
, | |||
/** | |||
* 小程序设置 | |||
*/ | |||
setInfo: { | |||
//定位授权 | |||
locationOpenIdWX: false, | |||
//纬度 | |||
latitude:'', | |||
//经度 | |||
longitude:'', | |||
} | |||
, | |||
systemType:'',//设备类型 Android IOS | |||
isIphoneX: false, // 用来标识当前手机机型是否为 iPhone X | |||
}, | |||
/** | |||
* 从服务端获取openId | |||
*/ | |||
getOpenIdFromFW(code) { | |||
let sendData = { | |||
code: code | |||
} | |||
UTIL.httpRequestNoneDetal(API.URL_GET_OPENID, sendData, "POST", { | |||
success: (res) => { | |||
if (res.code == API.SUCCESS_CODE) { | |||
// UTIL.showToastNoneIcon("openId:" + res._data.openid); | |||
STORAGE.setToken(res.token) | |||
STORAGE.setOpenId(res.data.openId) | |||
STORAGE.setSessionKey(res.data.sessionKey) | |||
getApp().globalData.userInfo.token = res.token; | |||
} else { | |||
//未获取到openId | |||
STORAGE.setOpenId(res.data.openId) | |||
STORAGE.setSessionKey(res.data.sessionKey) | |||
} | |||
} | |||
}) | |||
}, | |||
/** | |||
* 初始化globalData | |||
*/ | |||
initGlobalData() { | |||
var userInfo = { | |||
token: STORAGE.getToken() | |||
} | |||
console.log(userInfo) | |||
this.globalData.userInfo = userInfo; | |||
} | |||
, | |||
/** | |||
* 小程序更新机制 | |||
* 获取小程序更新机制兼容 | |||
*/ | |||
wxappUpdateManager() { | |||
if (wx.canIUse('getUpdateManager')) { | |||
const updateManager = wx.getUpdateManager(); | |||
if (!!updateManager) { | |||
updateManager.onCheckForUpdate(function (res) { | |||
// 请求完新版本信息的回调 | |||
if (res.hasUpdate) { | |||
updateManager.onUpdateReady(function () { | |||
wx.showModal({ | |||
title: '更新提示', | |||
content: '新版本已经准备好,是否重启应用?', | |||
success: function (res) { | |||
if (res.confirm) { | |||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 | |||
updateManager.applyUpdate() | |||
} | |||
} | |||
}) | |||
}) | |||
updateManager.onUpdateFailed(function () { | |||
// 新的版本下载失败 | |||
wx.showModal({ | |||
title: '已经有新版本了哟~', | |||
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~', | |||
}) | |||
}) | |||
} | |||
}) | |||
} | |||
} else { | |||
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 | |||
wx.showModal({ | |||
title: '提示', | |||
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' | |||
}) | |||
} | |||
}, | |||
showToast(msg, selfClass = '') { | |||
clearTimeout(this.globalData.toastTimeout); | |||
const page = getCurrentPages(); | |||
const currPage = page[page.length - 1]; | |||
currPage.setData({ | |||
toastData: { | |||
showFlag: true, | |||
toastMsg: msg, | |||
selfClass, | |||
}, | |||
}); | |||
this.globalData.toastTimeout = setTimeout(() => { | |||
currPage.setData({ | |||
toastData: { | |||
showFlag: false, | |||
selfClass: '', | |||
}, | |||
}); | |||
}, 2000); | |||
}, | |||
}) |
@@ -0,0 +1,19 @@ | |||
{ | |||
"pages": [ | |||
"pages/user/login/login", | |||
"pages/index/index" | |||
], | |||
"window": { | |||
"backgroundTextStyle": "light", | |||
"navigationBarBackgroundColor": "#fff", | |||
"navigationBarTitleText": "农燊高科", | |||
"navigationBarTextStyle": "black" | |||
}, | |||
"style": "v2", | |||
"sitemapLocation": "sitemap.json", | |||
"permission": { | |||
"scope.userLocation": { | |||
"desc": "你的位置信息将用于小程序位置接口的效果展示" | |||
} | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
/**app.wxss**/ | |||
@import '/style/main.wxss'; | |||
@import "./templates/global/global.wxss"; | |||
@import "/style/iconfont.wxss"; | |||
Page { | |||
font-size: 28rpx; | |||
line-height: 35rpx; | |||
background-color: #F4F4F4; | |||
color: #444; | |||
} | |||
view, | |||
scroll-view, | |||
swiper, | |||
movable-view, | |||
icon, | |||
text, | |||
progress, | |||
button, | |||
checkbox, | |||
form, | |||
input, | |||
label, | |||
picker, | |||
picker-view, | |||
radio, | |||
slider, | |||
switch, | |||
textarea, | |||
navigator, | |||
audio, | |||
image, | |||
video, | |||
map, | |||
canvas, | |||
contact-button { | |||
-webkit-box-sizing: border-box; | |||
box-sizing: border-box; | |||
} | |||
.Al_shenhui_text_color { | |||
color: #8b8686; | |||
} | |||
.singleLinHidenEllipsis | |||
{ | |||
overflow: hidden; | |||
text-overflow: ellipsis; | |||
white-space: nowrap; | |||
} |
@@ -0,0 +1,40 @@ | |||
// component/iconLoading/iconLoading.js | |||
Component({ | |||
/** | |||
* 组件的属性列表 | |||
*/ | |||
properties: { | |||
innerText: { | |||
type: String, | |||
value: 'default value', | |||
} | |||
}, | |||
/** | |||
* 组件的初始数据 | |||
*/ | |||
data: { | |||
isShowLoading: false | |||
}, | |||
/** | |||
* 组件的方法列表 | |||
*/ | |||
methods: { | |||
//隐藏弹框 | |||
hideLoading() { | |||
this.setData({ | |||
isShowLoading: false | |||
}) | |||
}, | |||
//展示弹框 | |||
showLoading() { | |||
this.setData({ | |||
isShowLoading: true | |||
}) | |||
} | |||
} | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,7 @@ | |||
<!-- 全局 弹窗loading 小图提示--> | |||
<block wx:if="{{isShowLoading}}"> | |||
<view class='global-loading'> | |||
<image class="img" src='https://shgm.jjyyx.com/m/images/loadings.gif'></image> | |||
<view > {{innerText}}</view> | |||
</view> | |||
</block> |
@@ -0,0 +1,20 @@ | |||
/* component/iconLoading/iconLoading.wxss */ | |||
.global-loading { | |||
z-index: 999999; | |||
position: fixed; | |||
top: 0%; | |||
left: 0%; | |||
width: 100%; | |||
height: 100%; | |||
background-color: rgba(255, 255, 255, 0.5); | |||
} | |||
.global-loading .img{ | |||
position: absolute; | |||
top: 50%; | |||
left: 50%; | |||
width: 180rpx; | |||
height: 180rpx; | |||
-webkit-transform: translate(-90rpx, -90rpx); | |||
transform: translate(-90rpx, -90rpx); | |||
z-index: 9999999; | |||
} |
@@ -0,0 +1,11 @@ | |||
module.exports = { | |||
DEV: { | |||
URL_PREFIX: 'http://116.255.223.226:8081/nsgk_test', | |||
}, | |||
PRE: { | |||
URL_PREFIX: 'http://116.255.223.226:8081/nsgk_test', | |||
}, | |||
PROD: { | |||
URL_PREFIX: 'http://116.255.223.226:8081/nsgk_test', | |||
} | |||
} |
@@ -0,0 +1,56 @@ | |||
import * as UTIL from '../../utils/util.js'; | |||
import * as API from '../../utils/API.js'; | |||
Page({ | |||
data: { | |||
//顶部胶囊按钮位置信息rect | |||
CustomMenuButton: null, | |||
wrokScrollHeight:0, | |||
userInfoObj:{} //用户信息 | |||
}, | |||
onLoad: function (options) { | |||
//获取用户信息 | |||
this.getUserInfo() | |||
//获取滚动条高度 | |||
this.computeBarLocation(); | |||
}, | |||
/* 计算bar 高度*/ | |||
computeBarLocation() { | |||
var that = this; | |||
let CustomMenuButton = wx.getMenuButtonBoundingClientRect(); | |||
let CustomWidows = wx.getSystemInfoSync(); | |||
// 根据文档,先创建一个SelectorQuery对象实例 | |||
let query = wx.createSelectorQuery().in(this); | |||
query.select('.top_title').boundingClientRect(); | |||
query.select('.information_header').boundingClientRect(); | |||
query.select('.navList_main').boundingClientRect(); | |||
query.select('.child_function').boundingClientRect(); | |||
query.select('.work_plan').boundingClientRect(); | |||
query.exec((res) => { | |||
let wrokScrollHeight = CustomWidows.windowHeight; | |||
res.forEach((v)=>{ | |||
wrokScrollHeight = wrokScrollHeight - v.height; | |||
}) | |||
wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15; | |||
that.setData({ | |||
wrokScrollHeight: wrokScrollHeight, | |||
}); | |||
}) | |||
that.setData({ | |||
CustomMenuButton: CustomMenuButton, | |||
}); | |||
}, | |||
/* 获取用户信息*/ | |||
getUserInfo(){ | |||
UTIL.httpRequest(API.URL_GET_GETINFO, {method:'GET'}, { | |||
success: (res) => { | |||
if (res.code == API.SUCCESS_CODE) { | |||
this.setData({userInfoObj:res.user}) | |||
} | |||
} | |||
}) | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"usingComponents": { | |||
"icon-loading":"/component/iconLoading/iconLoading" | |||
}, | |||
"navigationStyle": "custom" | |||
} |
@@ -0,0 +1,249 @@ | |||
<view class="container" style="background:url('../../image/index/header_bg.png') top center no-repeat; background-size: 100% auto;"> | |||
<!--自定义 顶部标题样式和位置--> | |||
<view class="top_title" style="height:{{CustomMenuButton.bottom}}px;z-index: 7777;padding-top: {{CustomMenuButton.top}}px;"></view> | |||
<!--账户信息--> | |||
<view class="information_header"> | |||
<view class="portrait_head"></view> | |||
<view class="information_main"> | |||
<view class="name_wrap"> | |||
<text class="name">{{userInfoObj.nickName}}</text> | |||
<view class="jobs"> | |||
<view class="icon" style="background:url('../../image/index/header_job.png') no-repeat; background-size: 100% 100%;"></view> | |||
{{userInfoObj.remark}} | |||
</view> | |||
</view> | |||
<view class="task_wrap "> | |||
<view class="flex_block"> | |||
<view class="desc">已完成</view> | |||
<view class="event">120件</view> | |||
</view> | |||
<view class="flex_block unfinished"> | |||
<view class="desc">已完成</view> | |||
<view class="event">120件</view> | |||
</view> | |||
</view> | |||
<view class="address_wrap"> | |||
<view class="icon"></view> | |||
{{userInfoObj.allDeptName}} | |||
</view> | |||
</view> | |||
</view> | |||
<!--主导航--> | |||
<view class="navList_main"> | |||
<view class="tab_item"> | |||
<view class="icon"> | |||
<image class="icon_img" src="../../image/index/nav_01.png" mode="aspectFit"></image> | |||
</view> | |||
<text class="desc">支出申请</text> | |||
</view> | |||
<view class="tab_item"> | |||
<view class="icon"> | |||
<image class="icon_img" src="../../image/index/nav_02.png" mode="aspectFit"></image> | |||
</view> | |||
<text class="desc">收入登记</text> | |||
</view> | |||
<view class="tab_item"> | |||
<view class="icon"> | |||
<image class="icon_img" src="../../image/index/nav_03.png" mode="aspectFit"></image> | |||
</view> | |||
<text class="desc">记账申请</text> | |||
</view> | |||
<view class="tab_item"> | |||
<view class="icon"> | |||
<image class="icon_img" src="../../image/index/nav_04.png" mode="aspectFit"></image> | |||
</view> | |||
<text class="desc">财务公开</text> | |||
</view> | |||
</view> | |||
<!--子导航功能导航--> | |||
<view class="child_function"> | |||
<view class="flex_block"> | |||
<view class="image"><image class="attribute" src="../../image/index/child_function_01.png" mode="aspectFit"></image></view> | |||
<text class="desc">收款人</text> | |||
</view> | |||
<view class="flex_block"> | |||
<view class="image"><image class="attribute" src="../../image/index/child_function_02.png" mode="aspectFit"></image></view> | |||
<text class="desc">付款人</text> | |||
</view> | |||
<view class="flex_block"> | |||
<view class="image"><image class="attribute" src="../../image/index/child_function_03.png" mode="aspectFit"></image></view> | |||
<text class="desc">合同报送</text> | |||
</view> | |||
<view class="flex_block"> | |||
<view class="image"><image class="attribute" src="../../image/index/child_function_04.png" mode="aspectFit"></image></view> | |||
<text class="desc">固资变动</text> | |||
</view> | |||
<view class="flex_block"> | |||
<view class="image"><image class="attribute" src="../../image/index/child_function_05.png" mode="aspectFit"></image></view> | |||
<text class="desc">资源变动</text> | |||
</view> | |||
</view> | |||
<!--工作计划--> | |||
<view class="work_plan"> | |||
<view class="menu_item active">待办<text class="remind">0</text></view> | |||
<view class="menu_item">已办</view> | |||
<view class="menu_item">已发起</view> | |||
<view class="menu_item">已制单</view> | |||
<view class="more">></view> | |||
</view> | |||
<scroll-view scroll-y="true" style="height: {{wrokScrollHeight}}px;"> | |||
<view class="workflow"> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
<!--1--> | |||
<view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">我的擦撒十大黑科技暗杀可接受的和</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe"> | |||
<image class="amount_icon" src="../../image/index/process_icon.png" mode="aspectFit"></image> | |||
<text>银行转账</text> | |||
</view> | |||
<view class="amount"><text class="unit">¥</text>-2600.00</view> | |||
</view> | |||
</view> | |||
</view> | |||
</scroll-view> | |||
</view> |
@@ -0,0 +1,291 @@ | |||
.singleLinHidenEllipsis{ | |||
color: black; | |||
text-align: center; | |||
width: auto; | |||
} | |||
.information_header{ | |||
/* padding: 30rpx 32rpx 54rpx; */ | |||
padding: 10rpx 32rpx 54rpx; | |||
display: flex; | |||
} | |||
.information_header .portrait_head{ | |||
width: 110rpx; | |||
height: 110rpx; | |||
background: #000; | |||
border-radius: 50%; | |||
} | |||
.information_header .information_main{ | |||
flex: 1; | |||
padding-left: 16rpx; | |||
} | |||
.information_header .name_wrap{ | |||
display: flex; | |||
height: 54rpx; | |||
align-items: center; | |||
margin-bottom: 10rpx; | |||
} | |||
.information_header .name_wrap .name{ | |||
font-size: 46rpx; | |||
} | |||
.information_header .name_wrap .jobs{ | |||
margin-left: 18rpx; | |||
width: 155rpx; | |||
height: 40rpx; | |||
background: #5bae75; | |||
border:2rpx solid #2c8e68; | |||
color: #fff; | |||
border-radius: 40rpx; | |||
display: flex; | |||
font-size: 28rpx; | |||
justify-content: center; | |||
align-items: center; | |||
} | |||
.information_header .name_wrap .jobs .icon{ | |||
width: 26rpx; | |||
height: 27rpx; | |||
margin-right: 5rpx; | |||
} | |||
.information_header .task_wrap{ | |||
display: flex; | |||
height: 44rpx; | |||
margin-bottom: 18rpx; | |||
} | |||
.information_header .unfinished{ | |||
margin-left: 12rpx; | |||
} | |||
.information_header .task_wrap .flex_block{ | |||
height: 48rpx; | |||
display: flex; | |||
background: #fff; | |||
line-height: 44rpx; | |||
border-radius: 44rpx; | |||
border:2rpx solid #2c8e68; | |||
text-align: center; | |||
font-size: 28rpx; | |||
} | |||
.information_header .task_wrap .flex_block .desc{ | |||
width: 115rpx; | |||
background: #2c8e68; | |||
position:relative; | |||
overflow: hidden; | |||
color: #fff; | |||
line-height: 44rpx; | |||
border-top-left-radius: 44rpx; | |||
border-bottom-left-radius: 44rpx; | |||
margin-top: -1rpx; | |||
margin-left: -1rpx; | |||
} | |||
.information_header .task_wrap .flex_block .desc::before{ | |||
position:absolute; | |||
top:-40rpx; | |||
right:-40rpx; | |||
content:""; | |||
z-index:1; | |||
width:110rpx; /*如果需要圆角的话 不用比box的宽度长,如果不需要圆角需要增长*/ | |||
height:40rpx; | |||
background-color:#fff; | |||
transform:rotate(-75deg); | |||
transform-origin:right bottom; | |||
border-radius:0px; | |||
} | |||
.information_header .task_wrap .flex_block .event{ | |||
color: #2c8e68; | |||
margin-left: -2%; | |||
padding:0 8rpx 0 5rpx; | |||
} | |||
.information_header .address_wrap{ | |||
font-size: 26rpx; | |||
color: #2b8e68; | |||
height: 46rpx; | |||
line-height: 46rpx; | |||
} | |||
.navList_main{ | |||
width: 685rpx; | |||
height: 228rpx; | |||
background-color: #fff; | |||
border-radius: 24rpx; | |||
margin:0 auto; | |||
display: flex; | |||
box-shadow: 0rpx 0rpx 12rpx rgba(0,0,0,.2); | |||
} | |||
.navList_main .tab_item{ | |||
flex: 1; | |||
display: flex; | |||
justify-content: center; | |||
align-items: center; | |||
flex-direction: column; | |||
} | |||
.navList_main .tab_item .icon{ | |||
width: 100rpx; | |||
height: 100rpx; | |||
margin-bottom: 12rpx; | |||
} | |||
.navList_main .tab_item .icon_img{ | |||
width: 100rpx; | |||
height: 100rpx; | |||
} | |||
.navList_main .tab_item .desc{ | |||
font-size: 26rpx; | |||
} | |||
.child_function{ | |||
margin: 55rpx 20rpx 0; | |||
display: flex; | |||
} | |||
.child_function .flex_block{ | |||
flex: 1; | |||
display: flex; | |||
justify-content: center; | |||
align-items: center; | |||
flex-direction: column; | |||
} | |||
.child_function .flex_block .image{ | |||
width: 76rpx; | |||
height: 70rpx; | |||
margin-bottom: 20rpx; | |||
} | |||
.child_function .flex_block .attribute{ | |||
width: 76rpx; | |||
height: 70rpx; | |||
} | |||
.child_function .flex_block .desc{ | |||
font-size: 26rpx; | |||
} | |||
.work_plan{ | |||
padding: 40rpx 32.5rpx 30rpx; | |||
display: flex; | |||
} | |||
.work_plan .menu_item{ | |||
height: 60rpx; | |||
width: 140rpx; | |||
background-color: #fff; | |||
box-shadow: 0rpx 0rpx 9rpx rgba(0,0,0,.2); | |||
border-radius: 60rpx; | |||
line-height: 60rpx; | |||
text-align: center; | |||
font-size: 32rpx; | |||
position: relative; | |||
margin-right: 16rpx; | |||
} | |||
.work_plan .menu_item.active{ | |||
background-color: #5bae78; | |||
color: #fff; | |||
} | |||
.work_plan .menu_item .remind{ | |||
height: 30rpx; | |||
background: #e90101; | |||
color: #fff; | |||
font-size: 26rpx; | |||
position: absolute; | |||
line-height: 30rpx; | |||
padding:0 10rpx; | |||
border-radius: 50%; | |||
top: -10rpx; | |||
right: -10rpx; | |||
} | |||
.work_plan .more{ | |||
flex: 1; | |||
text-align: center; | |||
line-height: 60rpx; | |||
font-size: 36rpx; | |||
color: #31936c; | |||
} | |||
.workflow{ | |||
padding: 10rpx 32.5rpx; | |||
} | |||
.workflow .workflow_list{ | |||
height: 150rpx; | |||
background-color: #fff; | |||
border-radius: 24rpx; | |||
box-shadow:0rpx 0rpx 10rpx rgba(0,0,0,.1); | |||
margin-bottom: 20rpx; | |||
padding:15rpx 25rpx 10rpx 35rpx; | |||
} | |||
.workflow .workflow_list .process_intro{ | |||
display: flex; | |||
height: 62rpx; | |||
align-items: center; | |||
} | |||
.workflow .process_intro .name{ | |||
width: 324rpx; | |||
font-size: 34rpx; | |||
margin-right: 30rpx; | |||
overflow: hidden; | |||
text-overflow: ellipsis; | |||
white-space: nowrap; | |||
} | |||
.workflow .process_intro .state{ | |||
width: 93rpx; | |||
height: 42rpx; | |||
background-color: #fbe3e3; | |||
color: #f31e1f; | |||
border-radius: 12rpx; | |||
text-align: center; | |||
line-height: 42rpx; | |||
} | |||
.workflow .process_intro .time{ | |||
flex: 1; | |||
text-align: right; | |||
font-size: 32rpx; | |||
color: #9ea1aa; | |||
} | |||
.workflow .workflow_list .process_pay{ | |||
display: flex; | |||
height: 52rpx; | |||
align-items: center; | |||
} | |||
.workflow .workflow_list .process_pay .describe{ | |||
font-size: 30rpx; | |||
width: 330rpx; | |||
color: #3c9370; | |||
display: flex; | |||
align-items: center; | |||
} | |||
.workflow .workflow_list .process_pay .describe .amount_icon{ | |||
width: 32rpx; | |||
height: 32rpx; | |||
margin-right: 12rpx; | |||
} | |||
.workflow .workflow_list .process_pay .amount{ | |||
font-size: 38rpx; | |||
flex: 1; | |||
text-align: right; | |||
color: #f31e1f; | |||
} | |||
.workflow .workflow_list .process_pay .amount .unit{ | |||
font-size: 26rpx; | |||
} | |||
/* <view class="workflow_list"> | |||
<view class="process_intro"> | |||
<view class="name">啊啊啊啊啊啊啊啊啊啊</view> | |||
<view class="state">待审</view> | |||
<view class="time">2021-1-26</view> | |||
</view> | |||
<view class="process_pay"> | |||
<view class="describe">银行转账</view> | |||
<view class="amount">¥-2600.00</view> | |||
</view> | |||
</view> */ |
@@ -0,0 +1,116 @@ | |||
// pages/index/index.js | |||
import * as UTIL from '../../../utils/util.js'; | |||
import * as API from '../../../utils/API.js'; | |||
import * as STORAGE from '../../../utils/storage' | |||
const APP = getApp(); | |||
Page({ | |||
data: { | |||
isIPhoneX:false, | |||
privacyCheck:true //用户协议 | |||
}, | |||
onLoad: function (options) { | |||
this.setData({ | |||
isIPhoneX:UTIL.isIPhoneX() | |||
}) | |||
this.automaticLogin() | |||
}, | |||
//自动登录 | |||
automaticLogin(){ | |||
let automatic = STORAGE.getToken(); | |||
let getOpenId = STORAGE.getOpenId(); | |||
if(automatic == '' && getOpenId ==''){ | |||
UTIL.getCOdeFromWX({ | |||
complate: (code) => { | |||
let sendData = { | |||
code: code | |||
} | |||
UTIL.httpRequestNoneDetal(API.URL_GET_OPENID, sendData, "POST", { | |||
success: (res) => { | |||
if (res.code == API.SUCCESS_CODE) { | |||
wx.navigateTo({ | |||
url: '/pages/index/index', | |||
}) | |||
} | |||
} | |||
}) | |||
} | |||
}); | |||
}else{ | |||
wx.navigateTo({ | |||
url: '/pages/index/index', | |||
}) | |||
} | |||
}, | |||
//用户隐私协议选项 | |||
checkboxChange: function(res) { | |||
let checkStatus = false; | |||
if(res.detail.value.length!=0){ | |||
checkStatus = true; | |||
}else{ | |||
checkStatus = false; | |||
} | |||
this.setData({ | |||
privacyCheck:checkStatus | |||
}) | |||
}, | |||
//微信一键登录授权 | |||
getPhoneNumber: function(res) { | |||
let that = this; | |||
let { | |||
detail | |||
} = res; | |||
if (!detail.encryptedData) { | |||
//允许授权 | |||
APP.showToast("未获取到手机号码,注册失败!"); | |||
return; | |||
}else if(this.data.privacyCheck == false){ | |||
APP.showToast("请阅读并同意用户协议和隐私政策!"); | |||
return; | |||
} | |||
let sendData = { | |||
sessionKey:STORAGE.getSessionKey(), | |||
iv:detail.iv, | |||
encryptedData:detail.encryptedData | |||
} | |||
UTIL.httpRequest(API.URL_POST_DECRYPTEDWXDATA, sendData,{ | |||
success: (res) => { | |||
if (res.code == API.SUCCESS_CODE) { | |||
let phoneNumber = res.data.phoneNumber; | |||
//微信手机号码绑定 | |||
that.wxUserBand(phoneNumber) | |||
// UTIL.showToastNoneIcon("数据共:" + res._data.length + "条"); | |||
} else { | |||
//待删 | |||
UTIL.showToastNoneIcon(res.msg) | |||
} | |||
}, | |||
fail: (res) => { | |||
UTIL.showToastNoneIcon(API.MSG_FAIL_HTTP) | |||
} | |||
}); | |||
}, | |||
wxUserBand(phone){ | |||
let sendData = { | |||
openId:STORAGE.getOpenId(), | |||
phonenumber:phone | |||
} | |||
UTIL.httpRequest(API.URL_POST_USERBAND, sendData,{ | |||
success: (res) => { | |||
if (res.code == API.SUCCESS_CODE) { | |||
wx.navigateTo({ | |||
url: '/pages/index/index', | |||
}) | |||
}else{ | |||
UTIL.showToastNoneIcon(res.msg) | |||
} | |||
}, | |||
fail: (res) => { | |||
UTIL.showToastNoneIcon(API.MSG_FAIL_HTTP) | |||
} | |||
}); | |||
console.log(sendData) | |||
// | |||
} | |||
}) |
@@ -0,0 +1,6 @@ | |||
{ | |||
"usingComponents": { | |||
"icon-loading":"/component/iconLoading/iconLoading" | |||
}, | |||
"navigationStyle": "custom" | |||
} |
@@ -0,0 +1,20 @@ | |||
<import src="/templates/global/global"/> | |||
<template is="toast" data="{{...toastData}}"></template> | |||
<view class="container" style="background: url('../../../image/login/container_bg.jpg') center center no-repeat; background-size: 100% auto;"> | |||
<view class="header" > | |||
<view class="principal">农村事项审批与记账</view> | |||
<view class="instructions">报账简单,操作便捷</view> | |||
</view> | |||
<view class="quick-login" style="bottom:{{isIPhoneX?'8vh':'5vh'}}"> | |||
<button class="key-login" type='primary' open-type='getPhoneNumber' bindgetphonenumber="getPhoneNumber">微信一键登录</button > | |||
<view class="authorization" style="margin-top:{{isIPhoneX?'5vh':'3vh'}}"> | |||
<checkbox-group bindchange="checkboxChange"> | |||
<label> | |||
<checkbox value="privacy" checked="{{privacyCheck}}" class="changeSize" /> | |||
<text>我已阅读并同意用户协议和隐私政策</text> | |||
</label> | |||
</checkbox-group> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,62 @@ | |||
.container{ | |||
width: 100vw; | |||
height: 100vh; | |||
} | |||
.container .header{ | |||
padding-top: 25.24vh; | |||
height: 36.94vh; | |||
} | |||
.container .header .principal{ | |||
height: 6.15vh; | |||
line-height: 6.15vh; | |||
margin-bottom: 0.61vh; | |||
text-align: center; | |||
font-size: 4.92vh; | |||
color: #2c7339; | |||
} | |||
.container .header .instructions{ | |||
font-size: 2.46vh; | |||
height: 4.92vh; | |||
line-height: 4.92vh; | |||
text-align: center; | |||
color: #2c7339; | |||
} | |||
.container .quick-login{ | |||
position: fixed; | |||
/* bottom: 8vh; */ | |||
width: 100%; | |||
} | |||
.container .quick-login .key-login{ | |||
width: 89vw; | |||
height: 5.17vh; | |||
background:#ffffff; | |||
margin:0 auto; | |||
border-radius: 5.17vh; | |||
text-align: center; | |||
line-height: 5.17vh; | |||
font-size: 2.21vh; | |||
color: #2c7339; | |||
box-shadow: 8rpx 6rpx 20rpx rgba(0,0,0,.3); | |||
padding: 0; | |||
} | |||
.container .quick-login .authorization{ | |||
margin-top: 5vh; | |||
display: flex; | |||
justify-content: center; /* 相对父元素水平居中 */ | |||
align-items: center; /* 子元素相对父元素垂直居中 */ | |||
color: #fff; | |||
} | |||
.container .quick-login .authorization .changeSize{ | |||
transform: scale(0.7,0.7); | |||
} | |||
.container .quick-login .authorization .changeSize .wx-checkbox-input { | |||
border-radius: 1vh; | |||
} | |||
.container .quick-login .authorization text{ | |||
margin-left: -.5vw; | |||
} |
@@ -0,0 +1,82 @@ | |||
{ | |||
"description": "项目配置文件", | |||
"packOptions": { | |||
"ignore": [ | |||
{ | |||
"type": "file", | |||
"value": ".eslintrc.js" | |||
} | |||
] | |||
}, | |||
"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": "" | |||
}, | |||
"useIsolateContext": true, | |||
"userConfirmedBundleSwitch": false, | |||
"packNpmManually": false, | |||
"packNpmRelationList": [], | |||
"minifyWXSS": true, | |||
"disableUseStrict": false, | |||
"minifyWXML": true, | |||
"showES6CompileOption": false, | |||
"useCompilerPlugins": false, | |||
"ignoreUploadUnusedFiles": true | |||
}, | |||
"compileType": "miniprogram", | |||
"libVersion": "2.21.1", | |||
"appid": "wxaace54cc2cf8924b", | |||
"projectname": "WXMB", | |||
"debugOptions": { | |||
"hidedInDevtools": [] | |||
}, | |||
"scripts": {}, | |||
"staticServerOptions": { | |||
"baseURL": "", | |||
"servePath": "" | |||
}, | |||
"isGameTourist": false, | |||
"condition": { | |||
"search": { | |||
"list": [] | |||
}, | |||
"conversation": { | |||
"list": [] | |||
}, | |||
"game": { | |||
"list": [] | |||
}, | |||
"plugin": { | |||
"list": [] | |||
}, | |||
"gamePlugin": { | |||
"list": [] | |||
}, | |||
"miniprogram": { | |||
"list": [] | |||
} | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
{ | |||
"condition": { | |||
"plugin": { | |||
"list": [] | |||
}, | |||
"game": { | |||
"list": [] | |||
}, | |||
"gamePlugin": { | |||
"list": [] | |||
}, | |||
"miniprogram": { | |||
"list": [ | |||
{ | |||
"name": "pages/show/show", | |||
"pathName": "pages/index/index", | |||
"query": "", | |||
"scene": null | |||
} | |||
] | |||
} | |||
} | |||
} |
@@ -0,0 +1,7 @@ | |||
{ | |||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", | |||
"rules": [{ | |||
"action": "allow", | |||
"page": "*" | |||
}] | |||
} |
@@ -0,0 +1,42 @@ | |||
@font-face { | |||
font-family: "iconfont"; /* Project id 3051601 */ | |||
src: url('//at.alicdn.com/t/font_3051601_80e3j4e5om7.woff2?t=1640658441847') format('woff2'), | |||
url('//at.alicdn.com/t/font_3051601_80e3j4e5om7.woff?t=1640658441847') format('woff'), | |||
url('//at.alicdn.com/t/font_3051601_80e3j4e5om7.ttf?t=1640658441847') format('truetype'); | |||
} | |||
.iconfont { | |||
font-family: "iconfont" !important; | |||
font-size: 16px; | |||
font-style: normal; | |||
-webkit-font-smoothing: antialiased; | |||
-moz-osx-font-smoothing: grayscale; | |||
} | |||
.icon-bianji:before { | |||
content: "\e63d"; | |||
} | |||
.icon-caipinguanli:before { | |||
content: "\e63f"; | |||
} | |||
.icon-sousuo:before { | |||
content: "\e62b"; | |||
} | |||
.icon-jiantou:before { | |||
content: "\e627"; | |||
} | |||
.icon-jiantouyou:before { | |||
content: "\e628"; | |||
} | |||
.icon-jiantoushang:before { | |||
content: "\e629"; | |||
} | |||
.icon-guanbi:before { | |||
content: "\e62a"; | |||
} |
@@ -0,0 +1,23 @@ | |||
page { | |||
/* 标准色 */ | |||
--blue: #0f3f69; | |||
--red: #ff4752; | |||
--orange: #ffa601; | |||
--golden: #d4b871; | |||
--gray: #94969c; | |||
--black: #444444; | |||
--white: #fff; | |||
--pale: #e7e7e7; | |||
/* 浅色 */ | |||
--orangeLight: #FFFAEB; | |||
--blueLight: #155c99; | |||
--redLight: #FF4752; | |||
--grayLight: #e7e7e7; | |||
--grayWhite: #f4f4f4; | |||
/* 背景色 */ | |||
--bgGrayWhite: #f4f4f4; | |||
--bgGrayWhiteLight: #f8f8f8; | |||
/* 渐变色 */ | |||
/* 阴影透明色 */ | |||
} |
@@ -0,0 +1,18 @@ | |||
function modalResult(event) { | |||
const { result } = event.currentTarget.dataset; | |||
const page = getCurrentPages(); | |||
const currPage = page[page.length - 1]; | |||
currPage.setData({ | |||
modalData: { | |||
showFlag: false, | |||
} | |||
}); | |||
return result === '1'; | |||
} | |||
export { | |||
modalResult, | |||
} |
@@ -0,0 +1,57 @@ | |||
<!-- 提示层 - 没有更多了 --> | |||
<template name="noMore"> | |||
<view class="noMore">{{noMoreMes||'已经到底啦~'}}</view> | |||
</template> | |||
<!-- 提示层 - 暂无数据 --> | |||
<template name="empty"> | |||
<view class="error-page-tpl"> | |||
<image src="https://shgm.jjyyx.com/m/images/{{errorImageName||'error_img3.png'}}?20190704" mode="aspectFit"></image> | |||
<text class="error-tpl-msg">{{emptyMsg||'暂无数据'}}</text> | |||
<block wx:if="{{backBtnState && backBtnState >= 1 && !exitBtn}}"> | |||
<view class="zb-back-live" bindtap="{{backBtnState >= 1?'allowToBack': ''}}">{{backBtnMsg}}</view> | |||
</block> | |||
<block wx:if="{{exitBtn}}"> | |||
<navigator class="zb-back-live" open-type="exit" target="miniProgram">{{backBtnMsg}}</navigator> | |||
</block> | |||
</view> | |||
</template> | |||
<!-- 全局 toast 提示层 --> | |||
<template name="toast"> | |||
<block wx:if="{{showFlag}}"> | |||
<view class="toast-container {{selfClass}}"> | |||
<text>{{toastMsg}}</text> | |||
</view> | |||
</block> | |||
</template> | |||
<!-- 全局 modal 弹框 --> | |||
<template name="modal"> | |||
<block wx:if="{{showFlag}}"> | |||
<view class="modal-container"> | |||
<view class="modal-msg-container"> | |||
<view class="modal-msg">{{content}}</view> | |||
<view class="modal-btn-container"> | |||
<block wx:if="{{showCancel}}"> | |||
<view class="cancel-btn" data-result="0" bindtap="modalCallback">{{cancelText||'取消'}}</view> | |||
</block> | |||
<view class="confirm-btn" data-result="1" bindtap="{{myCallBack?myCallBack:'modalCallback'}}">{{confirmText||'确定'}}</view> | |||
</view> | |||
</view> | |||
</view> | |||
</block> | |||
</template> | |||
<!-- 全局 弹窗loading 小图提示--> | |||
<template name='globalLoading'> | |||
<block wx:if="{{globalLoading}}"> | |||
<view id='global-loading' class="{{globalLoading.hideMask ? 'hide-mask' : '' }}"> | |||
<image src='https://shgm.jjyyx.com/m/images/loadings.gif'></image> | |||
</view> | |||
</block> | |||
</template> |
@@ -0,0 +1,167 @@ | |||
/** | |||
* 提示层 - 没有更多了 | |||
*/ | |||
.noMore { | |||
width: 100%; | |||
font-size: 24rpx; | |||
color: #CCC; | |||
text-align: center; | |||
padding: 20rpx 0; | |||
padding-bottom: env(safe-area-inset-bottom); | |||
} | |||
/** | |||
* 提示层 - 暂无数据 | |||
*/ | |||
.error-page-tpl { | |||
position: fixed; | |||
left: 0; | |||
top: 35%; | |||
width: 100%; | |||
transform: translate(0, -50%); | |||
display: flex; | |||
flex-flow: column; | |||
justify-content: center; | |||
align-items: center; | |||
z-index: 2; | |||
} | |||
.error-page-tpl image { | |||
width: 400rpx; | |||
height: 400rpx; | |||
} | |||
.error-page-tpl .error-tpl-msg { | |||
margin-top: -30rpx; | |||
font-size: 24rpx; | |||
color: #999; | |||
word-wrap: break-word; | |||
word-break: normal; | |||
width: 100%; | |||
text-align: center; | |||
} | |||
.error-page-tpl .zb-back-live{ | |||
display: block; | |||
/* width: 192rpx; */ | |||
height: 64rpx; | |||
margin: 30rpx auto 0; | |||
line-height: 64rpx; | |||
text-align: center; | |||
font-size: 30rpx; | |||
color: var(--blueLight); | |||
background: #fff; | |||
border-radius: 32rpx; | |||
border: 1rpx solid #7AA6CC; | |||
padding: 0 32rpx; | |||
} | |||
/** | |||
* 全局 toast 提示层样式 | |||
*/ | |||
.toast-container { | |||
position: fixed; | |||
left: 0; | |||
bottom: 20%; | |||
width: 100%; | |||
transform: translate(0, -50%); | |||
transform: translate3d(0, -50%, 10000rpx); | |||
z-index: 99999; | |||
text-align: center; | |||
overflow: hidden; | |||
} | |||
.toast-container text { | |||
display: inline-block; | |||
padding: 20rpx; | |||
font-size: 28rpx; | |||
line-height: 1.2; | |||
color: #FFF; | |||
background: rgba(0, 0, 0, 0.8); | |||
border-radius: 12rpx; | |||
} | |||
.modal-container { | |||
position: fixed; | |||
left: 0; | |||
top: 0; | |||
right: 0; | |||
bottom: 0; | |||
background: rgba(0, 0, 0, 0.5); | |||
display: flex; | |||
flex-flow: column; | |||
justify-content: center; | |||
align-items: center; | |||
z-index: 9999; | |||
transform: translateZ(100rpx); | |||
} | |||
.modal-container .modal-msg-container { | |||
width: 540rpx; | |||
background: #FFF; | |||
border-radius: 20rpx; | |||
} | |||
.modal-container .modal-msg-container .modal-msg { | |||
padding: 60rpx 20rpx; | |||
line-height: 40rpx; | |||
font-size: 32rpx; | |||
color: #444; | |||
text-align: center; | |||
} | |||
.modal-container .modal-msg-container .modal-btn-container { | |||
border-top: 2rpx solid #ededed; | |||
width: 100%; | |||
height: 96rpx; | |||
font-size: 32rpx; | |||
color: #444; | |||
display: flex; | |||
justify-content: center; | |||
align-items: center; | |||
overflow: hidden; | |||
} | |||
.modal-container .modal-msg-container .modal-btn-container view { | |||
flex: 1; | |||
text-align: center; | |||
line-height: 0; | |||
padding: 48rpx; | |||
} | |||
.modal-container .modal-msg-container .modal-btn-container .confirm-btn { | |||
color: #FF4752; | |||
} | |||
.modal-container .modal-msg-container .modal-btn-container .cancel-btn { | |||
border-right: 2rpx solid #ededed; | |||
} | |||
#global-loading { | |||
z-index: 9999999; | |||
position: fixed; | |||
top: 0%; | |||
left: 0%; | |||
width: 100%; | |||
height: 100%; | |||
background-color: rgba(255, 255, 255, 0.5); | |||
} | |||
#global-loading.hide-mask { | |||
background: transparent; | |||
} | |||
#global-loading image { | |||
position: absolute; | |||
top: 50%; | |||
left: 50%; | |||
width: 180rpx; | |||
height: 180rpx; | |||
-webkit-transform: translate(-90rpx, -90rpx); | |||
transform: translate(-90rpx, -90rpx); | |||
z-index: 99999999; | |||
} |
@@ -0,0 +1,54 @@ | |||
let EVN_CONFIG = require('../env/env'); | |||
// const DISTRIBUTE_ENVIROMENT = 'PROD'; | |||
const DISTRIBUTE_ENVIROMENT = 'DEV'; | |||
let { | |||
URL_PREFIX, | |||
} = EVN_CONFIG[DISTRIBUTE_ENVIROMENT]; | |||
//用户登录页面,接口检测用户token失效,需跳转重新登录 | |||
const USER_LOGIN_PAGE_PATH='/pages/user/login/login'; | |||
//接口成功 | |||
const SUCCESS_CODE = 200; | |||
//微信登陆失效 | |||
const INVALID_USER_TOKEN_CODE = '001007'; | |||
/****************接口提示信息start ****************/ | |||
const MSG_FAIL_HTTP = '获取数据失败 fail'; | |||
const MSG_ERROR_HTTP = '获取数据失败 error'; | |||
const MSG_FALSE_HTTP = '获取数据失败 false'; | |||
const MSG_NONE_HTTP = '暂无数据'; | |||
const MSG_FALSE_TO = '提交失败,请重试'; | |||
const MSG_ERROR_TO = '提交异常,请重试'; | |||
const MSG_INVALID_USER_TOKEN='登陆信息失效,请重新登陆'; | |||
/****************接口提示信息end**************** | |||
/****************接口地址start****************/ | |||
//获取openId | |||
const URL_GET_OPENID=`${URL_PREFIX}/wechat/codeLogin`; | |||
// 获取手机号解密接口 | |||
const URL_POST_DECRYPTEDWXDATA = `${URL_PREFIX}/wechat/decryptedWXData`; | |||
// 微信绑定手机号 | |||
const URL_POST_USERBAND = `${URL_PREFIX}/register/wechat/band`; | |||
//获取用户信息 | |||
const URL_GET_GETINFO = `${URL_PREFIX}/getInfo`; | |||
/****************接口地址end****************/ | |||
export { | |||
USER_LOGIN_PAGE_PATH, | |||
SUCCESS_CODE, | |||
INVALID_USER_TOKEN_CODE, | |||
MSG_FAIL_HTTP, | |||
MSG_ERROR_HTTP, | |||
MSG_FALSE_HTTP, | |||
MSG_NONE_HTTP, | |||
MSG_FALSE_TO, | |||
MSG_ERROR_TO, | |||
MSG_INVALID_USER_TOKEN, | |||
URL_GET_OPENID, | |||
URL_POST_DECRYPTEDWXDATA, | |||
URL_POST_USERBAND, | |||
URL_GET_GETINFO | |||
} |
@@ -0,0 +1,51 @@ | |||
/** | |||
* 获取当前登录用户的 token | |||
*/ | |||
function getToken() { | |||
return wx.getStorageSync('token'); | |||
} | |||
/** | |||
* 设置用户token | |||
* @param {用户token} token | |||
*/ | |||
function setToken(token) { | |||
wx.setStorageSync('token', token); | |||
} | |||
/** | |||
* 获取当前登录用户的 openId | |||
*/ | |||
function getOpenId() { | |||
return wx.getStorageSync('openId'); | |||
} | |||
/** | |||
* 设置用户openId | |||
* @param {用户openId} openId | |||
*/ | |||
function setOpenId(openId) { | |||
wx.setStorageSync('openId', openId); | |||
} | |||
/** | |||
* 获取当前登录用户的 sessionKey | |||
*/ | |||
function getSessionKey() { | |||
return wx.getStorageSync('sessionKey'); | |||
} | |||
/** | |||
* 设置用户openId | |||
* @param {用户openId} sessionKey | |||
*/ | |||
function setSessionKey(sessionKey) { | |||
wx.setStorageSync('sessionKey', sessionKey); | |||
} | |||
export { | |||
getToken, | |||
setToken, | |||
getOpenId, | |||
setOpenId, | |||
getSessionKey, | |||
setSessionKey | |||
} |
@@ -0,0 +1,364 @@ | |||
import * as API from './API'; | |||
let APP = getApp(); | |||
let FUNCTION_TEXT = 'function'; | |||
/*判断是否iphonex*/ | |||
function isIPhoneX() { | |||
let screenHeight = wx.getSystemInfoSync().screenHeight | |||
let bottom = wx.getSystemInfoSync().safeArea.bottom | |||
return screenHeight !== bottom | |||
} | |||
/*获取当前页url*/ | |||
function getCurrentPageUrl() { | |||
var pages = getCurrentPages() | |||
var currentPage = pages[pages.length - 1] | |||
var url = currentPage.route | |||
return url | |||
} | |||
/*获取当前页带参数的url*/ | |||
function getCurrentPageUrlWithArgs() { | |||
var pages = getCurrentPages() | |||
var currentPage = pages[pages.length - 1] | |||
var url = currentPage.route | |||
var options = currentPage.options | |||
var urlWithArgs = url + '?' | |||
for (var key in options) { | |||
var value = options[key] | |||
urlWithArgs += key + '=' + value + '&' | |||
} | |||
urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1) | |||
return urlWithArgs | |||
} | |||
/** | |||
* 无图标,纯文本Toast提示 | |||
*/ | |||
function showToastNoneIcon(title) { | |||
if (title == undefined || title == '') { | |||
title = ''; | |||
} | |||
return wx.showToast({ | |||
title: title, | |||
icon: 'none', | |||
}); | |||
} | |||
/** | |||
* 显示Modal弹框(无取消按钮,只显示) | |||
* @param {标题} title | |||
* @param {内容} content | |||
* @param {按钮文字,默认确定} confirmText | |||
*/ | |||
function showModalNoneCancel(title, content, confirmText) { | |||
wx.showModal({ | |||
title: title, | |||
showCancel: false, | |||
content: content, | |||
confirmText: (typeof confirmText == 'undefined' || confirmText == '') ? '确定' : confirmText, | |||
success: function (e) { | |||
} | |||
}) | |||
} | |||
/** | |||
* 显示完整的Modal弹框提示 | |||
* @param {标题} title | |||
* @param {内容} content | |||
* @param {确认} confirmText | |||
* @param {取消} cancelText | |||
* @param {回调} param4 | |||
*/ | |||
function showModalOnClick(title, content, confirmText, cancelText, { confirm, cancel }) { | |||
wx.showModal({ | |||
title: title, | |||
content: content, | |||
confirmText: (typeof confirmText == 'undefined' || confirmText == '') ? '确定' : confirmText, | |||
cancelText: (typeof cancelText == 'undefined' || cancelText == '') ? '取消' : cancelText, | |||
success: function (e) { | |||
if (e.confirm) { | |||
confirm(); | |||
} else if (e.cancel) { | |||
cancel(); | |||
} | |||
} | |||
}) | |||
} | |||
/** | |||
* 有背景图层的loading | |||
* * @param {内容} content | |||
*/ | |||
function showLoadingHaveMask(content) { | |||
wx.showLoading({ | |||
title: (typeof content == "undefined" || content == '') ? '加载中...' : content, | |||
mask: true | |||
}) | |||
} | |||
/** | |||
* 隐藏loading | |||
*/ | |||
function hideLoadingHaveMask() { | |||
wx.hideLoading(); | |||
} | |||
/** | |||
* 全局通用网络请求方法,默认post传输 | |||
*/ | |||
function httpRequest(url, data, { | |||
success, | |||
fail, | |||
complete | |||
}) { | |||
wx.showNavigationBarLoading(); | |||
let finalData = {}; | |||
Object.assign(finalData, data); | |||
// finalData.token = getApp().globalData.userInfo.token; | |||
wx.request({ | |||
url, | |||
data: finalData, | |||
method: data.method || 'POST', | |||
timeout: 60000, | |||
header: { | |||
'Authorization':'Bearer '+getApp().globalData.userInfo.token | |||
}, | |||
success: function (response) { | |||
if (response.data && response.data._code == API.INVALID_USER_TOKEN_CODE) { | |||
//微信登陆失效 | |||
showToastNoneIcon(API.MSG_INVALID_USER_TOKEN); | |||
wx.navigateTo({ | |||
url: API.USER_LOGIN_PAGE_PATH, | |||
}) | |||
} else if (typeof success === FUNCTION_TEXT) { | |||
success(response.data); | |||
} | |||
}, | |||
fail: function (response) { | |||
if (typeof fail === FUNCTION_TEXT) { | |||
fail(handleFail(response)); | |||
} else { | |||
showToastNoneIcon(API.MSG_FAIL_HTTP); | |||
} | |||
}, | |||
complete: function (response) { | |||
if (typeof complete === FUNCTION_TEXT) { | |||
if (response.data && response.data._code == API.SUCCESS_CODE) { | |||
complete(response.data); | |||
} else { | |||
complete(handleFail(response.data)); | |||
} | |||
} | |||
wx.hideNavigationBarLoading(); | |||
} | |||
}) | |||
} | |||
/** | |||
* 网络访问(无其他处理) | |||
* @param {地址} url | |||
* @param {参数} data | |||
* @param {方法 get or post} method | |||
* @param {回调} param3 | |||
*/ | |||
function httpRequestNoneDetal(url, data, method, { | |||
success, | |||
fail, | |||
complete | |||
}) { | |||
wx.showNavigationBarLoading(); | |||
wx.request({ | |||
url, | |||
data: data, | |||
method: method, | |||
success: function (response) { | |||
if (typeof success === FUNCTION_TEXT) { | |||
success(response.data); | |||
} | |||
}, | |||
fail: function (response) { | |||
if (typeof fail === FUNCTION_TEXT) { | |||
fail(handleFail(response)); | |||
} else { | |||
showToastNoneIcon(API.MSG_FAIL_HTTP); | |||
} | |||
}, | |||
complete: function (response) { | |||
if (typeof complete === FUNCTION_TEXT) { | |||
if (response.data && response.data._code == API.SUCCESS_CODE) { | |||
complete(response.data); | |||
} else { | |||
complete(handleFail(response.data)); | |||
} | |||
} | |||
wx.hideNavigationBarLoading(); | |||
} | |||
}) | |||
} | |||
/** | |||
* 调用失败 | |||
*/ | |||
function handleFail(data = '') { | |||
let { _msg = API.MSG_FAIL_HTTP, _code = 10001, _data = '', } = data; | |||
return { | |||
_code, | |||
_data, | |||
_msg | |||
} | |||
} | |||
/** | |||
* 微信授权 获取信息 | |||
*/ | |||
// function initSQFromWX() { | |||
// let that = this; | |||
// wx.getSetting({ | |||
// success(res) { | |||
// // if (res.authSetting['scope.userInfo']) { | |||
// // console.log('个人信息:authSetting 已授权'); | |||
// // } else { | |||
// // console.log('个人信息:authSetting 未授权'); | |||
// // } | |||
// if (res.authSetting['scope.userLocation']) { | |||
// //定位已开启,暂不做功能处理 | |||
// console.log('定位:authSetting 已授权'); | |||
// getApp().globalData.setInfo.locationOpenIdWX = true; | |||
// } else { | |||
// //定位未开启,申请授权 | |||
// wx.authorize({ | |||
// scope: 'scope.userLocation', | |||
// success() { | |||
// //定位已开启,暂不做功能处理 | |||
// console.log('定位:wx.authorize success'); | |||
// getApp().globalData.setInfo.locationOpenIdWX = true; | |||
// } | |||
// , | |||
// fail() { | |||
// //如果之前已经拒绝过,直接返回fail 不弹窗 | |||
// console.log('定位:wx.authorize fail'); | |||
// getApp().globalData.setInfo.locationOpenIdWX = false; | |||
// wx.navigateTo({ | |||
// url: '/pages/wxAuth/wxAuth', | |||
// }) | |||
// } | |||
// }) | |||
// } | |||
// }, | |||
// fail(e) { | |||
// }, | |||
// complete() { | |||
// } | |||
// }); | |||
// } | |||
/** | |||
* 获取微信Code | |||
*/ | |||
function getCOdeFromWX({ complate }) { | |||
showLoadingHaveMask('正在加载数据..'); | |||
wx.login({ | |||
success: function (data) { | |||
console.log(data) | |||
complate(data.code); | |||
hideLoadingHaveMask() | |||
}, | |||
fail: function (err) { | |||
hideLoadingHaveMask(); | |||
showModalNoneCancel("温馨提示", "登陆失败,建议请重新打开小程序") | |||
} | |||
}) | |||
} | |||
/** | |||
* ,获取到的微信用户信息(昵称、头像、省市 赋值给globalData.wxUserInfo) | |||
*/ | |||
function getUserInfoFomWX({ success }) { | |||
wx.getUserProfile({ | |||
desc: '用于完善会员资料', | |||
success: res => { | |||
getApp().globalData.wxUserInfo.nickName = res.userInfo.nickName; | |||
getApp().globalData.wxUserInfo.avatarUrl = res.userInfo.avatarUrl; | |||
//不再返回 强制返回“” | |||
// getApp().globalData.wxUserInfo.province = res.userInfo.province; | |||
// getApp().globalData.wxUserInfo.city = res.userInfo.city; | |||
console.log("获取到个人信息:" + res.userInfo.nickName); | |||
success(res); | |||
}, | |||
complete: res => { | |||
} | |||
}) | |||
} | |||
/** | |||
* 获取地理位置 | |||
* @param {回调} param0 | |||
*/ | |||
function getLocationFromWX({ success, fail }) { | |||
wx.getLocation({ | |||
type: 'wgs84', | |||
success(res) { | |||
getApp().globalData.setInfo.latitude = res.latitude; | |||
getApp().globalData.setInfo.longitude = res.longitude; | |||
success(); | |||
} | |||
, fail(res) { | |||
showToastNoneIcon('获取地理信息失败'); | |||
fail(res); | |||
} | |||
}) | |||
} | |||
function convert_length(length) { | |||
return Math.round(wx.getSystemInfoSync().windowWidth * length / 750); | |||
} | |||
/** | |||
* 比较版本号(参数'1.11.0', '1.9.9',返回1) | |||
* @param {*} v1 | |||
* @param {*} v2 | |||
*/ | |||
function compareVersion(v1, v2) { | |||
v1 = v1.split('.') | |||
v2 = v2.split('.') | |||
const len = Math.max(v1.length, v2.length) | |||
while (v1.length < len) { | |||
v1.push('0') | |||
} | |||
while (v2.length < len) { | |||
v2.push('0') | |||
} | |||
for (let i = 0; i < len; i++) { | |||
const num1 = parseInt(v1[i]) | |||
const num2 = parseInt(v2[i]) | |||
if (num1 > num2) { | |||
return 1 | |||
} else if (num1 < num2) { | |||
return -1 | |||
} | |||
} | |||
return 0 | |||
} | |||
export { | |||
getCurrentPageUrl, | |||
getCurrentPageUrlWithArgs, | |||
showToastNoneIcon, | |||
showModalNoneCancel, | |||
showModalOnClick, | |||
showLoadingHaveMask, | |||
hideLoadingHaveMask, | |||
httpRequest, | |||
httpRequestNoneDetal, | |||
getCOdeFromWX, | |||
getLocationFromWX, | |||
getUserInfoFomWX, | |||
convert_length, | |||
isIPhoneX | |||
} |