• uniapp 首页制作


    uniapp拨打固定的电话  

    1. function Hotline() {
    2. // 拨打电话
    3. uni.makePhoneCall({
    4. phoneNumber: '19969547693'
    5. })
    6. }

     页面跳转

    1. //普通跳转
    2. function homepage() {
    3. uni.navigateTo({
    4. url: '/pages/homepage/homepage'
    5. });
    6. }
    7. //二、uni.redirectTo关闭当前页面,跳转到应用内的某个页面。
    8. uni.redirectTo({
    9. url: './index/index'
    10. });
    11. //三、uni.switchTab跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。
    12. uni.switchTab({
    13. url: '/pages/homepage/homepage'
    14. });

    首页页面展示 

    代码

    1. <template>
    2. <view class="bg">
    3. <!-- 搜索地址 title-->
    4. <div class="title">
    5. <!-- 一级导航 -->
    6. <uni-combox :candidates="candidates" placeholder="请选择所在城市" v-model="city" labelWidth="70px"
    7. style="background-color:(117,17,29); margin: 4px 10px;"></uni-combox>
    8. <!-- 二级导航 -->
    9. <p
    10. style=" margin: 10px; color: white; line-height: 20px; height: 20px; background-color: (117,17,29);padding: 2px;">
    11. 无障碍阅读</p>
    12. </div>
    13. <!-- 轮播图 swiper-box-->
    14. <uni-swiper-dot :info="info">
    15. <swiper class="swiper-box">
    16. <swiper-item v-for="(item ,index) in info" :key="index">
    17. <view class="swiper-box-img">
    18. {{item.content}}
    19. </view>
    20. </swiper-item>
    21. </swiper>
    22. </uni-swiper-dot>
    23. <!-- 常用服务 service-->
    24. <div class="common">
    25. <uni-icons type="map-pin" size="30" color="red"></uni-icons>
    26. <h3>常用服务</h3>
    27. </div>
    28. <div style="display: flex;flex-wrap: wrap; justify-content:space-around;">
    29. <div @click='homepage ' style="margin: 4px 12px;">
    30. <image src="../../static/weixiu.png" class="service-img"></image>
    31. <p class="service-p">我要保修</p>
    32. </div>
    33. <div @click='complaint' style="margin: 4px 12px;">
    34. <image src="../../static/i247.png" class="service-img"></image>
    35. <p class="service-p">投诉意见</p>
    36. </div>
    37. <div @click='Hotline' style="margin: 4px 12px;">
    38. <image src="../../static/dianhua.png" class="service-img"></image>
    39. <p class="service-p">服务热线</p>
    40. </div>
    41. <div @click='Notice' style="margin: 4px 12px;">
    42. <image src="../../static/gonggao.png" class="service-img"></image>
    43. <p class="service-p">通知公告</p>
    44. </div>
    45. <div @click='HandleRepairs' style="margin: 4px 12px;">
    46. <image src="../../static/tousu.png" class="service-img"></image>
    47. <p class="service-p">导出表单</p>
    48. </div>
    49. <div @click='HandlingComplaints' style="margin: 4px 12px;">
    50. <image src="../../static/faxian.png" class="service-img"></image>
    51. <p class="service-p">导入表单</p>
    52. </div>
    53. </div>
    54. <!-- 公平 public-nav-->
    55. <h3><uni-icons type="map-pin" size="30" color="red"></uni-icons>{{listcons.title}}</h3>
    56. <uni-segmented-control :values="items" @clickItem="onClickItem" styleType="text"
    57. style="margin-right: 120px; margin-left: 20px;" />
    58. <view class="public-nav">
    59. <view>
    60. <view class="public-view" v-for="item in listcons.items " :key="item">
    61. <img :src="item.icon" class="public-img" />
    62. <p class="public-text">{{item.label}}</p>
    63. </view>
    64. </view>
    65. </view>
    66. </view>
    67. </template>
    68. <script>
    69. export default {
    70. setup(_, ctx) {
    71. const mode = 'round'
    72. const items = ['报修意见', '通知通告', '导出表单']
    73. const city = ''
    74. const candidates = ['北京', '南京', '东京', '武汉', '天津', '上海', '海口']
    75. const services = {
    76. title: '常用服务',
    77. items: [{
    78. icon: '/static/weixiu.png',
    79. label: '我要保修',
    80. url: '/pages/homepage/homepage'
    81. },
    82. {
    83. icon: '/static/i247.png',
    84. label: '投诉意见',
    85. },
    86. {
    87. icon: '/static/dianhua.png',
    88. label: '服务热线',
    89. }, {
    90. icon: '/static/gonggao.png',
    91. label: '通知公告',
    92. }, {
    93. icon: '/static/tousu.png',
    94. label: '导出表单',
    95. }, {
    96. icon: '/static/faxian.png',
    97. label: '导入表单',
    98. }
    99. ],
    100. }
    101. function onClickItem(e) {
    102. if (currents.value !== e.currentIndex) {
    103. currents.value = e.currentIndex
    104. }
    105. }
    106. const info = [{
    107. content: ''
    108. },
    109. {
    110. content: ''
    111. },
    112. {
    113. content: ''
    114. },
    115. ]
    116. const listcons = {
    117. title: '公开公正',
    118. items: [{
    119. icon: '../../static/微信图片_20230903143138.jpg',
    120. label: '2023中秋国庆假期盘点 高速公路川流不息,景区景点“人从众”,大型商超人气火爆,电影市场红火向好'
    121. }, {
    122. icon: '../../static/微信图片_20230903143138.jpg',
    123. label: '今年中秋、国庆双节并行,超8亿人次出游、国内旅游收入超7500亿元,上涨的热情、刷新的数据,映射出人们对美好生活的期盼,彰显中国经济的活力'
    124. }, {
    125. icon: '../../static/微信图片_20230903143138.jpg',
    126. label: '没想到泼天的富贵要到文具届了,我想说自动铅笔更贵是因为它比普通铅笔改进了技术'
    127. }, {
    128. icon: '../../static/微信图片_20230903143138.jpg',
    129. label: '2023中秋国庆假期盘点 高速公路川流不息,景区景点“人从众”,大型商超人气火爆,电影市场红火向好'
    130. }, {
    131. icon: '../../static/微信图片_20230903143138.jpg',
    132. label: '今年中秋、国庆双节并行,超8亿人次出游、国内旅游收入超7500亿元,上涨的热情、刷新的数据,映射出人们对美好生活的期盼,彰显中国经济的活力'
    133. }, {
    134. icon: '../../static/微信图片_20230903143138.jpg',
    135. label: '没想到泼天的富贵要到文具届了,我想说自动铅笔更贵是因为它比普通铅笔改进了技术'
    136. }, ],
    137. }
    138. function homepage() {
    139. uni.navigateTo({
    140. url: '/pages/homepage/homepage'
    141. });
    142. }
    143. function complaint() {
    144. uni.navigateTo({
    145. url: '/pages/complaint/complaint'
    146. });
    147. }
    148. function Hotline() {
    149. // 拨打电话
    150. uni.makePhoneCall({
    151. // phoneNumber: '19969547693'
    152. phoneNumber: '18343078388'
    153. })
    154. }
    155. function Notice() {
    156. uni.navigateTo({
    157. url: '/pages/Notice/Notice'
    158. });
    159. }
    160. function HandleRepairs() {
    161. uni.navigateTo({
    162. url: '/pages/HandleRepairs/HandleRepairs'
    163. });
    164. }
    165. function HandlingComplaints() {
    166. uni.navigateTo({
    167. url: '/pages/HandlingComplaints/HandlingComplaints'
    168. });
    169. }
    170. return {
    171. info,
    172. mode,
    173. items,
    174. onClickItem,
    175. city,
    176. candidates,
    177. complaint,
    178. homepage,
    179. Hotline,
    180. Notice,
    181. HandleRepairs,
    182. HandlingComplaints,
    183. listcons,
    184. services
    185. }
    186. }
    187. }
    188. </script>
    189. <style scoped>
    190. /* 背景 */
    191. .bg {
    192. width: 100%;
    193. height: 150px;
    194. background-image: url('/static//QQ截图20230928135008.jpg');
    195. background-position: center center;
    196. background-repeat: no-repeat;
    197. }
    198. /* 搜索地址 */
    199. .title {
    200. display: flex;
    201. justify-content: space-between;
    202. }
    203. .title-p {
    204. color: antiquewhite;
    205. }
    206. /* 轮播图 */
    207. .swiper-box {
    208. margin: 10px;
    209. }
    210. .swiper-box-img {
    211. /* background-color: aquamarine; */
    212. width: 100%;
    213. height: 150px;
    214. background-image: url('../../static/212592593253b564407bcec.jpg');
    215. background-position: center center;
    216. background-repeat: no-repeat;
    217. background-size: cover;
    218. color: aqua;
    219. }
    220. /* 常用服务 */
    221. .common {
    222. width: 120px;
    223. display: flex;
    224. /* margin: 20px 0; */
    225. margin-top: 20px;
    226. }
    227. .service-nav {
    228. display: flex;
    229. flex-wrap: wrap;
    230. }
    231. .service-img {
    232. width: 25px;
    233. height: 25px;
    234. margin-left: 20px;
    235. margin-top: 5px;
    236. }
    237. .service-p {
    238. margin-left: 10px;
    239. margin-top: 5px;
    240. }
    241. /* 公式公开 */
    242. .public {
    243. margin-top: -20px;
    244. }
    245. .public-nav {
    246. display: flex;
    247. margin-top: 15px;
    248. height: 22rem;
    249. }
    250. .public-view {
    251. display: flex;
    252. align-items: center;
    253. }
    254. .public-img {
    255. width: 70px;
    256. height: 70px;
    257. margin: 0 20px;
    258. margin-top: 5px;
    259. background-position: center center;
    260. background-repeat: no-repeat;
    261. background-size: cover;
    262. }
    263. .public-text {
    264. width: 240px;
    265. font-size: 14px;
    266. color: #666;
    267. /* 让文本不换行 */
    268. white-space: nowrap;
    269. overflow: hidden;
    270. /* 超出部分隐藏 */
    271. text-overflow: ellipsis;
    272. /* 使用省略号代替超出部分 */
    273. }
    274. .example-body {
    275. padding: 12px;
    276. background-color: #FFFFFF;
    277. }
    278. .result-box {
    279. text-align: center;
    280. padding: 20px 0px;
    281. font-size: 16px;
    282. }
    283. </style>

    我的页面展示

    代码 

    1. <template>
    2. <view class="bg">
    3. <p class="boder"></p>
    4. <h3 class="name">ID : {{name}}</h3>
    5. </view>
    6. <view class="">
    7. <view class="container">
    8. <uni-section>
    9. <uni-group mode="card">
    10. <view class="tuichu">
    11. <image src="../../static/baoxiu.png" style="width: 20px; height: 20px;margin-right: 20px;">
    12. </image>
    13. <h3 @click="gonavigate">服务 </h3>
    14. </view>
    15. </uni-group>
    16. <uni-group title="" mode="card">
    17. <view class="" style="display: flex; justify-content: space-between;">
    18. <view class="tuichu">
    19. <image src="../../static/baoxiu.png" style="width: 20px; height: 20px;margin-right: 20px;">
    20. </image>
    21. <h3 @click="gonavigate">收藏 </h3>
    22. </view>
    23. <uni-icons type="forward" size="20"></uni-icons>
    24. </view>
    25. <uni-list-item :disabled="true" style="margin-top: 10px;"></uni-list-item>
    26. <view class="" style="display: flex; justify-content: space-between;">
    27. <view class="tuichu">
    28. <image src="../../static/baoxiu.png" style="width: 20px; height: 20px;margin-right: 20px;">
    29. </image>
    30. <h3 @click="gonavigate">朋友圈 </h3>
    31. </view>
    32. <uni-icons type="forward" size="20"></uni-icons>
    33. </view>
    34. <uni-list-item :disabled="true" style="margin-top: 10px;"></uni-list-item>
    35. <view class="" style="display: flex; justify-content: space-between;">
    36. <view class="tuichu">
    37. <image src="../../static/baoxiu.png" style="width: 20px; height: 20px;margin-right: 20px;">
    38. </image>
    39. <h3 @click="gonavigate">导入 </h3>
    40. </view>
    41. <uni-icons type="forward" size="20"></uni-icons>
    42. </view>
    43. </uni-group>
    44. <uni-group mode="card">
    45. <view class="tuichu">
    46. <image src="../../static/baoxiu.png" style="width: 20px; height: 20px;margin-right: 20px;">
    47. </image>
    48. <h3 @click="gonavigate">退出 </h3>
    49. </view>
    50. </uni-group>
    51. </uni-section>
    52. </view>
    53. </view>
    54. </template>
    55. <script>
    56. export default {
    57. setup() {
    58. const name = '周阿狗'
    59. function gonavigate() {
    60. uni.showToast({
    61. title: '退出成功',
    62. icon: 'none',
    63. });
    64. uni.redirectTo({
    65. url: '../index/index'
    66. });
    67. }
    68. return {
    69. name,
    70. gonavigate
    71. }
    72. }
    73. }
    74. </script>
    75. <style>
    76. .bg {
    77. width: 100%;
    78. height: 180px;
    79. background-image: url('../../static/微信图片_20230903143208.jpg');
    80. background-position: center center;
    81. background-repeat: no-repeat;
    82. background-size: cover;
    83. display: flex;
    84. }
    85. .boder {
    86. width: 70px;
    87. height: 70px;
    88. margin: 40px;
    89. border-radius: 30px;
    90. background-image: url('../../static/31wode.png');
    91. background-position: center center;
    92. background-repeat: no-repeat;
    93. background-size: cover;
    94. }
    95. .name {
    96. padding: 60px 0;
    97. color: aliceblue;
    98. }
    99. .tuichu {
    100. display: flex;
    101. }
    102. </style>

    登录展示

    代码 

    1. <template>
    2. <view class="t-login">
    3. <image class="img-a" src="https://zhoukaiwen.com/img/loginImg/2.png"></image>
    4. <image class="img-b" src="https://zhoukaiwen.com/img/loginImg/3.png"></image>
    5. <view class="t-b">中通数智科技</view>
    6. <view class="t-b2">吉林省中通数智科技有限公司</view>
    7. <form class="cl">
    8. <view class="t-a">
    9. <image src="https://zhoukaiwen.com/img/loginImg/sj.png"></image>
    10. <view class="line"></view>
    11. <input placeholder="输入手机号" class="login-content_input" v-model="username" name="username" />
    12. <!-- <input type="number" name="username" placeholder="请输入手机号" maxlength="11" v-model="username" /> -->
    13. </view>
    14. <view class="t-a">
    15. <image src="https://zhoukaiwen.com/img/loginImg/yz.png"></image>
    16. <view class="line"></view>
    17. <input placeholder="请输入密码" class="login-content_input" v-model="password" :password="password" />
    18. <!-- <input type="number" name="code" maxlength="6" placeholder="请输入密码" v-model="password" :password="password" /> -->
    19. </view>
    20. <view class="rememberMe">
    21. <view class="rememberMe-text">记住我</view>
    22. </view>
    23. <button @tap="dengLu()">登 录</button>
    24. </form>
    25. </view>
    26. </template>
    27. <script lang="ts">
    28. import { ref } from 'vue'
    29. export default {
    30. setup() {
    31. const username = ref<String>('test000')
    32. const password = ref<String>('test123456')
    33. const rememberMe = ref<Boolean>(true)
    34. function dengLu() {
    35. uni.switchTab({
    36. url: '/pages/home/home'
    37. });
    38. }
    39. return {
    40. username,
    41. password,
    42. rememberMe,
    43. dengLu
    44. }
    45. }
    46. }
    47. </script>
    48. <style scoped>
    49. .login-content {
    50. width: 100%;
    51. text-align: center;
    52. position: fixed;
    53. }
    54. /* 标题 */
    55. .login-title {
    56. margin-top: 180px;
    57. font-size: 40px;
    58. font-weight: bold;
    59. margin-bottom: 50px;
    60. }
    61. .login-content_input {
    62. width: 80%;
    63. height: 40px;
    64. background: #F8F8F8;
    65. border-radius: 25px;
    66. text-align: left;
    67. padding: 10px;
    68. box-sizing: border-box;
    69. font-size: 15px;
    70. margin: 0 10%;
    71. }
    72. /* 手机号 密码 */
    73. .iphone,
    74. .password {
    75. position: relative;
    76. margin-bottom: 60px;
    77. }
    78. /* 记住我 */
    79. .rememberMe {
    80. right: 15%;
    81. position: fixed;
    82. display: flex;
    83. margin-top: 2px;
    84. }
    85. /* 按钮 */
    86. .login-btn {
    87. /* margin: 0 20%;
    88. width: 58%;
    89. height: 50px;
    90. background: #004d00;
    91. border-radius: 5px;
    92. color: #fff;
    93. font-size: 25px;
    94. text-align: center;
    95. line-height: 50px;
    96. position: fixed;
    97. bottom: 60px; */
    98. position: fixed;
    99. border-radius: 10px;
    100. top: 80%;
    101. left: 0;
    102. right: 0;
    103. bottom: 15%;
    104. margin: 0 auto;
    105. text-align: center;
    106. width: 200px;
    107. background-color: #006400;
    108. color: white;
    109. line-height: 34px;
    110. font-size: 1rem;
    111. }
    112. .img-a {
    113. position: absolute;
    114. width: 100%;
    115. top: -150rpx;
    116. right: 0;
    117. }
    118. .img-b {
    119. position: absolute;
    120. width: 50%;
    121. bottom: 0;
    122. left: -50rpx;
    123. /* margin-bottom: -200rpx; */
    124. }
    125. .t-login {
    126. width: 650rpx;
    127. margin: 0 auto;
    128. font-size: 28rpx;
    129. color: #000;
    130. }
    131. .t-login button {
    132. margin: 64px 0;
    133. font-size: 28rpx;
    134. background: #5677fc;
    135. color: #fff;
    136. height: 90rpx;
    137. line-height: 90rpx;
    138. border-radius: 50rpx;
    139. box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
    140. }
    141. .t-login input {
    142. padding: 0 20rpx 0 120rpx;
    143. height: 90rpx;
    144. line-height: 90rpx;
    145. margin-bottom: 50rpx;
    146. background: #f8f7fc;
    147. border: 1px solid #e9e9e9;
    148. font-size: 28rpx;
    149. border-radius: 50rpx;
    150. }
    151. .t-login .t-a {
    152. position: relative;
    153. }
    154. .t-login .t-a image {
    155. width: 40rpx;
    156. height: 40rpx;
    157. position: absolute;
    158. left: 80rpx;
    159. top: 28rpx;
    160. /* border-right: 2rpx solid #dedede; */
    161. margin-right: 20rpx;
    162. }
    163. .t-login .t-a .line {
    164. width: 2rpx;
    165. height: 40rpx;
    166. background-color: #dedede;
    167. position: absolute;
    168. top: 28rpx;
    169. left: 130rpx;
    170. }
    171. .t-login .t-b {
    172. text-align: left;
    173. font-size: 46rpx;
    174. color: #000;
    175. padding: 300rpx 0 30rpx 0;
    176. font-weight: bold;
    177. }
    178. .t-login .t-b2 {
    179. text-align: left;
    180. font-size: 32rpx;
    181. color: #aaaaaa;
    182. padding: 0rpx 0 120rpx 0;
    183. }
    184. .t-login .t-c {
    185. position: absolute;
    186. right: 22rpx;
    187. top: 22rpx;
    188. background: #5677fc;
    189. color: #fff;
    190. font-size: 24rpx;
    191. border-radius: 50rpx;
    192. height: 50rpx;
    193. line-height: 50rpx;
    194. padding: 0 25rpx;
    195. }
    196. .t-login .t-d {
    197. text-align: center;
    198. color: #999;
    199. margin: 80rpx 0;
    200. }
    201. .t-login .t-e {
    202. text-align: center;
    203. width: 250rpx;
    204. margin: 80rpx auto 0;
    205. }
    206. .t-login .t-g {
    207. float: left;
    208. width: 50%;
    209. }
    210. .t-login .t-e image {
    211. width: 50rpx;
    212. height: 50rpx;
    213. }
    214. .t-login .t-f {
    215. text-align: center;
    216. margin: 200rpx 0 0 0;
    217. color: #666;
    218. }
    219. .t-login .t-f text {
    220. margin-left: 20rpx;
    221. color: #aaaaaa;
    222. font-size: 27rpx;
    223. }
    224. .t-login .uni-input-placeholder {
    225. color: #000;
    226. }
    227. .cl {
    228. zoom: 1;
    229. }
    230. .cl:after {
    231. clear: both;
    232. display: block;
    233. visibility: hidden;
    234. height: 0;
    235. content: '\20';
    236. }
    237. .rememberMe {
    238. right: 15%;
    239. position: fixed;
    240. display: flex;
    241. }
    242. .ada {
    243. margin-top: 20px;
    244. }
    245. .rememberMe-text {
    246. line-height: 30px;
    247. }
    248. </style>

  • 相关阅读:
    什么是Vue开发技术
    Android Compose Column列表 数据更新列表不刷新的问题
    【软件测试】如何用python连接Linux服务器
    数据结构与算法之对于递归的理解
    新媒体达人投放技巧有哪些,投放总结!
    深入理解计算机网络-9IP地址和子网3
    数据结构第三部分——树和二叉树(C语言版)
    基于SSM的公司项目管理系统设计与实现
    AOP基础知识了解
    c++:蓝桥杯中的基础算法1(枚举,双指针)
  • 原文地址:https://blog.csdn.net/weixin_68266812/article/details/133748225