index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <view class="mine-container" >
  3. <!--顶部个人信息栏-->
  4. <view class="home_top">
  5. <uni-nav-bar title="我的" :background-color="backgroundColor" :border="navborder" statusBar='true' fixed="true">
  6. <!-- checkPermi(['system:notice:list']) -->
  7. <!-- <block slot="left" >
  8. <view class="min_top" @click="getMessage">
  9. <image :src="noticimg"></image>
  10. <view class="circ"></view>
  11. </view>
  12. </block> -->
  13. </uni-nav-bar>
  14. </view>
  15. <image :src="abg" class="abg"></image>
  16. <view style="margin-top: -487rpx;position: relative;padding:0 34rpx 20rpx;">
  17. <view class="header_top flexc mb6" @click="handleToinfo">
  18. <image v-if="avatar" @click.stop="handleToAvatar" :src="avatar" class="flex0 limg" mode="aspectFill"></image>
  19. <image v-else @click.stop="handleToAvatar" :src="avatarimg" class="flex0 limg" mode="aspectFill"></image>
  20. <view class="flex1 hcen">
  21. <view class="f17 fw c16 mb8 flexc">{{name}}
  22. <!-- <text v-if="choseroles=='teacher'">老师</text>
  23. <text v-if="choseroles=='school'">学校管理员</text>
  24. <text v-if="choseroles=='parents'">家长</text> -->
  25. </view>
  26. <!-- <view class="f15 co6" v-if="choseroles=='teacher'">{{schoolName}}/{{discipline}}</view>
  27. <view class="f15 co6" v-else-if="choseroles!='parents'" >{{schoolName}}</view> -->
  28. </view>
  29. <image :src="rimg" class="flex0 rimg"></image>
  30. </view>
  31. <view class="mnbox">
  32. <view class="mn_tit">账号设置</view>
  33. <view class="mn_list">
  34. <view class="mlist flexc" @click="handleUpassword">
  35. <view class="mlistl"><image :src="miconj" class="imgh"></image></view>
  36. <view class="mlistc">修改密码</view>
  37. </view>
  38. <view class="mlist flexc" @click="handlePrivacy">
  39. <view class="mlistl"><image :src="miconf" class="imgd"></image></view>
  40. <view class="mlistc">用户协议</view>
  41. </view>
  42. <view class="mlist flexc" @click="onlineWgt">
  43. <view class="mlistl"><image :src="micong" class="imgg"></image></view>
  44. <view class="mlistc">版本更新</view>
  45. </view>
  46. <view class="mlist flexc" @click="handleLogout">
  47. <view class="mlistl"><image :src="miconl" class="imgc"></image></view>
  48. <view class="mlistc">退出登录</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <footers v-if="isfootflag" :footlist="footlist" :footerindex="footerindex" :color_checked="color_checked" :color_nochecked="color_nochecked" :isHomeIndex="true"></footers>
  54. </view>
  55. </template>
  56. <script>
  57. import footers from '@/components/footer/footer.vue'
  58. import config from '@/config'
  59. const baseUrl = config.baseUrl
  60. import storage from '@/utils/storage'
  61. import {findVersion} from "@/api/system/user.js"
  62. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  63. import {getInfo } from '@/api/login'
  64. export default {
  65. components:{footers},
  66. data() {
  67. return {
  68. footlist:[
  69. {module:'home',title:'潜山政协',icon_checked:require('@/static/images/tabbar/home_.png'),icon_nochecked:require('@/static/images/tabbar/home.png')},
  70. {module:'report',title:'履职报告',icon_checked:require('@/static/images/tabbar/report_.png'),icon_nochecked:require('@/static/images/tabbar/report.png')},
  71. {module:'notice',title:'会议通知',icon_checked:require('@/static/images/tabbar/notice_.png'),icon_nochecked:require('@/static/images/tabbar/notice.png')},
  72. {module:'mine',title:'个人中心',icon_checked:require('@/static/images/tabbar/mine_.png'),icon_nochecked:require('@/static/images/tabbar/mine.png')},
  73. ],
  74. color_checked :'222327',
  75. color_nochecked :'AAAAAA',
  76. footerindex:'mine',
  77. isfootflag:true,
  78. abg:require('@/static/images/mine/habg.png'),
  79. noticimg:require('@/static/images/mine/mnotic.png'),
  80. rimg:require('@/static/images/mine/rimg.png'),
  81. wrimg:require('@/static/images/mine/wrimg.png'),
  82. miconf:require('@/static/images/mine/miconf.png'),
  83. miconj:require('@/static/images/mine/miconj.png'),
  84. miconl:require('@/static/images/mine/miconl.png'),
  85. micong:require('@/static/images/mine/micong.png'),
  86. type:0,
  87. confdat:{tit:'系统提示',txt:"确定注销并退出系统吗?",closetxt:'取消',suretxt:'确认'},
  88. backgroundColor:"transparent",
  89. navborder:false,
  90. timetit:'',
  91. timelist:[],
  92. timetype:'',
  93. discipline:'',
  94. schoolName:'',
  95. schoolId:'',
  96. classId:'',
  97. teacherClass:[],
  98. roles:'',
  99. baseUrl:'',
  100. name: this.$store.state.user.name,
  101. avatarimg:require("@/static/images/mine/profile.png"),
  102. platform:'Android',
  103. // version: getApp().globalData.config.appInfo.version
  104. }
  105. },
  106. computed: {
  107. avatar() {
  108. return this.$store.state.user.avatar
  109. },
  110. choseroles() {
  111. return this.$store.state.user.choseroles
  112. },
  113. windowHeight() {
  114. return uni.getSystemInfoSync().windowHeight - 50
  115. }
  116. },
  117. onShow() {
  118. },
  119. onLoad() {
  120. this.baseUrl=baseUrl;
  121. },
  122. onPageScroll(e) {
  123. var scrollTop=Number(e.scrollTop);
  124. if(scrollTop>0){
  125. this.backgroundColor='#c4defb'
  126. }else{
  127. this.backgroundColor='transparent'
  128. }
  129. },
  130. methods: {
  131. checkPermi, checkRole,
  132. onlineWgt() {
  133. let that = this;
  134. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  135. that.$store.dispatch('SetwgtFn',widgetInfo.version).then(()=>{
  136. })
  137. that.comparisonVersionNo(widgetInfo.versionCode);
  138. });
  139. // that.comparisonVersionNo()
  140. },
  141. comparisonVersionNo(versionCode) {
  142. let that = this;
  143. // console.log("aaaaaaa===versionCode", versionCode);
  144. const parmas = {
  145. model: that.platform
  146. }
  147. console.log(parmas)
  148. findVersion(parmas).then(res => {
  149. console.log(res,2)
  150. if (res.code == "200") {
  151. let versionNos = res.data.code;
  152. console.log(versionNos,'versionNos')
  153. // console.log(res.data.path);
  154. let filePath = res.data.path;
  155. if (versionNos != versionCode) { //服务器返回1更新,0则不更新
  156. uni.showModal({
  157. title: '提示',
  158. content: '发现新版本,是否升级',
  159. success: function(res) {
  160. // console.log(widgetInfo.version);
  161. if (res.confirm) {
  162. console.log('用户点击确定');
  163. that.getProperty(filePath);
  164. } else if (res.cancel) {
  165. console.log('用户点击取消');
  166. }
  167. }
  168. });
  169. }else{
  170. this.$toast('该版本已是最新版')
  171. }
  172. }
  173. }).catch(error=>{
  174. uni.hideLoading()
  175. console.log(error)
  176. })
  177. },
  178. getProperty(getProperty) {
  179. // console.log("bbbbbbbbb----------->", getProperty)
  180. let that = this;
  181. // 在线升级app/热更新
  182. that.showwri = true;
  183. const downloadTask = uni.downloadFile({ //下载文件
  184. url: baseUrl + getProperty,
  185. success: (downloadResult) => {
  186. // console.log(downloadResult);
  187. if (downloadResult.statusCode == 200) {
  188. // 更新升级
  189. plus.runtime.install(downloadResult.tempFilePath, {
  190. force: true
  191. }, function() {
  192. // console.log('install success...');
  193. that.showwri = false;
  194. plus.nativeUI.alert("应用资源更新完成!", function() {
  195. plus.runtime.restart();
  196. });
  197. }, function(e) {
  198. that.showwri = false;
  199. plus.nativeUI.alert("更新失败,请稍后再试");
  200. });
  201. }
  202. }
  203. });
  204. downloadTask.onProgressUpdate((res) => { //下载文件的进度
  205. that.totalBytesWritten = res.totalBytesWritten; //当前下载大小
  206. that.progress = res.progress; //当前下载比例
  207. that.totalBytesExpectedToWrite = res.totalBytesExpectedToWrite; //
  208. });
  209. },
  210. getConfirm(){
  211. this.$store.dispatch('LogOut').then(() => {
  212. this.$tab.reLaunch('/pages/index/index')
  213. })
  214. },
  215. handlePrivacy(){
  216. this.$tab.navigateTo(`/pages/agreement`)
  217. },
  218. handleUpassword(){
  219. this.$tab.navigateTo(`/pages/mine/pwd/index`)
  220. },
  221. handleToAvatar() {
  222. this.$tab.navigateTo('/pages/mine/avatar/index')
  223. },
  224. handleToinfo() {
  225. this.$tab.navigateTo('/pages/mine/info/index')
  226. },
  227. handleLogout() {
  228. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  229. this.$store.dispatch('LogOut').then(() => {
  230. this.$tab.reLaunch('/pages/index/index')
  231. })
  232. })
  233. },
  234. }
  235. }
  236. </script>
  237. <style lang="scss">
  238. page {
  239. background-color: #f5f6f7;
  240. }
  241. .home_top /deep/ .uni-navbar__placeholder{height: 0 !important;}
  242. .abg{width: 100%;height: 622rpx;}
  243. .min_top{position: relative;width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;
  244. image{width: 32rpx;height: 32rpx;}
  245. .circ{width: 12rpx;height: 12rpx;background: #EB5663;border-radius: 50%;position: absolute;right: 4rpx;top: 4rpx;}
  246. }
  247. .header_top{padding: 34rpx 26rpx;
  248. .limg{width: 120rpx;height: 120rpx;border-radius: 50%;margin-right: 26rpx;}
  249. .rimg{width: 14rpx;height: 24rpx;margin-left: 26rpx;}
  250. .hcen{
  251. text{height: 34rpx;background: #89A8F6;border-radius: 16rpx;line-height: 34rpx;font-weight: normal;font-size: 24rpx;color: #ffffff;display: inline-block;min-width: 78rpx;padding: 0 10rpx;box-sizing: border-box;margin-left: 24rpx;}
  252. }
  253. }
  254. .bgf{
  255. .mlist{padding:30rpx 34rpx;
  256. .mlistl{width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;margin-right: 16rpx;
  257. .imga{width: 38rpx;height: 38rpx;}
  258. .imgb{width: 32rpx;height: 32rpx;}
  259. .imgc{width: 30rpx;height: 30rpx;}
  260. .imgd{width: 32rpx;height: 34rpx;}
  261. .imge{width: 32rpx;height: 26rpx;}
  262. .imgf{width: 32rpx;height: 30rpx;}
  263. .imgg{width: 34rpx;height: 34rpx;}
  264. .imgi{width: 34rpx;height: 34rpx;}
  265. .imgk{width: 32rpx;height: 30rpx;}
  266. }
  267. .mlistc{flex: 1;font-size: 32rpx;font-weight: 500;
  268. color: #161616;}
  269. .mlistr{width: 14rpx;height: 24rpx;marign-left:16rpx}
  270. }
  271. }
  272. .mnbox{
  273. background: #FFFFFF;border-radius: 18rpx;margin-bottom: 24rpx;padding: 40rpx 0 16rpx;
  274. .mn_tit{font-size: 32rpx;font-weight: bold;
  275. color: #161616;padding-left: 68rpx;position: relative;margin-bottom: 12rpx;
  276. &::before{width: 6rpx;background: $com-cd3;border-radius: 4rpx;position: absolute;left: 36rpx;top: 4rpx;content: '';bottom: 4rpx;}
  277. }
  278. .mn_list{display: flex;flex-wrap: wrap;
  279. .mlist{width: 25%;box-sizing: border-box;display: flex;flex-direction: column;align-items: center;padding: 26rpx 0;
  280. .mlistl{width: 50rpx;height: 50rpx;display: flex;align-items: center;justify-content: center;margin-bottom: 16rpx;
  281. .imga{width: 42rpx;height: 44rpx;}
  282. .imgb{width: 44rpx;height: 44rpx;}
  283. .imgc{width: 44rpx;height: 42rpx;}
  284. .imgd{width: 42rpx;height: 44rpx;}
  285. .imge{width: 44rpx;height: 42rpx;}
  286. .imgf{width: 32rpx;height: 30rpx;}
  287. .imgg{width: 44rpx;height: 44rpx;}
  288. .imgh{width: 40rpx;height: 44rpx;}
  289. .imgk{width: 40rpx;height: 42rpx;}
  290. }
  291. .mlistc{flex: 1;font-size: 30rpx;font-weight: 500;color: #666666;}
  292. }
  293. }
  294. }
  295. .mine-container {
  296. width: 100%;
  297. height: 100%;
  298. .header-section {
  299. padding: 15px 15px 45px 15px;
  300. color: white;
  301. .login-tip {
  302. font-size: 18px;
  303. margin-left: 10px;
  304. }
  305. .cu-avatar {
  306. border: 2px solid #eaeaea;
  307. .icon {
  308. font-size: 40px;
  309. }
  310. }
  311. .user-info {
  312. margin-left: 15px;
  313. .u_title {
  314. font-size: 18px;
  315. line-height: 30px;
  316. }
  317. }
  318. }
  319. .content-section {
  320. position: relative;
  321. top: -50px;
  322. .mine-actions {
  323. margin: 15px 15px;
  324. padding: 20px 0px;
  325. border-radius: 8px;
  326. background-color: white;
  327. .action-item {
  328. .icon {
  329. font-size: 28px;
  330. }
  331. .text {
  332. display: block;
  333. font-size: 13px;
  334. margin: 8px 0px;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. </style>