Переглянути джерело

✨ 修改bug/增加切换环境组件/调整ui

谢创宏 3 роки тому
батько
коміт
ffd25437de

+ 109 - 0
components/local/change-env/change-env.js

@@ -0,0 +1,109 @@
1
+// components/local/change-env/change-env.js
2
+// app.js
3
+import {
4
+  login
5
+} from '../../../utils/http';
6
+Component({
7
+  /**
8
+   * 组件的属性列表
9
+   */
10
+  options: {
11
+    addGlobalClass: true
12
+  },
13
+  properties: {
14
+    visible: {
15
+      type: Boolean,
16
+      value: false,
17
+    },
18
+  },
19
+
20
+  /**
21
+   * 组件的初始数据
22
+   */
23
+  data: {
24
+    inputVal: "",
25
+    env: false,
26
+    items: [{
27
+        value: 'ijolijoli',
28
+        name: '正式环境',
29
+        checked: true
30
+      },
31
+      {
32
+        value: 'dev',
33
+        name: '测试环境',
34
+        checked: false
35
+      },
36
+    ]
37
+  },
38
+
39
+  /**
40
+   * 组件的方法列表
41
+   */
42
+  methods: {
43
+    // 监听输入框
44
+    onChangeInput(e) {
45
+      this.setData({
46
+        inputVal: e.detail.value
47
+      })
48
+    },
49
+
50
+    // 点击确定事件
51
+    onConfirm() {
52
+      let {
53
+        env,
54
+        items
55
+      } = this.data;
56
+      if (env) {
57
+        items.forEach((item, index) => {
58
+          if (item.checked) {
59
+            wx.setStorageSync('env', item.value)
60
+            wx.setStorageSync('token', '')
61
+            wx.setStorageSync('userInfo', {});
62
+
63
+            this.setData({
64
+              visible: false,
65
+              env: false,
66
+            }, () => {
67
+              // login()
68
+              wx.reLaunch({
69
+                url: '/pages/home/home',
70
+              })
71
+            })
72
+          }
73
+        })
74
+        return;
75
+      }
76
+      if (this.data.inputVal == 'ijolijoli') {
77
+        this.setData({
78
+          env: true
79
+        })
80
+      } else {
81
+        wx.showToast({
82
+          title: '密码错误',
83
+          icon: 'none'
84
+        })
85
+      }
86
+      console.log(this.data.inputVal)
87
+    },
88
+
89
+    // 点击取消事件
90
+    onCancel() {
91
+      this.setData({
92
+        visible: false,
93
+        env: false
94
+      })
95
+    },
96
+
97
+    // 监听却换环境
98
+    onChangeRadio(e) {
99
+      console.log('radio发生change事件,携带value值为:', e.detail.value)
100
+      const items = this.data.items
101
+      for (let i = 0, len = items.length; i < len; ++i) {
102
+        items[i].checked = items[i].value === e.detail.value
103
+      }
104
+      this.setData({
105
+        items
106
+      })
107
+    },
108
+  }
109
+})

+ 6 - 0
components/local/change-env/change-env.json

@@ -0,0 +1,6 @@
1
+{
2
+  "component": true,
3
+  "usingComponents": {
4
+    "wux-landscape": "../../dist/landscape/index"
5
+  }
6
+}

+ 15 - 0
components/local/change-env/change-env.wxml

@@ -0,0 +1,15 @@
1
+<wux-landscape visible="{{ visible }}"  maskClosable="{{ true }}" closable="{{ false }}" bind:close="onCancelUse">
2
+  <view class="use-popup flex-column" wx:if="{{ visible }}">
3
+    <input wx:if="{{!env}}" class="weui-input" auto-focus placeholder="请输入密码" bindinput="onChangeInput" />
4
+    <radio-group bindchange="onChangeRadio" wx:if="{{env}}">
5
+      <label class="flex" wx:for="{{items}}" wx:key="index">
6
+        <radio value="{{item.value}}" checked="{{item.checked}}"/>
7
+        <view style="margin-left: 30rpx;">{{item.name}}</view>
8
+      </label>
9
+    </radio-group>
10
+    <view class="use-btn flex">
11
+      <view class="btn cancel flex-center" bindtap="onCancel">取消</view>
12
+      <view class="btn confirm flex-center" bindtap="onConfirm">确定</view>
13
+    </view>
14
+  </view>
15
+</wux-landscape>

+ 53 - 0
components/local/change-env/change-env.wxss

