mainWorkIntro.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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. return;
  201. // 跳转到下一页,传递选中的业务标签
  202. uni.navigateTo({
  203. url:
  204. "/my/renzheng/editCompanyDesc?businessTags=" +
  205. encodeURIComponent(JSON.stringify(allSelectedTags)),
  206. });
  207. },
  208. },
  209. };
  210. </script>
  211. <style lang="scss" scoped>
  212. .switch-roles {
  213. background-color: #fff;
  214. position: absolute;
  215. left: 0;
  216. right: 0;
  217. top: 0;
  218. bottom: 0;
  219. display: flex;
  220. flex-direction: column;
  221. .roles-content {
  222. width: 100%;
  223. flex: 1;
  224. overflow: hidden;
  225. overflow-y: auto;
  226. .content {
  227. padding: 40rpx;
  228. box-sizing: border-box;
  229. display: flex;
  230. flex-direction: column;
  231. align-items: center;
  232. justify-content: center;
  233. .progress-num {
  234. color: #016bf6;
  235. font-family: DM Sans;
  236. font-size: 24rpx;
  237. font-weight: 500;
  238. width: 100%;
  239. padding-bottom: 20rpx;
  240. box-sizing: border-box;
  241. text {
  242. font-size: 48rpx;
  243. font-weight: 700;
  244. }
  245. }
  246. .title {
  247. color: #333;
  248. width: 100%;
  249. font-family: DM Sans;
  250. font-size: 48rpx;
  251. font-weight: 700;
  252. display: flex;
  253. justify-content: space-between;
  254. align-items: center;
  255. margin-bottom: 20rpx;
  256. }
  257. .desc {
  258. color: rgba(102, 102, 102, 1);
  259. width: 100%;
  260. font-family: DM Sans;
  261. font-size: 24rpx;
  262. font-weight: 400;
  263. line-height: 32rpx;
  264. letter-spacing: 0.5%;
  265. text-align: left;
  266. padding: 20rpx 0;
  267. box-sizing: border-box;
  268. margin-bottom: 20rpx;
  269. }
  270. .content-index {
  271. width: 100%;
  272. .content-item {
  273. margin-bottom: 40rpx;
  274. .content-item-title {
  275. color: rgba(34, 37, 42, 1);
  276. font-family: DM Sans;
  277. font-size: 32rpx;
  278. font-weight: 400;
  279. line-height: 48rpx;
  280. padding-bottom: 12rpx;
  281. box-sizing: border-box;
  282. }
  283. .check-box {
  284. display: flex;
  285. gap: 12rpx;
  286. flex-wrap: wrap;
  287. align-items: center;
  288. }
  289. // 自定义标签区域
  290. .custom-tags-box {
  291. display: flex;
  292. gap: 12rpx;
  293. flex-wrap: wrap;
  294. align-items: center;
  295. .custom-tag {
  296. position: relative;
  297. padding-right: 30rpx;
  298. .delete-tag {
  299. position: absolute;
  300. right: 8rpx;
  301. top: 50%;
  302. transform: translateY(-50%);
  303. font-size: 18rpx;
  304. color: #999;
  305. width: 20rpx;
  306. height: 20rpx;
  307. display: flex;
  308. align-items: center;
  309. justify-content: center;
  310. }
  311. }
  312. .add-tag-btn {
  313. flex-shrink: 0;
  314. padding: 8rpx 16rpx;
  315. border-radius: 8rpx;
  316. background: #9999991a;
  317. border: 1rpx solid #9999991a;
  318. box-sizing: border-box;
  319. color: rgba(102, 102, 102, 1);
  320. font-family: DM Sans;
  321. font-size: 16rpx;
  322. font-weight: 400;
  323. display: flex;
  324. align-items: center;
  325. gap: 4rpx;
  326. .add-text {
  327. color: #016bf6;
  328. }
  329. .add-icon {
  330. width: 16rpx;
  331. height: 16rpx;
  332. }
  333. }
  334. }
  335. }
  336. }
  337. .check-item {
  338. flex-shrink: 0;
  339. padding: 8rpx 16rpx;
  340. border-radius: 8rpx;
  341. background: #9999991a;
  342. border: 1rpx solid #9999991a;
  343. box-sizing: border-box;
  344. color: rgba(102, 102, 102, 1);
  345. font-family: DM Sans;
  346. font-size: 16rpx;
  347. font-weight: 400;
  348. }
  349. .check-active {
  350. box-sizing: border-box;
  351. border: 1rpx solid #016bf6;
  352. border-radius: 8rpx;
  353. background: rgba(252, 233, 220, 1);
  354. color: #016bf6;
  355. }
  356. }
  357. }
  358. .submit-btn {
  359. flex-shrink: 0;
  360. border-radius: 999px;
  361. background: #ff6600;
  362. color: rgba(255, 255, 255, 1);
  363. font-family: DM Sans;
  364. font-size: 32rpx;
  365. font-weight: 400;
  366. line-height: 48rpx;
  367. display: flex;
  368. justify-content: center;
  369. align-items: center;
  370. padding: 24rpx 32rpx;
  371. box-sizing: border-box;
  372. margin: 30rpx 40rpx;
  373. margin-top: 20rpx;
  374. }
  375. }
  376. // 弹框内容样式
  377. .dialog-content {
  378. padding: 40rpx;
  379. box-sizing: border-box;
  380. .tag-input {
  381. width: 100%;
  382. padding: 20rpx;
  383. border: 1rpx solid #ddd;
  384. border-radius: 8rpx;
  385. font-size: 28rpx;
  386. margin-bottom: 20rpx;
  387. }
  388. .input-tips {
  389. color: #999;
  390. font-size: 24rpx;
  391. text-align: right;
  392. }
  393. }
  394. // 输入框placeholder样式
  395. .input-placeholder {
  396. color: rgba(153, 153, 153, 1);
  397. font-family: DM Sans;
  398. font-size: 16rpx;
  399. font-weight: 400;
  400. }
  401. </style>