home.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template name="home">
  2. <view>
  3. <scroll-view>
  4. <!-- 常用服务 -->
  5. <view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.5s 1'}]">
  6. <view class="action">
  7. <text class='cuIcon-title text-blue'></text>个人中心
  8. </view>
  9. </view>
  10. <view class="cu-list grid col-4 text-sm">
  11. <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)">
  12. <icon-item :item="item"></icon-item>
  13. </view>
  14. </view>
  15. <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]">
  16. <view class="action">
  17. <text class='cuIcon-title text-yellow'></text>售后服务
  18. </view>
  19. </view>
  20. <view class="cu-list grid col-4 text-sm">
  21. <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)">
  22. <icon-item :item="item"></icon-item>
  23. </view>
  24. </view>
  25. <!-- 其他服务 -->
  26. <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]">
  27. <view class="action">
  28. <text class='cuIcon-title text-yellow'></text>账户管理
  29. </view>
  30. </view>
  31. <view class="cu-list grid col-4 text-sm">
  32. <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)">
  33. <icon-item :item="item"></icon-item>
  34. </view>
  35. </view>
  36. </scroll-view>
  37. <view class="cu-tabbar-height margin-top"></view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. us,
  43. os,
  44. sh
  45. } from '@/common/util/work.js'
  46. import socket from '@/common/js-sdk/socket/socket.js'
  47. import {
  48. ACCESS_TOKEN,
  49. USER_NAME,
  50. USER_INFO
  51. } from "@/common/util/constants"
  52. import iconItem from './iconItem.vue'
  53. export default {
  54. name: 'home',
  55. props: {
  56. cur: String,
  57. },
  58. components: {
  59. iconItem
  60. },
  61. watch: {
  62. cur: {
  63. immediate: true,
  64. handler: function(val, oldVal) {
  65. this.initMenu()
  66. },
  67. },
  68. },
  69. data() {
  70. return {
  71. middleApps: [{
  72. icon: 'line2_icon1.png',
  73. title: '审批',
  74. 'text': '个人审批'
  75. },
  76. {
  77. icon: 'line2_icon2.png',
  78. title: '审批稿',
  79. 'text': '审批草稿箱'
  80. },
  81. ],
  82. usList: us.data,
  83. osList: os.data,
  84. shList: sh.data,
  85. msgCount: 0,
  86. dot: {
  87. mailHome: false
  88. },
  89. userid: ''
  90. }
  91. },
  92. onLoad() {},
  93. created() {
  94. //获取账号id
  95. setTimeout(() => {
  96. let info = uni.getStorageSync(USER_INFO)
  97. if (info && info.user.id) {
  98. this.userid = info.user.id || ''
  99. }
  100. this.getCount()
  101. }, 500)
  102. },
  103. onShow() {
  104. this.getCount()
  105. },
  106. methods: {
  107. initMenu() {
  108. //this.onSocketOpen()
  109. // this.onSocketReceive()
  110. this.loadCount(0);
  111. },
  112. goPage(page) {
  113. //是否是退出按钮判断
  114. if (page == "userexit") {
  115. this.getQuit()
  116. return
  117. }
  118. if (!page) {
  119. return false;
  120. }
  121. // if (page === 'annotationList') {
  122. // this.msgCount = 0
  123. // }
  124. // this.dot[page] = false
  125. // this.$Router.push({
  126. // name: page
  127. // })
  128. uni.navigateTo({
  129. url: page
  130. })
  131. },
  132. // 启动webSocket
  133. onSocketOpen() {
  134. socket.init('websocket');
  135. },
  136. onSocketReceive() {
  137. var _this = this
  138. socket.acceptMessage = function(res) {
  139. if (res.cmd == "topic") {
  140. //系统通知
  141. _this.loadCount('1')
  142. } else if (res.cmd == "user") {
  143. //用户消息
  144. _this.loadCount('2')
  145. } else if (res.cmd == 'email') {
  146. //邮件消息
  147. _this.loadEmailCount()
  148. }
  149. }
  150. },
  151. loadCount(flag) {
  152. let url = '/sys/annountCement/listByUser';
  153. },
  154. loadEmailCount() {
  155. this.dot.mailHome = true
  156. },
  157. getTtemDotInfo(item) {
  158. if (item.page === 'annotationList' && this.msgCount > 0) {
  159. return this.msgCount
  160. }
  161. return '';
  162. },
  163. //退出逻辑
  164. getQuit() {
  165. uni.showModal({
  166. title: '提示',
  167. content: '是否退出登录?',
  168. success: function(res) {
  169. if (res.confirm) {
  170. let loginMessage2 = uni.getStorageSync('login-message')
  171. let para = {
  172. access_token: uni.getStorageSync(ACCESS_TOKEN)
  173. }
  174. uni.clearStorageSync()
  175. //ibps/oauth2/v3/user/logout?access_token=
  176. uni.setStorageSync('login-message', loginMessage2)
  177. uni.navigateTo({
  178. url: '/pages/login/login'
  179. })
  180. // let url = "/ibps/oauth2/v3/user/logout?access_token=" + uni.getStorageSync(
  181. // ACCESS_TOKEN)
  182. // api.logout(url, para).then(res => {
  183. // uni.clearStorageSync()
  184. // //ibps/oauth2/v3/user/logout?access_token=
  185. // uni.setStorageSync('login-message', loginMessage2)
  186. // uni.navigateTo({
  187. // url: '/pages/login/login'
  188. // })
  189. // })
  190. } else if (res.cancel) {
  191. }
  192. }
  193. });
  194. },
  195. getCount() {
  196. if (!this.userid) {
  197. return
  198. }
  199. let sql =
  200. `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}')`
  201. let requestData = this.$sig(sql)
  202. this.$http.post("/ibps/business/v3/sys/universal/inputSqlSelectData", requestData).then(res => {
  203. if (res.data.state == 200) {
  204. const data = res.data.variables.data[0]
  205. this.usList[2].text = data.count
  206. }
  207. })
  208. }
  209. }
  210. }
  211. </script>
  212. <style scoped>
  213. .cu-list.grid>.cu-item {
  214. padding: 0px 0px;
  215. }
  216. .line2-icon {
  217. width: 60px;
  218. height: 60px;
  219. }
  220. </style>