index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <view class="zxbox">
  3. <view class="navbox">
  4. <uni-nav-bar color="#ffffff" :background-color="backgroundColor" :border="false"
  5. statusBar='true' fixed="true">
  6. </uni-nav-bar>
  7. </view>
  8. <image :src="bgimg" class="bgimg"></image>
  9. <view class="mbox">
  10. <view class="infobox flexc" @click="handleToInfo">
  11. <view class="cbox">
  12. <view class="tit">{{name?name:'登录账号'}}</view>
  13. <view class="txt">点击登录 享受更多精彩信息</view>
  14. <!-- <view class="flexc pr" v-if="deptName">
  15. <image :src="headl"></image>
  16. <view class="txt">{{deptName}}点击登录 享受更多精彩信息</view>
  17. <image :src="headr"></image>
  18. </view> -->
  19. </view>
  20. <!-- 登录 -->
  21. <!-- <image v-if="avatar" @click.stop="handleToAvatar" :src="avatar" class="limg" mode="aspectFill"></image>
  22. <image v-else @click.stop="handleToAvatar" :src="avatarimg" class="limg" mode="aspectFill"></image> -->
  23. <!-- 未登录 -->
  24. <image @click.stop="handleToAvatar" :src="avatarimg" class="limg" mode="aspectFill"></image>
  25. </view>
  26. <view class="conts flexc">
  27. <view class="contn" v-if="checkPermi(['system:reservat:sh'])" @click="handleToYy">
  28. <view class="img">
  29. <image :src="listimga" class="imga"></image>
  30. </view>
  31. <view class="ctit">待我审批</view>
  32. </view>
  33. <view class="contn" v-if="checkPermi(['system:reservat:list'])" @click="handleToYy">
  34. <view class="img">
  35. <image :src="listimgb" class="imgb"></image>
  36. </view>
  37. <view class="ctit">预约管理</view>
  38. </view>
  39. <!-- <view class="contn">
  40. <view class="img">
  41. <image :src="listimgc" class="imgc"></image>
  42. </view>
  43. <view class="ctit">访客管理</view>
  44. </view> -->
  45. </view>
  46. <view class="mbgbox">
  47. <view class="flexc mine_list" @click="handleToMyhy" v-if="checkPermi(['system:order:list'])">
  48. <view class="limg">
  49. <image :src="listimgd" class="imga"></image>
  50. </view>
  51. <view class="tit flex1">我的会议预约</view>
  52. <image :src="rimg" class="rimg"></image>
  53. </view>
  54. <view class="flexc mine_list" @click="handleToMyjc" v-if="checkPermi(['system:food:list'])">
  55. <view class="limg">
  56. <image :src="listimge" class="imgb"></image>
  57. </view>
  58. <view class="tit flex1">我的订餐记录</view>
  59. <image :src="rimg" class="rimg"></image>
  60. </view>
  61. <!-- <view class="flexc mine_list" v-if="checkPermi(['system:reservat:add'])" @click="handleToAddYy" >
  62. <view class="limg">
  63. <image :src="listimgf" class="imgc"></image>
  64. </view>
  65. <view class="tit flex1">访客预约</view>
  66. <image :src="rimg" class="rimg"></image>
  67. </view> -->
  68. <view class="flexc mine_list" @click="handleToSetting">
  69. <view class="limg">
  70. <image :src="listimgg" class="imga"></image>
  71. </view>
  72. <view class="tit flex1">设置</view>
  73. <image :src="rimg" class="rimg"></image>
  74. </view>
  75. <!-- #ifdef APP-PLUS -->
  76. <view class="flexc mine_list"@click="onlineWgt">
  77. <view class="limg">
  78. <image :src="listimgi" class="imga"></image>
  79. </view>
  80. <view class="tit flex1">版本号</view>
  81. <view class="txt">{{wgtcode}}</view>
  82. <image :src="rimg" class="rimg"></image>
  83. </view>
  84. <!-- #endif -->
  85. <view class="flexc mine_list" @click="handleLogout">
  86. <view class="limg">
  87. <image :src="listimgh" class="imgd"></image>
  88. </view>
  89. <view class="tit flex1">退出登录</view>
  90. <image :src="rimg" class="rimg"></image>
  91. </view>
  92. <!-- <view class="flexc mine_list" @click="handleUpassword">
  93. <view class="limg">
  94. <image :src="listimgh" class="imga"></image>
  95. </view>
  96. <view class="tit flex1">修改密码</view>
  97. <image :src="rimg" class="rimg"></image>
  98. </view> -->
  99. </view>
  100. </view>
  101. <view class="ztit">安徽中新云计算有限公司提供支持</view>
  102. <footers v-if="isfootflag" :footerindex="footerindex" :isHomeIndex="false"></footers>
  103. </view>
  104. </template>
  105. <script>
  106. import storage from '@/utils/storage'
  107. import footers from '@/components/footer/footer.vue'
  108. import {findVersion} from "@/api/system/user.js"
  109. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  110. import config from '@/config'
  111. const baseUrl = config.baseUrl
  112. export default {
  113. data() {
  114. return {
  115. bgimg: require("@/static/images/mine/habg.png"),
  116. avatarimg:require("@/static/images/mine/head.png"),
  117. listimga: require('@/static/images/mine/minea.png'),
  118. listimgb: require('@/static/images/mine/mineb.png'),
  119. listimgc: require('@/static/images/mine/minec.png'),
  120. listimgd: require('@/static/images/mine/mined.png'),
  121. listimge: require('@/static/images/mine/minee.png'),
  122. listimgf: require('@/static/images/mine/minef.png'),
  123. listimgg: require('@/static/images/mine/mineg.png'),
  124. listimgh: require('@/static/images/mine/mineh.png'),
  125. listimgi: require('@/static/images/mine/minei.png'),
  126. head:require('@/static/images/mine/head.png'),
  127. // wrimg:require("@/static/images/mine/wrimg.png"),
  128. rimg:require("@/static/images/mine/wrimg.png"),
  129. border: false,
  130. backgroundColor: 'transparent',
  131. name: this.$store.state.user.name,
  132. deptName:this.$store.state.user.deptName,
  133. // version: getApp().globalData.config.appInfo.version,
  134. footerindex: 'mine',
  135. isfootflag: true,
  136. noticenum: 0,
  137. deptId: this.$store.state.user.deptId,
  138. wgtcode: this.$store.state.user.wgtcode,
  139. platform: 'Android',
  140. nvaHeight:44,
  141. }
  142. },
  143. components: {
  144. footers
  145. },
  146. computed: {
  147. avatar() {
  148. return this.$store.state.user.avatar
  149. },
  150. windowHeight() {
  151. return uni.getSystemInfoSync().windowHeight - 50
  152. }
  153. },
  154. onPageScroll(e) {
  155. // var scrollTop = Number(e.scrollTop);
  156. // var listTop=Number(this.listTop)-Number(this.nvaHeight)
  157. // if (scrollTop <=this.nvaHeight) {
  158. // const opacity = scrollTop / 100 // 计算透明度值
  159. // const color = `rgba(29, 100, 226, ${opacity})`
  160. // this.backgroundColor = color // 更新盒子背景颜色
  161. // } else {
  162. // // this.backgroundColor = '#00A9F0'
  163. // }
  164. },
  165. onLoad() {
  166. var that=this;
  167. this.nvaHeight=uni.getSystemInfoSync().statusBarHeight+44;
  168. // #ifdef APP-PLUS
  169. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  170. that.$store.dispatch('SetwgtFn', widgetInfo.version).then(() => {
  171. that.wgtcode=widgetInfo.version
  172. })
  173. });
  174. // #endif
  175. },
  176. mounted() {
  177. // this.getHeightFn()
  178. },
  179. methods: {
  180. checkPermi,checkRole,
  181. getHeightFn(){
  182. let query = uni.createSelectorQuery().in(this);
  183. //需要给黄色区域设置一个id标识,在这里是demo
  184. query.select('.zxbox').boundingClientRect(data => {
  185. var top=data.top<0 ? -data.top : data.top;
  186. this.listTop = data.height//赋值,待会要用
  187. if (top <=this.nvaHeight) {
  188. const opacity = top / 100 // 计算透明度值
  189. const color = `rgba(4, 145, 253, ${opacity})`
  190. this.backgroundColor = color // 更新盒子背景颜色
  191. } else {
  192. this.backgroundColor = '#00A9F0'
  193. }
  194. }).exec();
  195. },
  196. // 待我审批
  197. handleToYy(){
  198. this.$tab.navigateTo("/pages/order/list")
  199. },
  200. //访客预约
  201. handleToAddYy(){
  202. this.$tab.navigateTo("/pages/order/come")
  203. },
  204. //我的会议
  205. handleToMyhy(){
  206. this.$tab.navigateTo("/work/pages/yyorder/meetlist")
  207. },
  208. //我的就餐
  209. handleToMyjc(){
  210. this.$tab.navigateTo("/work/pages/yyorder/eatlist")
  211. },
  212. //我的申报
  213. handleToMysb(){
  214. // this.$tab.navigateTo("/work/pages/business/list?from=my&type=0")
  215. },
  216. // 设置
  217. handleToSetting() {
  218. this.$tab.navigateTo('/pages/mine/setting/index')
  219. },
  220. // 修改密码
  221. handleUpassword(){
  222. this.$tab.navigateTo(`/pages/mine/pwd/index`)
  223. },
  224. // 账号信息
  225. handleToInfo() {
  226. this.$tab.navigateTo('/pages/mine/info/index')
  227. },
  228. handleToLogin() {
  229. this.$tab.reLaunch('/pages/login')
  230. },
  231. handleToAvatar() {
  232. this.$tab.navigateTo('/pages/mine/avatar/index')
  233. },
  234. handleLogout() {
  235. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  236. this.$store.dispatch('LogOut').then(() => {
  237. this.$tab.reLaunch('/pages/index')
  238. })
  239. })
  240. },
  241. onlineWgt() {
  242. let that = this;
  243. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  244. that.$store.dispatch('SetwgtFn', widgetInfo.version).then(() => {
  245. that.wgtcode=widgetInfo.version
  246. })
  247. that.comparisonVersionNo(widgetInfo.versionCode);
  248. });
  249. // that.comparisonVersionNo()
  250. },
  251. comparisonVersionNo(versionCode) {
  252. let that = this;
  253. // console.log("aaaaaaa===versionCode", versionCode);
  254. const parmas = {
  255. model: that.platform
  256. }
  257. findVersion(parmas).then(res => {
  258. if (res.code == "200") {
  259. let versionNos = res.data.code;
  260. console.log(versionNos, 'versionNos')
  261. // console.log(res.data.path);
  262. let filePath = res.data.path;
  263. if (Number(versionNos) > Number(versionCode)) { //服务器返回1更新,0则不更新
  264. uni.showModal({
  265. title: '提示',
  266. content: '发现新版本,是否升级',
  267. success: function(res) {
  268. // console.log(widgetInfo.version);
  269. if (res.confirm) {
  270. console.log('用户点击确定');
  271. that.getProperty(filePath);
  272. } else if (res.cancel) {
  273. console.log('用户点击取消');
  274. }
  275. }
  276. });
  277. } else {
  278. this.$toast('该版本已是最新版')
  279. }
  280. }
  281. }).catch(error => {
  282. uni.hideLoading()
  283. console.log(error)
  284. })
  285. },
  286. getProperty(getProperty) {
  287. // console.log("bbbbbbbbb----------->", getProperty)
  288. let that = this;
  289. // 在线升级app/热更新
  290. that.showwri = true;
  291. const downloadTask = uni.downloadFile({ //下载文件
  292. url: baseUrl + getProperty,
  293. success: (downloadResult) => {
  294. // console.log(downloadResult);
  295. if (downloadResult.statusCode == 200) {
  296. // 更新升级
  297. plus.runtime.install(downloadResult.tempFilePath, {
  298. force: true
  299. }, function() {
  300. // console.log('install success...');
  301. that.showwri = false;
  302. plus.nativeUI.alert("应用资源更新完成!", function() {
  303. plus.runtime.restart();
  304. });
  305. }, function(e) {
  306. that.showwri = false;
  307. plus.nativeUI.alert("更新失败,请稍后再试");
  308. });
  309. }
  310. }
  311. });
  312. downloadTask.onProgressUpdate((res) => { //下载文件的进度
  313. that.totalBytesWritten = res.totalBytesWritten; //当前下载大小
  314. that.progress = res.progress; //当前下载比例
  315. that.totalBytesExpectedToWrite = res.totalBytesExpectedToWrite; //
  316. });
  317. },
  318. }
  319. }
  320. </script>
  321. <style lang="scss">
  322. page{background-color: #ffffff;}
  323. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4;
  324. .topl{width: 274rpx;height: 50rpx;margin-left: 14rpx;}
  325. .topr{width: 36rpx;height: 36rpx;position: relative;margin-right: 10rpx;
  326. image{width: 100%;height: 100%;}
  327. // .cir{background: #FF4747;font-size: 14rpx;color: #FFFFFF;border-radius: 50%;border: 2rpx solid #FFFFFF;min-width: 20rpx;height: 20rpx;
  328. // position: absolute;right: -5rpx;top: -5rpx;text-align: center;line-height: 16rpx;
  329. // }
  330. .cir{width: 14rpx;height: 14rpx;background: #DF0024;border-radius: 50%;position: absolute;right: -7rpx;top: -7rpx;}
  331. }
  332. }
  333. .zxbox{
  334. .bgimg{width: 100%;height: 344rpx;}
  335. .mbox{margin-top: -190rpx;padding: 0 34rpx;z-index: 1;position: relative;
  336. .infobox{margin-bottom: 46rpx;padding: 0 20rpx;
  337. .limg{width: 140rpx;height: 140rpx;flex: 0 0 auto;margin-right: 26rpx;border-radius: 50%;border: 4rpx solid #ffffff;box-sizing: border-box;}
  338. .cbox{flex: 1;z-index: 1;
  339. image{width: 32rpx;height: 38rpx;}
  340. .tit{font-weight: bold;font-size: 40rpx;color: #161616;margin-bottom: 20rpx;}
  341. .txt{font-weight: bold;font-size: 26rpx;color: #8A9AB5;}
  342. }
  343. }
  344. .conts{border-bottom: 2rpx solid #E6E6E6;;box-sizing: border-box;
  345. .contn{padding: 26rpx 0 44rpx;
  346. display: flex;align-items: center;flex: 0 0 auto;width: 33.3%;flex-direction: column;
  347. .img{width: 52rpx;height: 52rpx;display: flex;align-items: center;justify-content: center;margin-bottom: 16rpx;flex: 0 0 auto;
  348. .imga{width: 48rpx;height: 52rpx;}
  349. .imgb{width: 52rpx;height: 46rpx;}
  350. .imgc{width: 50rpx;height: 52rpx;}
  351. }
  352. .ctit{font-weight: bold;font-size: 26rpx;color: #161616;}
  353. }
  354. }
  355. .mbgbox{width: 100%;margin-bottom: 24rpx;padding-top: 32rpx;
  356. .mine_list{
  357. padding: 28rpx 20rpx;
  358. .limg{flex: 0 0 auto;width: 32rpx;height: 30rpx;margin-right: 22rpx;display: flex;align-items: center;justify-content: center;
  359. .imga{width: 30rpx;height: 30rpx;}
  360. .imgb{width: 22rpx;height: 30rpx;}
  361. .imgc{width: 28rpx;height: 30rpx;}
  362. .imgd{width: 32rpx;height: 26rpx;}
  363. }
  364. .tit{font-weight: bold;font-size: 26rpx;color: #161616;}
  365. .txt{font-weight: 500;font-size: 26rpx;color: #666666;margin-left: 20rpx;flex: 0 0 auto;}
  366. .rimg{width: 16rpx;height: 26rpx;margin-left: 20rpx;flex: 0 0 auto;}
  367. }
  368. }
  369. }
  370. }
  371. .ztit{font-size: 24rpx;color:#c6c6c9;text-align: center;flex:0 0 auto;margin-bottom: 28rpx;margin-top: 40rpx;}
  372. </style>