Commit 185e9049 authored by leon's avatar leon

Merge branch 'develop' of http://106.15.103.105/lihuizhen/ec-report-refactor into develop

# Conflicts:
#	pages/index/index.vue
parents ff5105fd 4cfcbebd
...@@ -13,13 +13,28 @@ const install = (Vue, vm) => { ...@@ -13,13 +13,28 @@ const install = (Vue, vm) => {
const dataSetPreview = params => vm.$u.post(`${reportUrl}/report/dataset/preview`, params) const dataSetPreview = params => vm.$u.post(`${reportUrl}/report/dataset/preview`, params)
// 检查授权状态 // 检查授权状态
const getAuthorized = params => vm.$u.get(`${baseUrl}/report/user/getAuthorized`, params) const getAuthorized = params => vm.$u.get(`${baseUrl}/report/user/getAuthorized`, params)
// 获取用户数据
const getUserListCount = params => vm.$u.get(`${baseUrl}/report/user/getUserListCount`, params)
// 修改密码
const changePassword = params => vm.$u.post(`${baseUrl}/report/user/changePassword`, params)
// 获取用户数据
const getAuthorizedList = params => vm.$u.get(`${baseUrl}/report/user/getAuthorizedList`, params)
// 授权/取消授权
const authorizeOrUnauthorize = params => vm.$u.post(`${baseUrl}/report/user/authorizeOrUnauthorize`, params)
// 获取OPENID
const getOpenId = params => vm.$u.get(`${baseUrl}/report/user/getOpenId`, params)
vm.$u.api = { vm.$u.api = {
quickLogin, quickLogin,
register, register,
getReportList, getReportList,
dataSetPreview, dataSetPreview,
getAuthorized getAuthorized,
getUserListCount,
changePassword,
getAuthorizedList,
authorizeOrUnauthorize,
getOpenId
} }
} }
......
<template> <template>
<view> <view>
柱状图混合地图
<uni-ec-canvas <uni-ec-canvas
class="uni-ec-canvas" class="uni-ec-canvas"
id="bar-mix-map" id="bar-mix-map"
...@@ -25,7 +24,8 @@ ...@@ -25,7 +24,8 @@
return { return {
ec: { ec: {
lazyLoad:true lazyLoad:true
} },
changeTimer: null
} }
}, },
components: { components: {
...@@ -34,9 +34,134 @@ ...@@ -34,9 +34,134 @@
methods: { methods: {
initChart() { initChart() {
this.$nextTick(() => { this.$nextTick(() => {
clearInterval(this.changeTimer)
this.$refs['barMixMapCanvas'].init((canvas, width, height, canvasDpr) => {
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: canvasDpr
})
canvas.setChart(chart)
let options = this.setMapOption()
const { mapMixBarShow, mapMixBarChangeInterval} = this.elementInfo.option.mapMix
let flag = true
chart.setOption(options, true)
// 柱状图 地图 切换
if(mapMixBarShow && mapMixBarChangeInterval) {
clearInterval(this.changeTimer)
this.changeTimer = setInterval(() => {
options = flag ? this.setBarOption() : this.setMapOption()
flag = !flag
chart.setOption(options, true)
}, mapMixBarChangeInterval * 1000)
}
return chart
})
}) })
}, },
setBarOption() {
const { dataList: { series } } = this.elementData
let options = {
...this.elementInfo.option,
tooltip: {},
yAxis: {
...this.elementInfo.option.yAxis,
data: this.dealSeriesData(series).categories
},
series: {
id: 'associate',
type: 'bar',
...this.elementInfo.option.bar,
label: {
...this.elementInfo.option.dataset,
formatter: (val) => {
return this.$u.common.converFunction(this.elementInfo.option.dataset.formatter, val)
}
},
animationDurationUpdate: 1000,
universalTransition: true,
data: this.dealSeriesData(series).series
}
}
return options
},
setMapOption() {
const { dataList } = this.elementData
const seriesData = dataList.series || []
const series = []
for (let i = 0; i < seriesData.length; i++) {
const geoCoord = geoCoordMapList[seriesData[i].name]
if (geoCoord) {
series.push({
name: seriesData[i].name,
value: geoCoord.concat(seriesData[i].value)
})
}
}
const options = {
title: {
...this.elementInfo.option.title
},
legend: {
...this.elementInfo.option.legend
},
geo: {
map: 'china',
zoom: 1.2,
roam: false,
itemStyle: {
areaColor: 'rgba(34, 70, 168, 0.7)',
borderColor: '#0692a4'
},
emphasis: {
itemStyle: {
areaColor: 'rgba(119, 139, 224, 0.548)'
}
},
},
animationDurationUpdate: 1000,
series: [{
id: 'associate',
type: 'map',
map: 'china',
geoIndex: 0,
aspectScale: 0.75,
animationDurationUpdate: 1000,
universalTransition: true,
tooltip: {
show: false
},
data: series,
}, {
type: 'effectScatter',
coordinateSystem: 'geo',
// zlevel: 2,
rippleEffect: {
brushType: 'stroke'
},
label: {
show: true,
position: 'right',
formatter: (value) => {
if(this.elementInfo.option.dataset.formatter) {
return this.$u.common.converFunction(this.elementInfo.option.dataset.formatter, value)
} else {
return this.elementInfo.option.dataset.show ? `${value.data.name}:${value.data.value[2]}` : value.data.name
}
},
fontSize: this.elementInfo.option.dataset.fontSize,
color: this.elementInfo.option.dataset.color,
fontWeight: this.elementInfo.option.dataset.fontWeight
},
symbolSize: 6,
itemStyle: {
color: '#a6c84c'
},
data: series,
}]
}
return options
},
/** /**
* 柱状图数据处理 * 柱状图数据处理
*/ */
......
<template>
<view class="normal-tabs">
<u-tabs
v-if="elementInfo.option.tabs.type === 'radio'"
:list="elementData.dataList.series"
:is-scroll="false"
:current="currentTabs"
:active-color="elementInfo.option.tabs.activeColor"
:inactive-color="elementInfo.option.tabs.color"
:bg-color="elementInfo.option.tabs.backgroundColor"
@change="handleTabsChange"
></u-tabs>
<u-input
v-if="elementInfo.option.tabs.type === 'select'"
v-model="tabsValue"
type="select"
border="true"
@click="show = true"
/>
<u-select
v-model="show"
:list="elementData.dataList.series"
:safe-area-inset-bottom="true"
label-name="name"
@confirm="handleSelectChange"
></u-select>
</view>
</template>
<script>
import echartElementData from '@/mixins/echartElementData.js'
export default {
name:"NormalTabs",
mixins: [echartElementData],
data() {
return {
currentTabs: 0,
show: false
};
},
computed: {
tabsValue() {
return this.elementData.dataList.series[this.currentTabs].value
}
},
methods: {
initChart() {},
handleTabsChange(index) {
this.currentTabs = index
},
handleSelectChange(e) {
console.log(e)
}
}
}
</script>
<style>
</style>
...@@ -32,6 +32,24 @@ ...@@ -32,6 +32,24 @@
} }
} }
,{
"path" : "pages/center/password",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/customer/customer",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
......
<template> <template>
<view> <view>
<view class="item-list">
<block v-for="(item,index) in itemList">
<view class="item-cell" @tap="selectCell(index)">
<view class="item-cell-text">{{item.text}}</view>
<view class="item-cell-list-count" v-if="item.show">({{item.count}})人</view>
</view>
</block>
</view>
<view class="subscribe" v-if="admin" @tap='subscribe()'>
订阅消息
</view>
<u-button <u-button
class="my-u-block u-m-t-80" class="my-u-block u-m-t-80"
type="warning" type="warning"
...@@ -14,13 +27,95 @@ ...@@ -14,13 +27,95 @@
export default { export default {
data() { data() {
return { return {
itemList: [],
admin: false
} }
}, },
async onLoad() { async onLoad() {
var admin = uni.getStorageSync('admin')
if (admin) {
this.$data.admin = admin
}
},
onShow() {
this.getUserCount()
}, },
methods: { methods: {
// 获取用户信息
getUserCount() {
var userId = uni.getStorageSync('userId')
var param = {
id: userId,
authorized: false
}
var itemList = [{ 'text': '修改密码', 'show': false, 'count': '0' },
{ 'text': '待授权', 'show': true, 'count': '0' },
{ 'text': '已授权', 'show': true, 'count': '0'}];
this.$u.api.getUserListCount(param).then(res=>{
const { Status, Result } = res.data
if (Status === 'true') {
itemList[1].count = Result.no_authorized;
itemList[2].count = Result.authorized;
}
this.$data.itemList = itemList
})
},
// item 点击
selectCell(index) {
switch(index) {
case 0:
uni.navigateTo({
url: './password'
})
break;
case 1:
if (this.$data.admin) {
uni.navigateTo({
url: '../customer/customer?confirmed=false'
})
} else {
this.$u.toast('您没有操作权限')
}
break;
case 2:
if (this.$data.admin) {
uni.navigateTo({
url: '../customer/customer?confirmed=true'
})
} else {
this.$u.toast('您没有操作权限')
}
break;
}
},
// 订阅消息
subscribe() {
var that = this
uni.login({
provider: 'weixin',
success: function(res) {
var code = res.code
var param = {
code: code,
id: uni.getStorageSync('userId')
}
that.$u.api.getOpenId(param).then(res=>{
const { Status, Result } = res.data
if (Status === 'true') {
}
})
}
})
uni.requestSubscribeMessage({
tmplIds: ['GSPZ_GSbsgfRSu8wugGPe2zqmReDbY8yeIEqd8pPPM8'],
success (res) {
console.log('授权结果' + res['GSPZ_GSbsgfRSu8wugGPe2zqmReDbY8yeIEqd8pPPM8'])
}
})
},
// 退出登录 // 退出登录
logout() { logout() {
uni.removeStorageSync('userId'); uni.removeStorageSync('userId');
...@@ -41,4 +136,38 @@ ...@@ -41,4 +136,38 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.item-list {
display: flex;
flex-direction: column;
}
.item-cell {
display: flex;
position: relative;
width: 100%;
height: 100rpx;
align-items: center;
border-bottom: 0.1rpx solid #cccccc;
}
.item-cell-text {
margin-left: 20rpx;
font-size: 28rpx;
}
.item-cell-list-count {
margin-left: 300rpx;
font-size: 28rpx;
}
.subscribe {
width: 30%;
text-align: center;
font-size: 30rpx;
border: 0.1rpx solid #cccccc;
border-radius: 10rpx;
margin: 60rpx;
padding: 25rpx 0rpx 25rpx 0rpx;
display: flex;
justify-content: center;
margin-left: 35%;
}
</style> </style>
\ No newline at end of file
<template>
<view class="wrap">
<view class="content">
<u-form
ref="uForm"
:model="params"
:error-type="['toast']"
:label-width="120"
>
<u-form-item label="新密码" prop="password1">
<u-input
v-model="params.password1"
placeholder="请输入新密码"
type="password"
:password-icon="true"
/>
</u-form-item>
<u-form-item label="确认密码" prop="password2">
<u-input
v-model="params.password2"
placeholder="请确认新密码"
type="password"
:password-icon="true"
/>
</u-form-item>
</u-form>
<u-button
class="my-u-block u-m-t-80"
type="warning"
shape="square"
:ripple="true"
@click="submit()"
:disabled="!submitDisabled"
>确认</u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
params: {
appId: wx.getAccountInfoSync().miniProgram.appId,
password1: '',
password2: ''
},
rules: {
password1: [
{ required: true, message: '请输入新密码', trigger: 'blur' }
],
password2: [
{ required: true, message: '请确认新密码', trigger: 'blur' }
]
}
}
},
computed: {
submitDisabled() {
return this.params.password1 && this.params.password2
}
},
methods: {
// 登录
submit() {
this.$refs.uForm.validate(async valid => {
if (valid) {
let res = await this.$u.api.changePassword(this.params)
const { Status, Result } = res.data
if (Status === 'true') {
this.$u.vuex('vuex_token', `${res.token_type} ${res.access_token}`)
this.$u.toast('密码修改成功')
// 登录成功后返回来源页面
let timer = setTimeout(() => {
uni.navigateBack({
})
clearTimeout(timer)
}, 500)
} else {
this.$u.toast('修改失败')
}
} else {
console.log('修改失败');
}
})
}
},
onReady() {
this.$refs.uForm.setRules(this.rules)
}
}
</script>
<style>
</style>
<template>
<view class="wrap">
<view class="item-list">
<block v-for="(item,index) in userList">
<view class="item-cell">
<view class="item-name">{{item.userName}}</view>
<view class="item-button" @tap ="authorized(item.id, item.authorized, index)" v-if="item.authorized">取消授权</view>
<view class="item-button" @tap ="authorized(item.id, item.authorized, index)" v-else>授权</view>
</view>
</block>
</view>
</view>
</template>
<script>
export default {
data() {
return {
confirmed: '',
userList: []
}
},
onLoad(option) {
var copfirmed = option.confirmed
this.$data.confirmed = copfirmed
},
onShow() {
this.judgeAndLoad()
},
methods: {
// 判断权限和加载数据
judgeAndLoad() {
var isAdmin = uni.getStorageSync('admin')
if (isAdmin) {
this.getUserList()
} else {
this.$u.toast('您没有操作权限')
uni.navigateBack({
})
}
if (this.$data.confirmed === 'true') {
uni.setNavigationBarTitle({
title: '已授权列表'
})
} else {
uni.setNavigationBarTitle({
title: '待授权列表'
})
}
},
// 获取列表
getUserList() {
var userId = uni.getStorageSync('userId')
var param = {
id: userId,
authorized: this.$data.confirmed
}
this.$u.api.getAuthorizedList(param).then(res=>{
const { Status, Result } = res.data
if (Status === 'true' || Result.length > 0) {
this.$data.userList = Result
} else {
this.$data.userList = []
}
})
},
// 授权
authorized(id, authorized, index) {
var type = authorized ? 'unthorize' : 'authorize'
var operatorId = uni.getStorageSync('userId')
var param = {
type: type,
id: id,
operatorId: operatorId
}
this.$u.api.authorizeOrUnauthorize(param).then(res=>{
const { Status, Result } = res.data
if (Status === 'true') {
this.$data.userList.splice(index,1)
this.$u.toast('操作成功')
} else {
this.$u.toast('操作失败')
}
})
}
},
// 下拉刷新
onPullDownRefresh() {
this.judgeAndLoad()
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss" scoped>
.item-list {
display: flex;
flex-direction: column;
}
.item-cell {
display: flex;
position: relative;
justify-content: space-between;
width: 100%;
height: 100rpx;
align-items: center;
border-bottom: 0.1rpx solid #cccccc;
}
.item-name {
margin-left: 20rpx;
font-size: 28rpx;
}
.item-button {
margin-right: 40rpx;
font-size: 28rpx;
border: 0.1rpx solid #cccccc;
border-radius: 5rpx;
padding: 10rpx 20rpx 10rpx 20rpx;
}
</style>
...@@ -22,10 +22,15 @@ ...@@ -22,10 +22,15 @@
<BarMixMap v-if="element.type == 'BarMixMap'" :elementInfo="element"></BarMixMap> <BarMixMap v-if="element.type == 'BarMixMap'" :elementInfo="element"></BarMixMap>
<!-- 雷达图 --> <!-- 雷达图 -->
<NormalRadar v-if="element.type == 'NormalRadar'" :elementInfo="element"></NormalRadar> <NormalRadar v-if="element.type == 'NormalRadar'" :elementInfo="element"></NormalRadar>
<<<<<<< HEAD
<!-- 普通数字滚动 --> <!-- 普通数字滚动 -->
<CountTo v-if="element.type == 'CountTo'" :elementInfo="element"></CountTo> <CountTo v-if="element.type == 'CountTo'" :elementInfo="element"></CountTo>
<!-- 数字滚动 --> <!-- 数字滚动 -->
<NumberScroll v-if="element.type == 'NumberScroll'" :elementInfo="element"></NumberScroll> <NumberScroll v-if="element.type == 'NumberScroll'" :elementInfo="element"></NumberScroll>
=======
<!-- 普通选项卡 -->
<NormalTabs v-if="element.type == 'NormalTabs'" :elementInfo="element"></NormalTabs>
>>>>>>> 4cfcbebdc7add01d46cf17248a41b752acef152b
<!-- 文本框 --> <!-- 文本框 -->
<BasicText v-if="element.type == 'BasicText'" :elementInfo="element"></BasicText> <BasicText v-if="element.type == 'BasicText'" :elementInfo="element"></BasicText>
<!-- 真实时间 --> <!-- 真实时间 -->
...@@ -85,9 +90,9 @@ ...@@ -85,9 +90,9 @@
//获取最新的授权信息 //获取最新的授权信息
getNewestAuthFromServer() { getNewestAuthFromServer() {
var param = { var param = {
id: uni.getStorageSync('usaerId') id: uni.getStorageSync('userId')
} }
this.$u.api.getAuthorized({param}).then(res=>{ this.$u.api.getAuthorized(param).then(res=>{
const { Status, Result } = res.data const { Status, Result } = res.data
if (Status === 'true') { if (Status === 'true') {
uni.setStorageSync('authorized', Result.authorized) uni.setStorageSync('authorized', Result.authorized)
......
<template> <template>
<view> <view class="wrap">
授权中心 <view class="container">
<view class="large-text">请等待管理员授权</view>
<view class="phone" @tap="call()">
<image class="phone-image" src="../../static/icon/phone.png"></image>
<view class="phone-text">直接通知管理员</view>
</view>
<view class="phone-text" @tap="backToLogin()">返回登录</view>
</view>
</view> </view>
</template> </template>
...@@ -12,11 +19,50 @@ ...@@ -12,11 +19,50 @@
} }
}, },
methods: { methods: {
// 打电话
call() {
uni.makePhoneCall({
phoneNumber: '8613918613467'
})
},
// 返回登录
backToLogin() {
uni.reLaunch({
url: './login'
})
}
} }
} }
</script> </script>
<style> <style lang="scss" scoped>
.container {
margin-top: 200rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.large-text {
font-size: 50rpx;
font-weight: bold;
}
.phone {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 100rpx;
margin-bottom: 60rpx;
}
.phone-image {
width: 80rpx;
height: 80rpx;
}
.phone-text {
font-size: 40rpx;
font-weight: bold;
}
</style> </style>
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