Browse Source

feta: 优化一些小细节

qiang 2 years ago
parent
commit
e6dc0b3a9f

+ 7 - 9
components/search/search.js

@@ -1,16 +1,14 @@
-//Component Object
 Component({
   properties: {
-    myProperty: {
-		type: String,
-			value: '',
-			observer: function () { }
+    disabled: {
+			type: Boolean,
+			value: true
 		},
+		isshow : {
+			type: Boolean,
+			value: false
+		}
   },
-	data: {
-		disabled: true,
-		isshow: false,
-	},
 	methods: {
 		goToSearch() {
 			wx.navigateTo({

+ 12 - 12
pages/classification/classification.js

@@ -29,36 +29,36 @@ Page({
   },
 
 
-  onLoad: function (options) {
-    var that = this;
+  onLoad() {
+    const that = this;
     //调用getSystemInfo APi获取到用户的手机屏幕高度,动态设置scroll-view的高度
     // 还有缺陷,代改进
     wx.getSystemInfo({
       success (res) {
         // var heightleft = (res.windowHeight*2);
-        var height = (res.windowHeight*2);
+        const height = (res.windowHeight*2);
         that.setData({
-          phoneHeight:height,
+          phoneHeight: height,
         })
       }
     })
   },
 
   //随着滚动动态设置左侧边栏的选中态
-  showActive:function (e) {
+  showActive(e) {
     //方法欠佳,还需改进
-    var index = parseInt( e.detail.scrollTop/116);
+    const index = parseInt(e.detail.scrollTop/116);
     this.setData({
       activeIndex: index
      })
   },
   // 侧边栏的点击事件
-  change:function (e){
-    var that = this;
-    that.setData({
-      VerticalNavTop: (e.currentTarget.dataset.index - 1) * 50,
-      activeIndex: e.currentTarget.dataset.index,
-      TabCur: e.currentTarget.dataset.id,
+  change(e) {
+    const { index, id } =  e.currentTarget.dataset
+    this.setData({
+      VerticalNavTop: (index - 1) * 50,
+      activeIndex:index,
+      TabCur: id,
     })
   },
 })

+ 4 - 8
pages/details/details.js

@@ -52,15 +52,11 @@ Page({
 			count: "5601.9万",
 			time: "34:36"
 		},
-		]
+		],
+		performanceInfo: [],
+		imgurl: ''
 	},
-
-	/**
-	 * 生命周期函数--监听页面加载
-	 */
-
-
-	onLoad: function (options) {
+	onLoad(options) {
 		this.setData({
 			performanceInfo: [{
 				imgurl: options.url + '=5&upload_type=album&device_type=ios&name=medium&magick=png',

+ 6 - 7
pages/index/index.js

@@ -40,20 +40,19 @@ Page({
 		],
 		swiperCurrent: 0,
 	},
-	/**
-	 * 生命周期函数--监听页面加载
-	 */
 	onLoad: function (options) {
 		const that = this
 		myRequest.getData().then(res => {
+			const {guess,hotRecommends} = res.data
 			that.setData({
 				showitem: true,
-				guess: res.data.guess.list.slice(0, 3),
-				xiaoshuocontent: res.data.hotRecommends.list[0].list,
-				xiangshengcontent: res.data.hotRecommends.list[2].list,
-				tuokocontent: res.data.hotRecommends.list[4].list
+				guess: guess.list.slice(0, 3),
+				xiaoshuocontent: hotRecommends.list[0].list,
+				xiangshengcontent: hotRecommends.list[2].list,
+				tuokocontent: hotRecommends.list[4].list
 			})
 		}).catch(err => {
+			console.log('error :>> ', err);
 			that.setData({
 				showitem: false
 			})

+ 0 - 2
pages/user/phoneLogin/phoneLogin.wxml

@@ -2,9 +2,7 @@
 	<view class="hmly-content_">
 		<!-- 提示标语 -->
 		<view class="hmly-slogn">
-			<!-- <view class="left-line" style="width:20rpx"></view> -->
 			登录后即可收听你的收藏专辑哦
-			<!-- <view class="right-line" style="width:20rpx"></view> -->
 		</view>
 		<!-- 表单输入部分 -->
 		<view class="hmly-login">

+ 0 - 4
pages/user/phoneLogin/phoneLogin.wxss

@@ -1,7 +1,3 @@
-/*  
-    96D655 
-    CCCCCC
-*/
 .hmly-main {
 	width: 100%;
 }

+ 1 - 8
style/icons.wxss

@@ -12,14 +12,7 @@
 	/* iOS 4.1- */
 }
 
-/* .iconfont {
-    font-family: "iconfont" !important;
-    font-size: 16px;
-    font-style: normal;
-    -webkit-font-smoothing: antialiased;
-    -moz-osx-font-smoothing: grayscale;
-  } */
-
+/* 小程序不推荐使用属性选择器 */
 [class*="icon-"] {
 	font-family: "iconfont" !important;
 	font-size: inherit;

+ 4 - 4
utils/request.js

@@ -7,15 +7,15 @@ const baseURL = 'http://mobile.ximalaya.com/mobile/discovery/v3/recommend/hotAnd
  */
 function request(params = { method, url, data }) {
 	return new Promise(function (resolve, reject) {
-		let header = { 'content-type': 'application/json' }; // 定义请求头
 		wx.request({
 			url: baseURL + params.url,
 			method: params.method,
 			data: params.data ? JSON.stringify(params.data) : null,
-			header: header,
+			header: { 'content-type': 'application/json' },
 			success(res) {
-				// 判断状态码---根据后端定义来判断
-				if (res.data.code != '-1') {  // 请求成功
+				// 判断状态码 根据后端定义来判断
+				const { code } = res.data
+				if (code !== '-1') {  // 请求成功
 					resolve(res);
 				} else {
 					reject('运行时错误,请稍后再试'); // 其他异常