index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  3. <tm-menubars title="" :shadow="0" :showback="false"></tm-menubars>
  4. <view class="C1b1b1b pb-20">
  5. <view style="width: 90%;margin:0 auto;">
  6. <view>
  7. <tm-search @confirm="sosoFun" class="fl" v-model="soso" color="white" confirm-text=""></tm-search>
  8. <text class="quxiao fr" @click="goindex()">取消</text>
  9. </view>
  10. <view style="clear: both;"></view>
  11. <view v-if="sosotype==1">
  12. <text class="text-size-m fl mt-30">搜索记录</text>
  13. <view class="fr mt-30 qingchu" @click="qingkong" v-if="libiaoList.length !=0">
  14. <text class="text-size-s fl">清空记录</text>
  15. <tm-badges :offset="[0,-5]" icon="icon-times"></tm-badges>
  16. </view>
  17. </view>
  18. <view v-if="sosotype==2">
  19. <tm-tabs align="left" @change="yiji" class="qiehuan1" v-model="activeIndex" :list="list" range-key="title"></tm-tabs>
  20. <!-- <tm-tabs align="left" class="qiehuan2" color="white" v-model="activeIndex1" :list="list1" range-key="title"></tm-tabs> -->
  21. </view>
  22. <view style="clear: both;"></view>
  23. </view>
  24. </view>
  25. <!-- 列表 -->
  26. <tm-grouplist class="liebiao mt-40" v-if="sosotype==1 && libiaoList.length !=0">
  27. <tm-listitem v-for="item in libiaoList" @click="tiaozhuan(item.type)" :title="item.name" left-icon="" show-left-icon :show-right-icon="false">
  28. </tm-listitem>
  29. </tm-grouplist>
  30. <tm-empty v-if="sosotype==1 && libiaoList.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
  31. <!-- 衣橱 -->
  32. <view class="zhuti">
  33. <tm-sheet class="yichu" v-if="sosotype==2" style="margin-bottom: 70px !important;">
  34. <view class="jihua">
  35. <view v-for="(item,index) in listdata" class="round-3 fl shadow-2 overflow pa-10 jihuaview" :class="[$tm.vx.state().tmVuetify.black ? 'black' : 'white']">
  36. <image class="logo" :src="item.image" mode="widthFix"></image>
  37. <view class="pa-10 text-size-s">
  38. <view class="text-overflow-2">
  39. <text>{{item.text}}</text>
  40. </view>
  41. <view class="mt-2 flex-between flex-center">
  42. <view class="touxiang mt-30">
  43. <image src="/static/img/7.png" mode="widthFix"></image>
  44. <text class="text-white text-size-m">可樂crys</text>
  45. </view>
  46. <view >
  47. <image class="remenzan" :src="dianzan1?'/static/img/29.png':'/static/img/9.png'" mode="widthFix"></image>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view style="clear: both;" class="more mt-40 pb-40 pt-40" @click="gengmore()" v-if="listdata.length !=0">
  54. <image src="/static/img/30.png" mode="widthFix"></image>
  55. <text class="text-size-s">下拉加载更多~</text>
  56. </view>
  57. </tm-sheet>
  58. <tm-empty v-if="sosotype==2 && listdata.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
  59. </view>
  60. <!-- 弹出层消息 -->
  61. <tm-message ref="toast"></tm-message>
  62. </view>
  63. </template>
  64. <script>
  65. import{myRequest} from '@/api/request.js'
  66. export default {
  67. data() {
  68. return {
  69. soso:'',
  70. libiaoList:[],
  71. sosotype:1,
  72. list:[ '全部','搭配','衣橱'],
  73. activeIndex:0,
  74. activeIndex1:0,
  75. list1:[ '综合','高级感','黑色','灰色'],
  76. listdata:[],
  77. dianzan1:true,
  78. sys:null
  79. };
  80. },
  81. onLoad() {
  82. },
  83. created() {
  84. this.sys = uni.getSystemInfoSync();
  85. // this.randouh()
  86. this.getlishi()
  87. },
  88. methods: {
  89. yiji(e){
  90. this.activeIndex=e;
  91. this.sosoFun()
  92. },
  93. getlishi(){
  94. var that=this;
  95. myRequest({
  96. url: "/api/SearchHistory/searchList",
  97. method:'get',
  98. data:{}
  99. }).then(res => {
  100. if (res.data.code == 200) {
  101. that.libiaoList=res.data.data;
  102. }else{
  103. }
  104. })
  105. },
  106. qingkong(){
  107. var that=this;
  108. myRequest({
  109. url: "/api/SearchHistory/deleteSearch",
  110. method:'get',
  111. data:{}
  112. }).then(res => {
  113. if (res.data.code == 200) {
  114. that.getlishi();
  115. that.$refs.toast.show({model:'success',label:res.data.msg})
  116. }else{
  117. }
  118. })
  119. },
  120. gengmore(){
  121. this.randouh()
  122. },
  123. goindex(){
  124. uni.navigateBack();
  125. },
  126. sosoFun(){
  127. console.log(this.soso)
  128. var that=this;
  129. myRequest({
  130. url: "/api/Collocation/search",
  131. method:'post',
  132. data:{search:that.soso,type:that.activeIndex}
  133. }).then(res => {
  134. if (res.data.code == 200) {
  135. that.listdata=res.data.data;
  136. }else{
  137. that.listdata=[];
  138. }
  139. })
  140. this.sosotype=2
  141. },
  142. randouh(){
  143. let list2 = [],that=this;
  144. for(let i=0;i<4;i++){
  145. list2.push({
  146. image:'../../static/img/25.png',
  147. text:'西装穿搭 | 韩系又A又飒休闲西装 高级感'
  148. })
  149. }
  150. this.listdata=this.listdata.concat(list2)
  151. console.log(this.listdata)
  152. },
  153. },
  154. }
  155. </script>
  156. <style lang="scss">
  157. /deep/ .tm-menubars .body{
  158. background-color: #1b1b1b !important;
  159. }
  160. /deep/ .icon-search{
  161. font-size: 23px !important;
  162. color: #8E8E93 !important;
  163. }
  164. /deep/ .tm-search{
  165. width: 86%;
  166. margin: 0 auto;
  167. background-color: #414141 !important;
  168. border-radius: 10px;
  169. }
  170. /deep/ .tm-search .grey-darken-5{
  171. background-color: #414141 !important;
  172. }
  173. .quxiao{color: #707070;line-height: 47px;}
  174. /deep/ .tm--badges--cm{border: 1px solid #303440 !important;
  175. background-color: #303440 !important;right: -7px !important;top: 6px !important;}
  176. /deep/ .tm--badges{display: inherit !important;}
  177. .qingchu{background: #303440;padding:5px 15px;border-radius: 20px;width: 62px;}
  178. /deep/ .liebiao .grey-darken-4.bk{background-color: #0D0D0D !important;}
  179. /deep/ .liebiao .py-24{padding-top: 15px;padding-bottom: 15px;}
  180. /deep/ .tm-grouplist{margin:0 10px !important;}
  181. /deep/ .qiehuan2 .tm-tabs-con-item-border{display: none;}
  182. /deep/ .qiehuan1 .text-primary{color: white !important;}
  183. /deep/ .qiehuan2 .tm-tabs-con-item-text{
  184. font-size: 14px;
  185. background: none !important;
  186. height: 28px;
  187. vertical-align: middle;
  188. line-height: 28px;
  189. border-radius: 20px;
  190. padding-left: 14px;
  191. padding-right: 14px;
  192. margin-top: 17%;
  193. }
  194. /deep/ .qiehuan2 .text-weight-b{
  195. font-size: 14px;
  196. background: #303440 !important;
  197. height: 28px;
  198. vertical-align: middle;
  199. line-height: 28px;
  200. border-radius: 20px;
  201. padding-left: 14px;
  202. padding-right: 14px;
  203. margin-top: 17%;
  204. color: white !important;
  205. }
  206. .jihua image{width: 30px;height: 30px;}
  207. .jihua{position: relative;}
  208. .jihua .a_1{position: absolute;top: 10%;}
  209. .jihuaview{width: 43%;margin: 7px;}
  210. .remenzan{width: 18px !important;margin-top: 10px;}
  211. .jihua .logo{width: 100%;}
  212. .touxiang image{width: 40px;margin-right: 10px;vertical-align: middle;}
  213. .yichu{padding: 0px !important;margin:0 !important}
  214. .more{text-align: center;}
  215. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  216. </style>