Kaynağa Gözat

更新

添加设置页面
unknown 4 yıl önce
ebeveyn
işleme
83430fb31b

+ 3 - 1
miniprogram/app.js

@@ -71,6 +71,8 @@ App({
   globalData: {
     userInfo: null,
     openId: null,
-    publisherId: null
+    publisherId: null,
+    noticeIndex: null,
+    vibrate: null
   }
 })

+ 3 - 1
miniprogram/app.json

@@ -1,5 +1,6 @@
 {
   "pages": [
+    "pages/setting/setting",
     "pages/main/main",
     "pages/activity/activity",
     "pages/myFollow/myFollow",
@@ -16,7 +17,8 @@
     "pages/aboutUs/aboutUs",
     "pages/opinion/opinion",
     "pages/myPublish/myPublish",
-    "pages/administratorSetting/administratorSetting"
+    "pages/administratorSetting/administratorSetting",
+    "pages/myColor/myColor"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 66 - 0
miniprogram/pages/myColor/myColor.js

@@ -0,0 +1,66 @@
+// miniprogram/pages/myColor/myColor.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 3 - 0
miniprogram/pages/myColor/myColor.json

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

+ 2 - 0
miniprogram/pages/myColor/myColor.wxml

@@ -0,0 +1,2 @@
+<!--miniprogram/pages/myColor/myColor.wxml-->
+<text>miniprogram/pages/myColor/myColor.wxml</text>

+ 1 - 0
miniprogram/pages/myColor/myColor.wxss

@@ -0,0 +1 @@
+/* miniprogram/pages/myColor/myColor.wxss */

+ 36 - 0
miniprogram/pages/setting/setting.js

@@ -0,0 +1,36 @@
+// miniprogram/pages/setting/setting.js
+const app = getApp()
+
+Page({
+  data:{
+    noticeIndex:0,
+    noticeForm:['数字','红点','不显示'],
+    vibrate: false
+  },
+
+  myColor: function() {
+    wx.navigateTo({
+      url: '/pages/myColor/myColor'
+    })
+  },
+
+  noticeIndexChange: function(e) {
+    this.setData({
+      noticeIndex: e.detail.value
+    })
+    app.globalData.noticeIndex = e.detail.value
+  },
+
+  vibrateChange: function(e) {
+    this.setData({
+      vibrate: e.detail.value
+    })
+    app.globalData.vibrate = e.detail.value
+  },
+
+  onLoad: function() {
+    this.data.noticeIndex = app.globalData.noticeIndex
+    this.data.vibrate = app.globalData.vibrate
+  }
+  
+})

+ 3 - 0
miniprogram/pages/setting/setting.json

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

+ 32 - 0
miniprogram/pages/setting/setting.wxml

@@ -0,0 +1,32 @@
+  <view class="btn block-background-color" hover-class="btn-hover" bindtap="myColor">
+    <image class="btn-icon" mode="aspectFit" src="/images/user/follow.png"></image>
+    <view class="btn-text primary-text">主题颜色设置</view>
+    <view class="btn-arrow secondary-text">></view>
+  </view>
+
+  <view class="line"></view>
+
+  <picker class="btn block-background-color" hover-class="btn-hover" bindchange="noticeIndexChange" value="{{noticeIndex}}" range="{{noticeForm}}">
+    <image class="btn-icon" mode="aspectFit" src="/images/user/question.png"></image>
+    <view class="btn-text primary-text">消息通知形式</view>
+    <view class="btn-arrow secondary-text">{{noticeForm[noticeIndex]}}</view>
+  </picker>
+
+  <view class="gap"></view>
+
+  <view class="btn block-background-color" hover-class="btn-hover">
+    <image class="btn-icon" mode="aspectFit" src="/images/user/setting.png"></image>
+    <view class="btn-text primary-text">收到消息振动</view>
+    <switch class="btn-arrow secondary-text" checked="{{vibrate}}" bindchange="vibrateChange"/>
+  </view>
+
+  <view class="line"></view>
+
+  <view class="btn block-background-color" hover-class="btn-hover"  bindtap="opinion">
+    <image class="btn-icon" mode="aspectFit" src="/images/user/feedback.png"></image>
+    <view class="btn-text primary-text">退出登录</view>
+    <view class="btn-arrow secondary-text">></view>
+  </view>
+
+  <view class="gap"></view>
+

+ 69 - 0
miniprogram/pages/setting/setting.wxss

@@ -0,0 +1,69 @@
+/* components/user/user.wxss */
+.card {
+  height: 300rpx;
+}
+
+.avatar {
+  position: absolute;
+  top: 50rpx;
+  left: 50rpx;
+  height: 200rpx;
+  width: 200rpx;
+  border-radius: 20%;
+}
+
+.nickname {
+  position: absolute;
+  font-size: 50rpx;
+  line-height: 50rpx;
+  top: 100rpx;
+  left: 300rpx;
+}
+
+.location {
+  position: absolute;
+  font-size: 27rpx;
+  line-height: 30rpx;
+  top: 175rpx;
+  left: 300rpx;
+}
+
+.gap {
+  height: 20rpx;
+}
+
+.line {
+  height: 5rpx;
+}
+
+.btn {
+  height: 100rpx;
+}
+
+.btn-hover {
+  background: #c0c0c0;
+}
+
+.btn-icon {
+  position: relative;
+  float: left;
+  top: 28rpx;
+  left: 35rpx;
+  height: 44rpx;
+  width: 44rpx;
+}
+
+.btn-text {
+  position: relative;
+  float: left;
+  left: 50rpx;
+  line-height: 100rpx;
+  font-size: 35rpx;
+}
+
+.btn-arrow {
+  position: relative;
+  float: right;
+  right: 40rpx;
+  line-height: 100rpx;
+}

+ 6 - 0
miniprogram/pages/user/user.js

@@ -36,6 +36,12 @@ Page({
     })
   },
 
+  setting:function(){
+    wx.navigateTo({
+      url: '/pages/setting/setting',
+    })
+  },
+
   myQuestion:function(){
     wx.navigateTo({
       url: '/pages/myQuestion/myQuestion',

+ 1 - 1
miniprogram/pages/user/user.wxml

@@ -25,7 +25,7 @@
 
   <view class="gap"></view>
 
-  <view class="btn block-background-color" hover-class="btn-hover">
+  <view class="btn block-background-color" hover-class="btn-hover" bindtap="setting">
     <image class="btn-icon" mode="aspectFit" src="/images/user/setting.png"></image>
     <view class="btn-text primary-text">设置</view>
     <view class="btn-arrow secondary-text">></view>