liyongli 1 ano atrás
pai
commit
01d2899e8c

+ 2 - 1
app.json

@@ -10,7 +10,8 @@
     "pages/userData/index",
     "pages/webview/index",
     "pages/sph/index",
-    "pages/modify/index"
+    "pages/modify/index",
+    "pages/login/index"
   ],
   "window": {
     "navigationBarTextStyle": "white",

+ 19 - 3
pages/application/index.js

@@ -131,6 +131,11 @@ Page({
       article,
       brief
     } = this.data;
+    const Authorization = wx.getStorageSync('token') || undefined;
+    if (Authorization) return wx.showToast({
+      title: '请登录后在提交',
+      icon: "none"
+    })
     let baseArea = this.data.multiArray[0][this.data.multiIndex[0]] + this.data.multiArray[1][this.data.multiIndex[1]];
     if (this.data.multiArray[2] && this.data.multiArray[2][this.data.multiIndex[2]]) baseArea += this.data.multiArray[2][this.data.multiIndex[2]]
     if (isNaN(phone)) return wx.showToast({
@@ -148,7 +153,7 @@ Page({
       filePath: local_image_url,
       name: 'file',
       header: {
-        Authorization: wx.getStorageSync('token') || undefined,
+        Authorization
       },
       formData: {
         name: author,
@@ -167,7 +172,7 @@ Page({
         wx.hideLoading()
       },
       success: res => {
-        if(res.statusCode !== 200) {
+        if (res.statusCode !== 200) {
           const data = JSON.parse(res.data || "{}")
           wx.showToast({
             title: data.message || "保存失败",
@@ -192,6 +197,14 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
+    if (!wx.getStorageSync('phone')) {
+      const pages = getCurrentPages();
+      const thisPage = pages[pages.length - 1];
+      wx.reLaunch({
+        url: "/pages/login/index?backurl=" + thisPage.route
+      })
+      return
+    }
     this.getArea();
 
   },
@@ -242,6 +255,9 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage() {
-
+    return {
+      title: __wxConfig.accountInfo.nickname,
+      path: "/pages/index/index"
+    }
   }
 })

+ 7 - 1
pages/application/index.wxml

@@ -45,13 +45,19 @@
             <van-radio name="其他" checked-color="#91725D">其他</van-radio>
           </van-radio-group>
         </view>
+        <view class="top_label">题材</view>
+        <view class="top_input" style="background-color: #ffffff00;height: auto;">
+          展现黄帝文化、弘扬中华民族优秀文化与传统道德
+        </view>
 
         <image wx:if="{{!local_image_url}}" bind:tap="upload" src="https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/upload.png" style="{{'height:' + uploadheight + 'px;width:600rpx;margin-top: 66rpx'}}" bindload="uploadimg" />
         <view wx:if="{{local_image_url}}" class="imgP" bind:tap="delimg">
           <image src="{{local_image_url}}" style="width: 100px; height: 100px;" />
           <image class="del" src="../../images/del.png" style="width: 30px;height: 30px" />
         </view>
-
+        <view style="color: #999999;">
+          (每个项目仅提交1件作品,提交的作品图片须为清晰的作品正面照,图片不小于1M且不大于5M。)
+        </view>
         <view style="padding-top: 15rpx;text-align: center;">
           <van-button round type="info" bind:tap="updata" size="large" color="#91725D">提交</van-button>
         </view>

+ 2 - 1
pages/downZS/index.json

@@ -3,6 +3,7 @@
   "usingComponents": {
     "Container": "../../component/container/index",
     "van-icon": "@vant/weapp/icon/index",
-    "van-button": "@vant/weapp/button/index"
+    "van-button": "@vant/weapp/button/index",
+    "van-empty": "@vant/weapp/empty/index"
   }
 }

+ 3 - 2
pages/downZS/index.wxml

@@ -1,12 +1,13 @@
 <!--pages/downZS/index.wxml-->
 <view class="downZS">
   <Container>
-    <swiper indicator-dots="{{true}}"	indicator-color="#ffffff"	indicator-active-color="#91725d" style="height:575rpx" 	bindchange="change">
+    <swiper wx:if="{{ls_url.length}}" indicator-dots="{{true}}"	indicator-color="#ffffff"	indicator-active-color="#91725d" style="height:575rpx" 	bindchange="change">
       <swiper-item wx:for="{{ls_url}}" wx:key="index" style="padding-top: 15rpx;">
         <image class="imge" src="{{item.url}}" mode="aspectFit"></image>
       </swiper-item>
     </swiper>
-    <van-button block round class="btn" color="#91725d" size="normal" bind:tap="download">
+    <van-empty wx:if="{{!ls_url.length}}" description="暂无数据" />
+    <van-button wx:if="{{ls_url.length}}" block round class="btn" color="#91725d" size="normal" bind:tap="download">
       <van-icon name="down" />
       保存证书
     </van-button>

+ 113 - 0
pages/login/index.js

@@ -0,0 +1,113 @@
+// pages/login/index.js
+import {
+  ajax
+} from "../../utils/util";
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    userUrl: wx.getStorageSync('userUrl') || "",
+    phone: wx.getStorageSync('phone') || false
+  },
+
+  chooseavatar(e) {
+    wx.setStorageSync('userUrl', e.detail.avatarUrl)
+    this.setData({
+      userUrl: e.detail.avatarUrl,
+    })
+  },
+
+  getphone(e) {
+    ajax({
+      urlType: "apiurl",
+      api: "/wx/getuserphonenumber?code=" + e.detail.code
+    }).then(res => {
+      if (res.code !== 0) return wx.showToast({
+        title: res.message || '请求失败',
+        icon: 'none'
+      })
+      wx.setStorageSync('token', res.data.token);
+      wx.setStorageSync('userGroup', res.data.userGroup);
+      wx.setStorageSync('phone', res.data.phoneInfo.phoneNumber);
+      this.setData({
+        phone: res.data.phoneInfo.phoneNumber
+      })
+    })
+  },
+
+  submit() {
+    const { phone, userUrl } = this.data;
+    if(!phone || !userUrl) return wx.showToast({
+      title: '请获取手机号或头像',
+      icon: 'none'
+    })
+    wx.showLoading({
+      title: '登录中',
+    });
+    const t = setTimeout(() => {
+      clearTimeout(t);
+      wx.hideLoading();
+      wx.switchTab({
+        url: this.backUrl,
+      })
+    }, 300);
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    options.backurl && (this.backUrl = '/' + options.backurl);
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 8 - 0
pages/login/index.json

@@ -0,0 +1,8 @@
+{
+  "navigationBarTitleText": "登录",
+  "usingComponents": {
+    "van-field": "@vant/weapp/field/index",
+    "van-cell-group": "@vant/weapp/cell-group/index",
+    "van-button": "@vant/weapp/button/index"
+  }
+}

+ 20 - 0
pages/login/index.wxml

@@ -0,0 +1,20 @@
+<!--pages/login/index.wxml-->
+<view class="index_main">
+  <image class="user" src="{{ userUrl || '../../images/user.png' }}" />
+  <van-cell-group inset>
+    <van-field value="{{phone || '获取手机号'}}" label="" disabled border="{{ false }}" use-button-slot="{{!phone}}">
+      <van-button bind:getphonenumber="getphone" openType="getPhoneNumber" color="#91725D" slot="button" size="small">
+        获取手机号
+      </van-button>
+    </van-field>
+    <van-field label="" disabled value="获取头像" border="{{ false }}" use-button-slot="{{!userUrl}}">
+      <van-button slot="button" size="small" color="#91725D" open-type="chooseAvatar" bind:chooseavatar="chooseavatar">
+        获取头像
+      </van-button>
+    </van-field>
+    <van-button block color="#91725D" bind:tap="submit">
+      登录
+    </van-button>
+  </van-cell-group>
+
+</view>

+ 23 - 0
pages/login/index.wxss

@@ -0,0 +1,23 @@
+/* pages/login/index.wxss */
+.index_main {
+  background-image: url("https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/us-top.png");
+  background-repeat: no-repeat;
+  background-size: 100%;
+  padding-top: 530rpx;
+  padding-bottom: 45rpx;
+  box-sizing: border-box;
+  color: #A57044;
+  position: relative;
+  min-height: 100vh;
+}
+
+.user {
+  width: 202rpx;
+  height: 202rpx;
+  position: absolute;
+  top: 235rpx;
+  left: 50%;
+  transform: translateX(-50%);
+  padding: 0;
+  border-radius: 50%;
+}

+ 9 - 23
pages/us/index.js

@@ -12,28 +12,12 @@ Page({
     userGroup: wx.getStorageSync('userGroup') || '',
     baseUrl: __wxConfig.accountInfo.icon || ""
   },
-  getphone(e) {
-    ajax({
-      urlType: "apiurl",
-      api: "/wx/getuserphonenumber?code=" + e.detail.code
-    }).then(res => {
-      if(res.code !== 0) return wx.showToast({
-        title: res.message || '请求失败',
-        icon: 'none'
-      })
-      wx.setStorageSync('token', res.data.token);
-      wx.setStorageSync('userGroup', res.data.userGroup);
-      wx.setStorageSync('phone', res.data.phoneInfo.phoneNumber);
-      this.setData({
-        phone: res.data.phoneInfo.phoneNumber
-      })
-    })
-  },
 
-  chooseavatar(e) {
-    wx.setStorageSync('userUrl', e.detail.avatarUrl)
-    this.setData({
-      userUrl: e.detail.avatarUrl,
+  toLogin(){
+    const pages = getCurrentPages();
+    const thisPage = pages[pages.length - 1];
+    wx.reLaunch({
+      url: "/pages/login/index?backurl=" + thisPage.route
     })
   },
 
@@ -41,7 +25,6 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
   },
 
   /**
@@ -90,6 +73,9 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage() {
-
+    return {
+      title: __wxConfig.accountInfo.nickname,
+      path: "/pages/index/index"
+    }
   }
 })

+ 2 - 5
pages/us/index.wxml

@@ -1,10 +1,7 @@
 <!--pages/us/index.wxml-->
 <scroll-view class="scrollarea" scroll-y type="list">
   <view class="index_main">
-    <button wx:if="{{!userUrl}}" class="user" open-type="chooseAvatar" bindchooseavatar="chooseavatar">
-      <image style="width: 202rpx;height:202rpx;" src="../../images/user.png" />
-    </button>
-    <image class="user" wx:else src="{{ userUrl }}" />
+    <image class="user" src="{{ userUrl || '../../images/user.png' }}" />
     <Container wx:if="{{phone}}">
       <van-cell is-link url="/pages/userData/index"  border="{{ false }}" >
         <view slot="title" class="title">
@@ -33,7 +30,7 @@
     </Container>
 
     <Container wx:if="{{!phone}}">
-      <van-button bind:getphonenumber="getphone" openType="getPhoneNumber" block>获取手机号</van-button>
+      <van-button block bind:tap="toLogin">登录</van-button>
     </Container>
 
     <image class="zwh" src="https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/us-kf.png" show-menu-by-longpress="{{true}}" mode="aspectFit" />