提交 59035092 作者: wk

Merge branch 'feature-wk-1230'

<script> <script>
export default { export default {
globalData: { globalData: {
userInfo: {} userInfo: {},
isReject: false
}, },
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
......
...@@ -97,6 +97,14 @@ const params = { ...@@ -97,6 +97,14 @@ const params = {
url: "/api/v2/org/o_job_v2/get_job_list_by_dept_id", url: "/api/v2/org/o_job_v2/get_job_list_by_dept_id",
method: "get" method: "get"
}, },
examine: {
url: "/api/v2/org/o_org_v2/examine_join_org",
method: "post"
},
getExamineList: {
url: "/api/v2/org/o_org_v2/get_join_org_list",
method: "get"
},
wxToLogin: { wxToLogin: {
url: "/ydt/api/v1/access/user_third/temp_login", url: "/ydt/api/v1/access/user_third/temp_login",
method: "post" method: "post"
...@@ -152,6 +160,10 @@ const params = { ...@@ -152,6 +160,10 @@ const params = {
getNearApp: { getNearApp: {
url: "/ydt/api/v1/navigation/list/recently_used", url: "/ydt/api/v1/navigation/list/recently_used",
method: "get" method: "get"
},
getMessages: {
url: "/api/v1/common_check/msg_notify/list",
method: "get"
} }
} }
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
</template> </template>
<script> <script>
import QRCode from "./qrcode.js" import QRCode from "./qrcode.js"
let qrcode let qrcode
export default { export default {
name: "tki-qrcode", name: "tki-qrcode",
props: { props: {
cid: { cid: {
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
if (!this._empty(this.val)) { if (!this._empty(this.val)) {
qrcode = new QRCode({ qrcode = new QRCode({
context: that, // 上下文环境 context: that, // 上下文环境
canvasId:that.cid, // canvas-id canvasId: that.cid, // canvas-id
usingComponents: that.usingComponents, // 是否是自定义组件 usingComponents: that.usingComponents, // 是否是自定义组件
showLoading: that.showLoading, // 是否显示loading showLoading: that.showLoading, // 是否显示loading
loadingText: that.loadingText, // loading文字 loadingText: that.loadingText, // loading文字
...@@ -98,8 +98,8 @@ export default { ...@@ -98,8 +98,8 @@ export default {
pdground: that.pdground, // 定位角点颜色 pdground: that.pdground, // 定位角点颜色
correctLevel: that.lv, // 容错级别 correctLevel: that.lv, // 容错级别
image: that.icon, // 二维码图标 image: that.icon, // 二维码图标
imageSize: that.iconSize,// 二维码图标大小 imageSize: that.iconSize, // 二维码图标大小
cbResult: function (res) { // 生成二维码的回调 cbResult: function(res) { // 生成二维码的回调
that._result(res) that._result(res)
}, },
}); });
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
if (this.result != "") { if (this.result != "") {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: that.result, filePath: that.result,
success: function () { success: function() {
uni.showToast({ uni.showToast({
title: '二维码保存成功', title: '二维码保存成功',
icon: 'success', icon: 'success',
...@@ -152,7 +152,7 @@ export default { ...@@ -152,7 +152,7 @@ export default {
} }
}, },
watch: { watch: {
size: function (n, o) { size: function(n, o) {
if (n != o && !this._empty(n)) { if (n != o && !this._empty(n)) {
this.cSize = n this.cSize = n
if (!this._empty(this.val)) { if (!this._empty(this.val)) {
...@@ -162,7 +162,7 @@ export default { ...@@ -162,7 +162,7 @@ export default {
} }
} }
}, },
val: function (n, o) { val: function(n, o) {
if (this.onval) { if (this.onval) {
if (n != o && !this._empty(n)) { if (n != o && !this._empty(n)) {
setTimeout(() => { setTimeout(() => {
...@@ -174,14 +174,14 @@ export default { ...@@ -174,14 +174,14 @@ export default {
}, },
computed: { computed: {
cpSize() { cpSize() {
if(this.unit == "upx"){ if (this.unit == "upx") {
return uni.upx2px(this.size) return uni.upx2px(this.size)
}else{ } else {
return this.size return this.size
} }
} }
}, },
mounted: function () { mounted: function() {
if (this.loadMake) { if (this.loadMake) {
if (!this._empty(this.val)) { if (!this._empty(this.val)) {
setTimeout(() => { setTimeout(() => {
...@@ -190,16 +190,17 @@ export default { ...@@ -190,16 +190,17 @@ export default {
} }
} }
}, },
} }
</script> </script>
<style> <style>
.tki-qrcode { .tki-qrcode {
position: relative; position: relative;
} }
.tki-qrcode-canvas {
.tki-qrcode-canvas {
position: fixed; position: fixed;
top: -99999upx; top: -99999upx;
left: -99999upx; left: -99999upx;
z-index: -99999; z-index: -99999;
} }
</style> </style>
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
tabList: [{ tabList: [{
id: 0, id: 0,
path: "/pages/index/index", path: "/pages/index/index",
icon: "/static/home-unsel.png", icon: "/static/homepage-ic.png",
selectIcon: "/static/home-sel.png", selectIcon: "/static/homepage-ic-sel.png",
text: "首页", text: "首页",
centerItem: false centerItem: false
}, { }, {
id: 1, id: 1,
path: "/pages/gallery/gallery", path: "/pages/gallery/gallery",
icon: "/static/gallery.png", icon: "/static/gzt-ic.png",
selectIcon: "/static/gallery-sel.png", selectIcon: "/static/gzt-ic-sel.png",
text: "工作台", text: "工作台",
centerItem: false centerItem: false
}, { }, {
...@@ -49,15 +49,15 @@ ...@@ -49,15 +49,15 @@
}, { }, {
id: 2, id: 2,
path: "/pages/monitor/monitor", path: "/pages/monitor/monitor",
icon: "/static/monitor.png", icon: "/static/jkt-ic.png",
selectIcon: "/static/monitor-sel.png", selectIcon: "/static/jkt-ic-sel.png",
text: "监控台", text: "监控台",
centerItem: false centerItem: false
}, { }, {
id: 3, id: 3,
path: "/pages/mine/mine", path: "/pages/mine/mine",
icon: "/static/mine.png", icon: "/static/user-ic.png",
selectIcon: "/static/mine-sel.png", selectIcon: "/static/user-ic-sel.png",
text: "我的", text: "我的",
centerItem: false centerItem: false
}], }],
......
## 插件说明
> 这是 `v-tabs` 插件的升级版本,参数上有很大变动,支持 `H5` `小程序` `手机端`,如果是在之前的插件上升级的话,请注意参数的变更,触发的事件没有变更。
## 使用说明
### 1、最基本用法
- 视图文件
```html
<v-tabs v-model="current" :tabs="tabs" @change="changeTab"></v-tabs>
```
- 脚本文件
```js
export default {
data() {
return {
current: 0,
tabs: ['军事', '国内', '新闻新闻', '军事', '国内', '新闻', '军事', '国内', '新闻']
}
},
methods: {
changeTab(index) {
console.log('当前选中的项:' + index)
}
}
}
```
### 2、平铺整个屏幕
- 视图文件
```html
<v-tabs v-model="activeTab" :scroll="false" :tabs="['全部', '进行中', '已完成']"></v-tabs>
```
- 脚本文件
```js
export default {
data() {
return {
activeTab: 0
}
}
}
```
### 3、胶囊用法
- 视图文件
```html
<v-tabs v-model="current" :tabs="tabs" :pills="true" line-height="0" activeColor="#fff" @change="changeTab"></v-tabs>
```
- 脚本文件
```js
data() {
return {
current: 2,
tabs: [
'军事',
'国内',
'新闻新闻',
'军事',
'国内',
'新闻',
'军事',
'国内',
'新闻',
],
},
methods: {
changeTab(index) {
console.log('当前选中索引:' + index)
}
}
}
```
## 文档说明
### 1、属性说明
| 参数 | 类型 | 默认值 | 说明 |
| :---------------: | :-----: | :-------: | :----------------------------------------: |
| value | Number | 0 | 必传(双向绑定的值) |
| color | String | '#333' | 默认文字颜色 |
| activeColor | String | '#2979ff' | 选中文字的颜色 |
| fontSize | String | '28rpx' | 默认文字大小(rpx 或 px) |
| bold | Boolean | true | 是否加粗选中项 |
| scroll | Boolean | true | 是否显示滚动条,平铺设置 false |
| height | String | '70rpx' | tab 高度(rpx 或 px) |
| lineHeight | String | '10rpx' | 滑块高度(rpx 或 px) |
| lineColor | String | '#2979ff' | 滑块的颜色 |
| lineScale | Number | 0.5 | 滑块宽度缩放值 |
| lineRadius | String | '10rpx' | 滑块圆角宽度(rpx 或 px) |
| pills | Boolean | false | 是否开启胶囊 |
| pillsColor | String | '#2979ff' | 胶囊背景颜色(rpx 或 px) |
| pillsBorderRadius | String | '10rpx' | 胶囊圆角宽度(rpx 或 px) |
| field | String | '' | 如果 tabs 子项是对象,输入需要展示的键名 |
| bgColor | String | '#fff' | 背景色,支持 linear-gradient 渐变 |
| padding | String | '0' | 整个 tab padding 属性 |
| fixed | Boolean | false | 是否固定在顶部 |
| paddingItem | String | '0 22rpx' | 选项的边距(设置上下不生效,需要设置高度) |
### 2、事件说明
| 名称 | 参数 | 说明 |
| :----: | :---: | :--------------------------------: |
| change | index | 改变选中项触发, index 选中项的下标 |
## 更新日志
### 2020-09-21
1. 修复添加 `fixed` 属性后,滚动条无效
2. 修复选项很少的情况下,下划线计算计算错误
3. 新增 `paddingItem` 属性,设置选项左右边距(上下边距需要设置 `height` 属性,或者设置 `padding` 属性)
**写在最后:**
欢迎各位老铁反馈 bug ,本人后端 PHP 一枚,只是应为感兴趣前端,自己琢磨,自己搞。如果你在使用的过程中有什么不合理,需要优化的,都可以在下面评论(或加我 QQ: 1207791534),本人看见后回复、修正,感谢。
### 2020-09-17
1. 紧急修复 bug,横向滑动不了的情况
### 2020-09-16
1. 新增 `fixed` 属性,是否固定在顶部,示例地址:`pages/tabs/tabs-static`
2. 优化之前的页面结构
**注意:**
1. 使用 `padding` 属性的时候,尽量不要左右边距,会导致下划线位置不对
2. 如果不绑定 `v-model` 会导致 `change` 事件改变的时候,下划线不跟随问题
### 2020-09-09
1. 修复 `width` 错误,dom 加载的时候没有及时获取到 `data` 属性导致的。
### 2020-08-29
1. 优化异步改变 `tabs` 后,下划线不初始化问题
2. `github` 地址上有图 2 的源码,需要的自行下载,页面路径:`pages/tabs/order`
### 2020-08-20
1. 优化 `节点查询``选中渲染`
2. 优化支付宝中 `createSelectorQuery()` 的影响
### 2020-08-19
1. 优化 `change` 事件触发机制
### 2020-08-16
1. 修改默认高度为 `70rpx`
2. 新增属性 `bgColor`,可设置背景颜色,默认 `#fff`
3. 新增整个 `tab``padding` 属性,默认 `0`
### 2020-08-13
1. 全新的 `v-tabs 2.0`
2. 支持 `H5` `小程序` `APP`
3. 属性高度可配置
## 预览
![v-tabs 2.0.1.gif](https://tva1.sinaimg.cn/large/007S8ZIlgy1ghsv40mj76g30ai0i2tsd.gif)
![v-tabs 2.0.2.gif](https://img-cdn-aliyun.dcloud.net.cn/stream/plugin_screens/42f3a920-a674-11ea-8a24-ffee00625e2e_1.png?v=1597912963)
<template>
<view :id="elId" class="v-tabs">
<scroll-view :scroll-x="scroll" :scroll-left="scroll ? scrollLeft : 0" :scroll-with-animation="scroll"
:style="{ position: fixed ? 'fixed' : 'relative', zIndex: 1993 }">
<view class="v-tabs__container" :style="{
display: scroll ? 'inline-flex' : 'flex',
whiteSpace: scroll ? 'nowrap' : 'normal',
background: bgColor,
height,
padding
}">
<view class="v-tabs__container-item" v-for="(v, i) in tabs" :key="i" :style="{
color: current == i ? activeColor : color,
fontSize: current == i ? fontSize : fontSize,
fontWeight: bold && current == i ? 'bold' : '',
justifyContent: !scroll ? 'center' : '',
flex: scroll ? '' : 1,
padding: paddingItem
}" @click="change(i)">
{{ field ? v[field] : v }}
</view>
<view v-if="!pills" class="v-tabs__container-line" :style="{
background: lineColor,
width: lineWidth + 'px',
height: lineHeight,
borderRadius: lineRadius,
left: lineLeft + 'px',
transform: `translateX(-${lineWidth / 2}px)`
}"></view>
<view v-else class="v-tabs__container-pills" :style="{
background: pillsColor,
borderRadius: pillsBorderRadius,
left: pillsLeft + 'px',
width: currentWidth + 'px',
height
}"></view>
</view>
</scroll-view>
<view class="v-tabs__placeholder" :style="{
height: fixed ? height : '0',
padding
}"></view>
</view>
</template>
<script>
/**
* v-tabs
* @property {Number} value 选中的下标
* @property {Array} tabs tabs 列表
* @property {String} bgColor = '#fff' 背景颜色
* @property {String} color = '#333' 默认颜色
* @property {String} activeColor = '#2979ff' 选中文字颜色
* @property {String} fontSize = '28rpx' 默认文字大小
* @property {String} activeFontSize = '28rpx' 选中文字大小
* @property {Boolean} bold = [true | false] 选中文字是否加粗
* @property {Boolean} scroll = [true | false] 是否滚动
* @property {String} height = '60rpx' tab 的高度
* @property {String} lineHeight = '10rpx' 下划线的高度
* @property {String} lineColor = '#2979ff' 下划线的颜色
* @property {Number} lineScale = 0.5 下划线的宽度缩放比例
* @property {String} lineRadius = '10rpx' 下划线圆角
* @property {Boolean} pills = [true | false] 是否胶囊样式
* @property {String} pillsColor = '#2979ff' 胶囊背景色
* @property {String} pillsBorderRadius = '10rpx' 胶囊圆角大小
* @property {String} field 如果是对象,显示的键名
* @property {Boolean} fixed = [true | false] 是否固定
* @property {String} paddingItem = '0 22rpx' 选项的边距
*
* @event {Function(current)} change 改变标签触发
*/
export default {
props: {
value: {
type: Number,
default: 0
},
tabs: {
type: Array,
default () {
return []
}
},
bgColor: {
type: String,
default: '#f8f8f8'
},
padding: {
type: String,
default: '0'
},
color: {
type: String,
default: '#333'
},
activeColor: {
type: String,
default: '#2979ff'
},
fontSize: {
type: String,
default: '28rpx'
},
activeFontSize: {
type: String,
default: '32rpx'
},
bold: {
type: Boolean,
default: true
},
scroll: {
type: Boolean,
default: true
},
height: {
type: String,
default: '80rpx'
},
lineColor: {
type: String,
default: '#2979ff'
},
lineHeight: {
type: String,
default: '4rpx'
},
lineScale: {
type: Number,
default: 0.5
},
lineRadius: {
type: String,
default: '10rpx'
},
pills: {
type: Boolean,
deafult: false
},
pillsColor: {
type: String,
default: '#2979ff'
},
pillsBorderRadius: {
type: String,
default: '10rpx'
},
field: {
type: String,
default: ''
},
fixed: {
type: Boolean,
default: false
},
paddingItem: {
type: String,
default: '0 16rpx'
}
},
data() {
return {
elId: '',
lineWidth: 30,
currentWidth: 0, // 当前选项的宽度
lineLeft: 0, // 滑块距离左侧的位置
pillsLeft: 0, // 胶囊距离左侧的位置
scrollLeft: 0, // 距离左边的位置
containerWidth: 0, // 容器的宽度
current: 0 // 当前选中项
}
},
watch: {
value(newVal) {
this.current = newVal
this.$nextTick(() => {
this.getTabItemWidth()
})
},
current(newVal) {
this.$emit('input', newVal)
},
tabs(newVal) {
this.$nextTick(() => {
this.getTabItemWidth()
})
}
},
methods: {
// 产生随机字符串
randomString(len) {
len = len || 32
let $chars =
'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678' /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
let maxPos = $chars.length
let pwd = ''
for (let i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos))
}
return pwd
},
// 切换事件
change(index) {
if (this.current !== index) {
this.current = index
this.$emit('change', index)
}
},
// 获取左移动位置
getTabItemWidth() {
let query = uni
.createSelectorQuery()
// #ifndef MP-ALIPAY
.in(this)
// #endif
// 获取容器的宽度
query
.select(`#${this.elId}`)
.boundingClientRect((data) => {
if (!this.containerWidth && data) {
this.containerWidth = data.width
}
})
.exec()
// 获取所有的 tab-item 的宽度
query
.selectAll('.v-tabs__container-item')
.boundingClientRect((data) => {
if (!data) {
return
}
let lineLeft = 0
let currentWidth = 0
if (data) {
for (let i = 0; i < data.length; i++) {
if (i < this.current) {
lineLeft += data[i].width
} else if (i == this.current) {
currentWidth = data[i].width
} else {
break
}
}
}
// 当前滑块的宽度
this.currentWidth = currentWidth
// 缩放后的滑块宽度
this.lineWidth = currentWidth * this.lineScale * 1
// 滑块作移动的位置
this.lineLeft = lineLeft + currentWidth / 2
// 胶囊距离左侧的位置
this.pillsLeft = lineLeft
// 计算滚动的距离左侧的位置
if (this.scroll) {
this.scrollLeft = this.lineLeft - this.containerWidth / 2
}
})
.exec()
}
},
mounted() {
this.elId = 'xfjpeter_' + this.randomString()
this.current = this.value
this.$nextTick(() => {
this.getTabItemWidth()
})
}
}
</script>
<style lang="scss" scoped>
.v-tabs {
width: 100%;
box-sizing: border-box;
overflow: hidden;
padding: 0 30rpx;
position: sticky;
z-index: 10;
&__container {
min-width: 100%;
position: relative;
display: inline-flex;
align-items: center;
white-space: nowrap;
overflow: hidden;
&-item {
display: flex;
align-items: center;
height: 100%;
position: relative;
z-index: 10;
// padding: 0 11px;
transition: all 0.3s;
white-space: nowrap;
}
&-line {
position: absolute;
bottom: 0;
transition: all 0.3s linear;
}
&-pills {
position: absolute;
transition: all 0.3s linear;
z-index: 9;
}
}
}
/* /deep/ ::-webkit-scrollbar {
display: none;
} */
</style>
...@@ -182,13 +182,36 @@ ...@@ -182,13 +182,36 @@
} }
}, { }, {
"path": "pages/login/authLogin/authLogin", "path": "pages/mine/myApproval/myApproval",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
}, {
"path": "pages/gallery/message/message",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/gallery/needDo/needDo",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "pages/login/authLogin/authLogin",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
} }
], ],
"globalStyle": { "globalStyle": {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</view> </view>
<view class="message-content" :style="{top:statusBarHeight+78+'px'}"> <view class="message-content" :style="{top:statusBarHeight+78+'px'}">
<view class="item"> <view class="item">
<view class="title-content"> <view class="title-content" @click="toMessage">
<view class="title">消息中心</view> <view class="title">消息中心</view>
<image src="../../static/message.png" class="image"></image> <image src="../../static/message.png" class="image"></image>
</view> </view>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="item"> <view class="item">
<view class="title-content"> <view class="title-content" @click="toNeedDo">
<view class="title">我的待办</view> <view class="title">我的待办</view>
<image src="../../static/willdo.png" class="image"></image> <image src="../../static/willdo.png" class="image"></image>
</view> </view>
...@@ -25,6 +25,12 @@ ...@@ -25,6 +25,12 @@
</view> </view>
</view> </view>
</view> </view>
<view class="popularity-content" :style="{'margin-top':statusBarHeight+116+'px'}">
<image src="../../static/ic-sjzg.png" class="image"></image>
<text class="text">数据智管</text>
<image src="../../static/ic-rqyy.png" class="rq-image"></image>
<text class="text">本周人气最佳:物料收发存(地磅)</text>
</view>
<uni-tabbar currentPage="1"></uni-tabbar> <uni-tabbar currentPage="1"></uni-tabbar>
</view> </view>
</template> </template>
...@@ -42,7 +48,16 @@ ...@@ -42,7 +48,16 @@
this.statusBarHeight = info.statusBarHeight this.statusBarHeight = info.statusBarHeight
}, },
methods: { methods: {
toMessage() {
uni.navigateTo({
url: "/pages/gallery/message/message"
})
},
toNeedDo() {
uni.navigateTo({
url: "/pages/gallery/needDo/needDo"
})
}
} }
} }
</script> </script>
...@@ -146,5 +161,36 @@ ...@@ -146,5 +161,36 @@
} }
} }
.popularity-content {
width: 690rpx;
height: 40px;
border-radius: 40rpx;
background: #fff;
display: flex;
margin: 0 30rpx;
padding: 0 30rpx;
flex-direction: row;
align-items: center;
image {
width: 50rpx;
margin-right: 20rpx;
height: 22px;
}
text {
font-weight: 400;
font-size: 24rpx;
text-align: center;
color: #333;
}
.rq-image {
width: 22rpx;
height: 16px;
margin: 0 10rpx 0 30rpx;
}
}
} }
</style> </style>
<template>
<view class="content">
<titleBar title="消息中心"></titleBar>
<v-tabs :tabs="tabs" :scroll="true" :value="current" @change="tabChange"></v-tabs>
<view class="list-content">
<view v-for="(item,index) in list" :key="index" class="list-item">
<view class="red-dot"></view>
<view class="item-content ">
<view class="title">塔机告警</view>
<view class="desc-content">
<view class="desc">限位告警提示</view>
<view class="time">2022/12/13 15:39:56</view>
</view>
<view class="line"></view>
</view>
<image class="right-image" src="../../../static/right-arrow.png"></image>
</view>
</view>
</view>
</template>
<script>
import Api from "../../../api/api.js"
export default {
data() {
return {
tabs: ["通知", "预警/报警"],
list: [{}, {}],
current: 0,
page: 1,
pageSize: 20,
totalPage: 1,
}
},
onLoad() {
},
onPullDownRefresh() {
this.page = 1
this.getMessages()
},
onReachBottom() {
if (this.totalPage > this.page) {
this.page++
this.getMessages()
}
},
methods: {
tabChange(e) {
console.log("tab切换", e);
this.current = e
this.page = 1
this.getMessages()
},
getMessages() {
Api.getMessages({
data: {
"page": this.page,
"page_size": this.pageSize,
"is_page": 1
}
}).then((result) => {
console.log("消息列表", result);
uni.stopPullDownRefresh()
if (result.code == 0) {
this.totalPage = result.data.total_page
if (this.page == 1) {
this.list = []
}
this.list = this.list.concat(result.data.list)
} else {
this.$toast.showToast(result.msg)
}
})
}
}
}
</script>
<style lang="scss">
.content {
display: flex;
flex-direction: column;
.list-content {
display: flex;
flex-direction: column;
background-color: #FFFFFF;
margin: 20rpx 30rpx;
border-radius: 30rpx;
padding: 30rpx;
.list-item {
display: flex;
flex-direction: row;
.red-dot {
width: 12rpx;
height: 12rpx;
margin-top: 10rpx;
border-radius: 12rpx;
background: #ff5000;
}
.item-content {
display: flex;
flex: 560rpx;
margin-left: 10rpx;
align-items: flex-start;
flex-direction: column;
.title {
font-weight: 400;
font-size: 28rpx;
text-align: center;
color: #333;
}
.desc-content {
display: flex;
flex-direction: row;
margin-top: 20rpx;
align-items: center;
.desc {
width: 300rpx;
font-weight: 400;
font-size: 24rpx;
color: #999;
}
.time {
font-weight: 400;
font-size: 24rpx;
text-align: center;
color: #999;
}
}
.line {
width: 560rpx;
height: 2rpx;
margin: 30rpx 0;
background-color: #e5e5e5;
}
}
.right-image {
width: 15rpx;
margin-top: 40rpx;
height: 14px;
}
}
}
}
</style>
<template>
<view class="content">
<titleBar title="我的待办"></titleBar>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style lang="scss">
.content {
display: flex;
flex-direction: column;
}
</style>
...@@ -516,10 +516,12 @@ ...@@ -516,10 +516,12 @@
this.statusBarHeight = info.statusBarHeight this.statusBarHeight = info.statusBarHeight
}, },
onShow() { onShow() {
if (!getApp().globalData.isReject) {
this.loginState()
}
}, },
onReady() { onReady() {
this.loginState()
}, },
methods: { methods: {
clickItem() { clickItem() {
...@@ -624,7 +626,7 @@ ...@@ -624,7 +626,7 @@
that.getHomeComp() that.getHomeComp()
}, },
fail() { fail() {
uni.navigateTo({ uni.redirectTo({
url: "/pages/login/authLogin/authLogin" url: "/pages/login/authLogin/authLogin"
}) })
// uni.showModal({ // uni.showModal({
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
}) })
}, },
toCancel() { toCancel() {
getApp().globalData.isReject = true
uni.switchTab({ uni.switchTab({
url: "/pages/index/index" url: "/pages/index/index"
}) })
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
onLoad: function(option) { onLoad: function(option) {
this.isAuth = option.auth_login === 1 this.isAuth = option.auth_login === 1
this.unique_token = option.unique_token this.unique_token = option.unique_token
this.wxLogin()
}, },
methods: { methods: {
register: function() { register: function() {
...@@ -75,8 +76,72 @@ ...@@ -75,8 +76,72 @@
}) })
}, },
toBind: function() { toBind: function() {
uni.redirectTo({ //判断是否绑定 如果绑定直接登录 没有绑定提示
url: "/pages/login/wxLogin/wxLogin" this.checkBind()
// uni.redirectTo({
// url: "/pages/login/wxLogin/wxLogin"
// })
},
checkBind: function() {
Api.checkBind({
data: {
unique_token: this.unique_token
}
}).then((res) => {
let code = res.code
if (code == 0) { //已绑定直接登录
this.directLogin()
} else if (code == 33199) { //未绑定 去绑定
this.showMadel()
} else { //其他错误
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
})
},
showMadel: function() {
let _this = this
uni.showModal({
title: '提示',
content: '是否微信绑定已有账号',
showCancel: true,
confirmText: "去绑定",
cancelText: "微信登录",
confirmColor: '#3B73FE',
success: res => {
if (res.confirm) {
uni.navigateTo({
url: `/pages/login/bindLogin/bindLogin?unique_token=${_this.unique_token}`
})
} else {
_this.wxToLogin()
}
}
})
},
wxToLogin() {
Api.wxToLogin({
data: {
unique_token: this.unique_token
}
}).then((res) => {
let result = res.data
console.log("微信登录", result);
if (result.code == 0) {
uni.setStorageSync("short_token", result.data.short_token)
this.setToken(result.data.access_token)
uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id)
uni.showToast({
title: "授权登录成功",
icon: 'none'
})
uni.switchTab({
url: "/pages/index/index"
})
}
}) })
}, },
sendCode() { sendCode() {
...@@ -221,7 +286,34 @@ ...@@ -221,7 +286,34 @@
icon: 'none' icon: 'none'
}) })
uni.switchTab({ uni.switchTab({
url:"/pages/index/index" url: "/pages/index/index"
})
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
})
},
directLogin: function() {
Api.bindLogin({
data: {
unique_token: this.unique_token
}
}).then((result) => {
console.log("登录用户信息:", result);
if (result.code == 0) {
uni.setStorageSync("short_token", result.data.short_token)
uni.setStorageSync("token", result.data.access_token)
uni.setStorageSync("user_info", result.data)
uni.setStorageSync("company_id", result.data.comp_id)
uni.showToast({
title: "授权登录成功",
icon: 'none'
})
uni.switchTab({
url: "/pages/index/index"
}) })
} else { } else {
uni.showToast({ uni.showToast({
...@@ -316,7 +408,35 @@ ...@@ -316,7 +408,35 @@
}) })
} }
},
wxLogin() {
let _this = this;
uni.showLoading({
title: '加载中...'
});
// 1.wx获取登录用户code
uni.login({
provider: 'weixin',
success: function(loginRes) {
let code = loginRes.code;
//2.将用户登录code传递到后台置换用户SessionKey、OpenId等信息
Api.exchangeToken({
data: {
"js_code": code,
"system_no": _this.$config.systemCode
},
header: {
"Content-Type": "application/json"
} }
}).then((res) => {
let result = res.data
console.log(result);
_this.unique_token = result.unique_token
})
},
});
},
} }
} }
</script> </script>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<image src="../../static/right-arrow.png" class="image"></image> <image src="../../static/right-arrow.png" class="image"></image>
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="item"> <view class="item" @click="linkTo('/pages/mine/myApproval/myApproval')">
<view class="name">我的审批</view> <view class="name">我的审批</view>
<image src="../../static/right-arrow.png" class="image"></image> <image src="../../static/right-arrow.png" class="image"></image>
</view> </view>
......
<template>
<view>
<titleBar title="我的审批"></titleBar>
<view class="column-list-root">
<view v-for="(item,index) in mDatas" :key="index" class="column-list-item">
<text class="text-black-normal">{{item.user_name}}申请加入你的单位</text>
<text class="text-grey" style="margin-top: 10rpx;">{{item.create_time}}</text>
<view style="display: flex;flex-direction: row-reverse;margin-top: 32rpx;">
<view @click="reject(index)"
style="font-size: 24rpx;color: #FF0000;border: 1rpx solid #FF0000;padding: 8rpx 28rpx;border-radius: 8rpx;margin-left: 32rpx;">
驳回</view>
<view @click="pass(index)"
style="border: 1rpx solid #3B73FE;background-color: #3B73FE;font-size: 24rpx;color: #FFFFFF;padding: 8rpx 28rpx;border-radius: 8rpx;">
批准</view>
</view>
</view>
</view>
</view>
</template>
<script>
import Api from "../../../api/api.js"
export default {
data() {
return {
page: 1,
pageSize: 20,
totalPage: 1,
mDatas: []
}
},
onLoad: function() {
this.getApplyList()
},
onPullDownRefresh: function() {
this.page = 1
this.getApplyList()
},
onReachBottom: function() {
if (this.page < this.totalPage) {
this.page++
this.getApplyList()
}
},
methods: {
reject: function(index) {
this.showTip(index, 4)
},
pass: function(index) {
this.showTip(index, 3)
},
showTip: function(index, type) {
let _this = this
let apply = this.mDatas[index]
let content = type == 3 ? `确定同意${apply.user_name}加入你的单位` : `确定拒绝${apply.user_name}加入你的单位`
uni.showModal({
title: '提示',
content: content,
showCancel: true,
confirmText: "确定",
confirmColor: '#1890FF',
success: res => {
if (res.confirm) {
_this.deal(index, type)
}
}
})
},
deal: function(index, type) {
let apply = this.mDatas[index]
Api.examine({
data: {
examine: type,
comp_user_id: apply.comp_user_id
},
}).then((result) => {
if (result.code == 0) {
this.mDatas.splice(index, 1)
} else {
this.$toast.showToast(result.msg)
}
})
},
getApplyList: function() {
Api.getExamineList({
data: {
dept_type: 1,
is_page: 1,
page: this.page,
page_size: this.pageSize
},
}).then((result) => {
console.log("申请列表", result);
if (result.code == 0) {
this.totalPage = result.data.total_page
if (this.page == 1) {
this.mDatas = []
}
result.data.list.forEach((item) => {
this.mDatas.push(item)
})
} else {
this.$toast.showToast(result.msg)
}
})
}
}
}
</script>
<style>
.column-list-root {
background-color: #F5F5F5;
display: flex;
flex-direction: column;
}
.column-list-item {
background-color: #FFFFFF;
display: flex;
margin-bottom: 20rpx;
flex-direction: column;
padding: 32rpx;
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment