index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-message ref="toast"></tm-message>
  5. <tm-menubars title="我的" :shadow="0" :showback="false"></tm-menubars>
  6. <tm-button theme="light-green" @click="show=true">退出</tm-button>
  7. <tm-button theme="light-green">上传图片</tm-button>
  8. <tm-button theme="light-green" @click="chuangjian()">创建家庭</tm-button>
  9. <tm-dialog v-model="show" content="确认退出系统?" @confirm="queren"></tm-dialog>
  10. </view>
  11. </template>
  12. <script>
  13. import{myRequest} from '@/api/request.js'
  14. export default {
  15. data() {
  16. return {
  17. show:false
  18. };
  19. },
  20. onLoad() {
  21. console.log(this.$store.state)
  22. },
  23. created() {
  24. this.sys = uni.getSystemInfoSync();
  25. console.log(this.$store.state)
  26. },
  27. methods: {
  28. chuangjian(){
  29. uni.navigateTo({
  30. url: "/pages/chuanghome/index",
  31. })
  32. },
  33. queren(){
  34. var that=this;
  35. if(uni.getStorageSync("token")==""){
  36. uni.redirectTo({
  37. url:"/pages/login/index"
  38. })
  39. return
  40. }
  41. myRequest({
  42. url: "/api/Logout/logout",
  43. method:'get',
  44. data:{}
  45. }).then(res => {
  46. uni.setStorageSync("token","")
  47. uni.redirectTo({
  48. url:"/pages/login/index"
  49. })
  50. })
  51. }
  52. },
  53. }
  54. </script>
  55. <style lang="scss">
  56. /deep/ .tm-menubars .body{
  57. background-color: #1b1b1b !important;
  58. }
  59. </style>