| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- <template>
- <view>
- <template v-if="!userInfo || !userInfo.realName">
- <view class="top d-flex a-center px3 main-color-bg" @tap="login">
- <view class="img">
- <image src="/static/images/user_pic.png" mode=""></image>
- </view>
- <view class="ml-3 f-size-36 text-color-white">登录 / 注册</view>
- </view>
- </template>
- <template v-else>
- <view class="top d-flex a-center px3 main-color-bg">
- <view class="img">
- <image :src="myAvatar" @error="myDefaultAvatar" mode=""></image>
- </view>
- <view class="ml-3 f-size-36 text-color-white">{{
- userInfo.realName
- }}</view>
- </view>
- </template>
- <view class="divider"></view>
- <view class="px3 bg-color-white">
- <view class="f-size-32 f-weight-bold py2 border-bottom">我的任务</view>
- <!-- <my-card
- icon="icon-runhuaguanli"
- title="点检任务"
- :tipNum="gatherTask.checkTask"
- @handleLubrication="handleCheck"
- ></my-card>
- <my-card
- icon="icon-xunjianguanli"
- title="巡检填报"
- @handleLubrication="handleInspection"
- ></my-card>-->
- <!-- <my-card icon="icon-tubiaozhizuomoban-135" title="今日保养任务" :tipNum="gatherTask.lubricationTask" @handleLubrication="handleMaintain(1)"></my-card> -->
- <!-- <my-card icon="icon-tubiaozhizuomoban-135" title="本周保养任务" :tipNum="gatherTask.lubricationTaskWeek" @handleLubrication="handleMaintain(2)"></my-card> -->
- <my-card icon="icon-tubiaozhizuomoban-135" title="本月保养任务" :tipNum="gatherTask.lubricationTaskMonth"
- @handleLubrication="handleMaintain(3)"></my-card>
- <!-- <my-card
- icon="icon-jiayou"
- title="加油任务"
- :tipNum="gatherTask.oilTask"
- @handleLubrication="handleOiling"
- iColor="#F1650C"
- ></my-card>-->
- <my-card
- v-show="$BaseTool.UserUtil.getUserInfo() != null && ($BaseTool.UserUtil.isRepairRole() || $BaseTool.UserUtil.isManagerRole())"
- icon="icon-weixiu" title="维修任务" :tipNum="gatherTask.repairTask"
- @handleLubrication="handleService"></my-card>
- <my-card v-show="$BaseTool.UserUtil.getUserInfo() != null && $BaseTool.UserUtil.isManagerRole()"
- icon="icon-tubiaozhizuomoban-135" title="审核任务" :tipNum="gatherTask.repairCheckTask"
- @handleLubrication="handleRepairCheck"></my-card>
- <!-- <my-card
- icon="icon-tubiaozhizuomoban-135"
- title="盘点任务"
- :tipNum="gatherTask.storeCheckTask"
- @handleLubrication="handleStoreCheck"
- ></my-card>-->
- </view>
- <view class="divider"></view>
- <view class="px3 bg-color-white">
- <my-card icon="icon-shezhi" title="设置" @handleLubrication="getSetting"></my-card>
- </view>
- <u-tabbar :list="tabbar" :mid-button="true" active-color="#0082ff"></u-tabbar>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- userInfo: {
- realName: null,
- avatar: null
- },
- gatherTask: {
- checkTask: 0,
- maintainTask: 0,
- lubricationTask: 0,
- lubricationTaskWeek: 0,
- lubricationTaskMonth: 0,
- oilTask: 0,
- repairTask: 0,
- repairCheckTask: 0
- },
- myAvatar: '',
- tabbar: [
- {
- iconPath: '/static/tabars/home.png',
- pagePath: '/pages/home/home',
- selectedIconPath: '/static/tabars/home_s.png',
- text: '首页'
- },
- {
- iconPath: '/static/tabars/order.png',
- pagePath: '/pages/operate/operate',
- selectedIconPath: '/static/tabars/order_s.png',
- text: '功能'
- },
- {
- iconPath: '/static/tabars/publish.png',
- pagePath: '/pages/middle/middle',
- selectedIconPath: '/static/tabars/publish.png',
- text: '报修',
- midButton: true
- },
- {
- iconPath: '/static/tabars/tiding.png',
- pagePath: '/pages/tidings/tidings',
- selectedIconPath: '/static/tabars/tiding_s.png',
- text: '消息'
- },
- {
- iconPath: '/static/tabars/mine.png',
- pagePath: '/pages/my/my',
- selectedIconPath: '/static/tabars/mine_s.png',
- text: '我的'
- }
- ]
- }
- },
- onLoad() { },
- onShow() {
- this.userInfo = this.$BaseTool.UserUtil.getUserInfo()
- if (!this.userInfo || !this.userInfo.username) {
- uni.showModal({
- content: '登录后方可查看内容',
- showCancel: true,
- cancelText: '账号登录',
- confirmText: '快捷登录',
- success: res => {
- if (res.confirm) {
- this.$Http.loginQuickly().then(res => {
- const url = res.data
- if (url !== '' && url !== null && url != undefined) {
- // 请求用户授权
- window.location.href = url
- }
- })
- } else if (res.cancel) {
- uni.reLaunch({ url: '/pages/login/login' })
- }
- }
- })
- return
- }
- this.myAvatar = this.$BaseTool.UserUtil.getFileUrl(this.userInfo.avatar)
- this.$Http.getGatherTask().then(res => {
- this.gatherTask = res.data
- })
- },
- methods: {
- myDefaultAvatar() {
- this.myAvatar = '/static/images/user_pic.png'
- },
- getSetting() {
- uni.navigateTo({
- url: '../setting/setting'
- })
- },
- // 维修任务
- handleService() {
- uni.navigateTo({
- url: '../service/service?filter=0'
- })
- },
- // 维修验收任务
- handleRepairCheck() {
- uni.navigateTo({
- url: '../repair-check/repair-check'
- })
- },
- // 盘点任务
- handleStoreCheck() {
- uni.navigateTo({
- url: '../store-check/list'
- })
- },
- // 加油任务
- handleOiling() {
- uni.navigateTo({
- url: '../oiling/oiling'
- })
- },
- // 点检任务
- handleCheck() {
- uni.navigateTo({
- url: '../check/check'
- })
- },
- // 保养任务
- handleMaintain(searchType) {
- uni.navigateTo({
- url: '/pages/maintain/maintain?filter=2&searchType=' + searchType
- })
- },
- // 巡检任务
- handleInspection() {
- uni.navigateTo({
- url: '../inspection/inspection'
- })
- },
- // 润滑任务
- handleLubrication(e) {
- uni.navigateTo({
- url: '../lubrication/lubrication'
- })
- },
- // 扫码
- handleCode() {
- // #ifdef H5
- uni.showToast({
- title: '暂不支持该功能',
- icon: 'none'
- })
- // #endif
- // #ifndef H5
- uni.scanCode({
- success(e) {
- console.log(e.result)
- if (e.result) {
- uni.navigateTo({
- url: '/pages/equipment-detail/equipment-detail?detailId=' + e.result
- })
- }
- }
- })
- // #endif
- },
- // 扫码出库
- handleCodeOut() {
- // #ifdef H5
- uni.showToast({
- title: '暂不支持该功能',
- icon: 'none'
- })
- // #endif
- // #ifndef H5
- uni.scanCode({
- success(e) {
- console.log(e.result)
- if (e.result) {
- uni.navigateTo({
- url: '/pages/out-store/out-store?detailId=' + e.result
- })
- }
- }
- })
- // #endif
- },
- // 登录
- login() {
- uni.navigateTo({
- url: '../login/login'
- })
- }
- }
- }
- </script>
- <style lang="less">
- page {
- background-color: #f4f4f4;
- }
- .often {
- image {
- width: unit(50, rpx);
- height: unit(50, rpx);
- }
- .iconfont {
- font-size: unit(50, rpx);
- }
- }
- .top {
- height: unit(200, rpx);
- .img {
- width: unit(128, rpx);
- height: unit(128, rpx);
- border-radius: 50%;
- image {
- width: unit(128, rpx);
- height: unit(128, rpx);
- border-radius: 50%;
- background-color: #999;
- // border: 5rpx solid #fff;
- }
- }
- }
- </style>
|