Commit 8eb7e5b8 authored by Jenny's avatar Jenny

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

# Conflicts:
#	pages/index/index.vue
parents 53a81ee2 6f19e4e6
...@@ -13,13 +13,19 @@ const install = (Vue, vm) => { ...@@ -13,13 +13,19 @@ 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)
vm.$u.api = { vm.$u.api = {
quickLogin, quickLogin,
register, register,
getReportList, getReportList,
dataSetPreview, dataSetPreview,
getAuthorized getAuthorized,
getUserListCount,
changePassword
} }
} }
......
<template>
<view>
</view>
</template>
<script>
export default {
name:"BasicText",
data() {
return {
};
}
}
</script>
<style>
</style>
<template>
<view>
</view>
</template>
<script>
export default {
name:"RealTime",
data() {
return {
};
}
}
</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>
<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 +22,69 @@ ...@@ -14,13 +22,69 @@
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;
}
},
// 退出登录 // 退出登录
logout() { logout() {
uni.removeStorageSync('userId'); uni.removeStorageSync('userId');
...@@ -41,4 +105,26 @@ ...@@ -41,4 +105,26 @@
</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: 24rpx;
}
.item-cell-list-count {
margin-left: 300rpx;
font-size: 24rpx;
}
</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>
授权列表
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
<NormalRadar v-if="element.type == 'NormalRadar'" :elementInfo="element"></NormalRadar> <NormalRadar v-if="element.type == 'NormalRadar'" :elementInfo="element"></NormalRadar>
<!-- 普通选项卡 --> <!-- 普通选项卡 -->
<NormalTabs v-if="element.type == 'NormalTabs'" :elementInfo="element"></NormalTabs> <NormalTabs v-if="element.type == 'NormalTabs'" :elementInfo="element"></NormalTabs>
<!-- 文本框 -->
<BasicText v-if="element.type == 'BasicText'" :elementInfo="element"></BasicText>
<!-- 真实时间 -->
<RealTime v-if="element.type == 'RealTime'" :elementInfo="element"></RealTime>
</view> </view>
</view> </view>
</template> </template>
...@@ -79,9 +83,9 @@ ...@@ -79,9 +83,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