index.vue 11 KB

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