Pārlūkot izejas kodu

推文攻略基本完成。

soft5566 2 gadi atpakaļ
vecāks
revīzija
5c2d3acf11

+ 127 - 64
src/api/strategyMgr.js

@@ -20,6 +20,19 @@ export function getTableData(forData) {
 	})
 }
 
+// 获取发布人
+export function getPublisher() {
+	let data = new FormData()
+	data.append('page', 1)
+	data.append('rows', 10000)
+
+	return request({
+		url: '/mhotel/articlegetUserContactList.action',
+		method: 'post',
+		data
+	})
+}
+
 // 置顶攻略
 export function setTop(id, istop) {
 	let data = {}
@@ -29,7 +42,7 @@ export function setTop(id, istop) {
 	if (typeof istop !== 'undefined') {
 		data.isTop = istop
 	}
-	
+
 	return request({
 		url: '/mhotel/articletopArticle.action',
 		method: 'post',
@@ -37,46 +50,63 @@ export function setTop(id, istop) {
 	})
 }
 
+// 获取乡镇
+export function getTown() {
+	return request({
+		url: '/mhotel/articletownShips.action',
+		method: 'get'
+	})
+}
+
+// 获取民宿
+export function getHotels(townId) {
+	var queryString = '?townId=' + townId + '&page=&rows=';
+
+	return request({
+		url: '/mhotel/articlehotelByid.action' + queryString,
+		method: 'get'
+	})
+}
+
 // 添加攻略
-export function appinsertArounds(forData) {
+export function insertStrategy(forData) {
 	let data = {}
-	if (typeof forData.rtype !== 'undefined' && forData.rtype !== '') {
-		data.rtype = forData.rtype
-	}
-	if (typeof forData.rtown !== 'undefined' && forData.rtown !== '') {
-		data.rtown = forData.rtown
-	}
-	if (typeof forData.rname !== 'undefined' && forData.rname !== '') {
-		data.rname = forData.rname
-	}
-	if (typeof forData.rphone !== 'undefined' && forData.rphone !== '') {
-		data.rphone = forData.rphone
+	if (typeof forData.title !== 'undefined' && forData.title !== '') {
+		data.title = forData.title
+	}
+	if (typeof forData.content !== 'undefined' && forData.content !== '') {
+		data.content = forData.content
+	}
+	if (typeof forData.imgs !== 'undefined' && forData.imgs.length !== 0) {
+		data.images = []
+		for (let i = 0; i < forData.imgs.length; i++) {
+			if (forData.imgs[i].img != '') {
+				data.images.push(forData.imgs[i].img);
+			}
+		}
 	}
-	if (typeof forData.radress !== 'undefined' && forData.radress !== '') {
-		data.radress = forData.radress
+	if (typeof forData.post_video !== 'undefined' && forData.post_video !== '') {
+		data.video = forData.post_video
 	}
-	if (typeof forData.detail !== 'undefined' && forData.detail !== '') {
-		data.detail = forData.detail
+	if (typeof forData.hotelIds !== 'undefined' && forData.hotelIds !== '') {
+		data.hotelIds = forData.hotelIds
 	}
-	if (typeof forData.first_img !== 'undefined' && forData.first_img !== '') {
-		data.first_img = forData.first_img
+	if (typeof forData.rtownId !== 'undefined' && forData.rtownId !== '') {
+		data.townId = forData.rtownId
 	}
-	if (typeof forData.post_video !== 'undefined' && forData.post_video !== '') {
-		data.show_video = forData.post_video
+	if (typeof forData.create_id !== 'undefined' && forData.create_id !== '') {
+		data.createId = forData.create_id
 	}
-	if (typeof forData.detail_img !== 'undefined' && forData.detail_img !== '' && forData.detail_img.length > 0) {
-		var tmpStr = ''
-		for (var i = 0; i < forData.detail_img.length; i++) {
-			tmpStr += forData.detail_img[i] + ','
+	if (typeof forData.istop !== 'undefined' && forData.istop !== '') {
+		if (forData.istop == true) {
+			data.isTop = 1
+		} else {
+			data.isTop = 0
 		}
-		data.detail_img = tmpStr.substring(0, tmpStr.length - 1)
 	}
-	if (typeof forData.jingwei !== 'undefined' && forData.jingwei !== '') {
-		data.jingwei = forData.jingwei
-	}
-	
+
 	return request({
-		url: '/mhotel/appinsertArounds.action',
+		url: '/mhotel/articleinsertArticleTweetMana.action',
 		method: 'post',
 		data
 	})
@@ -88,7 +118,7 @@ export function uploadFiles(file) {
 	if (typeof file !== 'undefined') {
 		data.append('files', file)
 	}
-	
+
 	return request({
 		url: '/file/cos/upload',
 		method: 'post',
@@ -96,49 +126,82 @@ export function uploadFiles(file) {
 	})
 }
 
-// 修改攻略
-export function appupdateArounds(forData) {
+// 修改攻略-增加附件
+export function addImgOrVideo(formData) {
 	let data = {}
 	if (typeof forData.id !== 'undefined' && forData.id !== '') {
 		data.id = forData.id
 	}
-	if (typeof forData.rtype !== 'undefined' && forData.rtype !== '') {
-		data.rtype = forData.rtype
+	if (typeof forData.img !== 'undefined' && forData.img !== '') {
+		data.images = forData.img
 	}
-	if (typeof forData.rtown !== 'undefined' && forData.rtown !== '') {
-		data.rtown = forData.rtown
+	if (typeof forData.video !== 'undefined' && forData.video !== '') {
+		data.video = forData.video
 	}
-	if (typeof forData.rname !== 'undefined' && forData.rname !== '') {
-		data.rname = forData.rname
+
+	return request({
+		url: '/mhotel/articleaddFile.action',
+		method: 'post',
+		data
+	})
+}
+
+// 修改攻略-删除附件
+export function delImgOrVideo(formData) {
+	let data = {}
+	if (typeof forData.id !== 'undefined' && forData.id !== '') {
+		data.id = forData.id
 	}
-	if (typeof forData.rphone !== 'undefined' && forData.rphone !== '') {
-		data.rphone = forData.rphone
+
+	return request({
+		url: '/mhotel/articledelFile.action',
+		method: 'post',
+		data
+	})
+}
+
+// 修改攻略
+export function updateStrategy(forData) {
+	let data = {}
+	if (typeof forData.id !== 'undefined' && forData.id !== '') {
+		data.id = forData.id
 	}
-	if (typeof forData.radress !== 'undefined' && forData.radress !== '') {
-		data.radress = forData.radress
+	if (typeof forData.title !== 'undefined' && forData.title !== '') {
+		data.title = forData.title
 	}
-	if (typeof forData.detail !== 'undefined' && forData.detail !== '') {
-		data.detail = forData.detail
+	if (typeof forData.content !== 'undefined' && forData.content !== '') {
+		data.content = forData.content
 	}
-	if (typeof forData.first_img !== 'undefined' && forData.first_img !== '') {
-		data.first_img = forData.first_img
+	if (typeof forData.imgs !== 'undefined' && forData.imgs.length !== 0) {
+		data.images = []
+		for (let i = 0; i < forData.imgs.length; i++) {
+			if (forData.imgs[i].img != '') {
+				data.images.push(forData.imgs[i].img);
+			}
+		}
 	}
 	if (typeof forData.post_video !== 'undefined' && forData.post_video !== '') {
-		data.show_video = forData.post_video
+		data.video = forData.post_video
 	}
-	if (typeof forData.detail_img !== 'undefined' && forData.detail_img !== '' && forData.detail_img.length > 0) {
-		var tmpStr = ''
-		for (var i = 0; i < forData.detail_img.length; i++) {
-			tmpStr += forData.detail_img[i] + ','
-		}
-		data.detail_img = tmpStr.substring(0, tmpStr.length - 1)
+	if (typeof forData.hotelIds !== 'undefined' && forData.hotelIds !== '') {
+		data.hotelIds = forData.hotelIds
+	}
+	if (typeof forData.rtownId !== 'undefined' && forData.rtownId !== '') {
+		data.townId = forData.rtownId
 	}
-	if (typeof forData.jingwei !== 'undefined' && forData.jingwei !== '') {
-		data.jingwei = forData.jingwei
+	if (typeof forData.create_id !== 'undefined' && forData.create_id !== '') {
+		data.createId = forData.create_id
+	}
+	if (typeof forData.istop !== 'undefined' && forData.istop !== '') {
+		if (forData.istop == true) {
+			data.isTop = 1
+		} else {
+			data.isTop = 0
+		}
 	}
-	
+
 	return request({
-		url: '/mhotel/appupdateArounds.action',
+		url: '/mhotel/articleupdateArticleTweetMana.action',
 		method: 'post',
 		data
 	})
@@ -146,10 +209,10 @@ export function appupdateArounds(forData) {
 
 
 // 删除攻略
-export function delArticle(id) {
-	let data = new FormData()
-	if (typeof id !== 'undefined' && forData != '') {
-		data.append('id', forData)
+export function delStrategy(id) {
+	let data = {};
+	if (typeof id !== 'undefined' && id != '') {
+		data.id = id;
 	}
 
 	return request({
@@ -157,4 +220,4 @@ export function delArticle(id) {
 		method: 'post',
 		data
 	})
-}
+}

+ 15 - 3
src/store/modules/user.js

@@ -1,15 +1,19 @@
 import {
 	login,
-	logout,
-	getInfo
+	// logout,
+	// getInfo
 } from '@/api/user'
+
 import {
 	getToken,
 	setToken,
 	removeToken,
 	setName,
-	setLevel
+	setLevel,
+	setUserId,
+	setCreateId
 } from '@/utils/auth'
+
 import {
 	resetRouter
 } from '@/router'
@@ -20,6 +24,8 @@ const getDefaultState = () => {
 		name: '',
 		level: '',
 		avatar: '',
+		user_id: '',
+		create_id: '',
 		user_name: '',
 		phone: ''
 	}
@@ -46,6 +52,9 @@ const mutations = {
 	SET_USER_ID: (state, user_id) => {
 		state.user_id = user_id
 	},
+	SET_CREATE_ID: (state, create_id) => {
+		state.create_id = create_id
+	},
 	SET_PWD: (state, pwd) => {
 		state.pwd = pwd
 	},
@@ -82,6 +91,7 @@ const actions = {
 					commit('SET_LEVEL', response.data.level)
 					commit('SET_NAME', response.data.adminName)
 					commit('SET_USER_ID', response.data.id)
+					commit('SET_CREATE_ID', response.data.createId)
 					commit('SET_PWD', password)
 					commit('SET_PHONE', response.data.phone)
 					commit('SET_USER_NAME', response.data.userName)
@@ -90,6 +100,7 @@ const actions = {
 					commit('SET_LEVEL', '')
 					commit('SET_NAME', '')
 					commit('SET_USER_ID', '')
+					commit('SET_CREATE_ID', '')
 					commit('SET_PWD', '')
 					commit('SET_PHONE', '')
 					commit('SET_USER_NAME', '')
@@ -144,6 +155,7 @@ const actions = {
 			commit('RESET_STATE')
 			commit('SET_NAME', '')
 			commit('SET_USER_ID', '')
+			commit('SET_CREATE_ID', '')
 			commit('SET_PWD', '')
 			commit('SET_LEVEL', '')
 			commit('SET_TOKEN', '')

+ 10 - 0
src/utils/auth.js

@@ -3,6 +3,8 @@ import Cookies from 'js-cookie'
 const TokenKey = 'admin_token'
 const AdminName = 'admin_name'
 const AdminLevel = 'admin_level'
+const UserId = 'user_id'
+const CreateId = 'create_id'
 
 export function getToken() {
   return Cookies.get(TokenKey)
@@ -24,6 +26,14 @@ export function setLevel(level) {
   return Cookies.set(AdminLevel, level)
 }
 
+export function setUserId(userId) {
+  return Cookies.set(UserId, userId)
+}
+
+export function setCreateId(createId) {
+  return Cookies.set(CreateId, createId)
+}
+
 export function getName() {
 	return Cookies.get(AdminName)
 }

+ 14 - 2
src/views/ad/index.vue

@@ -96,7 +96,7 @@
 		</el-row>
 		<!-- 修改广告窗口 -->
 		<el-dialog title="修改广告" custom-class="add-ad-class" :visible.sync="dialogModifyADFormVisible" :close-on-click-modal="false">
-			<div style="width: 100%; height: 580px; overflow-y: auto;">
+			<div style="width: 100%; height: 580px; overflow-y: auto;" class="scroll-container">
 				<el-form :model="formModifyAD" :rules="formADRules" ref="formModifyADRule" label-width="120px">
 					<el-form-item label="标题" prop="adTitle" :required="true">
 						<el-input placeholder="请输入标题" v-model="formModifyAD.adTitle" maxlength="20" style="width: 90%;" clearable></el-input>
@@ -185,7 +185,7 @@
 		</el-dialog>
 		<!-- 添加广告窗口 -->
 		<el-dialog title="添加广告" custom-class="add-ad-class" :visible.sync="dialogADFormVisible" :close-on-click-modal="false">
-			<div style="width: 100%; height: 580px; overflow-y: auto;">
+			<div style="width: 100%; height: 580px; overflow-y: auto;" class="scroll-container">
 				<el-form :model="formAD" :rules="formADRules" ref="formADRule" label-width="120px">
 					<el-form-item label="标题" prop="adTitle" :required="true">
 						<el-input placeholder="请输入标题" v-model="formAD.adTitle" maxlength="20" style="width: 90%;" clearable></el-input>
@@ -2104,4 +2104,16 @@
 	#shangpin_table table:first-child tr:first-child th:first-child {
 		pointer-events: none;
 	}
+	
+	.scroll-container::-webkit-scrollbar {
+	    width: 1px; /* 根据需要调整滚动条的宽度 */
+	}
+	
+	.scroll-container::-webkit-scrollbar-track {
+	    background-color: #ccc; /* 设置滚动条轨道的颜色 */
+	}
+	
+	.scroll-container::-webkit-scrollbar-thumb {
+	    background-color: rgba(9, 101, 98, 1); /* 设置滚动条滑块的颜色 */
+	}
 </style>

+ 3 - 0
src/views/login/index.vue

@@ -80,6 +80,9 @@
 				redirect: undefined
 			}
 		},
+		mounted() {
+			this.$refs.username.focus();
+		},
 		watch: {
 			$route: {
 				handler: function(route) {

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 974 - 512
src/views/strategyMgr/index.vue