提交 48b1c27e 作者: wk

图标替换

父级 6b3b1fc3
...@@ -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"
......
...@@ -6,200 +6,201 @@ ...@@ -6,200 +6,201 @@
</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: {
type: String, type: String,
default: 'tki-qrcode-canvas' default: 'tki-qrcode-canvas'
}, },
size: { size: {
type: Number, type: Number,
default: 200 default: 200
}, },
unit: { unit: {
type: String, type: String,
default: 'upx' default: 'upx'
}, },
show: { show: {
type: Boolean, type: Boolean,
default: true default: true
}, },
val: { val: {
type: String, type: String,
default: '' default: ''
}, },
background: { background: {
type: String, type: String,
default: '#ffffff' default: '#ffffff'
}, },
foreground: { foreground: {
type: String, type: String,
default: '#000000' default: '#000000'
}, },
pdground: { pdground: {
type: String, type: String,
default: '#000000' default: '#000000'
}, },
icon: { icon: {
type: String, type: String,
default: '' default: ''
}, },
iconSize: { iconSize: {
type: Number, type: Number,
default: 40 default: 40
}, },
lv: { lv: {
type: Number, type: Number,
default: 3 default: 3
}, },
onval: { onval: {
type: Boolean, type: Boolean,
default: false default: false
}, },
loadMake: { loadMake: {
type: Boolean, type: Boolean,
default: false default: false
}, },
usingComponents: { usingComponents: {
type: Boolean, type: Boolean,
default: true default: true
}, },
showLoading: { showLoading: {
type: Boolean, type: Boolean,
default: true default: true
}, },
loadingText: { loadingText: {
type: String, type: String,
default: '二维码生成中' default: '二维码生成中'
}, },
}, },
data() { data() {
return { return {
result: '', result: '',
}
},
methods: {
_makeCode() {
let that = this
if (!this._empty(this.val)) {
qrcode = new QRCode({
context: that, // 上下文环境
canvasId:that.cid, // canvas-id
usingComponents: that.usingComponents, // 是否是自定义组件
showLoading: that.showLoading, // 是否显示loading
loadingText: that.loadingText, // loading文字
text: that.val, // 生成内容
size: that.cpSize, // 二维码大小
background: that.background, // 背景色
foreground: that.foreground, // 前景色
pdground: that.pdground, // 定位角点颜色
correctLevel: that.lv, // 容错级别
image: that.icon, // 二维码图标
imageSize: that.iconSize,// 二维码图标大小
cbResult: function (res) { // 生成二维码的回调
that._result(res)
},
});
} else {
uni.showToast({
title: '二维码内容不能为空',
icon: 'none',
duration: 2000
});
} }
}, },
_clearCode() { methods: {
this._result('') _makeCode() {
qrcode.clear() let that = this
if (!this._empty(this.val)) {
qrcode = new QRCode({
context: that, // 上下文环境
canvasId: that.cid, // canvas-id
usingComponents: that.usingComponents, // 是否是自定义组件
showLoading: that.showLoading, // 是否显示loading
loadingText: that.loadingText, // loading文字
text: that.val, // 生成内容
size: that.cpSize, // 二维码大小
background: that.background, // 背景色
foreground: that.foreground, // 前景色
pdground: that.pdground, // 定位角点颜色
correctLevel: that.lv, // 容错级别
image: that.icon, // 二维码图标
imageSize: that.iconSize, // 二维码图标大小
cbResult: function(res) { // 生成二维码的回调
that._result(res)
},
});
} else {
uni.showToast({
title: '二维码内容不能为空',
icon: 'none',
duration: 2000
});
}
},
_clearCode() {
this._result('')
qrcode.clear()
},
_saveCode() {
let that = this;
if (this.result != "") {
uni.saveImageToPhotosAlbum({
filePath: that.result,
success: function() {
uni.showToast({
title: '二维码保存成功',
icon: 'success',
duration: 2000
});
}
});
}
},
_result(res) {
this.result = res;
this.$emit('result', res)
},
_empty(v) {
let tp = typeof v,
rt = false;
if (tp == "number" && String(v) == "") {
rt = true
} else if (tp == "undefined") {
rt = true
} else if (tp == "object") {
if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
} else if (tp == "string") {
if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
} else if (tp == "function") {
rt = false
}
return rt
}
}, },
_saveCode() { watch: {
let that = this; size: function(n, o) {
if (this.result != "") { if (n != o && !this._empty(n)) {
uni.saveImageToPhotosAlbum({ this.cSize = n
filePath: that.result, if (!this._empty(this.val)) {
success: function () { setTimeout(() => {
uni.showToast({ this._makeCode()
title: '二维码保存成功', }, 100);
icon: 'success',
duration: 2000
});
} }
}); }
},
val: function(n, o) {
if (this.onval) {
if (n != o && !this._empty(n)) {
setTimeout(() => {
this._makeCode()
}, 0);
}
}
} }
}, },
_result(res) { computed: {
this.result = res; cpSize() {
this.$emit('result', res) if (this.unit == "upx") {
}, return uni.upx2px(this.size)
_empty(v) { } else {
let tp = typeof v, return this.size
rt = false;
if (tp == "number" && String(v) == "") {
rt = true
} else if (tp == "undefined") {
rt = true
} else if (tp == "object") {
if (JSON.stringify(v) == "{}" || JSON.stringify(v) == "[]" || v == null) rt = true
} else if (tp == "string") {
if (v == "" || v == "undefined" || v == "null" || v == "{}" || v == "[]") rt = true
} else if (tp == "function") {
rt = false
}
return rt
}
},
watch: {
size: function (n, o) {
if (n != o && !this._empty(n)) {
this.cSize = n
if (!this._empty(this.val)) {
setTimeout(() => {
this._makeCode()
}, 100);
} }
} }
}, },
val: function (n, o) { mounted: function() {
if (this.onval) { if (this.loadMake) {
if (n != o && !this._empty(n)) { if (!this._empty(this.val)) {
setTimeout(() => { setTimeout(() => {
this._makeCode() this._makeCode()
}, 0); }, 0);
} }
} }
} },
}, }
computed: {
cpSize() {
if(this.unit == "upx"){
return uni.upx2px(this.size)
}else{
return this.size
}
}
},
mounted: function () {
if (this.loadMake) {
if (!this._empty(this.val)) {
setTimeout(() => {
this._makeCode()
}, 0);
}
}
},
}
</script> </script>
<style> <style>
.tki-qrcode { .tki-qrcode {
position: relative; position: relative;
} }
.tki-qrcode-canvas {
position: fixed; .tki-qrcode-canvas {
top: -99999upx; position: fixed;
left: -99999upx; top: -99999upx;
z-index: -99999; left: -99999upx;
} 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
}], }],
......
...@@ -181,6 +181,14 @@ ...@@ -181,6 +181,14 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, {
"path": "pages/mine/myApproval/myApproval",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
} }
], ],
"globalStyle": { "globalStyle": {
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
</view> </view>
</view> </view>
</view> </view>
<view class="popularity-content" :style="{'margin-top':statusBarHeight+116+'px'}">
</view>
<uni-tabbar currentPage="1"></uni-tabbar> <uni-tabbar currentPage="1"></uni-tabbar>
</view> </view>
</template> </template>
...@@ -146,5 +149,16 @@ ...@@ -146,5 +149,16 @@
} }
} }
.popularity-content {
width: 690rpx;
height: 40px;
border-radius: 40rpx;
background: #fff;
display: flex;
margin: 0 30rpx;
flex-direction: row;
align-items: center;
}
} }
</style> </style>
...@@ -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