index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }"
  3. :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  4. <tm-menubars title="搭配" :shadow="0" :showback="true"></tm-menubars>
  5. <view class="C1b1b1b pb-20">
  6. <tm-tabs align="left" class="qiehuan1" v-model="activeIndex" :list="list" range-key="title"></tm-tabs>
  7. </view>
  8. <!-- 天气 -->
  9. <scroll-view class="scroll-view_H" scroll-x="true">
  10. <view class="scroll-view-item_H">
  11. <image class="chuanda" src="/static/img/107.png"></image>
  12. <view class="mt-20 text-align-center">
  13. <image class="taiyang" src="/static/img/106.png" mode="widthFix"></image>
  14. <text class="text-size-s ml-15">16°c~20°c</text>
  15. <text class="text-size-s ml-15">星期一</text>
  16. </view>
  17. <view class="bianji" @click="bianji()">更换穿搭</view>
  18. </view>
  19. <view class="scroll-view-item_H">
  20. <view class="chuanda">
  21. <view class="text-white text-size-lg">南京市</view>
  22. <view class="text-size-lg mt-15 text-weight-b" style="color: #FFCC00;">8°C</view>
  23. <view class="text-white text-size-lg mt-15">局部地区降雨</view>
  24. <view class="text-gray text-size-lg mt-10">最低0°c 最高9°c</view>
  25. </view>
  26. <view class="mt-20 text-align-center">
  27. <image class="taiyang" src="/static/img/106.png" mode="widthFix"></image>
  28. <text class="text-size-s ml-15">16°c~20°c</text>
  29. <text class="text-size-s ml-15">星期一</text>
  30. </view>
  31. <view class="bianji" @click="bianji()">添加穿搭</view>
  32. </view>
  33. <!-- <view class="scroll-view-item_H">
  34. <image class="chuanda" src="/static/img/107.png" mode="widthFix"></image>
  35. <view class="mt-20 text-align-center">
  36. <image class="taiyang" src="/static/img/106.png" mode="widthFix"></image>
  37. <text class="text-size-s ml-15">16°c~20°c</text>
  38. <text class="text-size-s ml-15">星期一</text>
  39. </view>
  40. <view class="bianji" @click="bianji()">编辑穿搭</view>
  41. </view> -->
  42. </scroll-view>
  43. <div class="zhuti">
  44. <!-- 衣橱 -->
  45. <tm-sheet class="yichu" style="margin-bottom: 40px !important;">
  46. <tm-tabs @change="fenlei" class="C1b1b1b qiehuan" color="white" align="left" v-model="activeIndex1" :list="listfl" range-key="title"></tm-tabs>
  47. <view class="yiguicla black pa-6 ma-4 fl" v-for="(item,index) in quanbuList" @click="zidingyibianji()">
  48. <image :src="item.image" mode="widthFix"></image>
  49. <view class="text-size-m mt-20 mb-20 ml-10">{{item.title}}</view>
  50. </view>
  51. <view style="clear: both;"></view>
  52. <tm-empty v-if="quanbuList.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
  53. <!-- <view style="clear: both;" class="more ma-30 pt-40" @click="gengmore()">
  54. <image src="/static/img/30.png" mode="widthFix"></image>
  55. <text class="text-size-s">下拉加载更多~</text>
  56. </view> -->
  57. </tm-sheet>
  58. <tm-button :round="24" class="sao" block @click="zidingyi()">自定义搭配</tm-button>
  59. </div>
  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. list:[ '预约穿搭'],
  70. activeIndex:0,
  71. activeIndex1:0,
  72. quanbuList:[],
  73. chooseindex:-1,
  74. listfl:[],
  75. listflall:[]
  76. };
  77. },
  78. onLoad() {
  79. },
  80. created() {
  81. this.sys = uni.getSystemInfoSync();
  82. this.gettianqi();
  83. this.getFl();
  84. },
  85. methods: {
  86. fenlei(e){
  87. var id=this.listflall[e].id;
  88. this.getKxuan(id)
  89. },
  90. getFl(){
  91. var that=this;
  92. myRequest({
  93. url: "/api/Category/getCollocationClassList",
  94. method:'post',
  95. data:{}
  96. }).then(res => {
  97. if (res.data.code == 200) {
  98. if(res.data.data.length != 0){
  99. // that.listfl=['全部'];
  100. that.listfl=[];
  101. for(let i=0;i<res.data.data.length;i++){
  102. that.listfl.push(res.data.data[i].category_name)
  103. }
  104. that.listflall=res.data.data;
  105. that.getKxuan(that.listflall[0].id);
  106. }
  107. }else{
  108. that.listfl=[];
  109. }
  110. })
  111. },
  112. getKxuan(id){
  113. var that=this;
  114. myRequest({
  115. url: "/api/Collocation/getCollocationList",
  116. method:'post',
  117. data:{category_id:id}
  118. }).then(res => {
  119. if (res.data.code == 200) {
  120. if(res.data.data.length != 0){
  121. that.quanbuList=res.data.data.data;
  122. }else{
  123. that.quanbuList=[];
  124. }
  125. }else{
  126. that.quanbuList=[];
  127. }
  128. })
  129. },
  130. gettianqi(){
  131. var that=this;
  132. // uni.getLocation({
  133. // type: 'wgs84',
  134. // geocode:true,//设置该参数为true可直接获取经纬度及城市信息
  135. // success: function (res) {
  136. // console.log(res)
  137. // // that.addrDel = res;
  138. // },
  139. // fail: function () {
  140. // uni.showToast({
  141. // title: '获取地址失败,将导致部分功能不可用',
  142. // icon:'none'
  143. // });
  144. // }
  145. // });
  146. uni.request({
  147. url: "https://jisutqybmf.market.alicloudapi.com/weather/query",
  148. method: "get",
  149. header: {
  150. 'Authorization':'APPCODE e4b9accfb1f246cb8c0766a54efe8730'
  151. },
  152. data:{
  153. city:'南京'
  154. },
  155. dataType:'json',
  156. success : function(data) {
  157. },
  158. error : function(e) {
  159. alert("网络异常,请重试");
  160. }
  161. });
  162. },
  163. bianji(){
  164. uni.navigateTo({
  165. url: "/pages/bianjigh/index",
  166. })
  167. },
  168. zidingyibianji(){
  169. uni.navigateTo({
  170. url: "/pages/zidingyi/index?type=1",
  171. })
  172. },
  173. dapei(){
  174. uni.navigateTo({
  175. url: "/pages/dapeizidingyi/index?type=1",
  176. })
  177. },
  178. gengmore(){
  179. },
  180. zidingyi(){
  181. uni.navigateTo({
  182. url: "/pages/changan/index",
  183. })
  184. }
  185. },
  186. }
  187. </script>
  188. <style lang="scss">
  189. /deep/ .tm-menubars .body{
  190. background-color: #1b1b1b !important;
  191. }
  192. /deep/ .qiehuan1 .text-primary{color: white !important;}
  193. .chuanda{width: 100%;height: 144px;}
  194. .taiyang{width: 25px;}
  195. .bianji{border: 1px solid #303440;width: 80px;height: 30px;background: #303440;font-size: 15px;
  196. text-align: center;line-height: 30px;border-radius: 5px;margin: 0 auto;margin-top: 10px;border:1px solid white;}
  197. .scroll-view_H {
  198. white-space: nowrap;
  199. width: 100%;
  200. background: #1B1B1B;
  201. padding-bottom: 15px;
  202. }
  203. .scroll-view-item {
  204. height: 300rpx;
  205. text-align: center;
  206. font-size: 36rpx;
  207. }
  208. .scroll-view-item_H {
  209. display: inline-block;
  210. width: 150px;
  211. text-align: center;
  212. font-size: 36rpx;
  213. margin-left: 10px;
  214. background: #0D0D0D;
  215. padding: 6px;
  216. border-radius: 10px;
  217. }
  218. .yichu{margin:0 !important;padding: 4px !important;margin-top: 10px !important;}
  219. /deep/ .qiehuan .text-white{
  220. font-size: 14px;
  221. background: #303440;
  222. height: 28px;
  223. vertical-align: middle;
  224. line-height: 28px;
  225. border-radius: 20px;
  226. padding-left: 14px;
  227. padding-right: 14px;
  228. margin-top: 17%;
  229. }
  230. /deep/ .qiehuan .tm-tabs-con-item-border{display: none;}
  231. .yiguicla image{width: 95%;display: block;margin: 0 auto;margin-top: 5px;}
  232. .yiguicla{width: 47%;border-radius: 10px;}
  233. .more{text-align: center;}
  234. .more image{margin-right: 10px;vertical-align: middle;width: 30px;}
  235. .fudong{position:fixed;right:10px;bottom:150px;background: #303030;width: 130px;height: 60px;
  236. border-radius: 30px 0px 0px 30px;font-size: 14px;text-align: center;}
  237. .sao{width: 60%;display: block;margin: 0 auto;margin-bottom: 60px;}
  238. /deep/ .scroll-view_H{height:245px !important;}
  239. </style>