index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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="sousuo(item.name)" :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" @click="xiangqing(item)" 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;">
  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. xiangqing(item){
  94. console.log(item)
  95. if(item.type=="衣物"){
  96. uni.navigateTo({
  97. url: "/pages/yifu/index?id="+item.id,
  98. })
  99. }else if(item.type=="搭配"){
  100. uni.navigateTo({
  101. url: "/pages/zidingyikan/index?id="+item.id+'&type=1',
  102. })
  103. }
  104. },
  105. getlishi(){
  106. var that=this;
  107. myRequest({
  108. url: "/api/SearchHistory/searchList",
  109. method:'get',
  110. data:{}
  111. }).then(res => {
  112. if (res.data.code == 200) {
  113. that.libiaoList=res.data.data;
  114. }else{
  115. }
  116. })
  117. },
  118. qingkong(){
  119. var that=this;
  120. myRequest({
  121. url: "/api/SearchHistory/deleteSearch",
  122. method:'get',
  123. data:{}
  124. }).then(res => {
  125. if (res.data.code == 200) {
  126. that.getlishi();
  127. that.$refs.toast.show({model:'success',label:res.data.msg})
  128. }else{
  129. }
  130. })
  131. },
  132. gengmore(){
  133. this.randouh()
  134. },
  135. goindex(){
  136. uni.navigateBack();
  137. },
  138. sousuo(name){
  139. this.soso=name;
  140. this.sosoFun();
  141. },
  142. sosoFun(){
  143. console.log(this.soso)
  144. var that=this;
  145. myRequest({
  146. url: "/api/Collocation/search",
  147. method:'post',
  148. data:{search:that.soso,type:that.activeIndex}
  149. }).then(res => {
  150. if (res.data.code == 200) {
  151. that.listdata=res.data.data;
  152. }else{
  153. that.listdata=[];
  154. }
  155. })
  156. this.sosotype=2
  157. },
  158. randouh(){
  159. let list2 = [],that=this;
  160. for(let i=0;i<4;i++){
  161. list2.push({
  162. image:'../../static/img/25.png',
  163. text:'西装穿搭 | 韩系又A又飒休闲西装 高级感'
  164. })
  165. }
  166. this.listdata=this.listdata.concat(list2)
  167. console.log(this.listdata)
  168. },
  169. },
  170. }
  171. </script>
  172. <style lang="scss">
  173. /deep/ .tm-menubars .body{
  174. background-color: #1b1b1b !important;
  175. }
  176. /deep/ .icon-search{
  177. font-size: 23px !important;
  178. color: #8E8E93 !important;
  179. }
  180. /deep/ .tm-search{
  181. width: 86%;
  182. margin: 0 auto;
  183. background-color: #414141 !important;
  184. border-radius: 10px;
  185. }
  186. /deep/ .tm-search .grey-darken-5{
  187. background-color: #414141 !important;
  188. }
  189. .quxiao{color: #707070;line-height: 47px;}
  190. /deep/ .tm--badges--cm{border: 1px solid #303440 !important;
  191. background-color: #303440 !important;right: -7px !important;top: 6px !important;}
  192. /deep/ .tm--badges{display: inherit !important;}
  193. .qingchu{background: #303440;padding:5px 15px;border-radius: 20px;width: 62px;}
  194. /deep/ .liebiao .grey-darken-4.bk{background-color: #0D0D0D !important;}
  195. /deep/ .liebiao .py-24{padding-top: 15px;padding-bottom: 15px;}
  196. /deep/ .tm-grouplist{margin:0 10px !important;}
  197. /deep/ .qiehuan2 .tm-tabs-con-item-border{display: none;}
  198. /deep/ .qiehuan1 .text-primary{color: white !important;}
  199. /deep/ .qiehuan2 .tm-tabs-con-item-text{
  200. font-size: 14px;
  201. background: none !important;
  202. height: 28px;
  203. vertical-align: middle;
  204. line-height: 28px;
  205. border-radius: 20px;
  206. padding-left: 14px;
  207. padding-right: 14px;
  208. margin-top: 17%;
  209. }
  210. /deep/ .qiehuan2 .text-weight-b{
  211. font-size: 14px;
  212. background: #303440 !important;
  213. height: 28px;
  214. vertical-align: middle;
  215. line-height: 28px;
  216. border-radius: 20px;
  217. padding-left: 14px;
  218. padding-right: 14px;
  219. margin-top: 17%;
  220. color: white !important;
  221. }
  222. .jihua image{width: 30px;height: 30px;}
  223. .jihua{position: relative;}
  224. .jihua .a_1{position: absolute;top: 10%;}
  225. .jihuaview{width: 43%;margin: 7px;}
  226. .remenzan{width: 18px !important;margin-top: 10px;}
  227. .jihua .logo{width: 100%;}
  228. .touxiang image{width: 40px;margin-right: 10px;vertical-align: middle;}
  229. .yichu{padding: 0px !important;margin:0 !important}
  230. .more{text-align: center;}
  231. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  232. </style>