@@ -0,0 +1,53 @@
1
+.use-popup {
2
+  width: 558rpx;
3
+  /* height: 350rpx; */
4
+  background: #FFFFFF;
5
+  border-radius: 20rpx;
6
+  overflow: hidden;
7
+  /* justify-content: center; */
8
+  justify-content: space-evenly;
9
+}
10
+
11
+/* .use-popup .red {
12
+  font-size: 24rpx;
13
+  font-family: PingFangSC-Regular, PingFang SC;
14
+  font-weight: 400;
15
+  color: #E95564;
16
+} */
17
+
18
+.use-popup input {
19
+  text-align: left;
20
+  padding: 30rpx;
21
+}
22
+
23
+radio-group {
24
+  padding: 30rpx 30rpx 0;
25
+}
26
+
27
+radio-group label {
28
+  margin-bottom: 30rpx;
29
+}
30
+
31
+.use-btn {
32
+  padding: 30rpx;
33
+  border-top: 1rpx solid #ccc;
34
+}
35
+
36
+.use-btn .btn {
37
+  flex: 1;
38
+  /* width: 208rpx; */
39
+  height: 92rpx;
40
+  /* margin: 0 48rpx; */
41
+  font-size: 36rpx;
42
+  color: #FF77B0;
43
+  border-radius: 52rpx;
44
+  border: 2rpx solid #FF77B0;
45
+}
46
+
47
+
48
+.use-btn .confirm {
49
+  /* margin-top: 28rpx; */
50
+  margin-left: 46rpx;
51
+  background-color: #FF77B0;
52
+  color: #fff;
53
+}

BIN
images/.DS_Store


+ 1 - 4
pages/customerList/customerList.wxml

@@ -16,13 +16,10 @@
16 16
       <text>{{ item.nickname }}</text>
17 17
     </view>
18 18
   </view>
19
+  <view class="no-data" style="display: {{list.length == 0 ? 'block' : 'none'}};">暂无数据~</view>
19 20
 </view>
20 21
 
21 22
 
22
-<!-- font-size: 24px;
23
-font-family: PingFangSC-Regular, PingFang SC;
24
-font-weight: 400;
25
-color: #FF77B0; -->
26 23
 <view class="fixed flex-column flex-justify-center">
27 24
   <text style="font-size: 24rpx;color: #FF77B0;" wx:for="{{ list }}" wx:key="index">{{ item.word }}</text>
28 25
 </view>

+ 3 - 2
pages/feedback/feedback.js

@@ -1,6 +1,7 @@
1 1
 import {
2 2
   get,
3
-  post
3
+  post,
4
+  api_url
4 5
 } from '../../utils/http';
