Z1hgq 7 лет назад
Родитель
Сommit
19cab673e2

+ 0 - 0
Furniture/images/眼睛.png → Furniture/images/eyes.png


BIN
Furniture/images/like.png


BIN
Furniture/images/like1.png


BIN
Furniture/images/no.png


BIN
Furniture/images/no1.png


BIN
Furniture/images/normal.png


+ 0 - 0
Furniture/images/一般1.png → Furniture/images/normal1.png


BIN
Furniture/images/一般.png


BIN
Furniture/img/fuck.png


+ 29 - 5
Furniture/page/homePage/detail/detail.js

xqd xqd xqd xqd
@@ -1,4 +1,6 @@
 // page/homePage/detail/detail.js
+const app = getApp()
+var WxParse = require('../../../wxParse/wxParse.js');
 Page({
 
   /**
@@ -10,13 +12,33 @@ Page({
     normal: true,
     dislike: true,
     zan: false,
+    news:{},
+    news_comments:{},
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    var that = this
+    var id = options.id
+    console.log(id)
+    app.request({
+      url:'https://t6.9026.com/api/furniture/news_detail',
+      method:'get',
+      data:{
+        store_id:1,
+        newsid:id
+      },
+      success:function(res){
+        that.setData({
+          news:res.data.data.news,
+          news_comments:res.data.data.news_comments
+        })
+        var article = that.data.news.content
+        WxParse.wxParse('article', 'html', article, that, 5)
+      }
+    })
   },
 
   /**
@@ -69,6 +91,7 @@ Page({
   },
   like: function () {
     var that = this
+    console.log('hahhahhah')
     if (that.data.like == true) {
       that.setData({
         like: false,
@@ -127,9 +150,10 @@ Page({
       })
     }
   },
-  toConment: function () {
-    wx.navigateTo({
-      url: 'conment/conment',
-    })
+  toConment: function (e) {
+    console.log(e)
+    // wx.navigateTo({
+    //   url: 'conment/conment?',
+    // })
   }
 })

+ 31 - 125
Furniture/page/homePage/detail/detail.wxml

xqd
@@ -2,174 +2,80 @@
 <view class="page" style='background-color:white'>
   <view class="page__bd">
     <view class="weui-article">
-      <view class="weui-article__h1" style='font-size:42rpx'>新品发布新品发布新品发布新品发布新品发布</view>
+      <view class="weui-article__h1" style='font-size:42rpx'>{{news.title}}</view>
       <view class='container1' style='margin-left:0rpx;margin-top:0rpx'>
-        <image src='../../../images/people.png' style='width:80rpx;height:80rpx'></image>
+        <image src='{{news.avatar}}' style='width:80rpx;height:80rpx'></image>
       </view>
       <view class="weui-article__section">
-        <view class="weui-article__title" style='margin-left:100rpx'>天天家居</view>
+        <view class="weui-article__title" style='margin-left:100rpx'>天天家居</view>
         <view class="weui-article__section">
-          <view class="weui-article__h3" style='margin-left:100rpx'>{{time}}</view>
+          <view class="weui-article__h3" style='margin-left:100rpx'>{{news.created_at}}</view>
           <view class="weui-article__p" style='font-size:35rpx'>
-            新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布新品发布
+            <import src="../../../wxParse/wxParse.wxml" />
+            <template is="wxParse" data="{{wxParseData:article.nodes}}" />
           </view>
           <view class="weui-article__p">
-            <image src="../../../images/detail.png" mode="aspectFit" style="width: 100%" />
+            <image src="{{news.thumb}}" mode="aspectFit" style="width: 100%" />
           </view>
         </view>
       </view>
       <view style='height:80rpx;width:100%;position:relative'>
-        <view class='container1'>422</view>
-        <image src='../../../images/眼睛.png' style='width:50rpx;height:50rpx;margin-top:15rpx'></image>
+        <view class='container1'>{{news.viewed}}</view>
+        <image src='../../../images/eyes.png' style='width:50rpx;height:50rpx;margin-top:15rpx'></image>
       </view>
       <view class='weui-flex'>
-        <view class='weui-flex__item'>
+        <!-- <view class='weui-flex__item'>
           <image src='../../../images/like.png' style='width:50%;height:110rpx;margin-left:25%' bindtap='like' wx:if="{{like}}"></image>
           <image src='../../../images/like1.png' style='width:50%;height:110rpx;margin-left:25%' bindtap='like' wx:if="{{!like}}"></image>
         </view>
         <view class='weui-flex__item'>
-          <image src='../../../images/一般.png' style='width:50%;height:110rpx;margin-left:25%' bindtap='normal' wx:if="{{normal}}"></image>
-          <image src='../../../images/一般1.png' style='width:50%;height:110rpx;margin-left:25%' bindtap='normal' wx:if="{{!normal}}"></image>
+          <image src='../../../images/normal.png' style='width:50%;height:110rpx;margin-left:25%' bindtap='normal' wx:if="{{normal}}"></image>
+          <image src='../../../images/normal1.png' style='width:50%;height:110rpx;margin-left:25%' bindtap='normal' wx:if="{{!normal}}"></image>
         </view>
         <view class='weui-flex__item'>
           <image src='../../../images/no.png' style='width:50%;height:110rpx;margin-left:25%' bindtap='dislike' wx:if="{{dislike}}"></image>
           <image src='../../../images/no1.png' style='width:50%;height:110rpx;margin-left:25%' bindtap='dislike' wx:if="{{!dislike}}"></image>
-        </view>
+        </view> -->
       </view>
       <view class='container1' style='margin-left:55rpx;margin-top: 0rpx;' wx:if="{{like}}">
-        喜欢(252)
+        喜欢({{news.like}})
       </view>
       <view class='container1' style='margin-left:290rpx;margin-top: 0rpx;' wx:if="{{normal}}">
-        一般(14)
+        一般({{news.commonly}})
       </view>
       <view class='container1' style='margin-left:520rpx;margin-top: 0rpx;' wx:if="{{dislike}}">
-        淘汰(0)
+        淘汰({{news.bad}})
       </view>
       <view class='container1' style='margin-left:55rpx;margin-top: 0rpx;color:#d81e06;' wx:if="{{!like}}">
-        喜欢(252)
+        喜欢({{news.like+1}})
       </view>
       <view class='container1' style='margin-left:290rpx;margin-top: 0rpx;color:#d81e06;' wx:if="{{!normal}}">
-        一般(14)
+        一般({{news.commonly+1}})
       </view>
       <view class='container1' style='margin-left:520rpx;margin-top: 0rpx;color:#d81e06;' wx:if="{{!dislike}}">
-        淘汰(0)
+        淘汰({{news.bad+1}})
       </view>
       <view style='margin-top:80rpx;'>
-        全部评论(85)
+        全部评论({{news_comments.total}})
       </view>
     </view>
-    <view class='conment'>
-      <view class='container1' style='margin-left:0rpx;margin-top:-20rpx'>
-        <image src='../../../images/people.png' style='width:80rpx;height:80rpx'></image>
-      </view>
-      <view class='container1' style='margin-top:8rpx'>
-        <text style='margin-left:540rpx'>20</text>
-        <image src='../../../images/点赞.png' style='width:30rpx;height:30rpx;margin-left:10rpx;margin-top:8rpx' bindtap='zan' wx:if="{{!zan}}"></image>
-        <image src='../../../images/已赞.png' style='width:30rpx;height:30rpx;margin-left:10rpx;margin-top:8rpx' bindtap='zan' wx:if="{{zan}}"></image>
-      </view>
-      <view class="weui-article__title" style='margin-left:100rpx'>梦星羽</view>
-
-
-      <view style='font-size:35rpx;margin-left:100rpx' bindtap='toConment'>
-        评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内
+    <view class='conment' wx:for='{{news_comments.data}}'>
+      <view class='container1' style='margin-left:0rpx;margin-top:0rpx'>
+        <image src='{{item.avatar}}' style='width:80rpx;height:80rpx'></image>
       </view>
-      <view class='container1' style='margin-top:10rpx'>
-        <image src='../../../images/展开全文按钮.png' style='width:60rpx;height:30rpx;margin-left:20rpx' bindtap='toConment'></image>
+      <view class="weui-article__title" style='margin-left:100rpx'>{{item.username}}</view>
+      <view class='container1' style='margin-left:100rpx;margin-top:5rpx;font-size:24rpx;color:#d3d3d3'>
+        {{item.created_at}}
       </view>
-
-      <view class='container1' style='margin-left:100rpx;margin-top:55rpx;font-size:24rpx;color:#d3d3d3'>
-        6小时前
+      <view style='font-size:35rpx;margin-left:100rpx;margin-top:50rpx'>
+        {{item.content}}
       </view>
-      <view style='margin:0;margin-left:100rpx'>
-        <image src='../../../images/回复按钮.png' style='width:60rpx;height:30rpx;margin-left:100rpx;margin-top:60rpx'></image>
+      <view style='margin-top:5rpx;background-color:#f5f5f5;margin-left:100rpx;height:50rpx;padding:5rpx' id='{{item.id}}' bindtap='toConment' wx:if='{{item.replys.total != 0}}' >
+      <text style='color:#1E90FF;font-size:30rpx' decode="{{true}}" space="{{true}}">共{{item.replys.total}}条回复  ></text>
       </view>
 
-      <view style='margin-top:5rpx;background-color:#f5f5f5;margin-left:100rpx'>
-        <view style='margin-left:10rpx'>
-          <text style='font-size:30rpx;font-famaily:"黑体"'>梦星羽:</text>
-          <text style=' font-size:30rpx;color:#606060'>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评</text>
-        </view>
-
-        <view class='container1 ' style='margin-top:10rpx'>
-          <image src='../../../images/展开全文按钮.png ' style='width:60rpx;height:30rpx;margin-left:-70rpx;margin-top:0rpx'></image>
-        </view>
-
-        <view style='margin-top:50rpx;margin-left:10rpx'>
-          <text style='font-size:30rpx;font-famaily:"黑体"'>梦星羽:</text>
-          <text style=' font-size:30rpx;color:#606060'>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评</text>
-        </view>
-
-        <view class='container1 ' style='margin-top:10rpx'>
-          <image src='../../../images/展开全文按钮.png ' style='width:60rpx;height:30rpx;margin-left:-70rpx;margin-top:0rpx'></image>
-        </view>
-
-        <view style='margin-top:50rpx;height:1rpx'>
-        </view>
-        <view class='container1' style='margin-top:0rpx'>
-          <image src='../../../images/查看全部回复按钮.png ' style='width:160rpx;height:25rpx;margin-left:-70rpx;margin-top:0rpx'></image>
-        </view>
-        <view style='margin-top:50rpx;height:1rpx'>
-        </view>
-        <view class='container1' style='margin-top:0rpx;margin-left:0rpx'>
+      <view class='container1' style='margin-top:0rpx;margin-left:100rpx'>
           <image src='../../../../images/回复与回复之间的分割线.png ' style='width:81%;height:2rpx;margin-top:0rpx;margin-left:0rpx'></image>
-        </view>
-      </view>
-    </view>
-    <view class='conment'>
-      <view class='container1' style='margin-left:0rpx;margin-top:-20rpx'>
-        <image src='../../../images/people.png' style='width:80rpx;height:80rpx'></image>
-      </view>
-      <view class='container1' style='margin-top:8rpx'>
-        <text style='margin-left:540rpx'>20</text>
-        <image src='../../../images/点赞.png' style='width:30rpx;height:30rpx;margin-left:10rpx;margin-top:8rpx' bindtap='zan' wx:if="{{!zan}}"></image>
-        <image src='../../../images/已赞.png' style='width:30rpx;height:30rpx;margin-left:10rpx;margin-top:8rpx' bindtap='zan' wx:if="{{zan}}"></image>
-      </view>
-      <view class="weui-article__title" style='margin-left:100rpx'>梦星羽</view>
-
-
-      <view style='font-size:35rpx;margin-left:100rpx' bindtap='toConment'>
-        评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内
-      </view>
-      <view class='container1' style='margin-top:10rpx'>
-        <image src='../../../images/展开全文按钮.png' style='width:60rpx;height:30rpx;margin-left:20rpx' bindtap='toConment'></image>
-      </view>
-
-      <view class='container1' style='margin-left:100rpx;margin-top:55rpx;font-size:24rpx;color:#d3d3d3'>
-        6小时前
-      </view>
-      <view style='margin:0;margin-left:100rpx'>
-        <image src='../../../images/回复按钮.png' style='width:60rpx;height:30rpx;margin-left:100rpx;margin-top:60rpx'></image>
-      </view>
-
-      <view style='margin-top:5rpx;background-color:#f5f5f5;margin-left:100rpx'>
-        <view style='margin-left:10rpx'>
-          <text style='font-size:30rpx;font-famaily:"黑体"'>梦星羽:</text>
-          <text style=' font-size:30rpx;color:#606060'>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评</text>
-        </view>
-
-        <view class='container1 ' style='margin-top:10rpx'>
-          <image src='../../../images/展开全文按钮.png ' style='width:60rpx;height:30rpx;margin-left:-70rpx;margin-top:0rpx'></image>
-        </view>
-
-        <view style='margin-top:50rpx;margin-left:10rpx'>
-          <text style='font-size:30rpx;font-famaily:"黑体"'>梦星羽:</text>
-          <text style=' font-size:30rpx;color:#606060'>评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评论内容评</text>
-        </view>
-
-        <view class='container1' style='margin-top:10rpx'>
-          <image src='../../../images/展开全文按钮.png ' style='width:60rpx;height:30rpx;margin-left:-70rpx;margin-top:0rpx'></image>
-        </view>
-
-        <view style='margin-top:50rpx;height:1rpx'>
-        </view>
-        <view class='container1' style='margin-top:0rpx'>
-          <image src='../../../images/查看全部回复按钮.png ' style='width:160rpx;height:25rpx;margin-left:-70rpx;margin-top:0rpx'></image>
-        </view>
-        <view style='margin-top:50rpx;height:1rpx'>
-        </view>
-        <view class='container1' style='margin-top:0rpx;margin-left:0rpx'>
-          <image src='../../../images/回复与回复之间的分割线.png ' style='width:81%;height:2rpx;margin-top:0rpx;margin-left:0rpx'></image>
-        </view>
       </view>
     </view>
 

+ 89 - 87
Furniture/page/homePage/homePage.js

xqd xqd xqd xqd xqd xqd
@@ -11,7 +11,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    is_login:false,
+    is_login: false,
     inputShowed: false,
     inputVal: "",
     takeup: true,
@@ -21,53 +21,59 @@ Page({
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
+  onLoad: function(options) {
     var that = this
-    var myAmapFun = new amapFile.AMapWX({ key: 'f74da0d1484bbbefb69059efa771b01d' });
+    var myAmapFun = new amapFile.AMapWX({
+      key: 'f74da0d1484bbbefb69059efa771b01d'
+    });
     myAmapFun.getWeather({
-      success: function (data) {
+      success: function(data) {
         console.log(data)
         that.setData({
-          weather:data.weather.data,
+          weather: data.weather.data,
           temp: data.temperature.data,
         })
       },
-      fail: function (info) {
+      fail: function(info) {
         //失败回调
         console.log(info)
       }
     })
     app.request1({
-      url: api.setting,
-      success: function (e) {
-        console.log(e.data)
-        that.setData({
-          slide: e.data.banner,
-          nav: e.data.navbar,
-          sysinfo: e.data.setting,
-          menus: e.data.menus
-        }),
-          app.avatar = e.data.setting.avatar,
-          app.username = e.data.setting.name
-        wx.setNavigationBarTitle({
-          title: e.data.setting.illustrated_name,
-        }),
+        url: api.setting,
+        success: function(e) {
+          console.log(e.data)
+          that.setData({
+              slide: e.data.banner,
+              nav: e.data.navbar,
+              sysinfo: e.data.setting,
+              menus: e.data.menus
+            }),
+            app.avatar = e.data.setting.avatar,
+            app.username = e.data.setting.name
+          wx.setNavigationBarTitle({
+              title: e.data.setting.illustrated_name,
+            }),
 
-          wx.setNavigationBarColor({ frontColor: '#000000', backgroundColor: '#ffffff' })
-      }
-      //console.log(e.data)
-    }),
+            wx.setNavigationBarColor({
+              frontColor: '#000000',
+              backgroundColor: '#ffffff'
+            })
+        }
+        //console.log(e.data)
+      }),
       app.request1({
-      url: api.news_list,
-        success: function (e) {
+        url: api.news_list,
+        success: function(e) {
           that.setData({
             news: e.data.data,
           })
+          console.log(that.data.news)
         }
       }),
       app.request1({
         url: api.goods_list,
-        success: function (e) {
+        success: function(e) {
           that.setData({
             goods: e.data.data,
           })
@@ -77,7 +83,7 @@ Page({
 
   },
 
-  navigatorClick: function (e) {
+  navigatorClick: function(e) {
     console.log(1)
     var page = this;
     var open_type = e.currentTarget.dataset.open_type;
@@ -91,7 +97,7 @@ Page({
       wx.navigateToMiniProgram({
         appId: appid,
         path: url + '?user_id=' + user_info.user_id,
-        complete: function (e) {
+        complete: function(e) {
           console.log(e);
         }
       });
@@ -117,101 +123,103 @@ Page({
         url: url
       })
     }
-    },
+  },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function () {
+  onReady: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
+  onShow: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function () {
+  onHide: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function () {
+  onUnload: function() {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function () {
+  onPullDownRefresh: function() {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function () {
+  onReachBottom: function() {
 
   },
 
   /**
    * 用户点击右上角分享
    */
-  onShareAppMessage: function () {
+  onShareAppMessage: function() {
 
   },
-  showInput: function () {
+  showInput: function() {
     this.setData({
       inputShowed: true
     });
   },
-  hideInput: function () {
+  hideInput: function() {
     this.setData({
       inputVal: "",
       inputShowed: false
     });
   },
-  clearInput: function () {
+  clearInput: function() {
     this.setData({
       inputVal: ""
     });
   },
-  inputTyping: function (e) {
+  inputTyping: function(e) {
     this.setData({
       inputVal: e.detail.value
     });
   },
-  takeup: function () {
+  takeup: function() {
     var that = this
     that.setData({
       takeup: false,
       more: true
     })
   },
-  more: function () {
+  more: function() {
     var that = this
     that.setData({
       takeup: true,
       more: false
     })
   },
-  toDetail: function () {
+  todetail: function(e) {
+    console.log(e.currentTarget.dataset.id)
+    var news_id = e.currentTarget.dataset.id
     wx.navigateTo({
-      url: 'detail/detail',
+      url: 'detail/detail?id=' + news_id,
     })
   },
-  goShouhou:function(){
+  goShouhou: function() {
     var that = this
-    if(wx.getStorageSync('user')){
+    if (wx.getStorageSync('user')) {
       var u = wx.getStorageSync('user')
-      if(u.role == 0){
+      if (u.role == 0) {
         wx.navigateTo({
           url: '/pages/index/index',
         })
@@ -231,64 +239,58 @@ Page({
           url: '/pages/manager/manage',
         })
       }
-    }else{
+    } else {
       that.setData({
-        is_login:true
+        is_login: true
       })
     }
-    
+
   },
-  close_login: function () {
+  close_login: function() {
     this.setData({
       is_login: false
     })
   },
-  userLogin: function () {
+  userLogin: function(e) {
     this.setData({
       is_login: false
     })
     wx.showLoading({
       title: '登录中',
     })
+    console.log(e.detail)
+    var un = JSON.parse(e.detail.rawData)
     var that = this
     try {
       wx.login({
-        success: function (res) {
+        success: function(res) {
           let code = res.code
           console.log(code)
-          wx.getUserInfo({
-            success: function (res) {
-              let tx = res.userInfo.avatarUrl
-              let nn = res.userInfo.nickName
-              app.request({
-                url: 'https://t6.9026.com/api/furniture/service_login',
-                method: 'POST',
-                data: {
-                  code: code,
-                  avatar: tx,
-                  nickName: nn,
-                  store_id: 1
-                },
-                success: function (res) {
-                  console.log(res.data)
-                  wx.setStorageSync("token", res.data.data.token)
-                  wx.setStorageSync('key', res.data.data.session_key)
-                  wx.setStorageSync("user", res.data.data.user);
-                  wx.setStorageSync('ma', 0)
-                  wx.setStorageSync('pa', 0)
-                  wx.setStorageSync('us', 0)
-                  wx.hideLoading();
-                  wx.showToast({
-                    title: '登录成功',
-                    icon: 'success',
-                    duration: 1000,
-                    // success:()=>{
-                    //   wx.redirectTo({
-                    //     url: '../make/make',
-                    //   })
-                    // }
-                  })
-                }
+          let tx = un.avatarUrl
+          let nn = un.nickName
+          app.request({
+            url: 'https://t6.9026.com/api/furniture/service_login',
+            method: 'POST',
+            data: {
+              code: code,
+              avatar: tx,
+              nickName: nn,
+              store_id: 1
+            },
+            success: function(res) {
+              console.log(res.data)
+              wx.setStorageSync("token", res.data.data.token)
+              wx.setStorageSync('key', res.data.data.session_key)
+              wx.setStorageSync("user", res.data.data.user);
+              wx.setStorageSync('ma', 0)
+              wx.setStorageSync('pa', 0)
+              wx.setStorageSync('us', 0)
+              wx.hideLoading();
+              wx.showToast({
+                title: '登录成功',
+                icon: 'success',
+                duration: 1000,
+                
               })
             }
           })

+ 3 - 3
Furniture/page/homePage/homePage.wxml

xqd
@@ -108,10 +108,10 @@
     <view wx:if="{{takeup}}">
 
      <block wx:for="{{news}}" wx:key="{{index1}}" wx:for-item="item" wx:for-index="index1" >
-      <view class="relative" style='height:200rpx;border-bottom: 2rpx #D3D3D3 solid' bindtap='toDetail'>
+      <view class="relative" style='height:200rpx;border-bottom: 2rpx #D3D3D3 solid' catchtap='todetail' data-id='{{item.id}}'>
         <image class="pic_background" src="../../images/xinpingfabukuangjia.png"></image>
-        <view class="container1" style='width:400rpx;color:#000;font-size:33rpx;margin-left:30rpx'>
-          {{ item.title}}
+        <view class="container1" style='width:400rpx;height:200rpx;color:#000;font-size:33rpx;margin-left:30rpx'>
+          <text class='news_title'>{{item.title}}</text>
         </view>
         <view class="container1" style='color:#dcdcdc;font-size:26rpx;margin-left:180rpx;margin-top:130rpx'>
           {{ item.viewed}}次浏览

+ 9 - 1
Furniture/page/homePage/homePage.wxss

xqd
@@ -102,7 +102,15 @@
   text-align: center;
   margin-top: 10rpx;
 }
-
+.news_title{
+   display: -webkit-box;
+   word-break: break-all;
+   text-overflow: ellipsis;
+   font-size: 33rpx;
+   overflow: hidden;
+   -webkit-box-orient: vertical;
+   -webkit-line-clamp:2;
+}
 .bus-bg{ width: 100%; background: white; padding-bottom: 10rpx; }
 .bus{ width: 100%; margin: 0px auto; padding-top:10px; display: flex; justify-content:left; flex-wrap: wrap; }
 .bus-item{ width: 25%; height: 150rpx; text-align: center; }

+ 47 - 48
Furniture/page/user/user.js

xqd xqd
@@ -5,37 +5,37 @@ Page({
    * 页面的初始数据
    */
   data: {
-    is_login:'false',
-    nikename:'',
-    avatar:'',
+    is_login: 'false',
+    nikename: '',
+    avatar: '',
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
+  onLoad: function(options) {
 
   },
 
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
-  onReady: function () {
+  onReady: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
+  onShow: function() {
     var that = this
-    if(wx.getStorageSync('user')){
+    if (wx.getStorageSync('user')) {
       that.setData({
-        is_login:false,
+        is_login: false,
         nikename: wx.getStorageSync('user').username,
         avatar: wx.getStorageSync('user').avatar
       })
-    }else{
+    } else {
       that.setData({
         is_login: true
       })
@@ -45,86 +45,85 @@ Page({
   /**
    * 生命周期函数--监听页面隐藏
    */
-  onHide: function () {
+  onHide: function() {
 
   },
 
   /**
    * 生命周期函数--监听页面卸载
    */
-  onUnload: function () {
+  onUnload: function() {
 
   },
 
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
-  onPullDownRefresh: function () {
+  onPullDownRefresh: function() {
 
   },
 
   /**
    * 页面上拉触底事件的处理函数
    */
-  onReachBottom: function () {
+  onReachBottom: function() {
 
   },
 
   /**
    * 用户点击右上角分享
    */
-  onShareAppMessage: function () {
+  onShareAppMessage: function() {
 
   },
-  close_login: function () {
+  close_login: function() {
     this.setData({
       is_login: false
     })
   },
-  userLogin: function () {
+  userLogin: function(e) {
     this.setData({
       is_login: false
     })
     wx.showLoading({
       title: '登录中',
     })
+    console.log(e.detail)
+    var un = JSON.parse(e.detail.rawData)
     var that = this
     try {
       wx.login({
-        success: function (res) {
+        success: function(res) {
           let code = res.code
           console.log(code)
-          wx.getUserInfo({
-            success: function (res) {
-              let tx = res.userInfo.avatarUrl
-              let nn = res.userInfo.nickName
-              app.request({
-                url: 'https://t6.9026.com/api/furniture/service_login',
-                method: 'POST',
-                data: {
-                  code: code,
-                  avatar: tx,
-                  nickName: nn,
-                  store_id: 1
-                },
-                success: function (res) {
-                  console.log(res.data)
-                  wx.setStorageSync("token", res.data.data.token)
-                  wx.setStorageSync('key', res.data.data.session_key)
-                  wx.setStorageSync("user", res.data.data.user);
-                  wx.setStorageSync('ma', 0)
-                  wx.setStorageSync('pa', 0)
-                  wx.setStorageSync('us', 0)
-                  wx.hideLoading();
-                  wx.showToast({
-                    title: '登录成功',
-                    icon: 'success',
-                    duration: 1000,
-                    // success:()=>{
-                    //   wx.redirectTo({
-                    //     url: '../make/make',
-                    //   })
-                    // }
+          let tx = un.avatarUrl
+          let nn = un.nickName
+          app.request({
+            url: 'https://t6.9026.com/api/furniture/service_login',
+            method: 'POST',
+            data: {
+              code: code,
+              avatar: tx,
+              nickName: nn,
+              store_id: 1
+            },
+            success: function(res) {
+              console.log(res.data)
+              wx.setStorageSync("token", res.data.data.token)
+              wx.setStorageSync('key', res.data.data.session_key)
+              wx.setStorageSync("user", res.data.data.user);
+              wx.setStorageSync('ma', 0)
+              wx.setStorageSync('pa', 0)
+              wx.setStorageSync('us', 0)
+              wx.hideLoading();
+              wx.showToast({
+                title: '登录成功',
+                icon: 'success',
+                duration: 1000,
+                success: () => {
+                  that.setData({
+                    nikename: wx.getStorageSync('user').username,
+                    avatar: wx.getStorageSync('user').avatar
                   })
                 }
               })

+ 1 - 1
Furniture/pages/login/login.wxml

xqd
@@ -7,7 +7,7 @@
         <view class="txt">
             <open-data class="wxAvatarUrl" type="userAvatarUrl"></open-data>
             <text>首次使用需允许授权</text>
-            <button bindgetuserinfo="updateUserInfo" bindtap="userLogin" lang="zh_CN" openType="getUserInfo">确认授权</button>
+            <button bindgetuserinfo='userLogin'  lang="zh_CN" openType="getUserInfo">确认授权</button>
         </view>
     </view>
     <view class="floatBox floatBoxBg" style="display:block;"></view>

+ 1 - 1
Furniture/project.config.json

xqd
@@ -4,7 +4,7 @@
 		"ignore": []
 	},
 	"setting": {
-		"urlCheck": false,
+		"urlCheck": true,
 		"es6": true,
 		"postcss": true,
 		"minified": true,