setting.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view>
  3. <u-navbar
  4. title="设置"
  5. title-color="#fff"
  6. :custom-back="customBack"
  7. :border-bottom="false"
  8. back-icon-color="#CCE8FF"
  9. :background="{background: 'linear-gradient(145deg, #41AFF9 0%, #2D8CFB 100%)' }"></u-navbar>
  10. <view class="cell-group" style="margin-top: 30rpx;">
  11. <u-cell-group>
  12. <u-cell-item title="修改密码" @click="openPage('pages/modifypwd/modifypwd')">
  13. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
  14. </u-cell-item>
  15. <u-cell-item title="打印走纸" @click="onPrintFeed()">
  16. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
  17. </u-cell-item>
  18. <u-cell-item title="退出登录" @click="onLoginOut()">
  19. <u-icon slot="icon" custom-prefix="custom-icon" size="35" name="wodecheliang"></u-icon>
  20. </u-cell-item>
  21. </u-cell-group>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. //#ifdef APP-PLUS
  27. var device = uni.requireNativePlugin("DeviceInfo")
  28. //#endif
  29. export default{
  30. data(){
  31. return{
  32. }
  33. },
  34. onLoad(){
  35. },
  36. onShow(){
  37. },
  38. methods:{
  39. customBack(){
  40. this.$u.route({
  41. // type:'switchTab',
  42. url: 'pages/index/index'
  43. });
  44. },
  45. openPage(path) {
  46. // console.log('path',path);
  47. this.$u.route({
  48. url: path
  49. });
  50. },
  51. onPrintFeed(){
  52. //#ifdef APP-PLUS
  53. device.printFeed(10);
  54. //#endif
  55. //#ifdef H5
  56. uni.showToast({
  57. title: '非APP环境',
  58. duration: 2000
  59. });
  60. //#endif
  61. },
  62. onLoginOut(){
  63. uni.showModal({
  64. title: '温馨提示',
  65. content: '是否确认退出?',
  66. success: (res) => {
  67. if (res.confirm) {
  68. this.$u.api.loginOut({})
  69. .then(res=>{
  70. uni.showToast({
  71. title: '退出成功',
  72. duration: 2000
  73. });
  74. uni.redirectTo({
  75. url:'../login/login'
  76. });
  77. }).catch(err=>{
  78. });
  79. } else if (res.cancel) {
  80. }
  81. }
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. @import './setting.scss'
  89. </style>