Browse Source

修改代码,对接提交问题

wrh 2 years ago
parent
commit
6204483d07

+ 89 - 3
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/ZCWDK/add/add.js

@@ -1,18 +1,104 @@
 // pages/ZCWDK/add/add.js
+import {
+	request
+} from "../../api/request"
 Page({
 
 	/**
 	 * 页面的初始数据
 	 */
 	data: {
-
+		// 部门列表
+		deptList: [],
+		// 当前选择部门
+		deptChoose: '',
+		// 手机号验证是否通过
+		ajxtrue: false
+	},
+	// 手机号验证
+	blurPhone: function (e) {
+		var phone = e.detail.value;
+		if (!(/^1[34578]\d{9}$/.test(phone))) {
+			this.setData({
+				ajxtrue: false
+			})
+		} else {
+			this.setData({
+				ajxtrue: true
+			})
+		}
+	},
+	// 表单提交
+	formSubmit(e) {
+		if (e.detail.value.phone == '') {
+			wx.showToast({
+				title: '手机号不能为空',
+				icon: 'error',
+				duration: 2000
+			})
+		} else if (this.data.ajxtrue == false) {
+			wx.showToast({
+				title: '手机号有误',
+				icon: 'error',
+				duration: 2000
+			})
+		} else if (e.detail.value.dept == '') {
+			wx.showToast({
+				title: '部门不能为空',
+				icon: 'error',
+				duration: 2000
+			})
+		} else if (e.detail.value.remark == '') {
+			wx.showToast({
+				title: '问题不能为空',
+				icon: 'error',
+				duration: 2000
+			})
+		} else {
+			request({
+				url: '/elk/saveSub',
+				method: 'POST',
+				data: e.detail.value
+			}).then(res => {
+				if (res.result) {
+					wx.showToast({
+						title: '提交成功',
+						icon: 'success',
+						duration: 2000
+					})
+				}
+			})
+		}
+	},
+	// 选择部门
+	bindPickerChange: function (e) {
+		this.setData({
+			deptChoose: this.data.deptList[e.detail.value]
+		})
+	},
+	// 获取所有的分类
+	getSubDeptAll() {
+		request({
+			url: '/elk/getSubDeptAll',
+			method: 'GET'
+		}).then(res => {
+			this.setData({
+				deptList: res.data
+			})
+		})
+	},
+	// 返回
+	back() {
+		wx.navigateBack({
+			delta: 1
+		});
 	},
-
 	/**
 	 * 生命周期函数--监听页面加载
 	 */
 	onLoad(options) {
-
+		// 获取所有分类
+		this.getSubDeptAll();
 	},
 
 	/**

+ 20 - 16
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/ZCWDK/add/add.wxml

@@ -1,19 +1,23 @@
 <!--pages/ZCWDK/add/add.wxml-->
 <view>
-  <view class="inputss">
-    <view style="float: left; margin-right: 20rpx; font-size: 24rpx;font-family: PingFang SC;font-weight: 400;color: #333333;">手机号: </view>
-    <input class="weui-input" style=" border-bottom: 1rpx #B8B8B8 solid;" auto-focus placeholder="请输入手机号"/>
-  </view>
-  <view class="inputss">
-    <view style="float: left; margin-right: 20rpx; font-size: 24rpx;font-family: PingFang SC;font-weight: 400;color: #333333;">部门: </view>
-    <input class="weui-input" style=" border-bottom: 1rpx #B8B8B8 solid;" auto-focus placeholder="请输入部门"/>
-  </view>
-  <view class="inputss">
-    <view style="float: left; margin-right: 20rpx; font-size: 24rpx;font-family: PingFang SC;font-weight: 400;color: #333333;">问题: </view>
-    <input class="weui-input" style=" border-bottom: 1rpx #B8B8B8 solid;" auto-focus placeholder="请输入内容"/>
-  </view>
-  <view class="btns">
-	<view class="box qx">取消</view>
-	<view class="box qr">确认</view>
-  </view>
+	<form catchsubmit="formSubmit">
+		<view class="inputss">
+			<text style="float: left; margin-right: 20rpx; font-size: 24rpx;font-family: PingFang SC;font-weight: 400;color: #333333;">手机号: </text>
+			<input name='phone' class="weui-input" type='number' style=" border-bottom: 1rpx #B8B8B8 solid;" maxlength="11" bindinput='blurPhone' auto-focus placeholder="请输入手机号" />
+		</view>
+		<view class="inputss">
+			<text style="float: left; margin-right: 20rpx; font-size: 24rpx;font-family: PingFang SC;font-weight: 400;color: #333333;" space="emsp">部 门:</text>
+			<picker name='dept' bindchange="bindPickerChange" value="{{deptChoose}}" range="{{deptList}}">
+				<input class="weui-input" style=" border-bottom: 1rpx #B8B8B8 solid;" auto-focus placeholder="请选择部门" disabled="true" value="{{deptChoose}}" />
+			</picker>
+		</view>
+		<view class="inputss">
+			<text style="float: left; margin-right: 20rpx; font-size: 24rpx;font-family: PingFang SC;font-weight: 400;color: #333333;" space="emsp">问 题:</text>
+			<input name="remark" class="weui-input" style=" border-bottom: 1rpx #B8B8B8 solid;" auto-focus placeholder="请输入内容" />
+		</view>
+		<view class="btns">
+			<view class="box qx" bindtap="back">取消</view>
+			<button class="box qr" formType="submit">确认</button>
+		</view>
+	</form>
 </view>

+ 3 - 3
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/ZCWDK/index/index.js

@@ -109,7 +109,7 @@ Page({
 			dept = this.data.defaultSearch;
 		}
 		request({
-			url: '/data/elk/search',
+			url: '/elk/search',
 			data: {
 				page: 1,
 				limit: 5,
@@ -139,7 +139,7 @@ Page({
 	// 获取所有的分类
 	getSubDeptAll() {
 		request({
-			url: '/data/elk/getSubDeptAll',
+			url: '/elk/getSubDeptAll',
 			method: 'GET'
 		}).then(res => {
 			this.setData({
@@ -150,7 +150,7 @@ Page({
 	// 获取热门问题
 	searchHot() {
 		request({
-			url: '/data/elk/searchHot?page=1&limit=8'
+			url: '/elk/searchHot?page=1&limit=8'
 		}).then(res => {
 			for (let i = 0; i < res.data.array.length; i++) {
 				res.data.array[i].sourceAsMap.contentText = res.data.array[i].sourceAsMap.content.replace(/<[^>]+>/g, "");

+ 4 - 4
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/ZCWDK/info/info.js

@@ -110,7 +110,7 @@ Page({
 	// 获取决策事项信息
 	queryAllImportmentPage() {
 		request({
-			url: '/data/postManagement/queryAllImportmentPage?page=0&limit=3',
+			url: '/postManagement/queryAllImportmentPage?page=0&limit=3',
 			method: 'GET'
 		}).then(res => {
 			this.setData({
@@ -121,7 +121,7 @@ Page({
 	// 获取公众号信息
 	getNewestOrHotArticle() {
 		request({
-			url: '/data/api/article/getNewestOrHotArticle',
+			url: '/api/article/getNewestOrHotArticle',
 			method: 'POST',
 			data: {
 				articleType: '1'
@@ -135,7 +135,7 @@ Page({
 	// 获取所有的分类
 	getSubDeptAll() {
 		request({
-			url: '/data/elk/getSubDeptAll',
+			url: '/elk/getSubDeptAll',
 			method: 'GET'
 		}).then(res => {
 			this.setData({
@@ -146,7 +146,7 @@ Page({
 	// 获取热门问题
 	searchHot() {
 		request({
-			url: '/data/elk/searchHot?page=1&limit=8'
+			url: '/elk/searchHot?page=1&limit=8'
 		}).then(res => {
 			for (let i = 0; i < res.data.array.length; i++) {
 				res.data.array[i].sourceAsMap.contentText = res.data.array[i].sourceAsMap.content.replace(/<[^>]+>/g, "");