channel.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view>
  3. <!-- 顶部导航 -->
  4. <fa-navbar title="选择栏目"></fa-navbar>
  5. <view class="u-p-30">
  6. <u-form>
  7. <u-form-item label-position="left" label="栏目:" label-width="130">
  8. <fa-selects
  9. :fa-list="selectList"
  10. title="请选择栏目"
  11. checkeType="select"
  12. :showValue="channel_id"
  13. v-model="channel_id"
  14. ></fa-selects>
  15. </u-form-item>
  16. </u-form>
  17. </view>
  18. <view class="u-p-30 u-m-t-80">
  19. <u-button type="primary" hover-class="none" :custom-style="{ backgroundColor: theme.bgColor, color: theme.color }" shape="circle" @click="next">
  20. 下一步
  21. </u-button>
  22. </view>
  23. <!-- 底部导航 -->
  24. <fa-tabbar></fa-tabbar>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. onLoad(e) {
  30. let query = this.$Route.query || e || {};
  31. this.archives_id = query.archives_id || 0;
  32. this.getChannel();
  33. },
  34. data() {
  35. return {
  36. selectShow: false,
  37. archives_id: 0,
  38. channel_id: '',
  39. selectList: []
  40. };
  41. },
  42. watch: {
  43. channel_id(newValue, oldValue) {
  44. this.$u.vuex('vuex_channel_id',newValue);
  45. }
  46. },
  47. methods: {
  48. getChannel: async function() {
  49. let res = await this.$api.getChannel({ archives_id: this.archives_id });
  50. if (res.code) {
  51. this.selectList = res.data.channel;
  52. //编辑的时候赋值
  53. if (res.data.channel_id && this.archives_id) {
  54. this.selectList.some(item => {
  55. if (item.id == res.data.channel_id) {
  56. this.channel_id = res.data.channel_id;
  57. return true;
  58. }
  59. });
  60. }
  61. }
  62. },
  63. next() {
  64. if (!this.channel_id) {
  65. this.$u.toast('请先选择栏目!');
  66. return;
  67. }
  68. this.$Router.push({
  69. path: '/pages/publish/publish',
  70. query: { archives_id: this.archives_id }
  71. });
  72. }
  73. }
  74. };
  75. </script>
  76. <style lang="scss">
  77. page {
  78. background-color: #ffffff;
  79. }
  80. .richColor {
  81. color: #909399;
  82. }
  83. </style>