RecommendItem.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div style="height: 100%">
  3. <div class="menu-title">
  4. 洞悉({{ gorseQo.userId }})
  5. <div class="icon icon-back" @click="backBtn">
  6. <i title="返回"></i>
  7. </div>
  8. </div>
  9. <div class="block_box" style="margin-top: 0">
  10. <div class="title">推荐</div>
  11. <el-form :inline="true" class="demo-form-inline">
  12. <el-form-item>
  13. <el-select v-model="gorseQo.recommendation" @change="getRecommendItem">
  14. <el-option :key="item.value" :value="item.value" :label="item.label"
  15. v-for="item in recommendList"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item label="categories">
  19. <el-select v-model="gorseQo.category" @change="getRecommendItem">
  20. <el-option value="" label="无"></el-option>
  21. <el-option :key="item.id" :value="item.name" :label="item.name"
  22. v-for="item in categoryList"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. </el-form>
  26. <div class="line-item-box">
  27. <div class="line-item" v-for="item in list" :key="item.id">
  28. <div class="title-time">
  29. <div>{{ item.ItemId }}</div>
  30. <div>{{ item.Timestamp }}</div>
  31. </div>
  32. <div class="description">{{ item.Comment }}</div>
  33. <div class="labels">
  34. <el-tag v-for="la in item.Labels">{{ la }}</el-tag>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import request from '@/utils/request';
  43. var _this;
  44. export default {
  45. name: "RecommendItem",
  46. data() {
  47. return {
  48. qo: "",
  49. gorseQo: {
  50. userId: '',
  51. n: 10,
  52. recommendation: '_',
  53. category: ''
  54. },
  55. user: {},
  56. categoryList: [],
  57. recommendList: [{
  58. label: 'Recommendation',
  59. value: '_'
  60. }, {
  61. label: 'Offline Recommendation',
  62. value: 'offline'
  63. }, {
  64. label: 'Collaborative Recommendation',
  65. value: 'collaborative'
  66. }, {
  67. label: 'Item-based Recommendation',
  68. value: 'item_based'
  69. }, {
  70. label: 'User-based Recommendation',
  71. value: 'user_based'
  72. }],
  73. list: []
  74. }
  75. },
  76. mounted() {
  77. _this = this;
  78. _this.qo = _this.$route.query.qo;
  79. _this.gorseQo.userId = _this.$route.query.userId;
  80. _this.queryCategoryList();
  81. _this.getRecommendItem();
  82. },
  83. methods: {
  84. queryCategoryList() {
  85. request({
  86. url: '/category/query_list',
  87. method: 'post',
  88. data: {}
  89. }).then(res => {
  90. _this.categoryList = res.data;
  91. });
  92. },
  93. getRecommendItem() {
  94. request({
  95. url: '/gorse/get_recommend_by_user',
  96. method: 'post',
  97. data: _this.gorseQo
  98. }).then(res => {
  99. res.data.forEach(row => {
  100. row.labelsArr = row.labels ? row.labels.split(',') : [];
  101. });
  102. _this.list = res.data;
  103. });
  104. },
  105. backBtn() {
  106. this.$router.push({
  107. path: "userManage", query: {
  108. qo: _this.qo
  109. }
  110. });
  111. },
  112. }
  113. }
  114. </script>
  115. <style src="../../../css/back.css" scoped></style>
  116. <style scoped lang="scss">
  117. .block_box {
  118. margin: 25px;
  119. background: #FFFFFF;
  120. border-radius: 3px;
  121. height: calc(100% - 160px);
  122. .title {
  123. border-bottom: 1px solid #ccc;
  124. padding: 15px 25px;
  125. }
  126. }
  127. .demo-form-inline {
  128. padding: 25px 25px 0 25px;
  129. }
  130. .line-item-box {
  131. height: calc(100% - 140px);
  132. overflow-y: auto;
  133. .line-item {
  134. font-size: 14px;
  135. line-height: 32px;
  136. padding: 0 25px 10px 25px;
  137. margin: 20px 0;
  138. border-bottom: 1px solid #dee0e2;
  139. .title-time {
  140. display: flex;
  141. div:first-child {
  142. font-weight: bold;
  143. font-size: 18px;
  144. color: #9da2a8;
  145. }
  146. div:last-child {
  147. margin-left: auto;
  148. color: #bbbcbd;
  149. }
  150. }
  151. .description {
  152. color: #bbbcbd;
  153. }
  154. .labels {
  155. color: #9da2a8;
  156. .el-tag {
  157. margin: 0 10px 10px 0;
  158. }
  159. }
  160. }
  161. }
  162. </style>