setting.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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: '#008CFF' }"></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. var device = uni.requireNativePlugin("DeviceInfo")
  27. export default{
  28. data(){
  29. return{
  30. }
  31. },
  32. onLoad(){
  33. },
  34. onShow(){
  35. },
  36. methods:{
  37. customBack(){
  38. this.$u.route({
  39. // type:'switchTab',
  40. url: 'pages/index/index'
  41. });
  42. },
  43. openPage(path) {
  44. // console.log('path',path);
  45. this.$u.route({
  46. url: path
  47. });
  48. },
  49. onPrintFeed(){
  50. device.printFeed(10);
  51. },
  52. onLoginOut(){
  53. uni.showModal({
  54. title: '温馨提示',
  55. content: '是否确认退出?',
  56. success: (res) => {
  57. if (res.confirm) {
  58. this.$u.api.loginOut({})
  59. .then(res=>{
  60. uni.showToast({
  61. title: '退出成功',
  62. duration: 2000
  63. });
  64. uni.redirectTo({
  65. url:'../login/login'
  66. });
  67. }).catch(err=>{
  68. });
  69. } else if (res.cancel) {
  70. }
  71. }
  72. })
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. @import './setting.scss'
  79. </style>