index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view class="index">
  3. <view class="headTop">
  4. <image class="pic_hp_tbbg" src="/static/img/pic_hp_tbbg@2x.png" mode=""></image>
  5. <view class="userInfo">
  6. <view :style="{height:statusBarHeight+'px'}"></view>
  7. <view class="title" :style="{height:statusBarHeight2+'px'}"><text>潜山市教育局在线收发文系统</text></view>
  8. <view class="content">
  9. <image class="uImg" v-if="userInfo.avatar" :src="userInfo.avatar" mode=""></image>
  10. <image class="uImg" v-else src="/static/img/icon_hp_hp.png" mode=""></image>
  11. <view class="userText">
  12. <view class="nameT"><text class="n">{{userInfo.userName}}</text>您好!</view>
  13. <view class="toDay">
  14. <text class="j">今天是 </text><text class="d">{{toDay.time}} {{toDay.riqi}}</text> <text class="g">{{toDay.gongzuo}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="listItem">
  19. <view class="item" @click="addresseeY(0)">
  20. <view class="name">今日收文</view>
  21. <view class="num">
  22. <view class="n">{{messageReceiveData.todayReceipt}}</view>
  23. <view class="t">条</view>
  24. </view>
  25. </view>
  26. <view class="item" @click="addresseeY(0)">
  27. <view class="name">未读收文</view>
  28. <view class="num">
  29. <view class="n">{{messageReceiveData.unread}}</view>
  30. <view class="t">条</view>
  31. </view>
  32. </view>
  33. <view class="item" v-if="roles.indexOf('user-admin') != -1" @click="addresseeF()">
  34. <view class="name">今日发文</view>
  35. <view class="num">
  36. <view class="n">{{messageReceiveData.toDaySend}}</view>
  37. <view class="t">条</view>
  38. </view>
  39. </view>
  40. <view class="item" @click="addresseeY(1)">
  41. <view class="name">已读收文</view>
  42. <view class="num">
  43. <view class="n">{{messageReceiveData.read}}</view>
  44. <view class="t">条</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="gongju">
  51. <view class="item" @click="addPost()" v-if="roles.indexOf('user-admin') != -1">
  52. <image class="bg" src="/static/img/pic_hp_bgxzfw.png" mode=""></image>
  53. <view class="box">
  54. <image class="iocn" src="/static/img/icon_hp_xzfw.png" mode=""></image>
  55. <view class="text">新增发文</view>
  56. </view>
  57. </view>
  58. <view class="item" @click="addresseeY(0)">
  59. <image class="bg" src="/static/img/pic_hp_bgsw.png" mode=""></image>
  60. <view class="box">
  61. <image class="iocn" src="/static/img/icon_hp_sw.png" mode=""></image>
  62. <view class="text">收文</view>
  63. </view>
  64. </view>
  65. <view class="item" @click="archive()" v-if="roles.indexOf('user-admin') != -1">
  66. <image class="bg" src="/static/img/pic_hp_bgdgd.png" mode=""></image>
  67. <view class="box">
  68. <image class="iocn" src="/static/img/icon_hp_dgd.png" mode=""></image>
  69. <view class="text">待归档</view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. setNav:{
  80. backgroundColor:'', //背景色
  81. color:'#fff', //字体颜色
  82. bold: true,
  83. size: '36',
  84. backColor: '#ffff',
  85. immersive : true,
  86. isdisPlayNavTitle: false, //是否显示返回按钮
  87. navTitle:'潜山市教育局在线收发文系统' //导航标题
  88. },
  89. statusBarHeight: 0,
  90. statusBarHeight2: 0,
  91. userInfo: {},
  92. toDay: {
  93. time: this.$u.timeFormat(new Date(), 'yyyy年mm月dd日'),
  94. riqi: '星期一',
  95. gongzuo: '工作日'
  96. },
  97. messageReceiveData: {},
  98. roles: []
  99. }
  100. },
  101. onLoad() {
  102. },
  103. onShow () {
  104. // this.init()
  105. this.getByTableName()
  106. this.init()
  107. },
  108. methods:{
  109. init () {
  110. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
  111. this.statusBarHeight2 = uni.getSystemInfoSync().platform == 'ios' ? 44 : 48
  112. this.getInfo()
  113. switch (new Date().getDay()){
  114. case 1:
  115. this.toDay.riqi = '星期一'
  116. this.toDay.gongzuo = '工作日'
  117. break;
  118. case 2:
  119. this.toDay.riqi = '星期二'
  120. this.toDay.gongzuo = '工作日'
  121. break;
  122. case 3:
  123. this.toDay.riqi = '星期三'
  124. this.toDay.gongzuo = '工作日'
  125. break;
  126. case 4:
  127. this.toDay.riqi = '星期四'
  128. this.toDay.gongzuo = '工作日'
  129. break;
  130. case 5:
  131. this.toDay.riqi = '星期五'
  132. this.toDay.gongzuo = '工作日'
  133. break;
  134. case 6:
  135. this.toDay.riqi = '星期六'
  136. this.toDay.gongzuo = '工作日'
  137. break;
  138. case 0:
  139. this.toDay.riqi = '星期日'
  140. this.toDay.gongzuo = '工作日'
  141. break;
  142. default:
  143. this.toDay.riqi = '星期一'
  144. this.toDay.gongzuo = '工作日'
  145. break;
  146. }
  147. },
  148. async getInfo () {
  149. let that = this
  150. let res = await that.$u.get('system/user/getInfo')
  151. that.userInfo = res.user
  152. that.roles = res.roles
  153. uni.setStorageSync('userInfo', JSON.stringify(that.userInfo));
  154. uni.setStorageSync('roles', JSON.stringify(res.roles));
  155. this.getMessageReceive()
  156. },
  157. async getByTableName () {
  158. let res = await this.$u.get('boman-web-core/p/cs/table/getByTableName/boman_message')
  159. uni.setStorageSync('byTableInfo', JSON.stringify({
  160. id: res.data.id,
  161. tableName: res.data.tableName
  162. }));
  163. },
  164. async getMessageReceive () {
  165. let that = this
  166. let res = await that.$u.get(`boman-web-core/messageReceive/index/${that.userInfo.id}`)
  167. that.messageReceiveData = res.data
  168. },
  169. archive() {
  170. uni.navigateTo({
  171. url: '/pages/indexView/archive/index'
  172. })
  173. },
  174. addressee() {
  175. uni.navigateTo({
  176. url: '/pages/indexView/addressee/index'
  177. })
  178. },
  179. addresseeF() {
  180. uni.switchTab({
  181. url: '/pages/tabbar/post/index'
  182. })
  183. },
  184. addresseeY(type) {
  185. uni.setStorage({
  186. key: 'addresseeY',
  187. data: type,
  188. success: async function() {
  189. uni.switchTab({
  190. url: '/pages/tabbar/addressee/index'
  191. })
  192. }
  193. })
  194. },
  195. addPost() {
  196. uni.navigateTo({
  197. url: '/pages/indexView/addPost/index'
  198. })
  199. },
  200. postList() {
  201. uni.navigateTo({
  202. url: '/pages/indexView/postList/index'
  203. })
  204. },
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. .headTop{
  210. position: relative;
  211. .pic_hp_tbbg{
  212. width: 100%;
  213. height: 680rpx;
  214. }
  215. .userInfo{
  216. position: absolute;
  217. top: 0;
  218. z-index: 1;
  219. left: 0;
  220. width: 100%;
  221. .title{
  222. color: #FFFFFF;
  223. font-size: 31rpx;
  224. font-weight: 700;
  225. text-align: center;
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. }
  230. .content{
  231. padding: 20rpx 30rpx;
  232. display: flex;
  233. .uImg{
  234. width: 70rpx;
  235. height: 70rpx;
  236. border-radius: 100%;
  237. }
  238. .userText{
  239. flex: 1;
  240. margin-left: 30rpx;
  241. .nameT{
  242. font-size: 28rpx;
  243. color: #FFFFFF;
  244. .n{
  245. font-size: 36rpx;
  246. font-weight: 700;
  247. padding-right: 30rpx;
  248. }
  249. }
  250. .toDay{
  251. display: flex;
  252. align-items: center;
  253. font-size: 28rpx;
  254. color: #FFFFFF;
  255. margin-top: 30rpx;
  256. .j{
  257. opacity: 0.8;
  258. }
  259. .d{
  260. font-weight: 700;
  261. margin: 0 20rpx;
  262. }
  263. .g{
  264. font-size: 22rpx;
  265. background: #116cb9;
  266. width: 109rpx;
  267. height: 44rpx;
  268. text-align: center;
  269. line-height: 44rpx;
  270. border-radius: 10rpx 24rpx 24rpx 24rpx;
  271. box-shadow: 0px 0px 4px 0px #116cb9;
  272. }
  273. }
  274. }
  275. }
  276. .listItem{
  277. display: flex;
  278. align-items: center;
  279. padding: 30rpx;
  280. flex-wrap: wrap;
  281. .item{
  282. flex: 0 0 50%;
  283. margin-bottom: 30rpx;
  284. .name{
  285. color: #FFFFFF;
  286. font-size: 28rpx;
  287. text-align: center;
  288. }
  289. .num{
  290. display: flex;
  291. align-items: flex-end;
  292. color: #FFFFFF;
  293. justify-content: center;
  294. margin-top: 20rpx;
  295. .n{
  296. font-size: 49rpx;
  297. font-weight: 700;
  298. }
  299. .t{
  300. font-size: 25rpx;
  301. margin-bottom: 10rpx;
  302. margin-left: 10rpx;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. }
  309. .gongju{
  310. display: flex;
  311. align-items: center;
  312. margin: 43rpx 30rpx;
  313. justify-content: space-between;
  314. .item{
  315. width: 208rpx;
  316. height: 208rpx;
  317. position: relative;
  318. padding: 0 30rpx;
  319. .bg{
  320. width: 208rpx;
  321. height: 208rpx;
  322. position: absolute;
  323. top: 0;
  324. left: 0;
  325. }
  326. .box{
  327. position: absolute;
  328. width: 208rpx;
  329. height: 208rpx;
  330. top: 50%;
  331. left: 50%;
  332. margin-top: 22rpx;
  333. transform: translate(-50%,-50%);
  334. .iocn{
  335. width: 117rpx;
  336. height: 119rpx;
  337. margin: auto;
  338. }
  339. .text{
  340. color: #FFFFFF;
  341. font-size: 31rpx;
  342. font-weight: 700;
  343. text-align: center;
  344. }
  345. }
  346. }
  347. }
  348. </style>