index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. <div class="zhuti">
  6. <tm-sheet class="kuang" style="padding-bottom: 70px !important;">
  7. <image v-if="(active==1 || active==2)" class="jindu" src="/static/img/49.png" mode="widthFix"></image>
  8. <image v-if="active==3" class="jindu" src="/static/img/50.png" mode="widthFix"></image>
  9. <image v-if="active==4" class="jindu" src="/static/img/51.png" mode="widthFix"></image>
  10. <view class="wenzi flex-between flex-center" style="margin-top: 10px;">
  11. <view>
  12. <text class="text-white text-size-m">创建家庭</text>
  13. </view>
  14. <view>
  15. <text class="text-white text-size-m">创建角色</text>
  16. </view>
  17. <view>
  18. <text class="text-white text-size-m">创建成功</text>
  19. </view>
  20. </view>
  21. <!-- <view class="wenzi flex-between flex-center">
  22. <view>
  23. <text class="text-size-s">2022-11-28</text>
  24. </view>
  25. <view>
  26. <text class="text-size-s">等待审批</text>
  27. </view>
  28. <view>
  29. <text class="text-size-s">等待审批</text>
  30. </view>
  31. </view> -->
  32. <view v-if="active==1">
  33. <view class="mt-20 ml-15">
  34. <text class="text-white text-size-m">*扫描柜体上的二维码和衣柜绑定</text>
  35. </view>
  36. <image block class="zhanshi" mode="widthFix" src="/static/img/48.png"></image>
  37. <tm-button :round="24" class="sao mb-40" @click="saoma()" block>扫二维码</tm-button>
  38. </view>
  39. <view v-if="active==2">
  40. <tm-translate ref="a_1" :auto="true" animation-name="zoomIn">
  41. <image block class="nicheng" mode="widthFix" src="/static/img/52.png"></image>
  42. </tm-translate>
  43. <view class="text-align-center mt-20 mb-40">
  44. <text class="text-size-m">衣柜和手机关联成功</text>
  45. </view>
  46. <view class="black shuru pa-30">
  47. <tm-form>
  48. <view class="text-size-m">请输入家庭名称</view>
  49. <tm-input name="title" v-model="name" clear placeholder="相亲相爱一家人"></tm-input>
  50. </tm-form>
  51. </view>
  52. <tm-button :round="24" class="sao mb-40 mt-40" @click="chuangjianFun()" block>创建家庭</tm-button>
  53. </view>
  54. <view v-if="active==3">
  55. <view>
  56. <view class="fl zuo" style="width:70px;">
  57. <view class="flex-center flex-col mt-30" style="position: relative;" v-for="(item,index) in renList">
  58. <image block mode="widthFix" src="/static/img/53.png"></image>
  59. <tm-badges icon="icon-times" @click="shanchu(item.timestamp)" v-if="index != 0"></tm-badges>
  60. </view>
  61. <view class="flex-center flex-col mt-30" style="position: relative;" v-if="renList.length<4">
  62. <image block mode="widthFix" src="/static/img/54.png" @click="add()"></image>
  63. </view>
  64. </view>
  65. <view class="fr you black mt-30" style="width: calc(100% - 100px); ">
  66. <tm-input :required="true" title="用户名" v-model="reqData.username" placeholder="你想叫自己什么" align="right"></tm-input>
  67. <tm-input :required="true" title="身高(cm)" v-model="reqData.height" align="right"></tm-input>
  68. <tm-input :required="true" title="体重(kg)" v-model="reqData.weight" align="right"></tm-input>
  69. <tm-pickers class="tan" :default-value.sync="reqData.shencai" rang-key="title" :list="chelianglis">
  70. <tm-input name="shencai" title="身材" placeholder="请选择车型" disabled :value="obTstr2(reqData.shencai)" right-icon="icon-angle-right"></tm-input>
  71. </tm-pickers>
  72. </view>
  73. </view>
  74. <view style="clear: both;"></view>
  75. <tm-button :round="24" class="sao mb-40" style="margin-top: 50px;" @click="tijiao()" block>下一步</tm-button>
  76. </view>
  77. <view v-if="active==4">
  78. <tm-translate ref="a_1" :auto="true" animation-name="zoomIn">
  79. <image block class="nicheng" mode="widthFix" src="/static/img/52.png"></image>
  80. </tm-translate>
  81. <view class="text-align-center mt-20">
  82. <text class="text-size-m text-white">家庭创建成功!</text>
  83. </view>
  84. <view class="text-align-center mb-40">
  85. <text class="text-size-m">衣柜和手机关联成功</text>
  86. </view>
  87. <view class="px-24">
  88. <tm-button theme="primary" :round="24" block class="mt-50 logincla">添加衣服</tm-button>
  89. <tm-button @click="quindex()" theme="primary" :round="24" block class="mt-30 quindex">进入首页</tm-button>
  90. </view>
  91. </view>
  92. </tm-sheet>
  93. </div>
  94. <!-- 弹出层消息 -->
  95. <tm-message ref="toast"></tm-message>
  96. </view>
  97. </template>
  98. <script>
  99. import{myRequest} from '@/api/request.js'
  100. export default {
  101. data() {
  102. return {
  103. shencaiList:[
  104. {title:"梨形",id:21},
  105. {title:"标准",id:31},
  106. {title:"胖子",id:41},
  107. {title:"瘦子",id:51},
  108. {title:"模特",id:61},
  109. ],
  110. shenxing:'',
  111. active:3,
  112. name:'',
  113. val_1:'',
  114. chelianglis:[
  115. {title:"标准",id:21},
  116. {title:"偏瘦",id:31},
  117. {title:"偏胖",id:41},
  118. {title:"梨形",id:51},
  119. {title:"S型",id:61},
  120. ],
  121. reqData:{
  122. username:'',
  123. height:'',
  124. weight:'',
  125. shencai:[]
  126. },
  127. renList:[]
  128. };
  129. },
  130. onLoad() {
  131. },
  132. created() {
  133. this.sys = uni.getSystemInfoSync();
  134. this.add()
  135. },
  136. methods: {
  137. quindex(){
  138. uni.navigateTo({
  139. url: "/pages/index/index",
  140. })
  141. },
  142. tijiao(){
  143. // console.log(this.renList)
  144. // for(let i=0;i<this.renList.length;i++){
  145. // if(this.renList[i].){}
  146. // }
  147. // this.active=4;
  148. },
  149. add(){
  150. var timestamp = Date.parse(new Date());
  151. var obj={
  152. username:'',
  153. height:'',
  154. weight:'',
  155. shencai:[],
  156. timestamp:timestamp
  157. }
  158. this.renList.push(obj)
  159. },
  160. shanchu(timestamp){
  161. var index = this.renList.findIndex((item) => {
  162. return item.timestamp == timestamp;
  163. });
  164. this.renList.splice(index, 1);
  165. },
  166. obTstr2(o){
  167. if(Array.isArray(o)){
  168. if(o.length.length===0) return "";
  169. return o[0]?.title??""
  170. }
  171. return ''
  172. },
  173. saoma(){
  174. var that=this;
  175. uni.scanCode({
  176. scanType: ['barCode'],
  177. success: function (res) {
  178. console.log('条码类型:' + res.scanType);
  179. console.log('条码内容:' + res.result);
  180. that.active=2;
  181. },
  182. error : function(e) {
  183. alert("网络异常,请重试");
  184. }
  185. })
  186. },
  187. chuangjianFun(){
  188. var that=this;
  189. if(that.name==""){
  190. that.$refs.toast.show({model:'warn',label:'请输入家庭名称'})
  191. return
  192. }
  193. that.active=3;
  194. }
  195. },
  196. }
  197. </script>
  198. <style lang="scss">
  199. .zhanshi{
  200. width: 100%;
  201. margin: 0 auto;
  202. margin-top: 10px;
  203. margin-bottom: 40px;
  204. }
  205. /deep/ .tm-menubars .body{
  206. background-color: #1b1b1b !important;
  207. }
  208. /deep/ .kuang{margin:0 !important;padding: 14px !important;margin-bottom: 40px !important;}
  209. /deep/ .kuang uni-button{background-color: #303440 !important;}
  210. .jindu{width: 90%;margin: 0 auto;display: block;}
  211. .wenzi{width: 94%;margin: 0 auto;}
  212. .nicheng{width: 130px;height:132px;display: block;margin:0 auto;margin-top: 50px;}
  213. /deep/ .shuru .grey-darken-5{
  214. background-color: #0d0d0d!important;
  215. padding: 0px !important;
  216. }
  217. .shuru{border:1px solid #303030;border-radius: 10px;}
  218. /deep/ .shuru .text-primary.bk{color:#303030 !important;}
  219. /deep/ .shuru .border-grey-darken-4-b-1{border-bottom:none !important;}
  220. .zuo image{width:60px;display: block;}
  221. .you{border:1px solid #303030;border-radius: 10px;padding:10px;height: 300px;}
  222. /deep/ .you .grey-darken-5{
  223. background-color: #0d0d0d!important;
  224. padding: 0px !important;
  225. }
  226. /deep/ .you .text-red{color: white;}
  227. /deep/ .tan .active{background-color: #AAAAAA !important;}
  228. /deep/ .tan .tm-poups .grey-darken-5{background-color: gray !important;}
  229. /deep/ .tan uni-input{text-align: right;}
  230. /deep/ .you .border-grey-darken-4-b-1 {
  231. border-bottom: solid 1px #313131 !important;
  232. }
  233. /deep/ .tm--badges{position: absolute;top: 0px;right:6px}
  234. .logincla{margin-top: 100px;}
  235. /deep/ .quindex uni-button{background-color: #0A84FF !important;}
  236. </style>