| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <template name="home">
- <view>
- <scroll-view>
- <!-- 常用服务 -->
- <view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.5s 1'}]">
- <view class="action">
- <text class='cuIcon-title text-blue'></text>个人中心
- </view>
- </view>
- <view class="cu-list grid col-4 text-sm">
- <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item,index) in usList" :key="index" @tap="goPage(item.page)">
- <icon-item :item="item"></icon-item>
- </view>
- </view>
- <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]">
- <view class="action">
- <text class='cuIcon-title text-yellow'></text>售后服务
- </view>
- </view>
- <view class="cu-list grid col-4 text-sm">
- <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item,index) in shList" :key="index" @tap="goPage(item.page)">
- <icon-item :item="item"></icon-item>
- </view>
- </view>
- <!-- 其他服务 -->
- <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]">
- <view class="action">
- <text class='cuIcon-title text-yellow'></text>账户管理
- </view>
- </view>
- <view class="cu-list grid col-4 text-sm">
- <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" v-for="(item,index) in osList" :key="index" @tap="goPage(item.page)">
- <icon-item :item="item"></icon-item>
- </view>
- </view>
- </scroll-view>
- <view class="cu-tabbar-height margin-top"></view>
- </view>
- </template>
- <script>
- import {
- us,
- os,
- sh
- } from '@/common/util/work.js'
- import socket from '@/common/js-sdk/socket/socket.js'
- import {
- ACCESS_TOKEN,
- USER_NAME,
- USER_INFO
- } from "@/common/util/constants"
- import iconItem from './iconItem.vue'
- export default {
- name: 'home',
- props: {
- cur: String,
- },
- components: {
- iconItem
- },
- watch: {
- cur: {
- immediate: true,
- handler: function(val, oldVal) {
- this.initMenu()
- },
- },
- },
- data() {
- return {
- middleApps: [{
- icon: 'line2_icon1.png',
- title: '审批',
- 'text': '个人审批'
- },
- {
- icon: 'line2_icon2.png',
- title: '审批稿',
- 'text': '审批草稿箱'
- },
- ],
- usList: us.data,
- osList: os.data,
- shList: sh.data,
- msgCount: 0,
- dot: {
- mailHome: false
- },
- userid: ''
- }
- },
- onLoad() {},
- created() {
- //获取账号id
- setTimeout(() => {
- let info = uni.getStorageSync(USER_INFO)
- if (info && info.user.id) {
- this.userid = info.user.id || ''
- }
- this.getCount()
- }, 500)
- },
- onShow() {
- this.getCount()
- },
- methods: {
- initMenu() {
- //this.onSocketOpen()
- // this.onSocketReceive()
- this.loadCount(0);
- },
- goPage(page) {
- //是否是退出按钮判断
- if (page == "userexit") {
- this.getQuit()
- return
- }
- if (!page) {
- return false;
- }
- // if (page === 'annotationList') {
- // this.msgCount = 0
- // }
- // this.dot[page] = false
- // this.$Router.push({
- // name: page
- // })
- uni.navigateTo({
- url: page
- })
- },
- // 启动webSocket
- onSocketOpen() {
- socket.init('websocket');
- },
- onSocketReceive() {
- var _this = this
- socket.acceptMessage = function(res) {
- if (res.cmd == "topic") {
- //系统通知
- _this.loadCount('1')
- } else if (res.cmd == "user") {
- //用户消息
- _this.loadCount('2')
- } else if (res.cmd == 'email') {
- //邮件消息
- _this.loadEmailCount()
- }
- }
- },
- loadCount(flag) {
- let url = '/sys/annountCement/listByUser';
- },
- loadEmailCount() {
- this.dot.mailHome = true
- },
- getTtemDotInfo(item) {
- if (item.page === 'annotationList' && this.msgCount > 0) {
- return this.msgCount
- }
- return '';
- },
- //退出逻辑
- getQuit() {
- uni.showModal({
- title: '提示',
- content: '是否退出登录?',
- success: function(res) {
- if (res.confirm) {
- let loginMessage2 = uni.getStorageSync('login-message')
- let para = {
- access_token: uni.getStorageSync(ACCESS_TOKEN)
- }
- uni.clearStorageSync()
- //ibps/oauth2/v3/user/logout?access_token=
- uni.setStorageSync('login-message', loginMessage2)
- uni.navigateTo({
- url: '/pages/login/login'
- })
- // let url = "/ibps/oauth2/v3/user/logout?access_token=" + uni.getStorageSync(
- // ACCESS_TOKEN)
- // api.logout(url, para).then(res => {
- // uni.clearStorageSync()
- // //ibps/oauth2/v3/user/logout?access_token=
- // uni.setStorageSync('login-message', loginMessage2)
- // uni.navigateTo({
- // url: '/pages/login/login'
- // })
- // })
- } else if (res.cancel) {
- }
- }
- });
- },
- getCount() {
- if (!this.userid) {
- return
- }
- let sql =
- `select count(a.id_) as count from t_lhwtsqb a left join t_bjd d on a.he_tong_id_ = d.id_ where (a.wei_tuo_zhuang_ta = '待编制' or a.shi_fou_guo_shen_ = '已退回') and (a.create_by_ = '${this.userid}'or d.ke_hu_zhang_hao_ = '${this.userid}')`
- let requestData = this.$sig(sql)
- this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
- if (res.data.state == 200) {
- const data = res.data.variables.data[0]
- this.usList[2].text = data.count
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- .cu-list.grid>.cu-item {
- padding: 0px 0px;
- }
- .line2-icon {
- width: 60px;
- height: 60px;
- }
- </style>
|