5 6
 Page({
6 7
 
@@ -313,7 +314,7 @@ Page({
313 314
     return new Promise((resolve,reject) => {
314 315
       let { imgs } = this.data;
315 316
       wx.uploadFile({
316
-        url: 'https://store.test-api.ijolijoli.com/api/upload',
317
+        url: `${api_url}api/upload`,
317 318
         header: {
318 319
           token: wx.getStorageSync('token') || '',
319 320
         },

+ 3 - 1
pages/member/member.json

@@ -1,4 +1,6 @@
1 1
 {
2 2
   "navigationBarTitleText": "个人中心",
3
-  "usingComponents": {}
3
+  "usingComponents": {
4
+    "change-env": "../../components/local/change-env/change-env"
5
+  }
4 6
 }

+ 4 - 3
pages/recordList/recordList.wxml

@@ -10,9 +10,9 @@
10 10
         <text>营业复查:{{ todayData.is_review == 1 ? '已复查' : '未复查' }}</text>
11 11
       </view>
12 12
       <view class="top-text flex-column">
13
-        <text>今日负责人:{{ todayData.charge_name }}</text>
14
-        <text style="margin:20rpx 0;">检查负责人:{{ todayData.check_name }}</text>
15
-        <text>复查检查人:{{ todayData.review_name }}</text>
13
+        <text>今日负责人:{{ todayData.charge_name || '-' }}</text>
14
+        <text style="margin:20rpx 0;">检查负责人:{{ todayData.check_name || '-' }}</text>
15
+        <text>复查检查人:{{ todayData.review_name || '-' }}</text>
16 16
       </view>
17 17
     </view>
18 18
   </view>
@@ -34,5 +34,6 @@
34 34
         </view>
35 35
       </view>
36 36
     </navigator>
37
+    <view class="no-more-data" style="display: {{list.length == 0 ? 'block' : 'none'}};">暂无数据~</view>
37 38
   </view>
38 39
 </view>

+ 3 - 2
pages/recordSheet/components/inspect/inspect.js

@@ -1,4 +1,4 @@
1
-import { post } from "../../../../utils/http";
1
+import { post,api_url } from "../../../../utils/http";
2 2
 
3 3
 // pages/recordSheet/components/inspect/inspect.js
4 4
 Component({
@@ -175,7 +175,8 @@ Component({
175 175
       return new Promise((resolve,reject) => {
176 176
         let { imgs } = this.data;
177 177
         wx.uploadFile({
178
-          url: 'https://store.test-api.ijolijoli.com/api/upload',
178
+          url: `${api_url}api/upload`,
179
+          // url: 'https://store.test-api.ijolijoli.com/api/upload',
179 180
           header: {
180 181
             token: wx.getStorageSync('token') || '',
181 182
           },

+ 3 - 2
pages/recordSheet/components/review/review.js

@@ -1,4 +1,4 @@
1
-import { post } from "../../../../utils/http";
1
+import { post,api_url } from "../../../../utils/http";
2 2
 
3 3
 // pages/recordSheet/components/inspect/inspect.js
4 4
 Component({
@@ -156,7 +156,8 @@ Component({
156 156
       return new Promise((resolve,reject) => {
157 157
         let { imgs } = this.data;
158 158
         wx.uploadFile({
159
-          url: 'https://store.test-api.ijolijoli.com/api/upload',
159
+          url: `${api_url}api/upload`,
160
+          // url: 'https://store.test-api.ijolijoli.com/api/upload',
160 161
           header: {
161 162
             token: wx.getStorageSync('token') || '',
162 163
           },

+ 3 - 2
pages/recordSheet/components/verify/verify.js

@@ -1,4 +1,4 @@
1
-import { post } from "../../../../utils/http";
1
+import { post,api_url } from "../../../../utils/http";
2 2
 
3 3
 Component({
4 4
   /**
@@ -174,7 +174,8 @@ Component({
174 174
       return new Promise((resolve,reject) => {
175 175
         let { imgs } = this.data;
176 176
         wx.uploadFile({
177
-          url: 'https://store.test-api.ijolijoli.com/api/upload',
177
+          url: `${api_url}api/upload`,
178
+          // url: 'https://store.test-api.ijolijoli.com/api/upload',
178 179
           header: {
179 180
             token: wx.getStorageSync('token') || '',
180 181
           },

+ 3 - 3
pages/recordSheet/recordSheet.wxml

@@ -10,9 +10,9 @@
10 10
         <text>营业复查:{{ todayData.is_review == 1 ? '已复查' : '未复查' }}</text>
11 11
       </view>
12 12
       <view class="top-text flex-column">
13
-        <text>今日负责人:{{ todayData.charge_name }}</text>
14
-        <text style="margin:20rpx 0;">检查负责人:{{ todayData.check_name }}</text>
15
-        <text>复查检查人:{{ todayData.review_name }}</text>
13
+        <text>今日负责人:{{ todayData.charge_name || '-' }}</text>
14
+        <text style="margin:20rpx 0;">检查负责人:{{ todayData.check_name || '-' }}</text>
15
+        <text>复查检查人:{{ todayData.review_name || '-' }}</text>
16 16
       </view>
17 17
     </view>
18 18
   </view>

+ 13 - 0
pages/role/role.js

@@ -69,7 +69,13 @@ Page({
69 69
   },
70 70
 
71 71
   onChangeRole(e) {
72
+    let { list } = this.data;
73
+    list.forEach((item,index) => {
74
+      item.selected = 0
75
+    })
76
+    list[e.currentTarget.dataset.index].selected = 1
72 77
     this.setData({
78
+      list,
73 79
       current: e.currentTarget.dataset.index
74 80
     })
75 81
   },
@@ -79,7 +85,14 @@ Page({
79 85
    * api/mruser/role
80 86
   */
81 87
   getMruserRole() {
88
+    let { current } = this.data;
82 89
     get('api/mruser/role',{},(res) => {
90
+      // res.data.forEach((item,index) => {
91
+      //   if(item.) {
92
+          
93
+      //   }
94
+      // })
95
+      console.log(res.data);
83 96
       this.setData({
84 97
         list: res.data
85 98
       })

+ 1 - 1
pages/role/role.wxml

@@ -1,5 +1,5 @@
1 1
 <view class="content">
2
-  <view class="item flex-align-center {{ index== current ? 'active' : '' }}" wx:for="{{ list }}" wx:key="index" bindtap="onChangeRole" data-id="{{ item.id }}" data-index="{{index}}">{{ item.name }}</view>
2
+  <view class="item flex-align-center {{ item.selected == 1 ? 'active' : '' }}" wx:for="{{ list }}" wx:key="index" bindtap="onChangeRole" data-id="{{ item.id }}" data-index="{{index}}">{{ item.name }}</view>
3 3
 </view>
4 4
 
5 5
 <view class="btn-box">

+ 1 - 1
utils/http.js

@@ -18,7 +18,7 @@ function http(url,method,params, success, fail) {
18 18
       api_url = 'https://store.test-api.ijolijoli.com/'
19 19
       break;
20 20
     default:
21
-      api_url = 'https://api.ijolijoli.com/'
21
+      api_url = 'https://store-api.ijolijoli.com/'
22 22
       break;
23 23
   }
24 24
   return wx.request({