mainWorkIntro.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <view class="switch-roles">
  3. <nav-bar title="公司信息" color="#000"></nav-bar>
  4. <view class="roles-content">
  5. <view class="content">
  6. <view class="progress-num"> <text>8</text>/8 </view>
  7. <view class="title">
  8. <view>主营业务介绍</view>
  9. </view>
  10. <view class="desc">
  11. 介绍公司主营业务及旗下的产品信息,可有效提升求职者对公司及品牌的认知
  12. </view>
  13. <view class="content-index">
  14. <view class="content-item">
  15. <view class="content-item-title">主营产品</view>
  16. <view class="check-box">
  17. <view
  18. class="check-item"
  19. :class="{ 'check-active': selectedProducts.includes(item) }"
  20. v-for="(item, index) in productList"
  21. :key="index"
  22. @click="toggleProduct(item)"
  23. >{{ item }}</view
  24. >
  25. </view>
  26. </view>
  27. <view class="content-item">
  28. <view class="content-item-title">自定义</view>
  29. <!-- 自定义标签显示区域 -->
  30. <view class="custom-tags-box">
  31. <view
  32. class="check-item custom-tag"
  33. :class="{ 'check-active': selectedCustomTags.includes(tag) }"
  34. v-for="(tag, index) in customTags"
  35. :key="'custom-' + index"
  36. @click="toggleCustomTag(tag)"
  37. >
  38. {{ tag }}
  39. <text class="delete-tag" @click.stop="deleteCustomTag(index)">×</text>
  40. </view>
  41. <!-- 添加按钮 -->
  42. <view class="add-tag-btn" @click="showAddDialog">
  43. <text class="add-text">添加</text>
  44. <image
  45. class="add-icon"
  46. src="@/static/images/my/my/add.svg"
  47. mode="aspectFix"
  48. />
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="submit-btn" @click="goJobPostingSecond">下一步</view>
  56. <!-- 添加标签弹框 -->
  57. <u-modal
  58. v-model="showDialog"
  59. :show-cancel-button="true"
  60. confirm-text="确定"
  61. cancel-text="取消"
  62. title="添加标签"
  63. @confirm="confirmAddTag"
  64. @cancel="cancelAddTag"
  65. >
  66. <view class="dialog-content">
  67. <!-- <input
  68. class="tag-input"
  69. v-model="tempTag"
  70. placeholder="请输入标签内容"
  71. placeholder-class="input-placeholder"
  72. maxlength="20"
  73. @confirm="confirmAddTag"
  74. /> -->
  75. <u-input
  76. v-model="tempTag"
  77. type="text"
  78. :border="true"
  79. :clearable="true"
  80. input-align="left"
  81. />
  82. <view class="input-tips">最多输入20个字符</view>
  83. </view>
  84. </u-modal>
  85. </view>
  86. </template>
  87. <script>
  88. import navBar from "@/components/nav-bar/index.vue";
  89. export default {
  90. data() {
  91. return {
  92. // 主营产品列表
  93. productList: [
  94. "3C数码",
  95. "美妆日化",
  96. "智能家居",
  97. "宠物相机",
  98. "监控摄像头",
  99. "家装产品",
  100. "耗材",
  101. "装修材料",
  102. "卫浴产品",
  103. ],
  104. // 选中的产品
  105. selectedProducts: [],
  106. // 自定义标签列表
  107. customTags: [],
  108. // 选中的自定义标签
  109. selectedCustomTags: [],
  110. // 弹框显示控制
  111. showDialog: false,
  112. // 临时标签输入
  113. tempTag: "",
  114. };
  115. },
  116. components: {
  117. navBar,
  118. },
  119. onLoad(options) {
  120. if (options.text) {
  121. this.text = options.text;
  122. }
  123. },
  124. methods: {
  125. // 切换产品选择
  126. toggleProduct(product) {
  127. const index = this.selectedProducts.indexOf(product);
  128. if (index > -1) {
  129. this.selectedProducts.splice(index, 1);
  130. } else {
  131. this.selectedProducts.push(product);
  132. }
  133. },
  134. // 显示添加标签弹框
  135. showAddDialog() {
  136. this.tempTag = "";
  137. this.showDialog = true;
  138. // 延迟聚焦输入框
  139. setTimeout(() => {
  140. const input = this.$el.querySelector(".tag-input");
  141. if (input) input.focus();
  142. }, 300);
  143. },
  144. // 确认添加标签
  145. confirmAddTag() {
  146. if (this.tempTag.trim() === "") {
  147. uni.showToast({
  148. title: "请输入标签内容",
  149. icon: "none",
  150. });
  151. return;
  152. }
  153. if (this.customTags.includes(this.tempTag.trim())) {
  154. uni.showToast({
  155. title: "标签已存在",
  156. icon: "none",
  157. });
  158. return;
  159. }
  160. this.customTags.push(this.tempTag.trim());
  161. this.showDialog = false;
  162. this.tempTag = "";
  163. },
  164. // 取消添加标签
  165. cancelAddTag() {
  166. this.showDialog = false;
  167. this.tempTag = "";
  168. },
  169. // 切换自定义标签选择
  170. toggleCustomTag(tag) {
  171. const index = this.selectedCustomTags.indexOf(tag);
  172. if (index > -1) {
  173. this.selectedCustomTags.splice(index, 1);
  174. } else {
  175. this.selectedCustomTags.push(tag);
  176. }
  177. },
  178. // 删除自定义标签
  179. deleteCustomTag(index) {
  180. const tag = this.customTags[index];
  181. // 如果这个标签被选中了,先从选中列表中移除
  182. const selectedIndex = this.selectedCustomTags.indexOf(tag);
  183. if (selectedIndex > -1) {
  184. this.selectedCustomTags.splice(selectedIndex, 1);
  185. }
  186. // 删除标签
  187. this.customTags.splice(index, 1);
  188. },
  189. goJobPostingSecond() {
  190. // 获取所有选中的标签
  191. const allSelectedTags = [...this.selectedProducts, ...this.selectedCustomTags];
  192. if (allSelectedTags.length === 0) {
  193. uni.showToast({
  194. title: "请至少选择一个业务标签",
  195. icon: "none",
  196. });
  197. return;
  198. }
  199. console.log("选中的业务标签:", allSelectedTags);
  200. // 跳转到下一页,传递选中的业务标签
  201. uni.navigateTo({
  202. url:
  203. "/my/renzheng/editCompanyDesc?businessTags=" +
  204. encodeURIComponent(JSON.stringify(allSelectedTags)),
  205. });
  206. },
  207. },
  208. };
  209. </script>
  210. <style lang="scss" scoped>
  211. .switch-roles {
  212. background-color: #fff;
  213. position: absolute;
  214. left: 0;
  215. right: 0;
  216. top: 0;
  217. bottom: 0;
  218. display: flex;
  219. flex-direction: column;
  220. .roles-content {
  221. width: 100%;
  222. flex: 1;
  223. overflow: hidden;
  224. overflow-y: auto;
  225. .content {
  226. padding: 40rpx;
  227. box-sizing: border-box;
  228. display: flex;
  229. flex-direction: column;
  230. align-items: center;
  231. justify-content: center;
  232. .progress-num {
  233. color: #016bf6;
  234. font-family: DM Sans;
  235. font-size: 24rpx;
  236. font-weight: 500;
  237. width: 100%;
  238. padding-bottom: 20rpx;
  239. box-sizing: border-box;
  240. text {
  241. font-size: 48rpx;
  242. font-weight: 700;
  243. }
  244. }
  245. .title {
  246. color: #333;
  247. width: 100%;
  248. font-family: DM Sans;
  249. font-size: 48rpx;
  250. font-weight: 700;
  251. display: flex;
  252. justify-content: space-between;
  253. align-items: center;
  254. margin-bottom: 20rpx;
  255. }
  256. .desc {
  257. color: rgba(102, 102, 102, 1);
  258. width: 100%;
  259. font-family: DM Sans;
  260. font-size: 24rpx;
  261. font-weight: 400;
  262. line-height: 32rpx;
  263. letter-spacing: 0.5%;
  264. text-align: left;
  265. padding: 20rpx 0;
  266. box-sizing: border-box;
  267. margin-bottom: 20rpx;
  268. }
  269. .content-index {
  270. width: 100%;
  271. .content-item {
  272. margin-bottom: 40rpx;
  273. .content-item-title {
  274. color: rgba(34, 37, 42, 1);
  275. font-family: DM Sans;
  276. font-size: 32rpx;
  277. font-weight: 400;
  278. line-height: 48rpx;
  279. padding-bottom: 12rpx;
  280. box-sizing: border-box;
  281. }
  282. .check-box {
  283. display: flex;
  284. gap: 12rpx;
  285. flex-wrap: wrap;
  286. align-items: center;
  287. }
  288. // 自定义标签区域
  289. .custom-tags-box {
  290. display: flex;
  291. gap: 12rpx;
  292. flex-wrap: wrap;
  293. align-items: center;
  294. .custom-tag {
  295. position: relative;
  296. padding-right: 30rpx;
  297. .delete-tag {
  298. position: absolute;
  299. right: 8rpx;
  300. top: 50%;
  301. transform: translateY(-50%);
  302. font-size: 18rpx;
  303. color: #999;
  304. width: 20rpx;
  305. height: 20rpx;
  306. display: flex;
  307. align-items: center;
  308. justify-content: center;
  309. }
  310. }
  311. .add-tag-btn {
  312. flex-shrink: 0;
  313. padding: 8rpx 16rpx;
  314. border-radius: 8rpx;
  315. background: #9999991a;
  316. border: 1rpx solid #9999991a;
  317. box-sizing: border-box;
  318. color: rgba(102, 102, 102, 1);
  319. font-family: DM Sans;
  320. font-size: 16rpx;
  321. font-weight: 400;
  322. display: flex;
  323. align-items: center;
  324. gap: 4rpx;
  325. .add-text {
  326. color: #016bf6;
  327. }
  328. .add-icon {
  329. width: 16rpx;
  330. height: 16rpx;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. .check-item {
  337. flex-shrink: 0;
  338. padding: 8rpx 16rpx;
  339. border-radius: 8rpx;
  340. background: #9999991a;
  341. border: 1rpx solid #9999991a;
  342. box-sizing: border-box;
  343. color: rgba(102, 102, 102, 1);
  344. font-family: DM Sans;
  345. font-size: 16rpx;
  346. font-weight: 400;
  347. }
  348. .check-active {
  349. box-sizing: border-box;
  350. border: 1rpx solid #016bf6;
  351. border-radius: 8rpx;
  352. background: rgba(252, 233, 220, 1);
  353. color: #016bf6;
  354. }
  355. }
  356. }
  357. .submit-btn {
  358. flex-shrink: 0;
  359. border-radius: 999px;
  360. background: #ff6600;
  361. color: rgba(255, 255, 255, 1);
  362. font-family: DM Sans;
  363. font-size: 32rpx;
  364. font-weight: 400;
  365. line-height: 48rpx;
  366. display: flex;
  367. justify-content: center;
  368. align-items: center;
  369. padding: 24rpx 32rpx;
  370. box-sizing: border-box;
  371. margin: 30rpx 40rpx;
  372. margin-top: 20rpx;
  373. }
  374. }
  375. // 弹框内容样式
  376. .dialog-content {
  377. padding: 40rpx;
  378. box-sizing: border-box;
  379. .tag-input {
  380. width: 100%;
  381. padding: 20rpx;
  382. border: 1rpx solid #ddd;
  383. border-radius: 8rpx;
  384. font-size: 28rpx;
  385. margin-bottom: 20rpx;
  386. }
  387. .input-tips {
  388. color: #999;
  389. font-size: 24rpx;
  390. text-align: right;
  391. }
  392. }
  393. // 输入框placeholder样式
  394. .input-placeholder {
  395. color: rgba(153, 153, 153, 1);
  396. font-family: DM Sans;
  397. font-size: 16rpx;
  398. font-weight: 400;
  399. }
  400. </style>