index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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" :footerindex="footerindex"></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. footerindex:'mine',
  69. isfootflag:true,
  70. abg:require('@/static/images/mine/habg.png'),
  71. noticimg:require('@/static/images/mine/mnotic.png'),
  72. rimg:require('@/static/images/mine/rimg.png'),
  73. wrimg:require('@/static/images/mine/wrimg.png'),
  74. miconf:require('@/static/images/mine/miconf.png'),
  75. miconj:require('@/static/images/mine/miconj.png'),
  76. miconl:require('@/static/images/mine/miconl.png'),
  77. micong:require('@/static/images/mine/micong.png'),
  78. type:0,
  79. confdat:{tit:'系统提示',txt:"确定注销并退出系统吗?",closetxt:'取消',suretxt:'确认'},
  80. backgroundColor:"transparent",
  81. navborder:false,
  82. timetit:'',
  83. timelist:[],
  84. timetype:'',
  85. discipline:'',
  86. schoolName:'',
  87. schoolId:'',
  88. classId:'',
  89. teacherClass:[],
  90. roles:'',
  91. baseUrl:'',
  92. name: this.$store.state.user.name,
  93. avatarimg:require("@/static/images/mine/profile.png"),
  94. platform:'Android',
  95. // version: getApp().globalData.config.appInfo.version
  96. }
  97. },
  98. computed: {
  99. avatar() {
  100. return this.$store.state.user.avatar
  101. },
  102. choseroles() {
  103. return this.$store.state.user.choseroles
  104. },
  105. windowHeight() {
  106. return uni.getSystemInfoSync().windowHeight - 50
  107. }
  108. },
  109. onShow() {
  110. },
  111. onLoad() {
  112. this.baseUrl=baseUrl;
  113. },
  114. onPageScroll(e) {
  115. var scrollTop=Number(e.scrollTop);
  116. if(scrollTop>0){
  117. this.backgroundColor='#c4defb'
  118. }else{
  119. this.backgroundColor='transparent'
  120. }
  121. },
  122. methods: {
  123. checkPermi, checkRole,
  124. onlineWgt() {
  125. let that = this;
  126. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  127. that.$store.dispatch('SetwgtFn',widgetInfo.version).then(()=>{
  128. })
  129. that.comparisonVersionNo(widgetInfo.versionCode);
  130. });
  131. // that.comparisonVersionNo()
  132. },
  133. comparisonVersionNo(versionCode) {
  134. let that = this;
  135. // console.log("aaaaaaa===versionCode", versionCode);
  136. const parmas = {
  137. model: that.platform
  138. }
  139. console.log(parmas)
  140. findVersion(parmas).then(res => {
  141. console.log(res,2)
  142. if (res.code == "200") {
  143. let versionNos = res.data.code;
  144. console.log(versionNos,'versionNos')
  145. // console.log(res.data.path);
  146. let filePath = res.data.path;
  147. if (versionNos != versionCode) { //服务器返回1更新,0则不更新
  148. uni.showModal({
  149. title: '提示',
  150. content: '发现新版本,是否升级',
  151. success: function(res) {
  152. // console.log(widgetInfo.version);
  153. if (res.confirm) {
  154. console.log('用户点击确定');
  155. that.getProperty(filePath);
  156. } else if (res.cancel) {
  157. console.log('用户点击取消');
  158. }
  159. }
  160. });
  161. }else{
  162. this.$toast('该版本已是最新版')
  163. }
  164. }
  165. }).catch(error=>{
  166. uni.hideLoading()
  167. console.log(error)
  168. })
  169. },
  170. getProperty(getProperty) {
  171. // console.log("bbbbbbbbb----------->", getProperty)
  172. let that = this;
  173. // 在线升级app/热更新
  174. that.showwri = true;
  175. const downloadTask = uni.downloadFile({ //下载文件
  176. url: baseUrl + getProperty,
  177. success: (downloadResult) => {
  178. // console.log(downloadResult);
  179. if (downloadResult.statusCode == 200) {
  180. // 更新升级
  181. plus.runtime.install(downloadResult.tempFilePath, {
  182. force: true
  183. }, function() {
  184. // console.log('install success...');
  185. that.showwri = false;
  186. plus.nativeUI.alert("应用资源更新完成!", function() {
  187. plus.runtime.restart();
  188. });
  189. }, function(e) {
  190. that.showwri = false;
  191. plus.nativeUI.alert("更新失败,请稍后再试");
  192. });
  193. }
  194. }
  195. });
  196. downloadTask.onProgressUpdate((res) => { //下载文件的进度
  197. that.totalBytesWritten = res.totalBytesWritten; //当前下载大小
  198. that.progress = res.progress; //当前下载比例
  199. that.totalBytesExpectedToWrite = res.totalBytesExpectedToWrite; //
  200. });
  201. },
  202. getConfirm(){
  203. this.$store.dispatch('LogOut').then(() => {
  204. this.$tab.reLaunch('/pages/index/index')
  205. })
  206. },
  207. handlePrivacy(){
  208. this.$tab.navigateTo(`/pages/agreement`)
  209. },
  210. handleUpassword(){
  211. this.$tab.navigateTo(`/pages/mine/pwd/index`)
  212. },
  213. handleToAvatar() {
  214. this.$tab.navigateTo('/pages/mine/avatar/index')
  215. },
  216. handleToinfo() {
  217. this.$tab.navigateTo('/pages/mine/info/index')
  218. },
  219. handleLogout() {
  220. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  221. this.$store.dispatch('LogOut').then(() => {
  222. this.$tab.reLaunch('/pages/index/index')
  223. })
  224. })
  225. },
  226. }
  227. }
  228. </script>
  229. <style lang="scss">
  230. page {
  231. background-color: #f5f6f7;
  232. }
  233. .home_top /deep/ .uni-navbar__placeholder{height: 0 !important;}
  234. .abg{width: 100%;height: 622rpx;}
  235. .min_top{position: relative;width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;
  236. image{width: 32rpx;height: 32rpx;}
  237. .circ{width: 12rpx;height: 12rpx;background: #EB5663;border-radius: 50%;position: absolute;right: 4rpx;top: 4rpx;}
  238. }
  239. .header_top{padding: 34rpx 26rpx;
  240. .limg{width: 120rpx;height: 120rpx;border-radius: 50%;margin-right: 26rpx;}
  241. .rimg{width: 14rpx;height: 24rpx;margin-left: 26rpx;}
  242. .hcen{
  243. 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;}
  244. }
  245. }
  246. .bgf{
  247. .mlist{padding:30rpx 34rpx;
  248. .mlistl{width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;margin-right: 16rpx;
  249. .imga{width: 38rpx;height: 38rpx;}
  250. .imgb{width: 32rpx;height: 32rpx;}
  251. .imgc{width: 30rpx;height: 30rpx;}
  252. .imgd{width: 32rpx;height: 34rpx;}
  253. .imge{width: 32rpx;height: 26rpx;}
  254. .imgf{width: 32rpx;height: 30rpx;}
  255. .imgg{width: 34rpx;height: 34rpx;}
  256. .imgi{width: 34rpx;height: 34rpx;}
  257. .imgk{width: 32rpx;height: 30rpx;}
  258. }
  259. .mlistc{flex: 1;font-size: 32rpx;font-weight: 500;
  260. color: #161616;}
  261. .mlistr{width: 14rpx;height: 24rpx;marign-left:16rpx}
  262. }
  263. }
  264. .mnbox{
  265. background: #FFFFFF;border-radius: 18rpx;margin-bottom: 24rpx;padding: 40rpx 0 16rpx;
  266. .mn_tit{font-size: 32rpx;font-weight: bold;
  267. color: #161616;padding-left: 68rpx;position: relative;margin-bottom: 12rpx;
  268. &::before{width: 6rpx;background: $com-cd3;border-radius: 4rpx;position: absolute;left: 36rpx;top: 4rpx;content: '';bottom: 4rpx;}
  269. }
  270. .mn_list{display: flex;flex-wrap: wrap;
  271. .mlist{width: 25%;box-sizing: border-box;display: flex;flex-direction: column;align-items: center;padding: 26rpx 0;
  272. .mlistl{width: 50rpx;height: 50rpx;display: flex;align-items: center;justify-content: center;margin-bottom: 16rpx;
  273. .imga{width: 42rpx;height: 44rpx;}
  274. .imgb{width: 44rpx;height: 44rpx;}
  275. .imgc{width: 44rpx;height: 42rpx;}
  276. .imgd{width: 42rpx;height: 44rpx;}
  277. .imge{width: 44rpx;height: 42rpx;}
  278. .imgf{width: 32rpx;height: 30rpx;}
  279. .imgg{width: 44rpx;height: 44rpx;}
  280. .imgh{width: 40rpx;height: 44rpx;}
  281. .imgk{width: 40rpx;height: 42rpx;}
  282. }
  283. .mlistc{flex: 1;font-size: 30rpx;font-weight: 500;color: #666666;}
  284. }
  285. }
  286. }
  287. .mine-container {
  288. width: 100%;
  289. height: 100%;
  290. .header-section {
  291. padding: 15px 15px 45px 15px;
  292. color: white;
  293. .login-tip {
  294. font-size: 18px;
  295. margin-left: 10px;
  296. }
  297. .cu-avatar {
  298. border: 2px solid #eaeaea;
  299. .icon {
  300. font-size: 40px;
  301. }
  302. }
  303. .user-info {
  304. margin-left: 15px;
  305. .u_title {
  306. font-size: 18px;
  307. line-height: 30px;
  308. }
  309. }
  310. }
  311. .content-section {
  312. position: relative;
  313. top: -50px;
  314. .mine-actions {
  315. margin: 15px 15px;
  316. padding: 20px 0px;
  317. border-radius: 8px;
  318. background-color: white;
  319. .action-item {
  320. .icon {
  321. font-size: 28px;
  322. }
  323. .text {
  324. display: block;
  325. font-size: 13px;
  326. margin: 8px 0px;
  327. }
  328. }
  329. }
  330. }
  331. }
  332. </style>