Parcourir la source

Merge branch 'master' of ssh://s1.nsloop.com:29418/web_TracerMethodology

“yst il y a 4 ans
Parent
commit
cbcb93790a
2 fichiers modifiés avec 178 ajouts et 137 suppressions
  1. 177 135
      pages/configure/configure.vue
  2. 1 2
      utils/request.js

+ 177 - 135
pages/configure/configure.vue

@@ -1,143 +1,185 @@
 <template>
-	<view class="configure-page">
-		<view class="greyTitle">为结果选项配置后续操作</view>
-		<view v-for="(item,index) in resultConfigList" :key="index" class="configure-cont">
-			<text class="contTitle">{{item.name}}</text>
-			<text class="contCont" v-for="items in configList" v-if="item.resultType == items.key">{{items.name}}</text>
-			<image src="../../static/查看更多_.png" class="moreImg" @click="showConfig(item,index)"></image>
-		</view>
-		<view class="sure-button">
-			<button @click="sureList">保存</button>
-		</view>
-		<view class="recovery" @click="recoveryList">恢复初始配置</view>
-	  <tm-tabbar :permission="1" />
-	</view>
+  <view class="configure-page">
+    <view class="greyTitle">
+      <text>为结果选项配置后续操作</text>
+      <text class="recovery" @click="recoveryList">恢复初始配置</text>
+    </view>
+    <view class="configureCont">
+      <view
+        v-for="(item, index) in resultConfigList"
+        :key="index"
+        class="configure-cont"
+        @click="changeIndex(index)"
+      >
+        <view class="contTitle">{{ item.name }}</view>
+        <view class="contCon">
+          <tm-radio-group
+            :list="configList"
+            label=""
+            :defaultValue="item.resultType"
+            @change="changeSelect"
+            :setting="{
+              value: 'value',
+              name: 'label',
+            }"
+          />
+        </view>
+      </view>
+    </view>
+    <view class="sure-button">
+      <button @click="sureList">保存</button>
+    </view>
+    <tm-tabbar :permission="1" />
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				resultConfigList:[],
-				configList:[
-					{
-						key:'1',
-						name:'无需操作',
-					},{
-						key:'2',
-						name:'需改善回复',
-					},{
-						key:'3',
-						name:'需使用改善工具',
-					}
-				],
-				showPopup:false,
-				radioVal:null,
-				index:null,
-			}
-		},
-		created() {
-			this.getResultConfig()
-		},
-		methods: {
-			//获取最新配置
-			getResultConfig(){
-				this.$store.dispatch({
-					type:'configure/commActions',
-					payload:{
-						key:'getResultConfig'
-					}
-				}).then(res=>{
-					this.resultConfigList = res?res:[];
-				})
-			},
-			//恢复最初配置
-			recoveryList(){
-				this.$store.dispatch({
-					type:'configure/commActions',
-					payload:{
-						key:'getDefault'
-					}
-				}).then((res)=>{
-					// console.log(res)
-					// this.resultConfigList = res?res:[];
-				})
-			},
-			//保存配置
-			sureList(){
-				this.$store.dispatch({
-					type:'configure/commActions',
-					payload:{
-						key:'postResultConfig',
-						data:{
-							list:this.resultConfigList
-						}
-					}
-				}).then(res=>{
-					// console.log(res,'kkkk')
-					this.getResultConfig();
-					// this.resultConfigList = res?res:[];
-				})
-			}
-		},
-		components: {
-		}
-	}
+export default {
+  data() {
+    return {
+      resultConfigList: [],
+      configList: [
+        {
+          value: 1,
+          label: "无需操作",
+        },
+        {
+          value: 2,
+          label: "需改善回复",
+        },
+        {
+          value: 3,
+          label: "需使用改善工具",
+        },
+      ],
+      showPopup: false,
+      radioVal: null,
+      index: null,
+	  timer:null,
+    };
+  },
+  created() {
+    this.getResultConfig();
+  },
+  methods: {
+    //获取最新配置
+    getResultConfig() {
+      this.$store.dispatch({
+          type: "configure/commActions",
+          payload: {
+            key: "getResultConfig",
+          },
+        })
+        .then((res) => {
+          this.resultConfigList = res ? res : [];
+        });
+    },
+    //恢复最初配置
+    recoveryList() {
+      this.$store.dispatch({
+          type: "configure/commActions",
+          payload: {
+            key: "getDefault",
+          },
+        })
+        .then((res) => {
+          this.resultConfigList = res ? res : [];
+        });
+    },
+    //保存配置
+    sureList() {
+      this.$store.dispatch({
+          type: "configure/commActions",
+          payload: {
+            key: "postResultConfig",
+            data: {
+              list: this.resultConfigList,
+            },
+          },
+        })
+        .then(() => {
+          this.getResultConfig();
+		  clearTimeout(this.timer)
+        });
+    },
+    showConfig() {
+      uni.navigateTo({
+        url: "/pages/configure-detail/detail",
+      });
+    },
+    changeSelect(selectVal, selectData, i) {
+      this.timer = setTimeout(() => {
+        this.resultConfigList[this.index].resultType = selectVal;
+      }, 0);
+    },
+    changeIndex(index) {
+      this.index = index;
+    },
+  },
+  components: {},
+};
 </script>
 
 <style lang="less">
