Rorschach 4 years ago
parent
commit
70c5ed105e

+ 3 - 1
app.json

@@ -1,6 +1,7 @@
 {
   "pages": [
     "pages/index/index",
+    "pages/login/login",
     "pages/social/works/works",
     "pages/social/insideMessage/insideMessage",
     "pages/social/replyDetail/replyDetail",
@@ -21,7 +22,8 @@
     "pages/user/myworks/myworks",
     "pages/vipPage/vip/vip",
     "pages/vipPage/vipCode/vipCode",
-    "pages/vipPage/wechat/wechat"
+    "pages/vipPage/wechat/wechat",
+    "pages/grade/grade"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 89 - 0
pages/grade/grade.js

@@ -0,0 +1,89 @@
+// pages/grade/grade.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+    // 修改年级
+    changeGrade: function (e) {
+      const grade = e.target.dataset.code;
+      wx.setStorageSync('grade', grade)
+      this.setData({
+        grade: grade
+      })
+  
+      let gradeText = '一年级';
+      switch (e.target.dataset.code) {
+        case '0':
+          gradeText = '学前班';
+          break;
+        case '1':
+          gradeText = '一年级';
+          break;
+        case '2':
+          gradeText = '二年级';
+          break;
+        case '3':
+          gradeText = '三年级';
+          break;
+      }
+    },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
pages/grade/grade.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 22 - 0
pages/grade/grade.wxml

@@ -0,0 +1,22 @@
+<!--pages/grade/grade.wxml-->
+<view class="change_grade">
+  <view class="change_brage_wrapper">
+    <text class="title">分龄选择</text>
+    <view class="change_row">
+      <view class="change_item" bindtap="changeGrade" data-code="0">
+        学前班
+      </view>
+      <view class="change_item" bindtap="changeGrade" data-code="1">
+        一年级
+      </view>
+    </view>
+     <view class="change_row">
+      <view class="change_item" bindtap="changeGrade" data-code="2">
+        二年级
+      </view>
+      <view class="change_item" bindtap="changeGrade" data-code="3">
+        三年级
+      </view>
+    </view>
+  </view>
+</view>

+ 1 - 0
pages/grade/grade.wxss

@@ -0,0 +1 @@
+/* pages/grade/grade.wxss */

+ 93 - 103
pages/index/index.js

@@ -74,7 +74,7 @@ Page({
     commentNum: 0,
     followPageNo: 1,
     followPageSize: 6,
-    coursesData:[]
+    coursesData: []
   },
   jurisdiction: function () {
     //隐藏弹框
@@ -123,9 +123,12 @@ Page({
     getOpenidSessionKey((res) => {}, (error) => {
       console.log('获取信息失败', error)
       wx.setStorageSync('userSourseType', 'normal')
-      this.setData({
-        hide: !this.data.hide
-      })
+      // this.setData({
+      //   hide: !this.data.hide
+      // })
+      wx.navigateTo({
+        url: `../../pages/login/login`
+      });
       return;
     });
     console.log('继续')
@@ -153,19 +156,12 @@ Page({
 
 
   },
-  onLoad: function (options) {
-    this.uid = wx.getStorageSync('uid');
-    wx.getSystemInfo({
-      success: (res) => {
-        console.log('系统', res)
-        this.setData({
-          winH: res.windowHeight,
-          devicePixelRatio: res.pixelRatio
-        });
-      }
-    });
+  showPage: function(){
+    let options = this.data.options;
     if (options.index) {
       this.updateData(options.index)
+    } else {
+      this.updateData(0)
     }
     setTimeout(() => {
       if (wx.getStorageSync('uid')) {
@@ -203,51 +199,51 @@ Page({
       }
     }, 2800)
   },
-  onShow: function () {
-    wx.setNavigationBarTitle({
-      title: '小学语文朗读配音'
-    })
-    // this.init();
-    getOpenidNoLogin((res) => {
-      let winH = this.data.winH * this.data.devicePixelRatio;
-      // let minusNumber = 860;
-      let minusNumber = (winH * 920) / 1206;
-
-      // if(winH < 510){
-      //   minusNumber = 400;
-      // } 
-      // let nextMargin = parseInt(winH *(1 - (834 / winH)) );
-      let nextMargin = parseInt(winH - minusNumber);
-
-      console.log(123, winH)
-      console.log(321, nextMargin)
-      this.setData({
-        nextMargin: nextMargin + 'rpx'
-      })
-      app.globalData.nextMargin = nextMargin;
-      this.updateData(0)
-      // hotInit(this)
-    }, (error) => {
-      // console.log(error)
+  onLoad: function (options) {
+    this.uid = wx.getStorageSync('uid');
+    let grade = wx.getStorageSync('grade');
 
-      wx.setStorageSync('userSourseType', 'normal')
+    let user = wx.getStorageSync('user');
+    if(!this.uid || !grade){
       this.setData({
-        hide: !this.data.hide
+        isGradeShow: true,
+        options
       })
+      console.log('没有uid 也不是游客,需要去授权')
       return;
-    });
-    if (this.data.myIndex === 0) {
-      // 从修改信息页面退回
-      // this.getUserWorksInfo(true);
     }
-    this.setData({
-      statusbarobj: {
-        isshowbtn: true, //是否显示按钮
-        title: "小学语文课文朗读", //标题
-      },
-      grade: wx.getStorageSync('grade') ? wx.getStorageSync('grade') : '2'
+    this.showPage()
+    if(this.uid && !user){
+      console.log('游客状态')
+    }
+    if(this.uid && user){
+      console.log('登陆状态')
+    }
+    wx.getSystemInfo({
+      success: (res) => {
+        console.log('系统', res)
+
+        let winH = res.windowHeight * res.pixelRatio;
+        let minusNumber = (winH * 920) / 1206;
+        let nextMargin = parseInt(winH - minusNumber);
+        app.globalData.nextMargin = nextMargin;
 
+        this.setData({
+          winH: winH,
+          devicePixelRatio: res.pixelRatio,
+          nextMargin: nextMargin + 'rpx'
+
+        });
+
+      }
+    });
+
+  },
+  onShow: function () {
+    wx.setNavigationBarTitle({
+      title: '小学语文朗读配音'
     })
+
   },
 
   onHide: function () {
@@ -263,37 +259,37 @@ Page({
       uid
     ).success((res) => {
       // 点击切换按钮时 只刷新我的课程和未读消息 官方推荐和热门不加载
- /*      const recommendRes = res.data.data;
-      console.log(res)
-      recommendRes.hotReader.forEach(item => {
-        const temp = {};
-        temp.title = item.userRead ? item.userRead.title : '';
-        temp.img = item.userRead.iconImg;
-        temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
-        temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
-        temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-        temp.classId = item.userRead.lessonId;
-        temp.time = formatDate(item.userRead.gmtCreated, 3);
-        temp.avatar = item.user ? item.user.avatar : '';
-        temp.uid = item.user ? item.user.uid : '';
-        temp.url = item.userRead.originVideo;
-        temp.type = item.userRead.type;
-        // temp.avatar = item.user.avatar;
-        temp.nickName = item.user ? item.user.wechatName : '';
-        temp.id = item.userRead.id;
-        temp.isLike = item.isLike;
-        temp.isFavorite = item.isFavorites;
-        this.data.videoList.push(temp);
-      });
-      this.setData({
-        videoList: this.data.videoList
-      }) */
+      /*      const recommendRes = res.data.data;
+           console.log(res)
+           recommendRes.hotReader.forEach(item => {
+             const temp = {};
+             temp.title = item.userRead ? item.userRead.title : '';
+             temp.img = item.userRead.iconImg;
+             temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
+             temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
+             temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
+             temp.classId = item.userRead.lessonId;
+             temp.time = formatDate(item.userRead.gmtCreated, 3);
+             temp.avatar = item.user ? item.user.avatar : '';
+             temp.uid = item.user ? item.user.uid : '';
+             temp.url = item.userRead.originVideo;
+             temp.type = item.userRead.type;
+             // temp.avatar = item.user.avatar;
+             temp.nickName = item.user ? item.user.wechatName : '';
+             temp.id = item.userRead.id;
+             temp.isLike = item.isLike;
+             temp.isFavorite = item.isFavorites;
+             this.data.videoList.push(temp);
+           });
+           this.setData({
+             videoList: this.data.videoList
+           }) */
       this.getHotRecommendSecond(1, 5)
     })
   },
   // 获取热门作品 算法出来的
   getHotRecommendSecond: function (pageNo, pageSize) {
-    let grade = 'PRIMARY_FIRST_GRADE'
+    let grade = wx.getStorageSync('grade')
     httpRequestApi.getHotRecommendSecond(grade, pageNo, pageSize).success(res => {
       console.log(res)
       const recommendRes = res.data.data.list;
@@ -307,7 +303,7 @@ Page({
         temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
         temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
         temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-        temp.classId = item.userRead.exampleId ? item.userRead.exampleId :  1605097720036046;
+        temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
         temp.time = formatDate(item.userRead.gmtCreated, 3);
         temp.avatar = item.user.avatar;
         temp.profession = item.user.profession;
@@ -477,7 +473,7 @@ Page({
   // 获取我的朗读
   getMyRead: function () {
     httpRequestApi.myRead().success(res => {
-      console.log(123123,res)
+      console.log(123123, res)
       console.log('mydata', this.data.myData)
       const myList = res.data.data;
       if (myList.length === 0) return;
@@ -492,7 +488,7 @@ Page({
         temp.img = item.iconImg;
         temp.plays = item.playAmount;
         temp.likes = item.likeAmount;
-        temp.classId = item.userRead.exampleId ? item.userRead.exampleId :  1605097720036046;
+        temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
         temp.time = formatDate(item.gmtCreated, 3);
         temp.avatar = this.data.userInfo.avatar;
         temp.uid = this.uid;
@@ -538,7 +534,7 @@ Page({
       console.log('reply', res)
       const commentList = res.data.data.list;
       const commentNum = res.data.data.totalSize;
-      console.log('评论数量',commentNum)
+      console.log('评论数量', commentNum)
       commentList.forEach((item) => {
         const temp = {};
         temp.nickName = item.user.wechatName;
@@ -590,24 +586,18 @@ Page({
     wx.setStorageSync('grade', grade)
     this.setData({
       isGradeShow: false,
-      grade: grade
     })
-
-    let gradeText = '一年级';
-    switch (e.target.dataset.code) {
-      case '0':
-        gradeText = '学前班';
-        break;
-      case '1':
-        gradeText = '一年级';
-        break;
-      case '2':
-        gradeText = '二年级';
-        break;
-      case '3':
-        gradeText = '三年级';
-        break;
-    }
+    getOpenidNoLogin((res) => {
+      console.log('getOpenidNoLogin',res)
+      // 登录或注册完成 展示页面
+      this.showPage()
+    }, (error) => {
+      console.log('获取失败')
+      wx.setStorageSync('userSourseType', 'normal')
+      this.setData({
+        hide: !this.data.hide
+      })
+    },grade);
   },
 
   getFollowData: function () {
@@ -627,7 +617,7 @@ Page({
         temp.img = item.userRead.iconImg;
         temp.plays = item.userRead.playAmount ? item.userRead.playAmount : 0;
         temp.likes = item.userRead.likeAmount ? item.userRead.likeAmount : 0;
-        temp.classId = item.userRead.exampleId ? item.userRead.exampleId :  1605097720036046;
+        temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
         temp.time = formatDate(item.userRead.gmtCreated, 3);
         temp.avatar = item.user ? item.user.avatar : '';
         temp.uid = item.user ? item.user.uid : '';
@@ -655,13 +645,13 @@ Page({
       console.log('资源', res)
       this.setData({
         coursesData: res.data.data.list
-      },()=>{
+      }, () => {
         console.log(this.data.coursesData)
       })
     })
   },
   goToReading: function (e) {
-    console.log('去朗读',e)
+    console.log('去朗读', e)
     wx.navigateTo({
       url: `../../pages/main/reading/reading?id=${e.detail.activeId}`
     });

+ 11 - 44
pages/index/index.wxml

@@ -4,56 +4,33 @@
   <view class="change_brage_wrapper">
     <text class="title">分龄选择</text>
     <view class="change_row">
-      <view class="change_item" bindtap="changeGrade" data-code="0">
-        学前班
-      </view>
-      <view class="change_item" bindtap="changeGrade" data-code="1">
-        一年级
-      </view>
+      <view class="change_item" bindtap="changeGrade" data-code="PRIMARY_FIRST_GRADE">一年级</view>
+      <view class="change_item" bindtap="changeGrade" data-code="PRIMARY_SECOND_GRADE">二年级</view>
     </view>
-     <view class="change_row">
-      <view class="change_item" bindtap="changeGrade" data-code="2">
-        二年级
-      </view>
-      <view class="change_item" bindtap="changeGrade" data-code="3">
-        三年级
-      </view>
+    <view class="change_row">
+      <view class="change_item" bindtap="changeGrade" data-code="PRIMARY_THREE_GRADE">三年级</view>
+      <view class="change_item" bindtap="changeGrade" data-code="PRESCHOOL">学前班</view>
     </view>
   </view>
 </view>
 <view class="container">
-
   <!-- 引入组件 -->
   <!-- <import src="/component/group/group.wxml" /> -->
   <!-- <import src="/component/hot/hot.wxml" /> -->
   <!-- <import src="/component/follow/follow.wxml" /> -->
   <import src="/component/my/my.wxml" />
   <import src="/templates/courses/courses.wxml" />
- 
   <!-- 顶部导航 -->
-  <view class="top-tab">
+  <view class="top-tab" wx:if="{{!isGradeShow}}">
     <block wx:for="{{tab}}" wx:key="{{index}}">
       <view class="tabbar {{index == myIndex ? 'select':' '}}" bindtap="switcher" data-index="{{index}}">
         <text>{{item.name}}</text>
       </view>
     </block>
   </view>
-
-     <!-- 调用组件 -->
+  <!-- 调用组件 -->
   <template is="{{templates}}" wx:if="{{myIndex === 3 || myIndex === 2}}" data="{{myData: myData,coursesData:coursesData}}"></template>
-
-  <VideoSwiper 
-  wx:if="{{videoList.length > 0}}"
-  class="video-swiper" 
-  video-list="{{videoList}}" 
-  nextMargin="{{nextMargin}}"
-  isSwiper="{{isSwiper}}"
-  ifHeadTap="{{true}}"
-
-  bindopenComment="openComment"
-  bindheadTap="headTapHandler"
-  bindgoToReading="goToReading"
-  >
+  <VideoSwiper wx:if="{{videoList.length > 0}}" class="video-swiper" video-list="{{videoList}}" nextMargin="{{nextMargin}}" isSwiper="{{isSwiper}}" ifHeadTap="{{true}}" bindopenComment="openComment" bindheadTap="headTapHandler" bindgoToReading="goToReading">
     <!-- bindplay="onPlay"
   bindpause="onPause"
   bindtimeupdate="onTimeUpdate"
@@ -63,21 +40,11 @@
   bindprogress="onProgress"
   bindloadedmetadata="onLoadedMetaData" -->
   </VideoSwiper>
-
-
   <view class="comment_section" catchtap="commentTap" data-type="blank" wx:if="{{commentShow}}">
-  <Comment 
-  data-type="list"
-  commentId="{{commentId}}"
-  commentNum ="{{commentNum}}"
-  inputValue="{{inputValue}}"
-  bindsendReply = "sendReply"
-  />
-</view>
+    <Comment data-type="list" commentId="{{commentId}}" commentNum="{{commentNum}}" inputValue="{{inputValue}}" bindsendReply="sendReply" />
+  </view>
 </view>
-
-
- <!-- <MyToast /> -->
+<!-- <MyToast /> -->
 <view hidden="{{hide}}">
   <Dialog bindmyevent="jurisdiction" />
 </view>

+ 74 - 0
pages/login/login.js

@@ -0,0 +1,74 @@
+// pages/login/login.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+
+  onLoad: function (options) {
+
+  },
+  impower: function (e) {
+    console.log(e)
+    var myEventDetail = {} // detail对象,提供给事件监听函数
+    var myEventOption = {} // 触发事件的选项
+  },
+  touchMove: function(){
+    return false
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
pages/login/login.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 10 - 0
pages/login/login.wxml

@@ -0,0 +1,10 @@
+<!--pages/login/login.wxml-->
+<view class="dialog" catchtouchmove="touchMove">
+    <view class="dialog-contain">
+        <!-- <view class="title">微信授权</view> -->
+        <!-- <image class="head-bg" src="../../static/image/reader_logo.jpg" style="background: red;"></image> -->
+        <view class="text">使用您的微信登录</view>
+        <!-- <view class="shuoming">获得你的公开信息(昵称、头像等)</view> -->
+        <button class="btn"  open-type="getUserInfo" bindgetuserinfo="impower">登录</button>
+    </view>
+</view>

+ 70 - 0
pages/login/login.wxss

@@ -0,0 +1,70 @@
+.dialog {
+    position: fixed;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 100%;
+    background: rgba(0, 0, 0, .4);
+    z-index:9999;
+}
+
+.dialog-contain {
+    position: absolute;
+    left: 0;
+    top: -125rpx;
+    bottom: 0;
+    right: 0;
+    width: 70%;
+    height: 216rpx;
+    background: #fff;
+    margin: auto;
+    border-radius: 20rpx;
+    text-align: center;
+    box-sizing: border-box;
+    display: flex;
+    flex-direction: column;
+    justify-content: space-around;
+    align-items: center;
+    font-size: 32rpx;
+}
+
+.title {
+    font-size: 36rpx;
+    width: 100%;
+    border-bottom: 2rpx solid #ccc;
+    padding: 28rpx 0;
+}
+
+.head-bg {
+    width: 72rpx;
+    height: 72rpx;
+    border-radius: 50%;
+}
+
+.text {
+    font-size: 28rpx;
+    width: 95%;
+    /* border-bottom: 2rpx solid #ccc; */
+    padding: 28rpx 0;
+    margin-top:12rpx;
+}
+
+.shuoming {
+    font-size: 28rpx;
+    width: 100%;
+    border-bottom: 2rpx solid #ccc;
+    padding: 14rpx 0 46rpx 0;
+}
+
+.btn {
+    margin: 0;
+    padding: 0;
+    font-size: 36rpx;
+    color: #16B016;
+    background: #fff;
+    width: 100%;
+}
+
+.btn::after {
+    border: none;
+}

+ 35 - 2
pages/user/myEdit/myEdit.js

@@ -12,7 +12,30 @@ Page({
     occupations: [],
     date: '',
     msg: '',
-    nickname: ''
+    nickname: '',
+    gradeIndex:0,
+    gradeArray:['小学一年级','小学二年级','小学三年级','学前'],
+    gradeCode:'',
+    gradeObject: [{
+        code: 'PRIMARY_FIRST_GRADE',
+        name: '小学一年级'
+      },
+      {
+        code: 'PRIMARY_SECOND_GRADE',
+        name: '小学二年级'
+      },
+      {
+        code: 'PRIMARY_THREE_GRADE',
+        name: '小学三年级'
+      },
+      {
+        code: 'PRESCHOOL',
+        name: '学前'
+      }
+    ],
+  },
+  chooseGrade: function (e) {
+    console.log('选择年级')
   },
   saveNickName: function (e) {
     let nickname = e.detail.value;
@@ -82,7 +105,8 @@ Page({
       schoolName: e.detail.value.address || '',
       profession: e.detail.value.radioGroup2 || '',
       birthday: e.detail.value.picker || '',
-      avatar: this.data.user.avatar
+      avatar: this.data.user.avatar,
+      grade: this.data.gradeCode
     }
     httpRequestApi.settingUserInfo(data).success(res => {
       console.log(res.data.data); //修改资料成功后 调用 getUserInfo
@@ -95,6 +119,15 @@ Page({
       })
     });
   },
+  bindGradeChange: function(e){
+    console.log('年级选择',e)
+    this.setData({
+      gradeIndex: e.detail.value,
+      gradeCode: this.data.gradeObject[e.detail.value].code
+    },()=>{
+      console.log(this.data.gradeCode)
+    })
+  },
   /**
    * 生命周期函数--监听页面加载
    */

+ 11 - 9
pages/user/myEdit/myEdit.wxml

@@ -9,7 +9,7 @@
   <view class='setting-info'>
     <form bindsubmit="formSubmit" class='form'>
       <view class='nickname-box'>
-        <text class='setting-title'>宝贝昵称</text>
+        <text class='setting-title'>昵称</text>
         <view class='user-action'>
           <input name='nickname' class='nickname' type='text' maxlength="9" placeholder='{{user.nickName}}' placeholder-class='placeholderStyle' focus='{{ true }}' value='{{user.nickName}}' bindblur='saveNickName'></input>
         </view>
@@ -37,14 +37,16 @@
           <image src='../../../static/image/edit_new.png' class='icon'></image>
         </view>
       </view>
-      <view class='occupation-box'>
-        <text class='setting-title'>职业</text>
-        <radio-group name='radioGroup2' class="radio-group" bindchange="optionSetting">
-          <label class="radio" wx:for="{{ occupations }}" wx:key="{{ index }}">
-            <text class='sex-title'>{{ item.value }}</text>
-            <radio value="{{ item.value }}" checked="{{ item.checked }}" color='#fff' />
-          </label>
-        </radio-group>
+      <view class='birthday-box'>
+        <picker name='gradePicker'  value="{{gradeIndex}}" range="{{gradeArray}}" bindchange="bindGradeChange">
+          <view class="picker">
+            <text class='setting-title'>年级</text>
+            <text>{{ gradeArray[gradeIndex]}}</text>
+          </view>
+        </picker>
+        <view class='edit-img'>
+          <image src='../../../static/image/edit_new.png' class='icon'></image>
+        </view>
       </view>
       <view class='school-box'>
         <text class='setting-title'>学校</text>

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

@@ -28,6 +28,10 @@
   border-radius: 12rpx;
 }
 
+.nickname-box, .grade{
+  margin-top: 20rpx;
+}
+
 .user-action{
   /* min-width: 100rpx; */
   /* max-width: 400rpx; */

+ 1 - 1
pages/user/myworks/myworks.wxss

@@ -21,7 +21,7 @@ page {
   /* border-radius: 20rpx; */
   background: #FFFFFF;
   /* margin-top: 30rpx; */
-  margin: 20rpx 15rpx 20rpx;
+  margin: 20rpx 0 20rpx;
   display: flex;
   position: relative;
   box-sizing: border-box;

+ 9 - 5
utils/httpUtilNoLogin.js

@@ -22,7 +22,7 @@ function wxLogin(successcallback, failcallback) {
         success: function (res) {
             if (res.code) {
                 // 获取openid
-                console.log('code', res.code)
+                console.log('登录登录登录登录code', res.code)
                 let url = genAPIUrl('wx/user/openId')
                 let data = {
                     code: res.code
@@ -35,8 +35,9 @@ function wxLogin(successcallback, failcallback) {
     })
 }
 
-// 获取原来的 openid 和 session_key
-function getOpenidNoLogin(successcallback, failcallback) {
+// 获取原来的 openid 和 session_key 
+/* 新增参数grade 需要给游客添加grade参数 */
+function getOpenidNoLogin(successcallback, failcallback,grade) {
     if (wx.getStorageSync('user')) {
         successcallback(
             wx.getStorageSync('user'),
@@ -48,6 +49,7 @@ function getOpenidNoLogin(successcallback, failcallback) {
         return;
     }
     wxLogin(function (res) {
+        console.log('wx.login',res)
         if (res.data.code == 200) {
             let sessionKey = res.data.data.session_key;
             let openId = res.data.data.openid;
@@ -55,12 +57,14 @@ function getOpenidNoLogin(successcallback, failcallback) {
             // wx.setStorageSync('uid', '111')
             let url = genAPIUrl('wx/user/register');
             request.getInstance().method('POST').url(url).header({
-                'content-type': 'application/x-www-form-urlencoded'
+                'content-type': 'application/json'
             }).data({
-                openId
+                openId,
+                grade: grade? grade : 'PRIMARY_FIRST_GRADE'
             }).send().success((res) => {
                 if (res.data.code === 200) {
                     wx.setStorageSync('uid', res.data.data.uid)
+                    wx.setStorageSync('grade', res.data.data.grade)
                     successcallback(res)
                 }
             }).fail(() => {});