Ver Fonte

refactor:实名认证页面修改

zhanghui há 2 anos atrás
pai
commit
881e4fce97

+ 6 - 5
common/js/env.js

@@ -1,12 +1,13 @@
 "use strict";
+
+// let baseUrl = `https://jje.admin.xinyuekj.com.cn`
+// let baseUrl = `http://127.0.0.1:9000`
+let baseUrl = `http://192.168.1.150:8080`
+
 // 变量可自行添加修改
 export default { //存放变量的容器
-
 	appid: '__UNI__1EEA945',
-	// baseUrl: 'https://recruit.gzzzyd.com/api'
-	baseUrl: 'http://192.168.1.192:8080',
-	// baseUrl: 'https://jje.admin.xinyuekj.com.cn',
-
+	baseUrl,
 	uploadUrl: '/v1/file/put-file'
 
 }

+ 3 - 0
common/js/request.js

@@ -30,6 +30,9 @@ function service(options = {}) {
 			}
 		};
 		options.fail = (err) => {
+
+			console.log(err)
+
 			// 请求失败弹窗
 			uni.showToast({
 				icon: 'none',

+ 2 - 0
main.js

@@ -6,6 +6,8 @@ import api from './common/js/api'
 // 通用方法
 // import commonUtils from "./common/js/commonUtils.js"
 
+console.log(`process`, process.envenv)
+
 import uView from "uview-ui";
 const baseUrl = 'https://jje.admin.xinyuekj.com.cn/';
 Vue.use(uView);

+ 1 - 0
mm/.npmignore

@@ -0,0 +1 @@
+httpData/

+ 19 - 0
mm/api/index.js

@@ -0,0 +1,19 @@
+const { wrapApiData } = require(`../util.js`)
+
+/** @type {import('mockm/@types/config').Config} */
+module.exports = util => {
+  const {
+    libObj: { mockjs },
+  } = util
+  return {
+    api: {
+      // 创建接口并使用 mockjs 生成数据
+      'get /api/test': wrapApiData(mockjs.mock({
+        'data|3-7': [{
+          userId: `@id`,
+          userName: `@cname`,
+        }],
+      })),
+    },
+  }
+}

+ 19 - 0
mm/apiWeb.json

@@ -0,0 +1,19 @@
+{
+  "paths": {
+    "/business/wechat/order/common": {
+      "post": {
+        "responses": {
+          "200": {
+            "example": {
+              "useDataType": "custom",
+              "custom": "(req, res) => {\nres.set({\n  \"transfer-encoding\": \"chunked\",\n  \"content-type\": \"application/json\",\n  \"date\": \"Wed, 27 Sep 2023 11:22:28 GMT\",\n  \"connection\": \"close\"\n})\nres.json({\n  \"code\": 200,\n  \"msg\": \"操作成功\",\n  \"data\": {\n    \"orderNo\": \"20230927192227238\",\n    \"subOrderNo\": null\n  }\n})\n}"
+            }
+          }
+        }
+      }
+    }
+  },
+  "disable": [
+    "post /business/wechat/order/common"
+  ]
+}

+ 6 - 0
mm/httpData/.gitignore

@@ -0,0 +1,6 @@
+openApiHistory/
+request/
+db.json
+httpHistory.json
+log.err.txt
+store.json

+ 66 - 0
mm/mm.config.js

@@ -0,0 +1,66 @@
+const api = require(`./api/index.js`)
+const { wrapApiData } = require(`./util.js`)
+
+/**
+ * 配置说明请参考文档:
+ * https://hongqiye.com/doc/mockm/config/option.html
+ * @type {import('mockm/@types/config').Config}
+ */
+module.exports = util => {
+  return {
+    guard: false,
+    port: 9000,
+    testPort: 9005,
+    replayPort: 9001,
+    watch: [`./api/`],
+    apiWeb: `./apiWeb.json`,
+    proxy: {
+      '/': `http://192.168.1.192:8080/`, // 后端接口主域
+      '/anything/intercept': [`origin`, `127.0.0.1`], // 修改接口返回的数据
+    },
+    api: {
+      // 在其他文件里的 api
+      ...api(util).api,
+
+      // 当为基本数据类型时, 直接返回数据, 这个接口返回 {"msg":"ok"}
+      '/api/1': {msg: `ok`},
+
+      // 也可以像 express 一样返回数据
+      '/api/2' (req, res) {
+        res.send({msg: `ok`})
+      },
+
+      // 一个只能使用 post 方法访问的接口
+      'post /api/3': {msg: `ok`},
+
+      // // 一个 websocket 接口, 会发送收到的消息
+      // 'ws /api/4' (ws, req) {
+      //   ws.on('message', (msg) => ws.send(msg))
+      // },
+
+      // 一个下载文件的接口
+      '/file' (req, res) {
+        res.download(__filename, `mm.config.js`)
+      },
+
+      // 获取动态的接口路径的参数 code
+      '/status/:code' (req, res) {
+        res.json({statusCode: req.params.code})
+      },
+
+      // 使用 mockjs 生成数据
+      '/user' (req, res) {
+        const json = util.libObj.mockjs.mock({
+          'data|3-7': [{
+            userId: `@id`,
+            userName: `@cname`,
+          }],
+        })
+        res.json(json)
+      },
+    },
+    static: [],
+    resHandleReplay: ({req, res}) => wrapApiData({code: 200, data: {}}),
+    resHandleJsonApi: ({req, res: {statusCode: code}, data}) => wrapApiData({code, data}),
+  }
+}

+ 21 - 0
mm/readme.md

@@ -0,0 +1,21 @@
+# 说明
+
+此目录是运行命令 `mm --template` 之后生成的 mockm 常用配置, 该命令做了以下事情:
+
+在运行目录的 package.json 的 scripts 中添加命令 `"mm": "npx mockm --cwd=mm"`, 如果没有 package.json 文件, 会自动创建.
+
+创建名为 mm 的目录, 文件说明如下, 如果存在则不覆盖:
+
+```
+mm/
+  - api/ -- 手动创建的 api
+  - httpData/ -- 请求记录, 一般不提交到版本库
+  - apiWeb.json -- 从 UI 界面上创建的接口信息
+  - util.js -- 一些公用方法
+  - mm.config.js -- mockm 的配置文件
+```
+
+## 参考
+- [mm 代码仓库](https://github.com/wll8/mockm/)
+- [mm 文档](https://hongqiye.com/doc/mockm/)
+- [mockjs 文档](http://wll8.gitee.io/mockjs-examples/)

+ 19 - 0
mm/util.js

@@ -0,0 +1,19 @@
+/**
+ * 包裹 api 的返回值
+ * @param {*} param0
+ * @param {object} param0.data - 原始数据
+ * @param {number|string} [param0.code=200] - http状态码
+ * @returns
+ */
+function wrapApiData({data, code = 200}) {
+  code = String(code)
+  return {
+    code,
+    success: Boolean(code.match(/^[2]/)), // 如果状态码以2开头则为 true
+    data,
+  }
+}
+
+module.exports = {
+  wrapApiData,
+}

+ 59 - 0
myPages/promotionCenter/index.rpx.scss

@@ -0,0 +1,59 @@
+.page{
+  padding: 32rpx 32rpx;
+  background: #F9F9F9;
+}
+.item{
+  width: 328rpx;
+  background: linear-gradient(207deg, #FFFFFF 0%, #FFFCF1 100%);
+  border-radius: 20rpx;
+  padding: 32rpx 0;
+  border: 2rpx solid #FFFFFF;
+}
+.item1{
+  width: 328rpx;
+  background: linear-gradient(207deg, #FFFFFF 0%, #F9FFED 100%);
+  border-radius: 20rpx;
+  padding: 32rpx 0;
+  border: 2rpx solid #FFFFFF;
+}
+.image{
+  width: 56rpx;
+  height: 56rpx;
+}
+.title{
+  height: 40rpx;
+  font-size: 28rpx;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #333333;
+  line-height: 40rpx;
+  text-align: center;
+  margin-top: 16rpx;
+}
+
+.title1{
+  font-size: 48rpx;
+  font-family: DINAlternate-Bold, DINAlternate;
+  font-weight: bold;
+  color: #333333;
+  line-height: 60rpx;
+  text-align: center;
+  margin-top: 24rpx;
+
+}
+.btn{
+  width: 686rpx;
+  height: 84rpx;
+  background: #FFE05C;
+  border-radius: 54rpx;
+
+
+  font-size: 28rpx;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #333333;
+  line-height: 84rpx;
+  text-align: center;
+  margin-top: 64rpx;
+
+}

+ 67 - 0
myPages/promotionCenter/index.vue

@@ -0,0 +1,67 @@
+<template>
+    <view class="page">
+
+        <view class="flex-row justify-between top">
+
+            <view class="flex-col justify-start item">
+                <view class="flex-row justify-center">
+                    <image class="image" src="/static/order/ud16.png"></image>
+                </view>
+                <view class="title">
+                    <text>奖励金额</text>
+                </view>
+                <view class="title1">
+                    <text>¥1122</text>
+                </view>
+            </view>
+
+
+            <view class="flex-col justify-start item1">
+                <view class="flex-row justify-center">
+                    <image class="image" src="/static/order/ud15.png"></image>
+                </view>
+                <view class="title">
+                    <text>注册人数</text>
+                </view>
+                <view class="title1">
+                    <text>11552</text>
+                </view>
+            </view>
+
+        </view>
+
+
+        <view class="btn" @click="goStatisticalPanel">
+            <text>去提现</text>
+        </view>
+
+    </view>
+</template>
+
+<script>
+
+export default {
+    components: {
+    },
+    data() {
+        return {
+
+        };
+    },
+    onLoad() {
+
+    },
+    methods: {
+        goStatisticalPanel(){
+            uni.navigateTo({
+                url:'/myPages/statisticalPanel/index'
+            })
+        }
+    }
+}
+</script>
+
+<style scoped lang="scss">
+@import '../../common/css/common.css';
+@import './index.rpx.scss';
+</style>

+ 16 - 68
myPages/realNameAuth/index.vue

@@ -133,92 +133,40 @@ export default {
 
   },
   methods: {
-    async getImgUrlByOssId(ossId,type){
-      let url = await this.$getImgUrlByOssId(ossId);
-      if(type == 1){
-        this.$api.userRealNameAuth.idCardFrontUrl = url;
-      } else if(type == 2){
-        this.$api.userRealNameAuth.idCardBackUrl = url;
-      }
-      return url;
-    },
-    // 获取文件信息
-    getCommonFile(){
-      this.$api.getCommonFile({data:this.reqParm}).then((res)=>{
-        console.log(res)
-      }).catch(() =>{
-        uni.showToast({
-          title: "操作失败"
-        })
-      });
-    },
+
+
     // 保存实名信息
     saveUserRealNameAuth(){
       let that = this;
       that.$refs.form1.validate().then(res => {
         // 保存数据
-        this.$api.userRealNameAuth(null,{data:this.userRealNameAuth}).then((res)=>{
+        this.$api.userRealNameAuth(this.userRealNameAuth).then((res)=>{
           console.log(res)
           // 刷新用户信息
-          this.$refreshUserLoginInfo();
+          uni.setStorageSync('userInfo',res.data.data)
 
-          uni.$u.route({
-            url: '/pages/index/tabbar',
-            params: {
-              PageCur: 'me'
-            }
+          uni.showToast({
+            title: "操作成功"
           })
 
-        }).catch(() =>{
+          setTimeout(()=>{
+            uni.switchTab({
+              url: '/pages/my/index',
+            })
+          },1000)
+
+
+        }).catch((err) =>{
           uni.showToast({
-            title: "操作失败"
+            icon:'error',
+            title: err
           })
         });
       }).catch(errors => {
         uni.$u.toast('校验失败,请认真填写')
       })
     },
-    //头像上传
-    uploadImg1(imgIndex) {
-      let that = this;
-
-      uni.chooseImage({
-        count: 1,
-        success: (chooseImageRes) => {
-          const tempFilePaths = chooseImageRes.tempFilePaths;
-
-          uni.uploadFile({
-            url: that.$host + '/resource/oss/upload', //仅为示例,非真实的接口地址
-            filePath: tempFilePaths[0],
-            name: 'file',
-            header: {
-              // "Content-Type": "multipart/form-data",
-              // 'X-Access-Token': uni.getStorageSync('token'),
-              'Authorization': 'Bearer ' + that.$store.state.loginState.accessToken,
-            },
-            success: (uploadFileRes) => {
 
-              let res = JSON.parse(uploadFileRes.data)
-              console.log(res.data)
-              if(imgIndex == 1){ // 身份证正面
-                that.imgUrl1 = res.data.url;
-                that.userRealNameAuth.idCardFront = res.data.ossId
-                that.reqParm.ossId = res.data.ossId
-                console.log(that.reqParm)
-                that.userRealNameAuth.idCardFrontUrl = res.data.url;
-              }
-
-              if(imgIndex == 2){ // 微信证背面
-                that.imgUrl2 = res.url;
-                that.userRealNameAuth.idCardBack = res.data.ossId
-                that.userRealNameAuth.idCardBackUrl = res.data.url;
-              }
-
-            }
-          });
-        }
-      });
-    }
   }
 }
 </script>

+ 90 - 0
myPages/statisticalPanel/index.rpx.scss

@@ -0,0 +1,90 @@
+.page{
+  padding: 40rpx 32rpx;
+  background: #FFFFFF;
+}
+.image{
+  width: 56rpx;
+  height: 56rpx;
+}
+.amount{
+  font-size: 28rpx;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #333333;
+  line-height: 40rpx;
+  margin-top: 16rpx;
+}
+.unmber{
+  font-size: 48rpx;
+  font-family: DINAlternate-Bold, DINAlternate;
+  font-weight: bold;
+  color: #333333;
+  line-height: 60rpx;
+  margin-top: 24rpx;
+}
+.symbol{
+  font-size: 36rpx;
+  font-family: DINAlternate-Bold, DINAlternate;
+  font-weight: bold;
+  color: #333333;
+  line-height: 100rpx;
+
+}
+.inputView{
+  background: #F9F9F9;
+  margin-top: 40rpx;
+}
+.input{
+    margin-left: 20rpx;
+}
+.btn{
+  width: 686rpx;
+  height: 84rpx;
+  background: #FFE05C;
+  border-radius: 54rpx;
+
+  font-size: 28rpx;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #333333;
+  line-height: 84rpx;
+  text-align: center;
+  margin-top: 24rpx;
+}
+
+.outView{
+  width: 686rpx;
+  border-bottom: 1px solid #EEEEEE;
+  padding: 0 0 34rpx 0;
+}
+.num{
+  font-size: 32rpx;
+  font-family: PingFangSC-Medium, PingFang SC;
+  font-weight: bold;
+  color: #333333;
+  line-height: 48rpx;
+}
+.date{
+  font-size: 24rpx;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #999999;
+  line-height: 40rpx;
+  margin-top: 8rpx;
+}
+.state{
+  font-size: 24rpx;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #93D21A;
+  line-height: 40rpx;
+  margin-top: 24rpx;
+}
+.remark{
+  font-size: 24rpx;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #B66767;
+  line-height: 34rpx;
+  margin-top: 24rpx;
+}

+ 79 - 0
myPages/statisticalPanel/index.vue

@@ -0,0 +1,79 @@
+<template>
+    <view class="page">
+
+        <view class="flex-col">
+            <view class="flex-row justify-center">
+                <image class="image" src="/static/order/ud16.png"></image>
+            </view>
+
+            <view class="amount flex-row justify-center">
+                <text>奖励金额</text>
+            </view>
+            <view class="unmber flex-row justify-center">
+                <text>¥1122</text>
+            </view>
+
+            <view class="inputView flex-row justify-start">
+                <text class="symbol">¥</text>
+                <view class="flex-col justify-center input">
+                    <input type="digit" placeholder="请输入提现金额"/>
+                </view>
+            </view>
+
+            <view class="btn">
+                <text>立即提现</text>
+            </view>
+        </view>
+
+
+
+        <view class="flex-col outView">
+
+            <view class="flex-row justify-between">
+                <view class="flex-col leftView">
+                    <view class="num">
+                        <text>¥45000</text>
+                    </view>
+                    <view class="date">
+                        <text>2023-12-02 12:12:44</text>
+                    </view>
+                </view>
+
+                <view class="flex-row state">
+                    <text>已同意</text>
+                </view>
+
+            </view>
+
+            <view class="remark">
+                <text>经过审核,由于你最近不规范行为,拒绝此次提现申请。</text>
+            </view>
+
+        </view>
+
+    </view>
+</template>
+
+<script>
+
+export default {
+    components: {
+    },
+    data() {
+        return {
+
+        };
+    },
+    onLoad() {
+
+    },
+    methods: {
+
+    }
+}
+</script>
+
+<style scoped lang="scss">
+@import '../../common/css/common.css';
+@import './index.rpx.scss';
+</style>

+ 6 - 6
myPages/userInfo/index.vue

@@ -200,10 +200,10 @@ export default {
 				})
 			});
 		},
-		async getImgUrlByOssId(Id){
-			let url = await this.$api.getImgUrlByOssId(Id);
-			this.userInfo.selfPhotoUrl = url;
-			return url;
+		getImgUrlByOssId(Id){
+			this.$api.getImgUrlByOssId(Id).then(res=>{
+				this.userInfo.selfPhotoUrl = res.data.data[0].url.replace(/^http:/, "https:")
+			});
 		},
 		//头像上传
 		uploadImg1(imgIndex) {
@@ -214,13 +214,13 @@ export default {
 					const tempFilePaths = chooseImageRes.tempFilePaths;
 
 					uni.uploadFile({
-						url: that.$host + '/resource/oss/upload', //仅为示例,非真实的接口地址
+						url: that.$baseUrl + '/resource/oss/upload', //仅为示例,非真实的接口地址
 						filePath: tempFilePaths[0],
 						name: 'file',
 						header: {
 							// "Content-Type": "multipart/form-data",
 							// 'X-Access-Token': uni.getStorageSync('token'),
-							'Authorization': 'Bearer ' + that.$store.state.loginState.accessToken,
+							'Authorization': 'Bearer ' + uni.getStorageSync('accessToken'),
 						},
 						success: (uploadFileRes) => {
 							let res = JSON.parse(uploadFileRes.data)

+ 8 - 0
package.json

@@ -0,0 +1,8 @@
+{
+  "scripts": {
+    "mm": "npx mockm --cwd=mm"
+  },
+  "devDependencies": {
+    "mockm": "1.1.27-alpha.2"
+  }
+}

+ 14 - 0
pages.json

@@ -159,6 +159,20 @@
 		{
 			"root": "myPages",
 			"pages": [
+				{
+					"path": "statisticalPanel/index",
+					"style": {
+						"navigationBarTitleText": "统计面板",
+						"enablePullDownRefresh": false
+					}
+				},
+				{
+					"path": "promotionCenter/index",
+					"style": {
+						"navigationBarTitleText": "推广统计",
+						"enablePullDownRefresh": false
+					}
+				},
 				{
 					"path": "transactionPassword/index",
 					"style": {

BIN
static/order/ud15.png


BIN
static/order/ud16.png