-	.configure-page{
-		height: 100%;
-		background-color: #F5F6FA;
-		.greyTitle{
-			padding-left:25rpx;
-			height: 105rpx;
-			line-height: 105rpx;
-			font-size: 30rpx;
-			color: #292C33;
-		}
-		.configure-cont{
-			padding-left:25rpx;
-			font-size: 22.5rpx;
-			line-height: 87.5rpx;
-			border-bottom: 0.62rpx solid #DADEE6;
-			background-color: #fff;
-			.contTitle{
-				display: inline-block;
-				width: 175rpx;
-				color: #525866;
-			}
-			.contCont{
-				color: #292C33;
-			}
-			.moreImg{
-				margin-top: 31.23rpx;
-				margin-right: 18.68rpx;
-				padding: 1.89rpx 6.31rpx;
-				float: right;
-				width: 12.37rpx;
-				height: 21.21rpx;
-			}
-		}
-		.configure-cont:nth-child(6){
-			border-bottom: none;
-		}
-		.sure-button{
-			margin: 35rpx auto;
-			button{
-				width: 625rpx;
-				height: 62.5rpx;
-				line-height: 62.5rpx;
-				border-radius: 37.5rpx;
-				background-color: #3377FF;
-				color: #fff;
-				font-size: 22.5rpx;
-			}
-		}
-		.recovery{
-			text-align: center;
-			color: #7A8599;
-			font-size: 22.5rpx;
-		}
-	}
+.configure-page {
+  height: 100%;
+  background-color: #f5f6fa;
+  .greyTitle {
+    padding: 0rpx 25rpx;
+    height: 105rpx;
+    line-height: 105rpx;
+    font-size: 30rpx;
+    color: #292c33;
+    .recovery {
+      float: right;
+      text-align: center;
+      color: #7a8599;
+      font-size: 22.5rpx;
+    }
+  }
+  .configureCont {
+    height: calc(100vh - 280rpx);
+    overflow-y: auto;
+  }
+  .configure-cont {
+    font-size: 22.5rpx;
+    border-bottom: 0.62rpx solid #dadee6;
+    background-color: #fff;
+    .contTitle {
+      padding: 25rpx 0rpx 15rpx 25rpx;
+      font-size: 22.5rpx;
+      color: #666f80;
+      background-color: #f5f6fa;
+    }
+    .contCon {
+      padding-left: 25rpx;
+      color: #292c33;
+    }
+    .moreImg {
+      margin-top: 31.23rpx;
+      margin-right: 18.68rpx;
+      padding: 1.89rpx 6.31rpx;
+      float: right;
+      width: 12.37rpx;
+      height: 21.21rpx;
+    }
+  }
+  .configure-cont:nth-child(6) {
+    border-bottom: none;
+  }
+  .sure-button {
+    width: 100%;
+    position: fixed;
+    bottom: 100rpx;
+    button {
+      width: 625rpx;
+      height: 62.5rpx;
+      line-height: 62.5rpx;
+      border-radius: 37.5rpx;
+      background-color: #3377ff;
+      color: #fff;
+      font-size: 22.5rpx;
+    }
+  }
+}
 </style>

+ 1 - 2
utils/request.js

@@ -48,8 +48,7 @@ function request(url, options, additional) {
   // 模拟token,做登录的同学将这行代码移到登录成功函数中.
 
   // uni.setStorageSync('token', 'MjU2OzE2MTE2MjIxODYwNjM7OGJjMTA2ZjNhMzMyNGUxOTRhMmFlMGExOThjMzA5OGE=');
-  // const token = uni.getStorageSync('token');
-  const token = '/JY28U+aEf4jsMZoXx4jVKJl1iCZjBfMgEiS8wzU8Ts='
+  const token = uni.getStorageSync('token');
   return uni.request({
     url: `${BASE_URL}${url}`,
     ...options,